Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r90614:6e674eb4be9f
Date: 2017-03-10 07:46 +0100
http://bitbucket.org/pypy/pypy/changeset/6e674eb4be9f/
Log: Move PyObject_CallFinalizerFromDealloc() to a no-op stub
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
@@ -618,6 +618,7 @@
'PyMem_RawMalloc', 'PyMem_RawCalloc', 'PyMem_RawRealloc', 'PyMem_RawFree',
'PyMem_Malloc', 'PyMem_Calloc', 'PyMem_Realloc', 'PyMem_Free',
+ 'PyObject_CallFinalizerFromDealloc',
]
TYPES = {}
FORWARD_DECLS = []
@@ -1338,6 +1339,7 @@
source_dir / "import.c",
source_dir / "_warnings.c",
source_dir / "pylifecycle.c",
+ source_dir / "object.c",
]
def build_eci(code, use_micronumpy=False, translating=False):
diff --git a/pypy/module/cpyext/include/object.h
b/pypy/module/cpyext/include/object.h
--- a/pypy/module/cpyext/include/object.h
+++ b/pypy/module/cpyext/include/object.h
@@ -275,6 +275,9 @@
#define PyObject_Del PyObject_Free
#define PyObject_DEL PyObject_Free
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(int) PyObject_CallFinalizerFromDealloc(PyObject *);
+#endif
/* PyPy internal ----------------------------------- */
diff --git a/pypy/module/cpyext/src/object.c b/pypy/module/cpyext/src/object.c
new file mode 100644
--- /dev/null
+++ b/pypy/module/cpyext/src/object.c
@@ -0,0 +1,15 @@
+
+#include "Python.h"
+
+int
+PyObject_CallFinalizerFromDealloc(PyObject *self)
+{
+ /* STUB */
+ if (self->ob_type->tp_finalize) {
+ fprintf(stderr, "WARNING: PyObject_CallFinalizerFromDealloc() "
+ "not implemented (objects of type '%s')\n",
+ self->ob_type->tp_name);
+ self->ob_type->tp_finalize = NULL; /* only once */
+ }
+ return 0;
+}
diff --git a/pypy/module/cpyext/stubs.py b/pypy/module/cpyext/stubs.py
--- a/pypy/module/cpyext/stubs.py
+++ b/pypy/module/cpyext/stubs.py
@@ -2077,12 +2077,3 @@
it causes an exception to immediately be thrown; this is used for the
throw() methods of generator objects."""
raise NotImplementedError
-
-@cpython_api([PyObject], rffi.INT_real, error=-1)
-def PyObject_CallFinalizerFromDealloc(space, self):
- """Call tp_finalize() once, taking care of reference counting.
-
- NOT IMPLEMENTED: might need to keep the PyPy object alive even while
- tp_dealloc() is called, which the GC doesn't do so far.
- """
- raise NotImplementedError
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit