]> granicus.if.org Git - python/commitdiff
Delete a broken threading.local example (GH-5870)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 25 Feb 2018 15:56:56 +0000 (07:56 -0800)
committerGitHub <noreply@github.com>
Sun, 25 Feb 2018 15:56:56 +0000 (07:56 -0800)
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 <habnabit@users.noreply.github.com>
Lib/_threading_local.py

index 4ec4828144b7e9b265395deecbecde7907bae797..245bd0ac91b7997cd7da307564f1363ff2f0b9d7 100644 (file)
@@ -56,11 +56,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
@@ -97,7 +93,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: