Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f7f3887

Browse files
AlexArcPygvanrossum
authored andcommitted
Update stubutil.py is_c_module with .pyd check (python#5284)
Fixes python#5283.
1 parent 9bfd5ee commit f7f3887

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mypy/stubutil.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import re
22
import sys
3+
import os
34

45
from typing import Optional, Tuple, Sequence, MutableSequence, List, MutableMapping, IO
56
from types import ModuleType
@@ -87,7 +88,8 @@ def find_unique_signatures(sigs: Sequence[Sig]) -> List[Sig]:
8788

8889

8990
def is_c_module(module: ModuleType) -> bool:
90-
return '__file__' not in module.__dict__ or module.__dict__['__file__'].endswith('.so')
91+
return ('__file__' not in module.__dict__ or
92+
os.path.splitext(module.__dict__['__file__'])[-1] in ['.so', '.pyd'])
9193

9294

9395
def write_header(file: IO[str], module_name: Optional[str] = None,

0 commit comments

Comments
 (0)