This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: expose the finder details used by the FileFinder path hook
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, brett.cannon, chris.jerdonek, eric.snow, scoder
Priority: normal Keywords: patch

Created on 2012-08-09 03:43 by eric.snow, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
loader_details.diff eric.snow, 2012-08-09 03:43 review
Messages (7)
msg167755 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2012-08-09 03:43
The path hook associated with importlib.machinery.FileFinder hides away its loader details in a closure.  This is less than ideal for the purposes of introspection and general hacking.

Here's a simple patch that exposes the loader details as an attribute on the path hook.

This came up in issue 15576 (see msg167632).
msg167757 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2012-08-09 04:00
The alternative is this:

  path_hook.__closure__[1].cell_contents
msg167776 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-08-09 08:50
It seems like a test and documentation for this would be beneficial (for the usual reasons, etc).
msg185283 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-03-26 17:54
The details are no longer in a closure but instead on the _loaders attribute.

Why do you want the details exposed? Do you have an actual use-case?
msg222838 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-07-12 13:48
@Eric do you wish to take this any further?  I'm only asking as Brett's questions in msg185283 are currently unanswered.
msg360919 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-01-29 00:47
Since Eric never replied I'm just closing this.
msg360967 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2020-01-29 15:37
I have many other things higher on my todo list. :)  I'll re-open this issue if I get back to the project that motivated this (i.e. "source translation via import hooks for filename suffix").
History
Date User Action Args
2022-04-11 14:57:34adminsetgithub: 59805
2020-01-29 15:37:00eric.snowsetstatus: open -> closed
resolution: out of date
messages: + msg360967

stage: patch review -> resolved
2020-01-29 00:47:49brett.cannonsetmessages: + msg360919
2019-04-26 19:05:05BreamoreBoysetnosy: - BreamoreBoy
2014-07-12 13:48:46BreamoreBoysetstatus: pending -> open
versions: + Python 3.5, - Python 3.4
nosy: + BreamoreBoy

messages: + msg222838
2013-03-26 17:54:29brett.cannonsetstatus: open -> pending

messages: + msg185283
2012-08-11 14:35:28Arfreversetnosy: + Arfrever
2012-08-09 08:50:29chris.jerdoneksetnosy: + chris.jerdonek
messages: + msg167776
2012-08-09 04:00:40eric.snowsetmessages: + msg167757
2012-08-09 03:43:20eric.snowcreate