[Twisted-Python] Old-class-only support in manhole

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Sat Mar 26 14:13:30 EDT 2011

On 25 Mar, 10:26 pm, facundobatista at gmail.com wrote:
>Creating a test case for a change in twisted/manhole/explorer.py, I
>found these lines in CRUFT_WatchyThingie.watchObject:
>        if type(object) is not types.InstanceType:
>            raise TypeError, "Sorry, can only place a watch on 
>Always talking in Python 2, if you pass an instance of an old style
>class as the "object", it will be ok; but if you pass a new style
>class, it will raise TypeError.
>So, I wanted just to ask if this is on purpose, should I open a bug
>about it, or what.

This is really old, untested code.  At the time it was written, there 
was no such thing as a new-style class.  No one bothered to update the 
code when new-style classes were introduced into the language.  And the 
last time I tried to actually use this functionality (at least two years 
ago), it didn't work anymore anyway (even for classic classes).

The idea here is cool, and I think it would be nice to support it, but 
this code is pretty gross and, as far as I know, broken.  I think we 
should think about getting rid of it.  If we go that route, then you 
should be able to ignore it for your Python 3 porting efforts.


More information about the Twisted-Python mailing list