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

__init__ inherited from object fails required_args() on Python-2.7 #1656

Closed
ccxcz opened this issue Oct 25, 2018 · 2 comments · Fixed by #1657
Closed

__init__ inherited from object fails required_args() on Python-2.7 #1656

ccxcz opened this issue Oct 25, 2018 · 2 comments · Fixed by #1657
Assignees
Labels
bug something is clearly wrong here

Comments

@ccxcz
Copy link

ccxcz commented Oct 25, 2018

On Python 2.7 getargspec() fails on default __init__ method. This in turn triggers bug #1655. The required_args() function can use target.__init__ is object.__init__ to detect this case.
Test for checking correct result is provided in https://github.com/ccxcz/hypothesis/tree/check-default-init

@Zac-HD Zac-HD added the bug something is clearly wrong here label Oct 25, 2018
@Zac-HD Zac-HD self-assigned this Oct 26, 2018
@ccxcz
Copy link
Author

ccxcz commented Oct 26, 2018

Another way this breaks is on old-style classes that don't have to have init attribute at all. Checking with hasattr(target, '__init__') would work in that case.

@Zac-HD
Copy link
Member

Zac-HD commented Oct 26, 2018

Gah, I'm so sick of Python 2... thanks for the report though 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is clearly wrong here
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants