OMG. When I reviewed this, I thought your assertion that resources.open_binary('mercurial.templates', 'coal/map') is not valid was wrong because the low-level resource reader on the meta path importer does allow relative paths! However, it appears that the open_binary() helper functions limit this! This is yet another example of wonky behavior in these resources APIs. FWIW I've brought many of these to the attention of the core Python people at https://bugs.python.org/issue36128 and https://gitlab.com/python-devs/importlib_resources/-/issues/58 (and a few other places that I can't find the links to).
Mon, Aug 3
Sun, Aug 2
Fri, Jul 31
The commit message was hard to read.
Thu, Jul 30
The commit message is missing the "why" (which is fine if that's obvious, but it doesn't seem obvious to me here). It's also unclear how this is changing a Rust binding. Are you saying that fp is an object defined in Rust?
Wed, Jul 29
I may instead make the function return a resource. We'll see.
Tue, Jul 28
I didn't include release notes in this patch because D8839 needs to get in first. If that lands quickly and gets merged to default, I'll update this patch. Otherwise I'll just send a follow-up later.