Message1856

Author leosoto
Recipients
Date 2007-08-24.22:31:05
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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


History
Date User Action Args
2008-02-20 17:17:59adminlinkissue1781500 messages
2008-02-20 17:17:59admincreate