From 6ac7e93849baad1de6cb0eea948c69a26605d888 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 10 Aug 2022 19:14:43 +0100 Subject: [PATCH 1/5] Add `_threading_local.local.__delattr__` back to the stub --- stdlib/_threading_local.pyi | 1 + test_cases/stdlib/test_threading.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 test_cases/stdlib/test_threading.py diff --git a/stdlib/_threading_local.pyi b/stdlib/_threading_local.pyi index d455ce09227e..98683dabcef8 100644 --- a/stdlib/_threading_local.pyi +++ b/stdlib/_threading_local.pyi @@ -14,3 +14,4 @@ class _localimpl: class local: def __getattribute__(self, name: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... + def __delattr__(self, name: str) -> None: ... diff --git a/test_cases/stdlib/test_threading.py b/test_cases/stdlib/test_threading.py new file mode 100644 index 000000000000..8d463595fc24 --- /dev/null +++ b/test_cases/stdlib/test_threading.py @@ -0,0 +1,12 @@ +import threading +import _threading_local + +l = threading.local() +l.foo = 42 +del l.foo +l.baz = ["spam", "eggs"] +del l.baz + +l2 = _threading_local.local() +l2.asdfasdf = 56 +del l2.asdfasdf From 132ebb1ea00f683bc8fe6f379a198b1962ec075f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 Aug 2022 18:18:22 +0000 Subject: [PATCH 2/5] [pre-commit.ci] auto fixes from pre-commit.com hooks --- test_cases/stdlib/test_threading.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test_cases/stdlib/test_threading.py b/test_cases/stdlib/test_threading.py index 8d463595fc24..d96a70318ae3 100644 --- a/test_cases/stdlib/test_threading.py +++ b/test_cases/stdlib/test_threading.py @@ -1,4 +1,5 @@ import threading + import _threading_local l = threading.local() From 5e1f9306bc50e2cf6b37fd4e058a1f069f6c3ec2 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 10 Aug 2022 19:20:57 +0100 Subject: [PATCH 3/5] Fix flake8 --- test_cases/stdlib/test_threading.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test_cases/stdlib/test_threading.py b/test_cases/stdlib/test_threading.py index 8d463595fc24..09cc5436d31e 100644 --- a/test_cases/stdlib/test_threading.py +++ b/test_cases/stdlib/test_threading.py @@ -1,11 +1,11 @@ import threading import _threading_local -l = threading.local() -l.foo = 42 -del l.foo -l.baz = ["spam", "eggs"] -del l.baz +loc = threading.local() +loc.foo = 42 +del loc.foo +loc.baz = ["spam", "eggs"] +del loc.baz l2 = _threading_local.local() l2.asdfasdf = 56 From 714518ffdb7cbc4bf38eabb397ba5881160bc104 Mon Sep 17 00:00:00 2001 From: AlexWaygood Date: Wed, 10 Aug 2022 19:22:07 +0100 Subject: [PATCH 4/5] Fix isort --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 24762a194c24..5f76ae22ea8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,6 +21,7 @@ extra_standard_library = [ "_heapq", "_markupbase", "_random", + "_threading_local", "_tkinter", "_tracemalloc", "_warnings", From b2236b15cd1bce5c3605f05823435b76f58ce8b5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 10 Aug 2022 18:23:46 +0000 Subject: [PATCH 5/5] [pre-commit.ci] auto fixes from pre-commit.com hooks --- test_cases/stdlib/test_threading.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test_cases/stdlib/test_threading.py b/test_cases/stdlib/test_threading.py index 28d0d03c98c6..9b67ac540a75 100644 --- a/test_cases/stdlib/test_threading.py +++ b/test_cases/stdlib/test_threading.py @@ -1,6 +1,5 @@ -import threading - import _threading_local +import threading loc = threading.local() loc.foo = 42