[New-bugs-announce] [issue15864] Package cache doesn't cache packages with overlapping sys.path entries

Daniel Wagner-Hall report at bugs.python.org
Wed Sep 5 00:59:35 CEST 2012


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 <report at bugs.python.org>
<http://bugs.python.org/issue15864>
_______________________________________


More information about the New-bugs-announce mailing list