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

Fix check for pickling closures #5762

Merged
merged 1 commit into from May 1, 2014
Merged

Conversation

minrk
Copy link
Member

@minrk minrk commented Apr 30, 2014

In #5761 I added actual support for closures, which I don't want to backport. But I do want 2.x to get this simpler fix for the bug where we are too aggressive about preventing pickling of closures. Only closures on the outer-most function don't work; internal closures that fully resolve should still be fine, which comes up in often in list comprehensions in Python 3.

@minrk minrk added this to the 2.1 milestone Apr 30, 2014
@minrk minrk changed the title Fix test for pickling closures Fix check for pickling closures Apr 30, 2014
@@ -34,12 +21,11 @@ def code_ctor(*args):
return types.CodeType(*args)

def reduce_code(co):
if co.co_freevars or co.co_cellvars:
raise ValueError("Sorry, cannot pickle code objects with closures")
print(co.co_freevars, co.co_cellvars)
Copy link
Member

Choose a reason for hiding this comment

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

I guess this should be taken out?

Copy link
Member Author

Choose a reason for hiding this comment

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

Holy crap. If it weren't for you guys reviewing my code, I would have accidentally committed dozens of inappropriate print statements to IPython.

Fixed.

Only closures on the outer-most function don't work.
Internal closures that fully resolve should still be fine.
takluyver added a commit that referenced this pull request May 1, 2014
@takluyver takluyver merged commit 161841f into ipython:2.x May 1, 2014
@minrk minrk deleted the better_closure_check branch May 8, 2014 22:52
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.

None yet

2 participants