Message2683

Author pjenvey
Recipients
Date 2007-03-16.20:53:25
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Here's a patch against the 2.3 branch converting PyModule.java to a new-style class.

I've also added Lib/tests/test_module.py, from CPython, with some extra added tests

I've changed test_descr.py and the newly added test_module.py to reference ModuleType from types.ModuleType instead of type(sys). I've also commented out a small test in test_module.py that tests MoudleType.__doc__ (I think this might be a PyType or PyObject issue)

PyModule is a little tricky, a couple things I'd point out are:

o __findattr__ is like the old __findattr__, except it now works with an empty __dict__ (__dict__ can be null (None) after ModuleType.__new__())

o __setattr__ has to do some special handling for when __dict__ == null. It might pay to just hardcode the __dict__ access (which simply raises a TypeError) upfront in __set/get/delattr__ instead of having a __dict__ PyGetSetDescr

I haven't tried making an actual java subclass of PyModule yet (e.g. [1639028]). I took a brief look at doing it for PySystemState, but that seemed like it required more than a few changes (doing that would make type(sys) == types.ModuleType)

I'm not sure if the 2.2 branch needs this
History
Date User Action Args
2008-02-20 17:18:41adminlinkissue1682423 messages
2008-02-20 17:18:41admincreate