8000 BUG,ENH: fix pickling user-scalars by allowing non-format buffer export by seberg · Pull Request #17295 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG,ENH: fix pickling user-scalars by allowing non-format buffer export #17295

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

Merged
merged 9 commits into from
Nov 3, 2020
Prev Previous commit
Next Next commit
DOC: Add a comment to explain the format transfer
  • Loading branch information
seberg committed Oct 22, 2020
commit e9ce0f485c16f57fcc619de76b691acf8294f09c
6 changes: 6 additions & 0 deletions numpy/core/src/multiarray/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,12 @@ _buffer_get_info(PyObject *obj, int flags)
}

if (old_info != NULL) {
/*
* The two info->format are considered equal if one of them
* has no format set (meaning the format is arbitrary and can
* be modified). If the new info has a format, but we reuse
* the old one, this transfers the ownership to the old one.
*/
if (old_info->format == NULL) {
old_info->format = info->format;
info->format = NULL;
Expand Down
0