New submission from Dima Tisnek <[email protected]>:
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.
----------
components: None
messages: 152947
nosy: Dima.Tisnek, pitrou
priority: normal
severity: normal
status: open
title: threading.local doesn't support super()
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue13976>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com