This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Nitin Bhojwani
Recipients Nitin Bhojwani
Date 2018-05-31.04:18:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527740328.11.0.682650639539.issue33703@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-05-31 04:18:48Nitin Bhojwanisetrecipients: + Nitin Bhojwani
2018-05-31 04:18:48Nitin Bhojwanisetmessageid: <1527740328.11.0.682650639539.issue33703@psf.upfronthosting.co.za>
2018-05-31 04:18:47Nitin Bhojwanilinkissue33703 messages
2018-05-31 04:18:47Nitin Bhojwanicreate