[issue39832] Modules with decomposable characters in module name not found on macOS
Norbert
report at bugs.python.org
Mon Mar 2 19:25:16 EST 2020
New submission from Norbert <python at lindenbergsoftware.com>:
Modules whose names contain characters that are in precomposed form but can be decomposed in Normalization Form D can’t be found on macOS.
To reproduce:
1. Download and unzip the attached file Modules.zip. This produces a directory Modules with four Python source files.
2. In Terminal, go to the directory that contains Modules.
3. Run "python3 -m Modules.Import".
Expected behavior:
The following lines should be generated:
Maerchen
Märchen
Actual behavior:
The first line, “Maerchen” is generated, but then an error occurs:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/business/tmp/pyimports/Modules/Import.py", line 5, in <module>
from Modules.Märchen import hello2
ModuleNotFoundError: No module named 'Modules.Märchen'
Evaluation:
In the source file Modules/Import.py, the name of the module “Märchen” is written with the precomposed character U+00E4. The file name Märchen.py uses the decomposed character sequence U+0061 U+0308 instead. Macintosh file names commonly use a variant of Normalization Form D in file names – the old file system HFS enforces this, and while APFS doesn’t, the Finder still generates file names in this form. U+00E4 and U+0061 U+0308 are canonically equivalent, so they should be treated as equal in module loading.
Tested configuration:
CPython 3.8.2
macOS 10.14.6
----------
components: Interpreter Core
files: Modules.zip
messages: 363224
nosy: Norbert
priority: normal
severity: normal
status: open
title: Modules with decomposable characters in module name not found on macOS
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48944/Modules.zip
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39832>
_______________________________________
More information about the Python-bugs-list
mailing list