diff options
| author | Alexandru Ardelean <ardeleanalex@gmail.com> | 2017-06-12 23:17:05 +0300 |
|---|---|---|
| committer | Alexandru Ardelean <ardeleanalex@gmail.com> | 2017-06-12 23:26:54 +0300 |
| commit | 576c45eb0a5314121aeb2f8d8931644b65e5be99 (patch) | |
| tree | d8bfa44206c63a47f4422d055774c38f2dc44085 /lang/python/python3/patches | |
| parent | 3c820ff9adf8d137e967607cd37961515592fbee (diff) | |
python3: fix distutils path to package when using bytecodes
If there is only Python bytecodes, then
the __init__.py script will be concatenated, and
the __init__.pyc as well.
This is becase this bit `path = os.path.join(path, '__init__'+extension)`
is iterated twice.
This is a bug in Python3, also because we ship bytecodes
instead of source code [ with Python & Python3 ].
Python is not affected.
Reported-by: Mirko Vogt <mirko@nanl.de>
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python/python3/patches')
| -rw-r--r-- | lang/python/python3/patches/008-fix-distutils-path-creation.patch | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lang/python/python3/patches/008-fix-distutils-path-creation.patch b/lang/python/python3/patches/008-fix-distutils-path-creation.patch new file mode 100644 index 000000000..8db6bdc81 --- /dev/null +++ b/lang/python/python3/patches/008-fix-distutils-path-creation.patch @@ -0,0 +1,16 @@ +diff --git a/Lib/imp.py b/Lib/imp.py +index 781ff23..beeac70 100644 +--- a/Lib/imp.py ++++ b/Lib/imp.py +@@ -203,8 +203,9 @@ def load_package(name, path): + extensions = (machinery.SOURCE_SUFFIXES[:] + + machinery.BYTECODE_SUFFIXES[:]) + for extension in extensions: +- path = os.path.join(path, '__init__'+extension) +- if os.path.exists(path): ++ init_path = os.path.join(path, '__init__'+extension) ++ if os.path.exists(init_path): ++ path = init_path + break + else: + raise ValueError('{!r} is not a package'.format(path)) |
