[issue20383] Add a keyword-only spec argument to types.ModuleType
Brett Cannon
report at bugs.python.org
Fri May 30 16:08:06 CEST 2014
Brett Cannon added the comment:
Giving Eric is polymorphic first argument to types.ModuleType() is going to be tricky thanks to the fact that it is not hard-coded anywhere in the C code nor documented that the first argument must be a string (the only way it might come up is from PyModule_GetName() and even then that's not required to work as you would expect). And since we purposefully kept specs type-agnostic, you can't do a type check for a SimpleNamespace.
I think the only way for it to work is by attribute check (e.g. is 'name' or 'loader' defined on the object, regardless of value).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20383>
_______________________________________
More information about the Python-bugs-list
mailing list