Skip to content

Conversation

@robsdedude
Copy link
Member

@robsdedude robsdedude commented Nov 5, 2025

@robsdedude robsdedude force-pushed the clean-up/remove-vector-native-conversion-functions branch 2 times, most recently from 745a6aa to ae8a2c0 Compare November 6, 2025 14:09
@robsdedude robsdedude marked this pull request as draft November 7, 2025 09:18
@robsdedude robsdedude force-pushed the clean-up/remove-vector-native-conversion-functions branch 2 times, most recently from 410d93e to 80b57c9 Compare November 7, 2025 10:53
@robsdedude robsdedude force-pushed the clean-up/remove-vector-native-conversion-functions branch from 80b57c9 to b1663fb Compare November 7, 2025 10:55
@robsdedude robsdedude marked this pull request as ready for review November 7, 2025 12:18
Copy link
Contributor

@RichardIrons-neo4j RichardIrons-neo4j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one note. Up to you if you bother with it.

🦩

let len = bytes.len();
if len % type_size != 0 {
return Err(PyErr::new::<PyValueError, _>(
"Data length not a multiple of type_size",
Copy link
Contributor

@RichardIrons-neo4j RichardIrons-neo4j Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could add the bad length and size to the message here?

Copy link
Member Author

@robsdedude robsdedude Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could do. But this is really just a second line of defense. The driver code calling this already preforms this check.

Import here: https://github.com/neo4j/neo4j-python-driver/blob/d10d2cd689340d9f2acfe67ca19131936e722f04/src/neo4j/vector.py#L45-L48

Assignment here: https://github.com/neo4j/neo4j-python-driver/blob/d10d2cd689340d9f2acfe67ca19131936e722f04/src/neo4j/vector.py#L618-L623

Check followed by call here: https://github.com/neo4j/neo4j-python-driver/blob/d10d2cd689340d9f2acfe67ca19131936e722f04/src/neo4j/vector.py#L581-L585

So I think it's not worth bothering. I also remove it and let if fall through to the assert_eq!(src.len() % N, 0); in swap_n resulting in an uglier error message. But again, only when messing up in the driver code would this ever surface. 🤷 I really don't have strong opinion on this.

@robsdedude robsdedude merged commit a1904d3 into 6.x Nov 7, 2025
15 of 19 checks passed
@robsdedude robsdedude deleted the clean-up/remove-vector-native-conversion-functions branch November 7, 2025 13:59
robsdedude added a commit that referenced this pull request Nov 7, 2025
This error path shouldn't ever be hit if the driver is working as intended.
This change might make debugging while developing the driver slightly easier in
the future.

Initial discussion:
#70 (comment)
robsdedude added a commit that referenced this pull request Nov 7, 2025
This error path shouldn't ever be hit if the driver is working as intended.
This change might make debugging while developing the driver slightly easier in
the future.

Initial discussion:
#70 (comment)
robsdedude added a commit that referenced this pull request Nov 7, 2025
This error path shouldn't ever be hit if the driver is working as intended.
This change might make debugging while developing the driver slightly easier in
the future.

Initial discussion:
#70 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants