mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
bpo-41515: Fix KeyError raised in get_type_hints (GH-25352)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> Co-authored-by: efahl <36704995+efahl@users.noreply.github.com>
This commit is contained in:
parent
852150ddfe
commit
a9cf69df2e
3 changed files with 12 additions and 1 deletions
|
@ -2267,6 +2267,12 @@ class ClassVarTests(BaseTestCase):
|
|||
with self.assertRaises(TypeError):
|
||||
issubclass(int, ClassVar)
|
||||
|
||||
def test_bad_module(self):
|
||||
# bpo-41515
|
||||
class BadModule:
|
||||
pass
|
||||
BadModule.__module__ = 'bad' # Something not in sys.modules
|
||||
assert(get_type_hints(BadModule), {})
|
||||
|
||||
class FinalTests(BaseTestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue