Issue 9140: SocketServer.BaseRequestHandler not a new-style class? (original) (raw)

Created on 2010-07-02 04:53 by phf, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (4)
msg109089 - (view) Author: Peter Froehlich (phf) Date: 2010-07-02 04:53
I tried to do this: class Handler(SimpleHTTPRequestHandler): def do_GET(self): super(Handler, self).do_GET() print self.path However super fails: TypeError: super() argument 1 must be type, not classobj Looking up the chain of base classes, I found that SocketServer.BaseRequestHandler is defined as follows: class BaseRequestHandler: No "(object)" there to make it a new-style class. I think that's wrong? BTW, in the 3.1 library it's defined the same way, but I'd assume that all classes are "new-style" in 3.1?
msg109105 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2010-07-02 12:48
We can't change this for 2.6 since it's not a bug fix, and it's too late for 2.7. I doubt we would ever change it for 2.x, since it's likely to break other code is subtle ways. In 3.x all classes are new-style, so it's not at issue there.
msg109106 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-02 12:50
To address the OP’s problem, super can be removed: - super(Handler, self).do_GET() + Handler.do_GET(self)
msg109108 - (view) Author: Peter Froehlich (phf) Date: 2010-07-02 13:33
On Fri, Jul 2, 2010 at 8:50 AM, Éric Araujo <report@bugs.python.org> wrote: > -    super(Handler, self).do_GET() > +    Handler.do_GET(self) Yep, that's how I solved it. :-D
History
Date User Action Args
2022-04-11 14:57:03 admin set github: 53386
2010-07-02 13:33:17 phf set messages: +
2010-07-02 12:50:27 eric.araujo set nosy: + eric.araujomessages: +
2010-07-02 12:48:44 eric.smith set status: open -> closedtype: behavior -> enhancementversions: + Python 2.7, - Python 2.6nosy: + eric.smithmessages: + resolution: wont fixstage: resolved
2010-07-02 04:53:40 phf create