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.

Author brett.cannon
Recipients brett.cannon, eric.snow, pitrou, r.david.murray
Date 2012-04-16.17:46:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
To help refine this, so you would expect all of the usual import stuff (e.g. sys.modules use, generating bytecode, etc.), you just want a short-circuit to the loading when you happen to already know the name and desired file path?

Basically I want to kill off the file argument to imp.load_source() since it buys you nothing as import is no longer structured to work off of already opened files, and especially files opened to return text instead of bytes (the only reason load_*() even takes an open file is because it directly exposes stuff part way through import.c's import process).

And as for having an already opened file, don't count on load_module() sticking around since find_module() is going to go since, once again, it is only structured the way it is with its poor API because of how import.c's C code was structured.

Thinking about it a little, would importlib.util.SourceFileLoader(name, path).load_source() be an okay API for you? Or do you really want a function instead of a convenience method on a loader instance? I basically want to gut imp down to only stuff that is required for backwards-compatibility for for really low-level stuff that normal people never touch and have common stuff like load_source() be in importlib somewhere.
Date User Action Args
2012-04-16 17:46:44brett.cannonsetrecipients: + brett.cannon, pitrou, r.david.murray, eric.snow
2012-04-16 17:46:44brett.cannonsetmessageid: <>
2012-04-16 17:46:43brett.cannonlinkissue14551 messages
2012-04-16 17:46:43brett.cannoncreate