Skip to content

Commit 6afb2f8

Browse files
authored
fix: Missing isinstance check (#139)
1 parent 0b02889 commit 6afb2f8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pybind11_stubgen/parser/mixins/error_handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def handle_class(self, path: QualifiedName, class_: type) -> Class | None:
4545

4646
@property
4747
def current_path(self) -> QualifiedName:
48+
assert self.__current_path is not None
4849
return self.__current_path
4950

5051
@property

pybind11_stubgen/parser/mixins/fix.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ def parse_annotation_str(
525525
],
526526
)
527527

528+
assert result.parameters is not None
528529
if (
529530
scalar_with_dims.parameters is not None
530531
and len(scalar_with_dims.parameters) >= 0
@@ -590,7 +591,7 @@ def parse_annotation_str(
590591
if isinstance(result, ResolvedType) and result.name == self.__ndarray_name:
591592
if result.parameters is not None:
592593
for param in result.parameters:
593-
if param.name in self.__flags:
594+
if isinstance(param, ResolvedType) and param.name in self.__flags:
594595
param.name = QualifiedName.from_str(
595596
f"numpy.ndarray.{param.name}"
596597
)

0 commit comments

Comments
 (0)