You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test that ensure_vector_match properly cleans up the first vector
449
+
when the second vector fails to parse.
450
+
451
+
This tests the fix for a bug where aCleanup(a) was called instead of
452
+
aCleanup(*a), passing the wrong pointer to the cleanup function.
453
+
454
+
The bug only manifests when the first vector is parsed from JSON/TEXT
455
+
(which uses sqlite3_free as cleanup) rather than BLOB (which uses noop).
456
+
"""
457
+
# Valid first vector as JSON text - this causes memory allocation
458
+
# and sets cleanup to sqlite3_free
459
+
valid_vector_json="[1.0, 2.0, 3.0, 4.0]"
460
+
461
+
# Invalid second vector: 5 bytes, not divisible by 4 (sizeof float32)
462
+
# This will fail in fvec_from_value with "invalid float32 vector BLOB length"
463
+
invalid_vector=b"\x01\x02\x03\x04\x05"
464
+
465
+
withpytest.raises(sqlite3.OperationalError, match=r"^Error reading 2nd vector: invalid float32 vector BLOB length\. Must be divisible by 4, found 5$"):
0 commit comments