#35756: Auto reload raises TypeError: unhashable type: 'types.SimpleNamespace'
-------------------------------+--------------------------------------
Reporter: Paul Petersik | Owner: (none)
Type: Bug | Status: closed
Component: Utilities | Version: 5.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Sarah Boyce):
* resolution: => duplicate
* status: new => closed
Comment:
I can replicate an error, but as Tim mentioned, I will mark this is a
duplicate of #35085
{{{#!diff
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -148,6 +148,12 @@ class TestIterModulesAndFiles(SimpleTestCase):
self.addCleanup(lambda: sys.modules.pop("time_proxy", None))
list(autoreload.iter_all_python_module_files()) # No crash.
+ def test_unhashable_objects_in_sys_module(self):
+ name_space = types.SimpleNamespace()
+ sys.modules["name_space"] = name_space # type:
ignore[assignment]
+ self.addCleanup(lambda: sys.modules.pop("name_space", None))
+ list(autoreload.iter_all_python_module_files()) # Crash
+
def test_module_without_spec(self):
module = types.ModuleType("test_module")
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/35756#comment:3>