Message282378
I had a brief look at the source for ABCMeta, and it seems to me that the __module__ behaviour is coming from `type`. I'm not sure whether it can, or should, can be fixed in type, but I think that the correct behaviour for ABCMeta is to set __module__ to the caller's global "__name__", not its own.
Something like this should probably work:
class ABCMeta(type):
def __new__(mcls, name, bases, namespace):
if '__module__' not in namespace:
# globals()['__name__'] gives 'abc'
frame = inspect.currentframe()
if frame is not None:
# IronPython?
caller_globals = frame.f_back.f_globals
namespace['__module__'] = caller_globals['__name__']
cls = super().__new__(mcls, name, bases, namespace)
... |
|
Date |
User |
Action |
Args |
2016-12-04 23:15:31 | steven.daprano | set | recipients:
+ steven.daprano, levkivskyi, abarry |
2016-12-04 23:15:31 | steven.daprano | set | messageid: <1480893331.16.0.582578212969.issue28869@psf.upfronthosting.co.za> |
2016-12-04 23:15:31 | steven.daprano | link | issue28869 messages |
2016-12-04 23:15:31 | steven.daprano | create | |
|