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, 09:40:32) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> a = 'test string A'
>>> b = 'test string B'
>>> print sys.getrefcount(a) - 1, sys.getrefcount(b) - 1
1 1
>>> a
'test string A'
>>> print sys.getrefcount(a) - 1, sys.getrefcount(b) - 1
2 1
>>> b
'test string B'
>>> print sys.getrefcount(a) - 1, sys.getrefcount(b) - 1
1 2
>>> print a, b
test string A test string B
>>> print sys.getrefcount(a) - 1, sys.getrefcount(b) - 1
1 2
>>> (a, b)
('test string A', 'test string B')
>>> print sys.getrefcount(a) - 1, sys.getrefcount(b) - 1
2 2
>>> sys
<module 'sys' (built-in)>
>>> print sys.getrefcount(a) - 1, sys.getrefcount(b) - 1
1 1

When I used python interactive console to display variable value on it's own 
(no print usage), it holds a hard link on last object, blocking it's 
destruction sometimes, if there were no other links to this object. When user 
perform an 'eval' calculation, result is displayed, and interpreter holds a 
hard link to it, however user can not access it.

1. Is this behavior normal?
2. Is there any way to clean this link directly?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25273>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to