[Python-Dev] PEP 578: Python Runtime Audit Hooks (original) (raw)
Steve Dower steve.dower at python.org
Mon Apr 1 13:42:58 EDT 2019
- Previous message (by thread): [Python-Dev] PEP 578: Python Runtime Audit Hooks
- Next message (by thread): [Python-Dev] PEP 578: Python Runtime Audit Hooks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 30Mar2019 0913, Steve Dower wrote:
On 30Mar.2019 0747, Nick Coghlan wrote:
I like this PEP in principle, but the specific "openforimport" name bothers me a lot, as it implies that "importing" is the only situation where a file will be opened for code execution.
If this part of the API were lower down the stack (e.g. "io.openforcodeexecution") then I think it would make more sense - APIs like tokenize.open(), runpy.runpath(), PyRunSimpleFile(), shelve, etc, could use that, without having to introduce a dependency on importlib to get access to the functionality. It was called "openforexec" at one point, though I forget exactly why we changed it. But I have no problem with moving it. Something like this? PyImportOpenForImport -> PyIOOpenForExec PyImportSetOpenForImportHook -> PyIOSetOpenForExecHook importlib.util.openforimport -> io.openforexec Or more in line with Nick's suggestion: PyImportOpenForImport -> PyIOOpenExecutableCode PyImportSetOpenForImportHook -> PyIOSetOpenExecutableCodeHook importlib.util.openforimport -> io.openexecutablecode I dropped "For", but I don't really care that much about the name. I'd be okay dropping either "executable" or "code" as well - I don't really have a good sense of which will make people more likely to use this correctly.
Looking at what we already have, perhaps putting it under "PyFile_OpenForExecute" would make the most sense? We don't currently have any public "PyIO" types or functions.
Bikeshedding now, but as I'm the only one really participating in it, I think it's allowed :)
Cheers, Steve
- Previous message (by thread): [Python-Dev] PEP 578: Python Runtime Audit Hooks
- Next message (by thread): [Python-Dev] PEP 578: Python Runtime Audit Hooks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]