Author: Matti Picus <[email protected]>
Branch: cpyext-subclass-setattr
Changeset: r94211:2315922104c7
Date: 2018-04-01 15:25 +0300
http://bitbucket.org/pypy/pypy/changeset/2315922104c7/
Log: restore rpython Py_IncRef, Py_DecRef for PYPY_DEBUG_REFCOUNT, old
versions segfaulted
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -640,7 +640,7 @@
'Py_DivisionWarningFlag', 'Py_DontWriteBytecodeFlag',
'Py_NoUserSiteDirectory',
'_Py_QnewFlag', 'Py_Py3kWarningFlag', 'Py_HashRandomizationFlag',
'_Py_PackageContext',
'_PyTraceMalloc_Track', '_PyTraceMalloc_Untrack', 'PyMem_Malloc',
- 'Py_IncRef', 'Py_DecRef', 'PyObject_Free', 'PyObject_GC_Del',
'PyType_GenericAlloc',
+ 'PyObject_Free', 'PyObject_GC_Del', 'PyType_GenericAlloc',
'_PyObject_New', '_PyObject_NewVar',
'_PyObject_GC_New', '_PyObject_GC_NewVar',
'PyObject_Init', 'PyObject_InitVar', 'PyInt_FromLong',
diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -414,3 +414,13 @@
@cpython_api([rffi.VOIDP], lltype.Signed, error=CANNOT_FAIL)
def _Py_HashPointer(space, ptr):
return rffi.cast(lltype.Signed, ptr)
+
+@cpython_api([PyObject], lltype.Void)
+def Py_IncRef(space, obj):
+ incref(space, obj)
+
+@cpython_api([PyObject], lltype.Void)
+def Py_DecRef(space, obj):
+ decref(space, obj)
+
+
diff --git a/pypy/module/cpyext/src/object.c b/pypy/module/cpyext/src/object.c
--- a/pypy/module/cpyext/src/object.c
+++ b/pypy/module/cpyext/src/object.c
@@ -5,18 +5,6 @@
extern void _PyPy_Free(void *ptr);
extern void *_PyPy_Malloc(Py_ssize_t size);
-void
-Py_IncRef(PyObject *o)
-{
- Py_XINCREF(o);
-}
-
-void
-Py_DecRef(PyObject *o)
-{
- Py_XDECREF(o);
-}
-
/*
* The actual value of this variable will be the address of
* pyobject.w_marker_deallocating, and will be set by
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit