-
Notifications
You must be signed in to change notification settings - Fork 106
Re-enable VLenBytes round-trip None test
#736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
07571e5
b97fc62
e7b6b4b
9bcd15c
8e24cce
d6085a8
c05d33b
5b550ae
739dd88
a37b8f9
644f147
8cc95fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -227,6 +227,7 @@ class VLenBytes(Codec): | |
| cdef: | ||
| Py_ssize_t i, l, n_items, data_length, total_length | ||
| object[:] values | ||
| object[:] normed_values | ||
| int[:] lengths | ||
| char* encv | ||
| object b | ||
|
|
@@ -240,6 +241,7 @@ class VLenBytes(Codec): | |
| n_items = values.shape[0] | ||
|
|
||
| # setup intermediates | ||
| normed_values = np.empty(n_items, dtype=object) | ||
| lengths = np.empty(n_items, dtype=np.intc) | ||
|
|
||
| # first iteration to find lengths | ||
|
|
@@ -250,6 +252,7 @@ class VLenBytes(Codec): | |
| b = b'' | ||
| elif not PyBytes_Check(b): | ||
| raise TypeError('expected byte string, found %r' % b) | ||
| normed_values[i] = b | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now when we loop through and normalize an input, we can store each normalized value for processing later |
||
| l = PyBytes_GET_SIZE(b) | ||
| data_length += l + HEADER_LENGTH | ||
| lengths[i] = l | ||
|
|
@@ -268,7 +271,7 @@ class VLenBytes(Codec): | |
| l = lengths[i] | ||
| store_le32(<uint8_t*>data, l) | ||
| data += HEADER_LENGTH | ||
| encv = PyBytes_AS_STRING(values[i]) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like this line was the actual one that failed ( a bit further in than the aforementioned error would suggest: #683 (comment) ) The issue is that |
||
| encv = PyBytes_AS_STRING(normed_values[i]) | ||
|
||
| memcpy(data, encv, l) | ||
| data += l | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix the error mentioned above, we need to create a place to store the normalized values
So we allocate an empty array to start.
objecttype as we are storing Python objects in it