Changes by Vladislav Ignatenko :
--
components: Interpreter Core
nosy: GPCracker
priority: normal
severity: normal
status: open
title: Console interpreter holds a hard link on last displayed object
type: behavior
versions: Python 2.7
New submission from Vladislav Ignatenko:
Hi everyone,
I've faced with python interpreter behavior I didn't expected when I was using
code.InteractiveConsole in my remote python console.
I have also detected this behavior on local python interpreter.
Python 2.7.10 (default, May 23 2015,
eryksun added the comment:
In interactive mode the extra reference is held by the "_" built-in variable.
>>> a
'test string A'
>>> del __builtin__._; sys.getrefcount(a) - 1
1
Look at the following disassembled code, compiled in the 'single' interactive
mode:
>>>