From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 25 Feb 2018 15:34:46 +0000 (-0800) Subject: Delete a broken threading.local example (GH-5870) X-Git-Tag: v2.7.15rc1~33 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=07c13eee79852296a4bc732037012c424a087369;p=python Delete a broken threading.local example (GH-5870) This code never did anything correct or useful. The class attribute will never be affected, and the condition will never be true. (cherry picked from commit 5fb632e83136399bad9427ee23ec8b771695290a) Co-authored-by: Aaron Gallagher --- diff --git a/Lib/_threading_local.py b/Lib/_threading_local.py index 09a3515bdb..1480329fde 100644 --- a/Lib/_threading_local.py +++ b/Lib/_threading_local.py @@ -57,11 +57,7 @@ You can create custom local objects by subclassing the local class: >>> class MyLocal(local): ... number = 2 - ... initialized = False ... def __init__(self, **kw): - ... if self.initialized: - ... raise SystemError('__init__ called too many times') - ... self.initialized = True ... self.__dict__.update(kw) ... def squared(self): ... return self.number ** 2 @@ -98,7 +94,7 @@ As before, we can access the data in a separate thread: >>> thread.start() >>> thread.join() >>> log - [[('color', 'red'), ('initialized', True)], 11] + [[('color', 'red')], 11] without affecting this thread's data: