From d02fc48f67b140e8605a1c9e986f78c8bb8df531 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Tue, 22 Jan 2008 19:56:03 +0000 Subject: Fix for #1087741 patch. --- Lib/test/test_mmap.py | 7 +++++++ Modules/mmapmodule.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 8cc8ded..91d6275 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -420,6 +420,13 @@ class MmapTests(unittest.TestCase): except OSError: pass + def test_subclass(self): + class anon_mmap(mmap.mmap): + def __new__(klass, *args, **kwargs): + return mmap.mmap.__new__(klass, -1, *args, **kwargs) + anon_mmap(PAGESIZE) + + def test_main(): run_unittest(MmapTests) diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index dfbc8fc..09e9465 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -129,7 +129,7 @@ mmap_object_dealloc(mmap_object *m_obj) } #endif /* UNIX */ - PyObject_Del(m_obj); + m_obj->ob_type->tp_free((PyObject*)m_obj); } static PyObject * -- cgit v0.12