New submission from Nitin Bhojwani <nitinbhojwani1...@gmail.com>:
I observed a strange behaviour while working on a module. This bug is present in multiple python version so seems it is related to core-interpreter. Behaviour can be reproduced by: 1. Create an object and in __init__ of class, we define a dictionary attribute to that object. 2. After that we change that attribute, like assign any key-value(s) to that attribute. 3. Delete the object. 4. recreate the object. 5. If you check, this new object's same attribute(dictionary) is same old attribute which was pointed by the older object. This is a behavioural bug, as once delete is performed on an object the whole object and it's (attributes') references must be removed. I can demonstrate this using a test from unittest, in which I put instance creation in setUp phase, instance deletion in tearDown phase and run same test multiple times. The result is different each time. The zip file contains ngraph.py which defines a class and test_util.py which runs test against it. Unzip and execute as: python test_util.py #2.7.10 python3 test_util.py #3.6.3 ---------- components: Interpreter Core files: test-bug.zip messages: 318241 nosy: Nitin Bhojwani priority: normal severity: normal status: open title: Object deletion and re-creation points to same attribute if attribute is a dictionary. type: behavior versions: Python 3.6 Added file: https://bugs.python.org/file47627/test-bug.zip _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33703> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com