diff --git a/torch/_jit_internal.py b/torch/_jit_internal.py index 223d96aa84ab..9d108651ffdd 100644 --- a/torch/_jit_internal.py +++ b/torch/_jit_internal.py @@ -448,6 +448,10 @@ def createResolutionCallbackForClassMethods(cls): for name in cls.__dict__ if inspect.isroutine(getattr(cls, name)) ] + # Skip built-ins, as they do not have global scope nor type hints + # Needed to support `enum.Enum` derived classes in Python-3.11 + # That adds `_new_member_` property which is an alias to `__new__` + fns = [fn for fn in fns if not inspect.isbuiltin(fn)] captures = {} for fn in fns: