Skip to content

Commit 45b57d2

Browse files
committed
[stubgenc] Skip pybind11-specific internal attributes
1 parent b215da2 commit 45b57d2

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

mypy/stubgenc.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,20 @@ def method_name_sort_key(name: str) -> Tuple[int, str]:
367367
return 1, name
368368

369369

370+
def is_pybind_skipped_attribute(attr: str) -> bool:
371+
return attr.startswith("__pybind11_module_local_")
372+
373+
370374
def is_skipped_attribute(attr: str) -> bool:
371-
return attr in ('__getattribute__',
372-
'__str__',
373-
'__repr__',
374-
'__doc__',
375-
'__dict__',
376-
'__module__',
377-
'__weakref__') # For pickling
375+
return (attr in ('__getattribute__',
376+
'__str__',
377+
'__repr__',
378+
'__doc__',
379+
'__dict__',
380+
'__module__',
381+
'__weakref__') # For pickling
382+
or is_pybind_skipped_attribute(attr)
383+
)
378384

379385

380386
def infer_method_sig(name: str) -> List[ArgSig]:

0 commit comments

Comments
 (0)