Changes by Terry J. Reedy tjre...@udel.edu:
--
status: pending - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3328
___
___
New submission from Dominic Lavoie [EMAIL PROTECTED]:
This issue is similar to issue 1229429. In the called Python method, a
regular expression fails to compile PyEval_CallMethod() returns 0.
However, the reference count is incremented by 1 which prevents the
object from being destroyed.
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:
No, PyTuple_SET_ITEM() steals a reference to its argument, so that
ownership is transferred to the tuple.
The reference will be released when the tuple is disposed, with
Py_DECREF(arg).
What makes you think that there is a reference
Dominic Lavoie [EMAIL PROTECTED] added the comment:
My application is fairly complex so I am currently trying to build a simple
test case that reproduces the problem. Will let you know as soon as it is ready.
Regards,
Dominic
___
Python tracker [EMAIL
Dominic Lavoie [EMAIL PROTECTED] added the comment:
OK, I have been able to reproduce the problem with a simple test
program. All you have to do is compile issue328.c and run it.
issue328.py compiles an invalid regexp. You will see that the refcount
goes from 1 to 2 if the regexp compilation
Amaury Forgeot d'Arc [EMAIL PROTECTED] added the comment:
Thanks for the short case. It makes everything simpler.
First, note that you get the same behaviour with python-only code:
import re, sys
class Issue3328:
def f(self):
# unbalanced parenthesis
x = re.compile('(123')