-
Notifications
You must be signed in to change notification settings - Fork 171
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
recursive and unhashable closure #90
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
da4dd39
support recursive closure cells
ba23a20
support unhashable closure values
2c49ba0
pypy fixes and _cell_set definition update
4b251a0
test the expected failure for pypy
6d8ec33
add test for f.__closure__ preservation
9e11439
2.6 compat for TestCase.assertIsNone
121604a
don't send the closure twice on pypy
ac85930
update closure serialization for pypy
55cd6fd
use pytest.raises instead of xfail
cb524a4
support pypy
ed7a73c
clean up names and inline single-use functions
6656cca
add comment pointing out my one weird trick for mutating a cell
26c319c
use an empty cell instead of cell(None)
cf882c6
add cell manipulation helper unit tests
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test the expected failure for pypy
- Loading branch information
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,6 +154,19 @@ def g(n): | |
g2 = pickle_depickle(f2(2)) | ||
self.assertEqual(g2(5), 240) | ||
|
||
@pytest.mark.skipif( | ||
supports_recursive_closure, | ||
reason="Recursive closures shouldn't raise an exception if supported" | ||
) | ||
@pytest.mark.xfail | ||
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. Rather than a xfail, I'd like to see the specific exception tested for inside the test, so that we don't miss it failing for other reasons... |
||
def test_recursive_closure_unsupported(self): | ||
def f1(): | ||
def g(): | ||
return g | ||
return g | ||
|
||
pickle_depickle(f1()) | ||
|
||
def test_unhashable_closure(self): | ||
def f(): | ||
s = set((1, 2)) # mutable set is unhashable | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This test actually should succeed on PyPy, no?
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.
yes, this is a mistake