Skip to content

Commit

Permalink
Add new types types to _INVALID_BUILTIN_CLASSES (#13262)
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner authored Jan 23, 2025
1 parent ea5fc59 commit 47bff3f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sphinx/util/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
types.ClassMethodDescriptorType: 'types.ClassMethodDescriptorType',
types.CodeType: 'types.CodeType',
types.CoroutineType: 'types.CoroutineType',
types.EllipsisType: 'types.EllipsisType',
types.FrameType: 'types.FrameType',
types.FunctionType: 'types.FunctionType',
types.GeneratorType: 'types.GeneratorType',
Expand All @@ -73,6 +74,8 @@
types.MethodType: 'types.MethodType',
types.MethodWrapperType: 'types.MethodWrapperType',
types.ModuleType: 'types.ModuleType',
types.NoneType: 'types.NoneType',
types.NotImplementedType: 'types.NotImplementedType',
types.TracebackType: 'types.TracebackType',
types.WrapperDescriptorType: 'types.WrapperDescriptorType',
}
Expand Down
9 changes: 9 additions & 0 deletions tests/test_util/test_util_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ClassMethodDescriptorType,
CodeType,
CoroutineType,
EllipsisType,
FrameType,
FunctionType,
GeneratorType,
Expand All @@ -37,6 +38,8 @@
MethodType,
MethodWrapperType,
ModuleType,
NoneType,
NotImplementedType,
TracebackType,
WrapperDescriptorType,
)
Expand Down Expand Up @@ -143,6 +146,7 @@ def test_is_invalid_builtin_class():
ClassMethodDescriptorType,
CodeType,
CoroutineType,
EllipsisType,
FrameType,
FunctionType,
GeneratorType,
Expand All @@ -154,6 +158,8 @@ def test_is_invalid_builtin_class():
MethodType,
MethodWrapperType,
ModuleType,
NoneType,
NotImplementedType,
TracebackType,
WrapperDescriptorType,
}
Expand All @@ -179,6 +185,7 @@ def test_is_invalid_builtin_class():
assert ClassMethodDescriptorType.__module__ == 'builtins'
assert CodeType.__module__ == 'builtins'
assert CoroutineType.__module__ == 'builtins'
assert EllipsisType.__module__ == 'builtins'
assert FrameType.__module__ == 'builtins'
assert FunctionType.__module__ == 'builtins'
assert GeneratorType.__module__ == 'builtins'
Expand All @@ -190,6 +197,8 @@ def test_is_invalid_builtin_class():
assert MethodType.__module__ == 'builtins'
assert MethodWrapperType.__module__ == 'builtins'
assert ModuleType.__module__ == 'builtins'
assert NoneType.__module__ == 'builtins'
assert NotImplementedType.__module__ == 'builtins'
assert TracebackType.__module__ == 'builtins'
assert WrapperDescriptorType.__module__ == 'builtins'

Expand Down

0 comments on commit 47bff3f

Please sign in to comment.