[New-bugs-announce] [issue40451] Unexpected sys.getrefcount(foo) output

Cristian Martinez de Morentin report at bugs.python.org
Thu Apr 30 11:18:10 EDT 2020


New submission from Cristian Martinez de Morentin <cmartinez at das-nano.com>:

Hello, I have observed a strange behaviour regarding reference counting in Python 3.8.2 (Windows 64 bits). Perhaps, it could be linked to a memory leakage issue.

In the following code, I would not expect an output of '137' for the reference counter of the 'aux' object. Could you please explain this behaviour?

>>> import sys
>>> test = {'a': 0, 'b': 1}
>>> sys.getrefcount(test)
2
>>> aux = test['b']
>>> sys.getrefcount(aux)
137

Thank you so much.

----------
components: Windows
messages: 367760
nosy: Cristian Martinez de Morentin, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Unexpected sys.getrefcount(foo) output
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40451>
_______________________________________


More information about the New-bugs-announce mailing list