New submission from Daniel Wagner-Hall:

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.

----------
files: packageissue.tgz
messages: 169842
nosy: daniel.wagner-hall
priority: normal
severity: normal
status: open
title: Package cache doesn't cache packages with overlapping sys.path entries
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file27119/packageissue.tgz

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

Reply via email to