summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authornullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com>2026-02-15 19:28:34 +1100
committerGlenn Smith <glenn@vector35.com>2026-02-26 13:47:42 -0500
commit4399766500542074600721693015367320395719 (patch)
tree1dc38044dd11ad2be6303af7fbd33e896885f9fd /python
parent8629952448196921178343893775948845506257 (diff)
fix[python]: covariant user lists
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py6
-rw-r--r--python/typeprinter.py8
2 files changed, 7 insertions, 7 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 2dc3c05c..4b8fedbd 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -30,7 +30,7 @@ import pprint
import inspect
import os
import uuid
-from typing import Callable, Generator, Optional, Union, Tuple, List, Mapping, Any, \
+from typing import Callable, Generator, Optional, Union, Tuple, List, Sequence, Mapping, Any, \
Iterator, Iterable, KeysView, ItemsView, ValuesView, Dict, overload
from dataclasses import dataclass
from enum import IntFlag
@@ -8561,7 +8561,7 @@ class BinaryView:
type_obj = type_obj.immutable_copy()
core.BNDefineUserAnalysisType(self.handle, _name, type_obj.handle)
- def define_types(self, types: List[Tuple[str, Optional['_types.QualifiedNameType'], StringOrType]], progress_func: Optional[ProgressFuncType]) -> Mapping[str, '_types.QualifiedName']:
+ def define_types(self, types: Sequence[Tuple[str, Optional['_types.QualifiedNameType'], StringOrType]], progress_func: Optional[ProgressFuncType]) -> Mapping[str, '_types.QualifiedName']:
"""
``define_types`` registers multiple types as though calling :py:func:`define_type` multiple times.
The difference with this plural version is that it is optimized for adding many types
@@ -8613,7 +8613,7 @@ class BinaryView:
core.BNFreeStringList(result_ids, result_count)
core.BNFreeTypeNameList(result_names, result_count)
- def define_user_types(self, types: List[Tuple[Optional['_types.QualifiedNameType'], StringOrType]], progress_func: Optional[ProgressFuncType]):
+ def define_user_types(self, types: Sequence[Tuple[Optional['_types.QualifiedNameType'], StringOrType]], progress_func: Optional[ProgressFuncType]):
"""
``define_user_types`` registers multiple types as though calling :py:func:`define_user_type` multiple times.
The difference with this plural version is that it is optimized for adding many types
diff --git a/python/typeprinter.py b/python/typeprinter.py
index 048dec39..e908666d 100644
--- a/python/typeprinter.py
+++ b/python/typeprinter.py
@@ -21,7 +21,7 @@ import abc
import ctypes
import dataclasses
from json import dumps
-from typing import List, Tuple, Optional, Any
+from typing import List, Sequence, Tuple, Optional, Any
import sys
import traceback
@@ -305,7 +305,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass):
log_error_for_exception("Unhandled Python exception in TypePrinter._free_lines")
return False
- def _default_print_all_types(self, types_: List[Tuple[types.QualifiedNameType, types.Type]], data: binaryview.BinaryView, padding_cols = 64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) -> str:
+ def _default_print_all_types(self, types_: Sequence[Tuple[types.QualifiedNameType, types.Type]], data: binaryview.BinaryView, padding_cols = 64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) -> str:
cpp_names = (core.BNQualifiedName * len(types_))()
cpp_types = (ctypes.POINTER(core.BNType) * len(types_))()
@@ -427,7 +427,7 @@ class TypePrinter(metaclass=_TypePrinterMetaclass):
"""
raise NotImplementedError()
- def print_all_types(self, types: List[Tuple[types.QualifiedNameType, types.Type]], data: binaryview.BinaryView, padding_cols = 64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) -> str:
+ def print_all_types(self, types: Sequence[Tuple[types.QualifiedNameType, types.Type]], data: binaryview.BinaryView, padding_cols = 64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) -> str:
"""
Print all types to a single big string, including headers, sections, etc
@@ -541,7 +541,7 @@ class CoreTypePrinter(TypePrinter):
core.BNFreeTypeDefinitionLineList(core_lines, count.value)
return lines
- def print_all_types(self, types_: List[Tuple[types.QualifiedNameType, types.Type]], data: binaryview.BinaryView, padding_cols = 64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) -> str:
+ def print_all_types(self, types_: Sequence[Tuple[types.QualifiedNameType, types.Type]], data: binaryview.BinaryView, padding_cols = 64, escaping: TokenEscapingType = TokenEscapingType.BackticksTokenEscapingType) -> str:
cpp_names = (core.BNQualifiedName * len(types_))()
cpp_types = (ctypes.POINTER(core.BNType) * len(types_))()