homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dima.Tisnek
Recipients Dima.Tisnek, pitrou
Date 2012年02月09日.15:07:17
SpamBayes Score 5.024363e-05
Marked as misclassified No
Message-id <1328800038.58.0.378315403366.issue13976@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2012年02月09日 15:07:18Dima.Tisneksetrecipients: + Dima.Tisnek, pitrou
2012年02月09日 15:07:18Dima.Tisneksetmessageid: <1328800038.58.0.378315403366.issue13976@psf.upfronthosting.co.za>
2012年02月09日 15:07:17Dima.Tisneklinkissue13976 messages
2012年02月09日 15:07:17Dima.Tisnekcreate

AltStyle によって変換されたページ (->オリジナル) /