[issue46935] import of submodule polutes global namespace

2022-03-06 Thread Max Bachmann
Max Bachmann added the comment: Thanks Dennis. This helped me track down the issue in rapidfuzz. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker

[issue46935] import of submodule polutes global namespace

2022-03-05 Thread Dennis Sweeney
Dennis Sweeney added the comment: This might be something that rapidfuzz can fix, rather than CPython. In whatever import process rapidfuzz uses, it populates sys.modules with a module named `Levenshtein` in addition to 'rapidfuzz.distance.Levenshtein'. You might be able to request that

[issue46935] import of submodule polutes global namespace

2022-03-05 Thread Max Bachmann
Max Bachmann added the comment: It appears this only occurs when a C Extension is involved. When the so is imported first it is preferred over the .py file that the user would like to import. I could not find any documentation on this behavior, so I assume that this is not the intended. My

[issue46935] import of submodule polutes global namespace

2022-03-05 Thread Max Bachmann
New submission from Max Bachmann : In my environment I installed the following two libraries: ``` pip install rapidfuzz pip install python-Levenshtein ``` Those two libraries have the following structures: rapidfuzz |-distance |- __init__.py (from . import Levenshtein) |- Levenshtein.*.so