[issue1087741] subclassable mmap
Ralf Schmitt added the comment: sorry, I somehow managed to introduce a segfault: ~/pydev/trunk/ cat t.py [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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=0xff866b0f are zsh: segmentation fault ./python t.py The following fixes it for me: ~/pydev/trunk/ cat patch [EMAIL PROTECTED] 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. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1087741 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1087741] subclassable mmap
Changes by Ralf Schmitt: Added file: http://bugs.python.org/file9261/subclass_mmap_patch.txt _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1087741 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1087741] subclassable mmap
Ralf Schmitt added the comment: ./python Lib/test/test_mmap.py works with a debug build with this patch. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1087741 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1087741] subclassable mmap
Georg Brandl added the comment: Committed as r60202. Thanks for the care! _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1087741 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1087741] subclassable mmap
Ralf Schmitt added the comment: I'm attaching a patch, which makes mmap.mmap the mmap class itself and also makes it subclassable. It also contains changes to the documentation. This is against revision 60148 of trunk. -- nosy: +schmir Added file: http://bugs.python.org/file9248/mmapclass.txt _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1087741 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1087741] subclassable mmap
Georg Brandl added the comment: Reviewed and committed in r60152. -- nosy: +georg.brandl resolution: - accepted status: open - closed _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1087741 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1087741] subclassable mmap
Ralf Schmitt added the comment: Many thanks for handling it immediately. _ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue1087741 _ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com