Issue1781500
Created on 2007-08-24.22:31:05 by leosoto, last changed 2007-10-06.05:28:53 by cgroves.
File name |
Uploaded |
Description |
Edit |
Remove |
__module__.diff
|
leosoto,
2007-08-24.22:33:14
|
Patch |
|
|
msg1856 (view) |
Author: Leonardo Soto (leosoto) |
Date: 2007-08-24.22:31:05 |
|
On CPython, the __module__ attribute is passed to metaclasses. That doesn't happen on Jython (SVN trunk).
How to reproduce it:
Make a foo.py file with this contents:
class Meta(type):
def __new__(cls, name, bases, attrs):
print cls, name, bases, attrs
r = type.__new__(cls, name, bases, attrs)
print "Module", r.__module__
return r
class Super(object):
__metaclass__ = Meta
And a bar.py with this code:
from foo import Super
class Sub(Super):
pass
Run bar.py from CPython and Jython. CPython prints:
<class 'foo.Meta'> Super (<type 'object'>,) {'__module__': 'foo', '__metaclass__': <class 'foo.Meta'>}
Module foo
<class 'foo.Meta'> Sub (<class 'foo.Super'>,) {'__module__': '__main__'}
Module __main__
But Jython says:
<class 'foo.Meta'> Super (<type 'object'>,) {'__metaclass__': <class 'foo.Meta'>}
Module foo
<class 'foo.Meta'> Sub (<foo.Meta object 1>,) {}
Module foo
|
msg1857 (view) |
Author: Leonardo Soto (leosoto) |
Date: 2007-08-24.22:33:15 |
|
Attaching a patch that fixes the issue.
File Added: __module__.diff
|
msg1858 (view) |
Author: Charlie Groves (cgroves) |
Date: 2007-10-06.05:28:53 |
|
Committed to trunk in r3572. Thanks!
|
|
Date |
User |
Action |
Args |
2007-08-24 22:31:05 | leosoto | create | |
|