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

Created on 2012-08-09 03:43 by eric.snow, last changed 2014-07-12 13:48 by BreamoreBoy.

Files
File name Uploaded Description Edit
loader_details.diff eric.snow, 2012-08-09 03:43 review
Messages (5)
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.
History
Date User Action Args
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