New submission from STINNER Victor <[EMAIL PROTECTED]>:

"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 <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3299>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to