A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2012-June/120659.html below:

[Python-Dev] A reference leak with PyType_FromSpec

[Python-Dev] A reference leak with PyType_FromSpec [Python-Dev] A reference leak with PyType_FromSpecAntoine Pitrou solipsis at pitrou.net
Fri Jun 22 21:23:10 CEST 2012
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.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4