Re: Type implications bug
"Phillip J. Eby" <pje-Wh6+Hckhi6HFNGf7iClzIwC/[email protected]>
| Newsgroups | gmane.comp.python.peak |
|---|---|
| Message-ID | <[email protected]> |
At 12:23 PM 7/15/2008 +0200, Alberto Valverde wrote: >Hi, > >I've attached a unit test which blows up peak/rules/indexing.py._get_mro. Hm. There are actually two problems here. First, issubclass() is being called on an object that's not a class or type, and that blows up the class lookup code. The second is that isclass(x) isn't being tested before that, because direct tests on parameters are assumed to not require prerequisites to go first. In other words, PEAK-Rules assumes that issubclass(x, ...) can go before any other test on x. This can be fixed by removing the predicates.always_testable() rule for IsSubclass criteria; then IsSubclass tests will not be moved in front of other criteria. Doing issubclass() on a non-class/type object will still blow up, though.