[New-bugs-announce] [issue3299] invalid object destruction in re.finditer()
STINNER Victor
report at bugs.python.org
Sun Jul 6 16:20:44 CEST 2008
New submission from STINNER Victor <haypo at users.sourceforge.net>:
"import re: re.finditer("a", {})" crash on Python 2.x (tested with svn
trunk) because of an invalid use of PyObject_NEW/PyObject_DEL. The
error is in pattern_scanner(), in block "if (!string) { ... }".
- scanner_dealloc() calls Py_DECREF(self->pattern); whereas pattern
attribute is not initialized
- scanner_dealloc() calls PyObject_DEL(self); whereas
scanner_dealloc() is already the destructor of self object!
I wrote a patch to fix these errors. Please review my patch, I don't
know C API very well.
I also patched _compile(): replace PyObject_DEL() by Py_DECREF(). Is
it really needed?
----------
components: Library (Lib)
files: re_finditer.patch
keywords: patch
messages: 69331
nosy: haypo
severity: normal
status: open
title: invalid object destruction in re.finditer()
type: crash
versions: Python 2.6
Added file: http://bugs.python.org/file10828/re_finditer.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3299>
_______________________________________
More information about the New-bugs-announce
mailing list