aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2023-05-24 09:43:18 +0300
committerMatti Picus <matti.picus@gmail.com>2023-05-24 09:43:18 +0300
commit4fbf6ce11042a44a541f25a99d8c1251ca634ccf (patch)
tree43a43cafc30447dc138a2c741198e083ed6da14c
parentsqueeze a little more accuracy out of windows time.time(), to make a cython t... (diff)
downloadpypy-4fbf6ce11042a44a541f25a99d8c1251ca634ccf.tar.gz
pypy-4fbf6ce11042a44a541f25a99d8c1251ca634ccf.tar.bz2
pypy-4fbf6ce11042a44a541f25a99d8c1251ca634ccf.zip
back out 89d6f93a10f3, we need a wrap_del
-rw-r--r--pypy/module/cpyext/slotdefs.py17
-rw-r--r--pypy/module/cpyext/test/test_module.py2
2 files changed, 17 insertions, 2 deletions
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
index 7e0e481f8c..9537f21cc8 100644
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -837,6 +837,21 @@ def slot_from_buffer_w(space, typedef):
return 0
return buff_w
+def _make_missing_wrapper(name):
+ assert name not in globals()
+ class missing_wrapper(W_PyCWrapperObject):
+ def call(self, space, w_self, __args__):
+ msg = "cpyext: missing slot wrapper %s for class %s" %(
+ name, space.getfulltypename(w_self))
+ print msg
+ raise NotImplementedError("Slot wrapper " + name)
+ missing_wrapper.__name__ = name
+ globals()[name] = missing_wrapper
+
+missing_wrappers = ['wrap_del']
+for name in missing_wrappers:
+ _make_missing_wrapper(name)
+
def make_missing_slot(space, typedef, name, attr):
return None
@@ -994,7 +1009,7 @@ static slotdef slotdefs[] = {
TPSLOT("__new__", tp_new, slot_tp_new, NULL,
"__new__(type, /, *args, **kwargs)\n--\n\n"
"Create and return new object. See help(type) for accurate signature."),
- TPSLOT("__del__", tp_finalize, slot_tp_finalize, NULL, ""),
+ TPSLOT("__del__", tp_finalize, slot_tp_finalize, (wrapperfunc)wrap_del, ""),
AMSLOT("__await__", am_await, slot_am_await, wrap_unaryfunc,
"__await__($self, /)\n--\n\nReturn an iterator to be used in await expression."),
diff --git a/pypy/module/cpyext/test/test_module.py b/pypy/module/cpyext/test/test_module.py
index 0bb4be84dc..cd8907453b 100644
--- a/pypy/module/cpyext/test/test_module.py
+++ b/pypy/module/cpyext/test/test_module.py
@@ -271,7 +271,7 @@ class AppTestMultiPhase2(AppTestCpythonExtensionBase):
raises(module.error, 'raise module.error()')
assert module.int_const == 1969
assert module.str_const == 'something different'
- ex.__del__()
+ del ex
import gc
for i in range(3):
gc.collect()