8000 BUG: Fix SystemError when pickling datetime64 array with pickle5 by pitrou · Pull Request #12748 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Fix SystemError when pickling datetime64 array with pickle5 #12748

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 5 commits into from
Jan 23, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a test for the fixed reference leak
  • Loading branch information
pitrou committed Jan 22, 2019
commit ceabdf68c919ca85fa37061e7c7322c9c9f33a01
5 changes: 5 additions & 0 deletions numpy/core/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3769,10 +3769,15 @@ def test_roundtrip(self):
('c', float)])
]

refs = [weakref.ref(a) for a in DATA]
for a in DATA:
assert_equal(
a, pickle.loads(pickle.dumps(a, protocol=proto)),
err_msg="%r" % a)
del a, DATA, carray
# check for reference leaks (gh-12793)
for ref in refs:
assert ref() is None
Copy link
Member

Choose a reason for hiding this comment

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

@mattip, this type of test will fail on pypy, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, yes, I should call gc.collect.

Copy link
Member

Choose a reason for hiding this comment

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

Could skip for pypy. These sorts of tests do tend to be fragile.


def _loads(self, obj):
if sys.version_info[0] >= 3:
Expand Down
0