Index: Lib/_threading_local.py =================================================================== --- Lib/_threading_local.py (revision 70268) +++ Lib/_threading_local.py (working copy) @@ -155,7 +155,7 @@ object.__setattr__(self, '_local__args', (args, kw)) object.__setattr__(self, '_local__lock', RLock()) - if args or kw and (cls.__init__ is object.__init__): + if (args or kw) and (cls.__init__ is object.__init__): raise TypeError("Initialization arguments are not supported") # We need to create the thread dict in anticipation of Index: Lib/test/test_threading_local.py =================================================================== --- Lib/test/test_threading_local.py (revision 70268) +++ Lib/test/test_threading_local.py (working copy) @@ -67,7 +67,20 @@ for t in threads: t.join() + def test_arguments(self): + # Issue 1522237 + from thread import _local as local + from _threading_local import local as py_local + for cls in (local, py_local): + class MyLocal(cls): + def __init__(self, *args, **kwargs): + pass + + MyLocal(a=1) + MyLocal(1) + + def test_main(): suite = unittest.TestSuite() suite.addTest(DocTestSuite('_threading_local'))