[pypy-commit] pypy release-pypy3.5-5.x: fix for -A, fix issue setting tp_new to 0x1
mattip
pypy.commits at gmail.com
Sun Apr 2 13:58:27 EDT 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch: release-pypy3.5-5.x
Changeset: r90924:c49045ac1e81
Date: 2017-04-02 20:45 +0300
http://bitbucket.org/pypy/pypy/changeset/c49045ac1e81/
Log: fix for -A, fix issue setting tp_new to 0x1 (grafted from
c121ac248c573b43f774b4907e7d637bdeddddd6)
diff --git a/pypy/module/cpyext/test/foo.c b/pypy/module/cpyext/test/foo.c
--- a/pypy/module/cpyext/test/foo.c
+++ b/pypy/module/cpyext/test/foo.c
@@ -728,13 +728,14 @@
if (module == NULL)
INITERROR;
- footype.tp_new = PyType_GenericNew;
-
UnicodeSubtype.tp_base = &PyUnicode_Type;
UnicodeSubtype2.tp_base = &UnicodeSubtype;
MetaType.tp_base = &PyType_Type;
- if (PyType_Ready(&footype) < 0)
+ fooType.tp_new = &new_fooType;
+ InitErrType.tp_new = PyType_GenericNew;
+
+ if (PyType_Ready(&fooType) < 0)
INITERROR;
if (PyType_Ready(&UnicodeSubtype) < 0)
INITERROR;
diff --git a/pypy/module/cpyext/test/test_typeobject.py b/pypy/module/cpyext/test/test_typeobject.py
--- a/pypy/module/cpyext/test/test_typeobject.py
+++ b/pypy/module/cpyext/test/test_typeobject.py
@@ -950,7 +950,7 @@
class foo(f2, f1):
pass
- x = foo(1)
+ x = foo()
assert bar.__base__ is f2
# On cpython, the size changes.
if '__pypy__' in sys.builtin_module_names:
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -682,10 +682,6 @@
if pto.c_tp_itemsize < pto.c_tp_base.c_tp_itemsize:
pto.c_tp_itemsize = pto.c_tp_base.c_tp_itemsize
- if space.is_w(w_type, space.w_object):
- # will be filled later on with the correct value
- # may not be 0
- pto.c_tp_new = cts.cast('newfunc', 1)
update_all_slots(space, w_type, pto)
if not pto.c_tp_new:
base_object_pyo = make_ref(space, space.w_object)
More information about the pypy-commit
mailing list