gh-122459: Optimize pickling by name objects without __module__ (GH-122460)

This commit is contained in:
Serhiy Storchaka 2024-08-05 16:21:32 +03:00 committed by GitHub
parent 1422500d02
commit 1bb955a2fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 177 additions and 181 deletions

View file

@ -2068,7 +2068,7 @@ class AbstractPicklingErrorTests:
self.dumps(f, proto)
self.assertIn(str(cm.exception), {
f"Can't pickle {f!r}: it's not found as {__name__}.{f.__qualname__}",
f"Can't get local object {f.__qualname__!r}"})
f"Can't get local attribute {f.__qualname__!r} on {sys.modules[__name__]}"})
# Same without a __module__ attribute (exercises a different path
# in _pickle.c).
del f.__module__