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 daniel.wagner-hall
Recipients daniel.wagner-hall
Date 2012-09-04.22:59:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1346799575.05.0.866449286676.issue15864@psf.upfronthosting.co.za>
In-reply-to
Content
Importing the same module twice should only execute its code once, and should only lead to one copy of the classes defined in the module's file.

If a subdirectory of $PWD is on $PYTHONPATH, and a package is imported both relative to $PWD and relative to that subdirectory, its code is loaded twice, and its classes are defined twice independently.

Downloading the attached file, and running:

mkdir folder
cd folder
tar xf file.tgz
PYTHONPATH=$(pwd)/package python main.py

should print import once, but does print import twice.
History
Date User Action Args
2012-09-04 22:59:35daniel.wagner-hallsetrecipients: + daniel.wagner-hall
2012-09-04 22:59:35daniel.wagner-hallsetmessageid: <1346799575.05.0.866449286676.issue15864@psf.upfronthosting.co.za>
2012-09-04 22:59:34daniel.wagner-halllinkissue15864 messages
2012-09-04 22:59:33daniel.wagner-hallcreate