[issue39980] importlib.resources.path() may return incorrect path when using custom loader

2020-03-18 Thread Krzysztof Rusek
Krzysztof Rusek added the comment: I can confirm that this problem doesn't occur when using recent version of importlib_resources (checked importlib_resources==1.3.1). -- ___ Python tracker <https://bugs.python.org/is

[issue39980] importlib.resources.path() may return incorrect path when using custom loader

2020-03-16 Thread Krzysztof Rusek
Krzysztof Rusek added the comment: Maybe importlib.resources.path() should skip checking file existence when ResourceReader.resource_path() raises FileNotFoundError? Current logic: @contextmanager def path(package: Package, resource: Resource) -> Iterator[Path]: resou

[issue39980] importlib.resources.path() may return incorrect path when using custom loader

2020-03-16 Thread Krzysztof Rusek
New submission from Krzysztof Rusek : importlib.resources.path() function may return a path to a file with different contents than expected. This may happen when using a custom loader implementation that uses fake filenames (like ''). I'm attaching a reproduction tes