Fix up Python2 regressions in PR 417 #452
Merged
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.
#417 introduced some regressions with Python2. To whit:
add_property()
attempts to add docstrings to functions passed to it.test.properties
binds an existing instance method again as a getter, which works fine on Python3, whereklass.member
returns the underlying function object. On Python2, however, this returned an unboundinstancemethod
with an immutable__doc__
attribute. Work around this by skipping docstring generation onPyMethod
objects.test.nested
exercises the__qualname__
attribute, which didn't exist before Python 3.3. Use doctest option flags to make examples conditional on the Python version.