[Pyrex] [bug report] Object reference count incorrect

Joseph Koshy jkoshy at FreeBSD.ORG
Sat May 3 08:13:38 CEST 2003


Pyrex v0.7.2, and Python v2.2.2

+-+-+ "refbug.pyx"
import sys

class RefBug:

  def __init__(self):  

  # Buggy variants:
  # def __init__(self, *a, **kw): # variant (A)
  # def __init__(self, *a):       # variant (B) 
  # def __init__(self, **kw):     # variant (C)

    print '__init__'

  def __del__(self): 

    print '__del__'
+-+-+

Sample session (variant A)
+-+-+
  $ python
  Python 2.2.1 (#1, Oct  5 2002, 11:19:44)
  [GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import refbug
  >>> x = refbug.RefBug()
  __init__
  >>> del x             # nothing happens
+-+-+

The bug exists for extension types defined with 'cdef class ...' too.

Regards,
Koshy
<jkoshy at freebsd.org>






More information about the Pyrex mailing list