[pypy-issue] Issue #2306: PyPy3 stricter handling of __new__/__init__ arguments (pypy/pypy)

Philip Jenvey issues-reply at bitbucket.org
Sun May 22 19:18:56 EDT 2016


New issue 2306: PyPy3 stricter handling of __new__/__init__ arguments
https://bitbucket.org/pypy/pypy/issues/2306/pypy3-stricter-handling-of-__new__

Philip Jenvey:

Python 3 makes `object.__new/init__` stricter (raise TypeErrors) about accepting any arguments depending on whether or not these methods were overwritten.

This is currently annoying to implement on PyPy because we don't perfectly match CPython's use of `__new/init__` methods (e.g. PyPy's type doesn't implement an `__init__`) and that causes the rules to go haywire:

http://buildbot.pypy.org/builders/pypy-c-jit-linux-x86-64/builds/3314

CPython 2.x issues warnings in these cases (PyPy doesn't). That newinitwarn branch linked above is an attempt to see how many warnings would be issued on 2.7 -- by making them errors. It's currently very broken, due to lack of `type.__init__`, but likely needs more work after that one's fixed.

Maybe we can emulate CPython by special casing not <type>.is_heaptype -- we should probably just fix our mismatch `__new/init__`s though

Py3k's test for this is:
test_descr.test_object_new_and_init_with_parameters




More information about the pypy-issue mailing list