Skip to content
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

Test pickling a simple callable (does not work). #3906

Merged
merged 4 commits into from
May 2, 2022

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Apr 26, 2022

Description

Currently only documents that it does not work for C Python (it only works for PyPy). Starting point for future fix.

Suggested changelog entry:

serialized = pickle.dumps(m.simple_callable)
deserialized = pickle.loads(serialized)
assert deserialized() == 20220426
else:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we really want to test the broken behavior of CPython or just wrap this test with a non-strict xfail? At the very least, we should add a comment that this is a CPython bug not a PyPy bug and that PyPY is doing the preferred behavior for once.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a comment to be explicit.

The test as-is gives unambiguous information about the where & what, in 3 lines.

strict xfail would lose where & what exactly the failure is.

non-strict xfail would lose almost all information about the where & what.

unless it's tracked in a comment, which is about as many characters, only not executable code, therefore leaving room for doubts and misunderstandings.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@rwgk You can add a raises arg to xfail, but I see what you mean.

@rwgk
Copy link
Collaborator Author

rwgk commented May 2, 2022

Thanks Aaron! Merging this now, to get this into the smart_holder update.

@rwgk rwgk merged commit 287e4f2 into pybind:master May 2, 2022
@rwgk rwgk deleted the pickle_callable branch May 2, 2022 19:39
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label May 2, 2022
@rwgk rwgk removed the needs changelog Possibly needs a changelog entry label May 2, 2022
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.

2 participants