This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author schmir
Recipients georg.brandl, josiahcarlson, nnorwitz, schmir
Date 2008-01-22.13:25:27
SpamBayes Score 0.001966248
Marked as misclassified No
Message-id <1201008330.13.0.467229349464.issue1087741@psf.upfronthosting.co.za>
In-reply-to
Content
sorry, I somehow managed to introduce a segfault: 

~/pydev/trunk/ cat t.py                                                
            ralf@red ok
from mmap import mmap

class anon_mmap(mmap):
    def __new__(klass, *args, **kwargs):
        res = mmap.__new__(klass, -1, *args, **kwargs)
        print "NEW:", res
        return res

anon_mmap(4096)
~/pydev/trunk/ ./python t.py                                           
            ralf@red ok
NEW: <__main__.anon_mmap object at 0x866b10>
Debug memory block at address p=0x866b10:
    18374686479671623679 bytes originally requested
    The 8 pad bytes at p-8 are not all FORBIDDENBYTE (0xfb):
        at p-8: 0xcb *** OUCH
        at p-7: 0xcb *** OUCH
        at p-6: 0xcb *** OUCH
        at p-5: 0xcb *** OUCH
        at p-4: 0xcb *** OUCH
        at p-3: 0xcb *** OUCH
        at p-2: 0xcb *** OUCH
        at p-1: 0xcb *** OUCH
    Because memory is corrupted at the start, the count of bytes requested
       may be bogus, and checking the trailing pad bytes may segfault.
    The 8 pad bytes at tail=0xff00000000866b0f are zsh: segmentation
fault  ./python t.py



The following fixes it for me:

~/pydev/trunk/ cat patch                                               
    ralf@red failed 139
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
--- 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 *



I'll write a test for this issue and will attach a complete patch.
Sorry again.
History
Date User Action Args
2008-01-22 13:25:30schmirsetspambayes_score: 0.00196625 -> 0.001966248
recipients: + schmir, nnorwitz, georg.brandl, josiahcarlson
2008-01-22 13:25:30schmirsetspambayes_score: 0.00196625 -> 0.00196625
messageid: <1201008330.13.0.467229349464.issue1087741@psf.upfronthosting.co.za>
2008-01-22 13:25:28schmirlinkissue1087741 messages
2008-01-22 13:25:28schmircreate