Hi,

As mentioned in the commit message for 96513d71e650, creating a type
using PyType_FromSpec seems to leak references when the type is
instantiated. This happens with SSLError:

>>> e = ssl.SSLError()
>>> sys.getrefcount(ssl.SSLError)  
35
>>> e = ssl.SSLError()
>>> sys.getrefcount(ssl.SSLError)  
36
>>> e = ssl.SSLError()
>>> sys.getrefcount(ssl.SSLError)  
37

(the SSLError definition is quite simple; it only uses the
Py_tp_base, Py_tp_doc and Py_tp_str slots)

The SSLError subclasses, e.g. SSLWantReadError, which are created using
PyErr_NewExceptionWithDoc, are not affected:

>>> e = ssl.SSLWantReadError()
>>> sys.getrefcount(ssl.SSLWantReadError)
8
>>> e = ssl.SSLWantReadError()
>>> sys.getrefcount(ssl.SSLWantReadError)
8
>>> e = ssl.SSLWantReadError()
>>> sys.getrefcount(ssl.SSLWantReadError)
8

Regards

Antoine.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to