[Python-checkins] gh-96478: Test `@overload` on C functions (GH-96479)
miss-islington
webhook-mailer at python.org
Tue Sep 20 21:36:28 EDT 2022
https://github.com/python/cpython/commit/2a5e3337367b4636802697f8e5c78bc5382ec8cb
commit: 2a5e3337367b4636802697f8e5c78bc5382ec8cb
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-09-20T18:36:23-07:00
summary:
gh-96478: Test `@overload` on C functions (GH-96479)
Co-authored-by: Alex Waygood <Alex.Waygood at Gmail.com>
(cherry picked from commit f177f6f29b069f522a0b3ba44eaae19852b6d2b0)
Co-authored-by: Nikita Sobolev <mail at sobolevn.me>
files:
M Lib/test/test_typing.py
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 776a6f003c0..7df7e3ceb68 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -4379,6 +4379,20 @@ def blah():
blah()
+ @patch("typing._overload_registry",
+ defaultdict(lambda: defaultdict(dict)))
+ def test_overload_on_compiled_functions(self):
+ # The registry starts out empty:
+ self.assertEqual(typing._overload_registry, {})
+
+ # This should just not fail:
+ overload(sum)
+ overload(print)
+
+ # No overloads are recorded (but, it still has a side-effect):
+ self.assertEqual(typing.get_overloads(sum), [])
+ self.assertEqual(typing.get_overloads(print), [])
+
def set_up_overloads(self):
def blah():
pass
More information about the Python-checkins
mailing list