Issue 13976: threading.local doesn't support super() (original) (raw)

import threading import pprint

class A: def init(self, **kw): pprint.pprint("a") super(A, self).init()

class B(threading.local, A): def init(self, **kw): pprint.pprint("b") super(B, self).init()

if name == "main": B()

breaks (prints only b) in python 2. tested 2.7.2

works (prints b, a) in python 3, tested 3.2.2

threading.local is before A on purpose, to have different A attribute in different threads, not shown in the example.

caveat implementor: it may be impossible to support both super().init and explicit threading.local.init at the same time; explicit initialization is used far and wide in legacy code.