William Schwartz <wkschwa...@gmail.com> added the comment:

> For that, please submit a PR to importlib_resources and it will get synced to 
> CPython later.

Will do once PR 23611 gets in shape. 

> Can you tell me more about the use-case that exhibited this undesirable 
> behavior?

Using the [PyOxidizer] "freezer". It compiles Python together with frozen 
Python code or byte code.

> That is, what loader is it that supports `open_binary` but not `is_resource` 
> and doesn't have a `__origin__`?

PyOxidizer's [OxidizedImporter] importer. It [does not set `__file__`] (i.e., 
`__spec__.origin__ is None`). Its maintainer has resolved some ambiguities in 
the resources API contract (#36128) [differently from CPython], but I don't 
think that's related to the issue I ran into. The resource-related 
functionality of the importer is implemented here (extension module written in 
Rust): 
https://github.com/indygreg/PyOxidizer/blob/e86b2f46ed6b449bdb912900b0ac83576ad5ebe9/pyembed/src/importer.rs#L1078-L1269

[PyOxidizer]: https://pyoxidizer.readthedocs.io
[OxidizedImporter]: 
https://pyoxidizer.readthedocs.io/en/v0.10.3/oxidized_importer.html
[does not set `__file__`]: 
https://pyoxidizer.readthedocs.io/en/v0.10.3/oxidized_importer_behavior_and_compliance.html#file-and-cached-module-attributes
[unsure about `ResourceReader` semantics]: 
https://pyoxidizer.readthedocs.io/en/v0.10.3/oxidized_importer_resource_files.html#resource-reader-support

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42531>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to