[New-bugs-announce] [issue13976] threading.local doesn't support super()

Dima Tisnek report at bugs.python.org
Thu Feb 9 16:07:18 CET 2012


New submission from Dima Tisnek <dimaqq at gmail.com>:

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 <report at bugs.python.org>
<http://bugs.python.org/issue13976>
_______________________________________


More information about the New-bugs-announce mailing list