[Import-SIG] PEP 451 (ModuleSpec) round 3
solipsis at pitrou.net
Mon Sep 2 15:15:20 CEST 2013
Le Mon, 2 Sep 2013 23:09:18 +1000,
Nick Coghlan <ncoghlan at gmail.com> a écrit :
> > Er... There may (or even will) be compatibility issues with that.
> > Such as pickling of top level functions, or the various
> > discrepancies of bound methods vs. plain functions. Or, of course,
> > all the changes in introspection results that might disrupt
> > existing code (think the various `inspect` functions).
> > I think it would be much safer to have top level functions remain
> > plain functions, and take the module object as first argument as
> > they already do (the "PyObject *self"). And it would help extension
> > modules be more like normal Python modules.
> Yeah, I made that suggestion when I was confused between which of
> PyModule_GetState and PyState_GetModule caused problems. Since it's
> only the latter, there's no need to muck about with exposing bound
> methods of objects with hidden state - we already have that by calling
> "PyModule_GetState" on the module parameter.
But even PyModule_GetState isn't necessary anymore, if module objects
can have custom C fields.
More information about the Import-SIG