[pypy-svn] r24769 - pypy/dist/pypy/translator/c
tismer at codespeak.net
tismer at codespeak.net
Wed Mar 22 04:05:44 CET 2006
Author: tismer
Date: Wed Mar 22 04:05:36 2006
New Revision: 24769
Modified:
pypy/dist/pypy/translator/c/funcgen.py
Log:
there are ugly refcounting bugs with PyObjects. Could not yet clean this up. See email
Modified: pypy/dist/pypy/translator/c/funcgen.py
==============================================================================
--- pypy/dist/pypy/translator/c/funcgen.py (original)
+++ pypy/dist/pypy/translator/c/funcgen.py Wed Mar 22 04:05:36 2006
@@ -11,6 +11,9 @@
PyObjPtr = Ptr(PyObject)
LOCALVAR = 'l_%s'
+# I'm not absolutely sure, so just in case:
+NEED_OLD_EXTRA_REFS = True # oupps seems to be
+
class FunctionCodeGenerator(object):
"""
Collects information about a function which we have to generate
@@ -455,7 +458,7 @@
newvalue = self.expr(op.result, special_case_void=False)
result = ['%s = %s;' % (newvalue, sourceexpr)]
# need to adjust the refcount of the result only for PyObjects
- if T == PyObjPtr:
+ if NEED_OLD_EXTRA_REFS and T == PyObjPtr:
result.append('Py_XINCREF(%s);' % newvalue)
result = '\n'.join(result)
if T is Void:
@@ -599,7 +602,7 @@
cdecl(typename, ''),
self.expr(op.args[0])))
- if TYPE == PyObjPtr:
+ if NEED_OLD_EXTRA_REFS and TYPE == PyObjPtr:
result.append('Py_XINCREF(%s);'%(LOCAL_VAR % op.result.name))
return '\t'.join(result)
@@ -619,7 +622,7 @@
if TYPE is not Void:
result.append('%s = %s;' % (self.expr(op.result),
self.expr(op.args[0])))
- if TYPE == PyObjPtr:
+ if NEED_OLD_EXTRA_REFS and TYPE == PyObjPtr:
result.append('Py_XINCREF(%s);'%(LOCAL_VAR % op.result.name))
return '\t'.join(result)
More information about the Pypy-commit
mailing list