We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#9015 specifically fixed types.TracebackType - but in fact almost all of the classes in types have __module__ set to builtins.
types.TracebackType
types
__module__
builtins
So the fix in #9015 should be expanded, in order to support the rest of them.
In particular we've had trouble with FrameType in the Trio project, but I don't see any reason not to support all the classes in types
FrameType
import types for x in dir(types): if getattr(getattr(types, x), "__module__", None) == "builtins": print(x)
gives the following list on python 3.11.6:
AsyncGeneratorType BuiltinFunctionType BuiltinMethodType CellType ClassMethodDescriptorType CodeType CoroutineType EllipsisType FrameType FunctionType GeneratorType GetSetDescriptorType LambdaType MappingProxyType MemberDescriptorType MethodDescriptorType MethodType MethodWrapperType ModuleType NoneType NotImplementedType TracebackType WrapperDescriptorType
See #8992 and #8315
The fix from #9015 is still live on master with no changes since:
sphinx/sphinx/util/typing.py
Lines 23 to 27 in 3596590
The text was updated successfully, but these errors were encountered:
Well, this part of the code has not been touched for a while and people totally forgot about it I think.
PR is welcomed.
Sorry, something went wrong.
For future reference, to generate a list of mismatched types:
import sys, importlib successful = [] modules = sorted(m for m in sys.stdlib_module_names if not m.startswith('_') and '._' not in m) for m in modules: try: mod = importlib.import_module(m) except: pass else: successful.append(m) errs = [(m, x, n) for m in successful for x in dir(sys.modules[m]) if not x.startswith('_') and (n:=getattr(getattr(sys.modules[m], x), "__module__", m)) != m and type(getattr(sys.modules[m], x)) is type] print(errs)
Successfully merging a pull request may close this issue.
Describe the bug
#9015 specifically fixed
types.TracebackType
- but in fact almost all of the classes intypes
have__module__
set tobuiltins
.So the fix in #9015 should be expanded, in order to support the rest of them.
In particular we've had trouble with
FrameType
in the Trio project, but I don't see any reason not to support all the classes intypes
gives the following list on python 3.11.6:
How to Reproduce
See #8992 and #8315
Environment Information
The fix from #9015 is still live on master with no changes since:
sphinx/sphinx/util/typing.py
Lines 23 to 27 in 3596590
The text was updated successfully, but these errors were encountered: