angr 9.2.102__py3-none-win_amd64.whl → 9.2.103__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of angr might be problematic. Click here for more details.

Files changed (240) hide show
  1. angr/__init__.py +1 -1
  2. angr/analyses/analysis.py +7 -6
  3. angr/analyses/calling_convention.py +33 -35
  4. angr/analyses/cdg.py +2 -4
  5. angr/analyses/cfg/cfb.py +4 -3
  6. angr/analyses/cfg/cfg_base.py +14 -14
  7. angr/analyses/cfg/cfg_emulated.py +3 -4
  8. angr/analyses/cfg/cfg_fast.py +46 -46
  9. angr/analyses/cfg/cfg_fast_soot.py +1 -2
  10. angr/analyses/cfg/cfg_job_base.py +2 -2
  11. angr/analyses/cfg/indirect_jump_resolvers/jumptable.py +14 -13
  12. angr/analyses/cfg/indirect_jump_resolvers/mips_elf_fast.py +5 -5
  13. angr/analyses/cfg_slice_to_sink/cfg_slice_to_sink.py +3 -3
  14. angr/analyses/complete_calling_conventions.py +13 -12
  15. angr/analyses/data_dep/data_dependency_analysis.py +24 -24
  16. angr/analyses/data_dep/dep_nodes.py +3 -3
  17. angr/analyses/ddg.py +1 -2
  18. angr/analyses/decompiler/ail_simplifier.py +35 -34
  19. angr/analyses/decompiler/block_io_finder.py +20 -20
  20. angr/analyses/decompiler/block_similarity.py +4 -6
  21. angr/analyses/decompiler/block_simplifier.py +17 -16
  22. angr/analyses/decompiler/callsite_maker.py +25 -10
  23. angr/analyses/decompiler/ccall_rewriters/amd64_ccalls.py +1 -3
  24. angr/analyses/decompiler/ccall_rewriters/rewriter_base.py +2 -4
  25. angr/analyses/decompiler/clinic.py +250 -45
  26. angr/analyses/decompiler/condition_processor.py +15 -8
  27. angr/analyses/decompiler/decompilation_cache.py +7 -7
  28. angr/analyses/decompiler/decompilation_options.py +4 -4
  29. angr/analyses/decompiler/decompiler.py +19 -15
  30. angr/analyses/decompiler/expression_counters.py +10 -9
  31. angr/analyses/decompiler/goto_manager.py +2 -4
  32. angr/analyses/decompiler/graph_region.py +9 -9
  33. angr/analyses/decompiler/jump_target_collector.py +1 -2
  34. angr/analyses/decompiler/optimization_passes/__init__.py +4 -3
  35. angr/analyses/decompiler/optimization_passes/code_motion.py +5 -6
  36. angr/analyses/decompiler/optimization_passes/const_derefs.py +4 -4
  37. angr/analyses/decompiler/optimization_passes/deadblock_remover.py +73 -0
  38. angr/analyses/decompiler/optimization_passes/engine_base.py +25 -3
  39. angr/analyses/decompiler/optimization_passes/expr_op_swapper.py +6 -5
  40. angr/analyses/decompiler/optimization_passes/flip_boolean_cmp.py +2 -2
  41. angr/analyses/decompiler/optimization_passes/inlined_string_transformation_simplifier.py +3 -0
  42. angr/analyses/decompiler/optimization_passes/ite_expr_converter.py +2 -2
  43. angr/analyses/decompiler/optimization_passes/lowered_switch_simplifier.py +17 -17
  44. angr/analyses/decompiler/optimization_passes/optimization_pass.py +12 -13
  45. angr/analyses/decompiler/optimization_passes/register_save_area_simplifier.py +25 -21
  46. angr/analyses/decompiler/optimization_passes/ret_addr_save_simplifier.py +3 -3
  47. angr/analyses/decompiler/optimization_passes/ret_deduplicator.py +1 -2
  48. angr/analyses/decompiler/optimization_passes/return_duplicator_base.py +7 -7
  49. angr/analyses/decompiler/optimization_passes/spilled_register_finder.py +18 -0
  50. angr/analyses/decompiler/optimization_passes/stack_canary_simplifier.py +2 -3
  51. angr/analyses/decompiler/optimization_passes/win_stack_canary_simplifier.py +1 -2
  52. angr/analyses/decompiler/optimization_passes/x86_gcc_getpc_simplifier.py +2 -2
  53. angr/analyses/decompiler/peephole_optimizations/__init__.py +4 -3
  54. angr/analyses/decompiler/peephole_optimizations/base.py +13 -15
  55. angr/analyses/decompiler/peephole_optimizations/bswap.py +1 -3
  56. angr/analyses/decompiler/peephole_optimizations/cmpord_rewriter.py +72 -0
  57. angr/analyses/decompiler/peephole_optimizations/const_mull_a_shift.py +1 -2
  58. angr/analyses/decompiler/peephole_optimizations/eager_eval.py +1 -1
  59. angr/analyses/decompiler/peephole_optimizations/inlined_strcpy.py +5 -10
  60. angr/analyses/decompiler/peephole_optimizations/inlined_strcpy_consolidation.py +3 -4
  61. angr/analyses/decompiler/peephole_optimizations/inlined_wstrcpy.py +7 -10
  62. angr/analyses/decompiler/peephole_optimizations/rewrite_bit_extractions.py +2 -3
  63. angr/analyses/decompiler/peephole_optimizations/sar_to_signed_div.py +1 -2
  64. angr/analyses/decompiler/peephole_optimizations/tidy_stack_addr.py +4 -4
  65. angr/analyses/decompiler/redundant_label_remover.py +4 -5
  66. angr/analyses/decompiler/region_identifier.py +4 -5
  67. angr/analyses/decompiler/region_simplifiers/cascading_cond_transformer.py +1 -2
  68. angr/analyses/decompiler/region_simplifiers/expr_folding.py +19 -20
  69. angr/analyses/decompiler/region_simplifiers/goto.py +2 -3
  70. angr/analyses/decompiler/region_simplifiers/loop.py +1 -2
  71. angr/analyses/decompiler/region_simplifiers/node_address_finder.py +1 -2
  72. angr/analyses/decompiler/region_simplifiers/region_simplifier.py +1 -3
  73. angr/analyses/decompiler/region_simplifiers/switch_cluster_simplifier.py +19 -19
  74. angr/analyses/decompiler/return_maker.py +1 -2
  75. angr/analyses/decompiler/structured_codegen/base.py +5 -6
  76. angr/analyses/decompiler/structured_codegen/c.py +39 -38
  77. angr/analyses/decompiler/structuring/__init__.py +1 -1
  78. angr/analyses/decompiler/structuring/dream.py +17 -16
  79. angr/analyses/decompiler/structuring/phoenix.py +45 -46
  80. angr/analyses/decompiler/structuring/recursive_structurer.py +4 -4
  81. angr/analyses/decompiler/structuring/structurer_base.py +16 -15
  82. angr/analyses/decompiler/structuring/structurer_nodes.py +10 -9
  83. angr/analyses/decompiler/utils.py +17 -16
  84. angr/analyses/disassembly.py +7 -6
  85. angr/analyses/flirt.py +9 -9
  86. angr/analyses/forward_analysis/forward_analysis.py +15 -14
  87. angr/analyses/forward_analysis/visitors/function_graph.py +1 -2
  88. angr/analyses/forward_analysis/visitors/graph.py +16 -15
  89. angr/analyses/propagator/engine_ail.py +30 -26
  90. angr/analyses/propagator/outdated_definition_walker.py +8 -7
  91. angr/analyses/propagator/propagator.py +11 -13
  92. angr/analyses/proximity_graph.py +21 -21
  93. angr/analyses/reaching_definitions/__init__.py +3 -3
  94. angr/analyses/reaching_definitions/call_trace.py +3 -6
  95. angr/analyses/reaching_definitions/dep_graph.py +41 -48
  96. angr/analyses/reaching_definitions/engine_ail.py +11 -5
  97. angr/analyses/reaching_definitions/engine_vex.py +9 -8
  98. angr/analyses/reaching_definitions/function_handler.py +51 -34
  99. angr/analyses/reaching_definitions/heap_allocator.py +3 -4
  100. angr/analyses/reaching_definitions/rd_initializer.py +8 -8
  101. angr/analyses/reaching_definitions/rd_state.py +57 -58
  102. angr/analyses/reaching_definitions/reaching_definitions.py +18 -17
  103. angr/analyses/reaching_definitions/subject.py +2 -3
  104. angr/analyses/stack_pointer_tracker.py +15 -6
  105. angr/analyses/typehoon/dfa.py +4 -4
  106. angr/analyses/typehoon/simple_solver.py +48 -52
  107. angr/analyses/typehoon/translator.py +3 -6
  108. angr/analyses/typehoon/typeconsts.py +13 -14
  109. angr/analyses/typehoon/typehoon.py +9 -9
  110. angr/analyses/typehoon/typevars.py +18 -17
  111. angr/analyses/variable_recovery/engine_ail.py +5 -5
  112. angr/analyses/variable_recovery/engine_base.py +25 -21
  113. angr/analyses/variable_recovery/irsb_scanner.py +8 -9
  114. angr/analyses/variable_recovery/variable_recovery.py +1 -2
  115. angr/analyses/variable_recovery/variable_recovery_base.py +14 -13
  116. angr/analyses/variable_recovery/variable_recovery_fast.py +8 -8
  117. angr/analyses/veritesting.py +1 -2
  118. angr/analyses/vfg.py +57 -56
  119. angr/analyses/xrefs.py +1 -2
  120. angr/angrdb/db.py +7 -7
  121. angr/angrdb/serializers/kb.py +16 -13
  122. angr/angrdb/serializers/loader.py +1 -2
  123. angr/angrdb/serializers/structured_code.py +2 -2
  124. angr/annocfg.py +1 -2
  125. angr/block.py +16 -6
  126. angr/calling_conventions.py +27 -27
  127. angr/code_location.py +8 -8
  128. angr/codenode.py +1 -2
  129. angr/concretization_strategies/max.py +1 -3
  130. angr/distributed/server.py +1 -3
  131. angr/distributed/worker.py +1 -2
  132. angr/engines/engine.py +2 -3
  133. angr/engines/light/engine.py +4 -4
  134. angr/engines/pcode/behavior.py +20 -2
  135. angr/engines/pcode/emulate.py +1 -1
  136. angr/engines/pcode/engine.py +7 -7
  137. angr/engines/pcode/lifter.py +78 -77
  138. angr/engines/vex/claripy/ccall.py +1 -2
  139. angr/engines/vex/claripy/datalayer.py +1 -2
  140. angr/engines/vex/light/light.py +1 -2
  141. angr/exploration_techniques/tracer.py +4 -4
  142. angr/factory.py +12 -15
  143. angr/flirt/__init__.py +8 -8
  144. angr/flirt/build_sig.py +2 -3
  145. angr/keyed_region.py +2 -2
  146. angr/knowledge_base/knowledge_base.py +3 -3
  147. angr/knowledge_plugins/callsite_prototypes.py +4 -6
  148. angr/knowledge_plugins/cfg/cfg_manager.py +19 -6
  149. angr/knowledge_plugins/cfg/cfg_model.py +26 -27
  150. angr/knowledge_plugins/cfg/cfg_node.py +2 -2
  151. angr/knowledge_plugins/cfg/indirect_jump.py +6 -8
  152. angr/knowledge_plugins/cfg/memory_data.py +8 -9
  153. angr/knowledge_plugins/custom_strings.py +1 -3
  154. angr/knowledge_plugins/debug_variables.py +2 -2
  155. angr/knowledge_plugins/functions/function.py +21 -22
  156. angr/knowledge_plugins/functions/function_manager.py +5 -5
  157. angr/knowledge_plugins/indirect_jumps.py +1 -3
  158. angr/knowledge_plugins/key_definitions/atoms.py +7 -7
  159. angr/knowledge_plugins/key_definitions/definition.py +14 -14
  160. angr/knowledge_plugins/key_definitions/environment.py +5 -7
  161. angr/knowledge_plugins/key_definitions/heap_address.py +1 -3
  162. angr/knowledge_plugins/key_definitions/key_definition_manager.py +3 -2
  163. angr/knowledge_plugins/key_definitions/live_definitions.py +60 -59
  164. angr/knowledge_plugins/key_definitions/liveness.py +16 -16
  165. angr/knowledge_plugins/key_definitions/rd_model.py +15 -15
  166. angr/knowledge_plugins/key_definitions/uses.py +11 -11
  167. angr/knowledge_plugins/patches.py +4 -8
  168. angr/knowledge_plugins/propagations/prop_value.py +10 -9
  169. angr/knowledge_plugins/propagations/propagation_manager.py +3 -5
  170. angr/knowledge_plugins/propagations/propagation_model.py +9 -9
  171. angr/knowledge_plugins/propagations/states.py +52 -22
  172. angr/knowledge_plugins/structured_code/manager.py +2 -2
  173. angr/knowledge_plugins/sync/sync_controller.py +3 -3
  174. angr/knowledge_plugins/variables/variable_access.py +4 -4
  175. angr/knowledge_plugins/variables/variable_manager.py +39 -39
  176. angr/knowledge_plugins/xrefs/xref.py +9 -11
  177. angr/knowledge_plugins/xrefs/xref_manager.py +3 -4
  178. angr/lib/angr_native.dll +0 -0
  179. angr/misc/ansi.py +1 -2
  180. angr/misc/autoimport.py +3 -3
  181. angr/misc/plugins.py +9 -9
  182. angr/procedures/definitions/__init__.py +16 -16
  183. angr/procedures/definitions/linux_kernel.py +1 -1
  184. angr/procedures/definitions/parse_win32json.py +1 -1
  185. angr/procedures/java_jni/__init__.py +1 -1
  186. angr/procedures/java_jni/array_operations.py +1 -2
  187. angr/procedures/java_jni/method_calls.py +1 -2
  188. angr/procedures/posix/inet_ntoa.py +1 -2
  189. angr/procedures/stubs/format_parser.py +3 -3
  190. angr/project.py +13 -11
  191. angr/sim_manager.py +12 -12
  192. angr/sim_procedure.py +7 -3
  193. angr/sim_state.py +2 -2
  194. angr/sim_type.py +60 -45
  195. angr/sim_variable.py +5 -5
  196. angr/simos/simos.py +1 -2
  197. angr/simos/userland.py +1 -2
  198. angr/state_plugins/callstack.py +3 -2
  199. angr/state_plugins/history.py +1 -2
  200. angr/state_plugins/solver.py +34 -34
  201. angr/storage/memory_mixins/__init__.py +4 -3
  202. angr/storage/memory_mixins/actions_mixin.py +1 -3
  203. angr/storage/memory_mixins/address_concretization_mixin.py +1 -3
  204. angr/storage/memory_mixins/convenient_mappings_mixin.py +3 -4
  205. angr/storage/memory_mixins/default_filler_mixin.py +1 -1
  206. angr/storage/memory_mixins/label_merger_mixin.py +2 -2
  207. angr/storage/memory_mixins/multi_value_merger_mixin.py +4 -3
  208. angr/storage/memory_mixins/paged_memory/page_backer_mixins.py +9 -8
  209. angr/storage/memory_mixins/paged_memory/paged_memory_mixin.py +12 -11
  210. angr/storage/memory_mixins/paged_memory/pages/cooperation.py +8 -8
  211. angr/storage/memory_mixins/paged_memory/pages/history_tracking_mixin.py +2 -3
  212. angr/storage/memory_mixins/paged_memory/pages/list_page.py +10 -11
  213. angr/storage/memory_mixins/paged_memory/pages/multi_values.py +11 -10
  214. angr/storage/memory_mixins/paged_memory/pages/mv_list_page.py +18 -17
  215. angr/storage/memory_mixins/paged_memory/pages/ultra_page.py +12 -11
  216. angr/storage/memory_mixins/regioned_memory/abstract_address_descriptor.py +3 -3
  217. angr/storage/memory_mixins/regioned_memory/abstract_merger_mixin.py +3 -2
  218. angr/storage/memory_mixins/regioned_memory/region_data.py +1 -2
  219. angr/storage/memory_mixins/regioned_memory/region_meta_mixin.py +2 -2
  220. angr/storage/memory_mixins/regioned_memory/regioned_address_concretization_mixin.py +3 -3
  221. angr/storage/memory_mixins/regioned_memory/regioned_memory_mixin.py +18 -21
  222. angr/storage/memory_mixins/size_resolution_mixin.py +1 -2
  223. angr/storage/memory_mixins/symbolic_merger_mixin.py +3 -2
  224. angr/storage/memory_mixins/top_merger_mixin.py +3 -2
  225. angr/storage/memory_object.py +2 -4
  226. angr/utils/algo.py +3 -2
  227. angr/utils/dynamic_dictlist.py +5 -5
  228. angr/utils/formatting.py +4 -4
  229. angr/utils/funcid.py +1 -2
  230. angr/utils/graph.py +5 -6
  231. angr/utils/library.py +5 -5
  232. angr/utils/mp.py +5 -4
  233. angr/utils/segment_list.py +3 -4
  234. angr/utils/typing.py +3 -2
  235. {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/METADATA +9 -11
  236. {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/RECORD +240 -237
  237. {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/LICENSE +0 -0
  238. {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/WHEEL +0 -0
  239. {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/entry_points.txt +0 -0
  240. {angr-9.2.102.dist-info → angr-9.2.103.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  import functools
2
2
  import time
3
3
  import logging
4
- from typing import List, Type, TypeVar, overload, Optional, Union
4
+ from typing import TypeVar, overload
5
5
 
6
6
  from claripy import backend_manager
7
7
 
@@ -774,9 +774,9 @@ class SimSolver(SimStatePlugin):
774
774
 
775
775
  @staticmethod
776
776
  def _cast_to(
777
- e: Union[claripy.ast.Bool, claripy.ast.BV, claripy.ast.FP],
778
- solution: Union[bool, float, int],
779
- cast_to: Optional[Type[CastType]],
777
+ e: claripy.ast.Bool | claripy.ast.BV | claripy.ast.FP,
778
+ solution: bool | float | int,
779
+ cast_to: type[CastType] | None,
780
780
  ) -> CastType:
781
781
  """
782
782
  Casts a solution for the given expression to type `cast_to`.
@@ -813,22 +813,22 @@ class SimSolver(SimStatePlugin):
813
813
  return solution
814
814
 
815
815
  @overload
816
- def eval_upto(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> List[int]: ...
816
+ def eval_upto(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
817
817
 
818
818
  @overload
819
- def eval_upto(self, e: claripy.ast.BV, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
819
+ def eval_upto(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
820
820
 
821
821
  @overload
822
- def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> List[bool]: ...
822
+ def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
823
823
 
824
824
  @overload
825
- def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
825
+ def eval_upto(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
826
826
 
827
827
  @overload
828
- def eval_upto(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> List[float]: ...
828
+ def eval_upto(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
829
829
 
830
830
  @overload
831
- def eval_upto(self, e: claripy.ast.FP, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
831
+ def eval_upto(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
832
832
 
833
833
  def eval_upto(self, e, n, cast_to=None, **kwargs):
834
834
  """
@@ -856,19 +856,19 @@ class SimSolver(SimStatePlugin):
856
856
  def eval(self, e: claripy.ast.BV, cast_to: None = ..., **kwargs) -> int: ...
857
857
 
858
858
  @overload
859
- def eval(self, e: claripy.ast.BV, cast_to: Type[CastType], **kwargs) -> CastType: ...
859
+ def eval(self, e: claripy.ast.BV, cast_to: type[CastType], **kwargs) -> CastType: ...
860
860
 
861
861
  @overload
862
862
  def eval(self, e: claripy.ast.Bool, cast_to: None = ..., **kwargs) -> bool: ...
863
863
 
864
864
  @overload
865
- def eval(self, e: claripy.ast.Bool, cast_to: Type[CastType], **kwargs) -> CastType: ...
865
+ def eval(self, e: claripy.ast.Bool, cast_to: type[CastType], **kwargs) -> CastType: ...
866
866
 
867
867
  @overload
868
868
  def eval(self, e: claripy.ast.FP, cast_to: None = ..., **kwargs) -> float: ...
869
869
 
870
870
  @overload
871
- def eval(self, e: claripy.ast.FP, cast_to: Type[CastType], **kwargs) -> CastType: ...
871
+ def eval(self, e: claripy.ast.FP, cast_to: type[CastType], **kwargs) -> CastType: ...
872
872
 
873
873
  def eval(self, e, cast_to=None, **kwargs):
874
874
  """
@@ -893,19 +893,19 @@ class SimSolver(SimStatePlugin):
893
893
  def eval_one(self, e: claripy.ast.BV, cast_to: None = ..., **kwargs) -> int: ...
894
894
 
895
895
  @overload
896
- def eval_one(self, e: claripy.ast.BV, cast_to: Type[CastType], **kwargs) -> CastType: ...
896
+ def eval_one(self, e: claripy.ast.BV, cast_to: type[CastType], **kwargs) -> CastType: ...
897
897
 
898
898
  @overload
899
899
  def eval_one(self, e: claripy.ast.Bool, cast_to: None = ..., **kwargs) -> bool: ...
900
900
 
901
901
  @overload
902
- def eval_one(self, e: claripy.ast.Bool, cast_to: Type[CastType], **kwargs) -> CastType: ...
902
+ def eval_one(self, e: claripy.ast.Bool, cast_to: type[CastType], **kwargs) -> CastType: ...
903
903
 
904
904
  @overload
905
905
  def eval_one(self, e: claripy.ast.FP, cast_to: None = ..., **kwargs) -> float: ...
906
906
 
907
907
  @overload
908
- def eval_one(self, e: claripy.ast.FP, cast_to: Type[CastType], **kwargs) -> CastType: ...
908
+ def eval_one(self, e: claripy.ast.FP, cast_to: type[CastType], **kwargs) -> CastType: ...
909
909
 
910
910
  def eval_one(self, e, cast_to=None, **kwargs):
911
911
  """
@@ -928,22 +928,22 @@ class SimSolver(SimStatePlugin):
928
928
  raise
929
929
 
930
930
  @overload
931
- def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> List[int]: ...
931
+ def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
932
932
 
933
933
  @overload
934
- def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
934
+ def eval_atmost(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
935
935
 
936
936
  @overload
937
- def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> List[bool]: ...
937
+ def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
938
938
 
939
939
  @overload
940
- def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
940
+ def eval_atmost(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
941
941
 
942
942
  @overload
943
- def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> List[float]: ...
943
+ def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
944
944
 
945
945
  @overload
946
- def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
946
+ def eval_atmost(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
947
947
 
948
948
  def eval_atmost(self, e, n, cast_to=None, **kwargs):
949
949
  """
@@ -964,22 +964,22 @@ class SimSolver(SimStatePlugin):
964
964
  return r
965
965
 
966
966
  @overload
967
- def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> List[int]: ...
967
+ def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
968
968
 
969
969
  @overload
970
- def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
970
+ def eval_atleast(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
971
971
 
972
972
  @overload
973
- def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> List[bool]: ...
973
+ def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
974
974
 
975
975
  @overload
976
- def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
976
+ def eval_atleast(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
977
977
 
978
978
  @overload
979
- def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> List[float]: ...
979
+ def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
980
980
 
981
981
  @overload
982
- def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
982
+ def eval_atleast(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
983
983
 
984
984
  def eval_atleast(self, e, n, cast_to=None, **kwargs):
985
985
  """
@@ -999,22 +999,22 @@ class SimSolver(SimStatePlugin):
999
999
  return r
1000
1000
 
1001
1001
  @overload
1002
- def eval_exact(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> List[int]: ...
1002
+ def eval_exact(self, e: claripy.ast.BV, n: int, cast_to: None = ..., **kwargs) -> list[int]: ...
1003
1003
 
1004
1004
  @overload
1005
- def eval_exact(self, e: claripy.ast.BV, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
1005
+ def eval_exact(self, e: claripy.ast.BV, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
1006
1006
 
1007
1007
  @overload
1008
- def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> List[bool]: ...
1008
+ def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to: None = ..., **kwargs) -> list[bool]: ...
1009
1009
 
1010
1010
  @overload
1011
- def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
1011
+ def eval_exact(self, e: claripy.ast.Bool, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
1012
1012
 
1013
1013
  @overload
1014
- def eval_exact(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> List[float]: ...
1014
+ def eval_exact(self, e: claripy.ast.FP, n: int, cast_to: None = ..., **kwargs) -> list[float]: ...
1015
1015
 
1016
1016
  @overload
1017
- def eval_exact(self, e: claripy.ast.FP, n: int, cast_to: Type[CastType], **kwargs) -> List[CastType]: ...
1017
+ def eval_exact(self, e: claripy.ast.FP, n: int, cast_to: type[CastType], **kwargs) -> list[CastType]: ...
1018
1018
 
1019
1019
  def eval_exact(self, e, n, cast_to=None, **kwargs):
1020
1020
  """
@@ -1,5 +1,6 @@
1
1
  # pylint:disable=abstract-method,wrong-import-position,unused-argument,missing-class-docstring,arguments-differ
2
- from typing import Iterable, Tuple, Dict, Any, Optional
2
+ from typing import Tuple, Dict, Any, Optional
3
+ from collections.abc import Iterable
3
4
 
4
5
  import claripy
5
6
 
@@ -118,7 +119,7 @@ class MemoryMixin(SimStatePlugin):
118
119
  The ``inspect``, ``events``, and ``key`` parameters are for ``state.solver.Unconstrained``, if it is used.
119
120
  """
120
121
 
121
- def _merge_values(self, values: Iterable[Tuple[Any, Any]], merged_size: int, **kwargs) -> Optional[Any]:
122
+ def _merge_values(self, values: Iterable[tuple[Any, Any]], merged_size: int, **kwargs) -> Any | None:
122
123
  """
123
124
  Override this method to provide value merging support.
124
125
 
@@ -128,7 +129,7 @@ class MemoryMixin(SimStatePlugin):
128
129
  """
129
130
  raise NotImplementedError()
130
131
 
131
- def _merge_labels(self, labels: Iterable[Dict], **kwargs) -> Optional[Dict]:
132
+ def _merge_labels(self, labels: Iterable[dict], **kwargs) -> dict | None:
132
133
  """
133
134
  Override this method to provide label merging support.
134
135
 
@@ -1,5 +1,3 @@
1
- from typing import Optional
2
-
3
1
  from ...state_plugins.sim_action import SimActionData, SimActionObject
4
2
  from ... import sim_options as o
5
3
  from . import MemoryMixin
@@ -62,7 +60,7 @@ class ActionsMixinLow(MemoryMixin):
62
60
  action.actual_addrs.append(addr)
63
61
  return super().load(addr, action=action, **kwargs)
64
62
 
65
- def store(self, addr, data, action: Optional[SimActionData] = None, **kwargs):
63
+ def store(self, addr, data, action: SimActionData | None = None, **kwargs):
66
64
  if action is not None:
67
65
  if action.actual_addrs is None:
68
66
  action.actual_addrs = []
@@ -1,5 +1,3 @@
1
- from typing import List
2
-
3
1
  import claripy
4
2
 
5
3
  from . import MemoryMixin
@@ -227,7 +225,7 @@ class AddressConcretizationMixin(MemoryMixin):
227
225
  #
228
226
 
229
227
  @staticmethod
230
- def _interleave_ints(addrs: List[int]) -> List[int]:
228
+ def _interleave_ints(addrs: list[int]) -> list[int]:
231
229
  """
232
230
  Take a list of integers and return a new list of integers where front and back integers interleave.
233
231
  """
@@ -1,5 +1,4 @@
1
1
  # pylint:disable=arguments-differ,assignment-from-no-return,isinstance-second-argument-not-valid-type
2
- from typing import Optional, Set
3
2
  import logging
4
3
 
5
4
  import claripy
@@ -20,7 +19,7 @@ class ConvenientMappingsMixin(MemoryMixin):
20
19
  def __init__(self, **kwargs):
21
20
  super().__init__(**kwargs)
22
21
 
23
- self._symbolic_addrs: Set = set()
22
+ self._symbolic_addrs: set = set()
24
23
  self._name_mapping = ChainMapCOW()
25
24
  self._hash_mapping = ChainMapCOW()
26
25
  self._updated_mappings = set()
@@ -116,7 +115,7 @@ class ConvenientMappingsMixin(MemoryMixin):
116
115
  d[m] = set()
117
116
  self._updated_mappings.add((m, id(d)))
118
117
 
119
- def _update_mappings(self, actual_addr: int, old_obj: Optional[claripy.ast.BV], new_obj: claripy.ast.BV):
118
+ def _update_mappings(self, actual_addr: int, old_obj: claripy.ast.BV | None, new_obj: claripy.ast.BV):
120
119
  if options.MEMORY_SYMBOLIC_BYTES_MAP in self.state.options:
121
120
  if self.state.solver.symbolic(new_obj):
122
121
  self._symbolic_addrs.add(actual_addr)
@@ -243,7 +242,7 @@ class ConvenientMappingsMixin(MemoryMixin):
243
242
 
244
243
  # Computer an intersection between sets of memory addresses for each unique variable name. The eventual address
245
244
  # set contains all addresses whose memory objects we should update.
246
- addrs: Optional[Set] = None
245
+ addrs: set | None = None
247
246
  for v in old.variables:
248
247
  v: str
249
248
  if addrs is None:
@@ -120,7 +120,7 @@ class SpecialFillerMixin(MemoryMixin):
120
120
  and self.state._special_memory_filler is not None
121
121
  and type(addr) is int
122
122
  ):
123
- return self.state._special_memory_filler(name, size * self.state.arch.byte_width, self.state)
123
+ return self.state._special_memory_filler(name, addr, size * self.state.arch.byte_width, self.state)
124
124
  return super()._default_value(addr, size, name=name, **kwargs)
125
125
 
126
126
  def copy(self, memo):
@@ -1,4 +1,4 @@
1
- from typing import Iterable, Dict, Optional
1
+ from collections.abc import Iterable
2
2
 
3
3
  from . import MemoryMixin
4
4
 
@@ -11,7 +11,7 @@ class LabelMergerMixin(MemoryMixin):
11
11
  def __init__(self, *args, **kwargs):
12
12
  super().__init__(*args, **kwargs)
13
13
 
14
- def _merge_labels(self, labels: Iterable[Dict], **kwargs) -> Optional[Dict]:
14
+ def _merge_labels(self, labels: Iterable[dict], **kwargs) -> dict | None:
15
15
  new_label = {}
16
16
  all_keys = set()
17
17
  for label in labels:
@@ -1,5 +1,6 @@
1
1
  # pylint:disable=missing-class-docstring
2
- from typing import Iterable, Tuple, Any, Callable, Optional
2
+ from typing import Any
3
+ from collections.abc import Iterable, Callable
3
4
 
4
5
  from . import MemoryMixin
5
6
 
@@ -12,11 +13,11 @@ class MultiValueMergerMixin(MemoryMixin):
12
13
  self._annotation_limit = annotation_limit
13
14
  self._top_func: Callable = top_func
14
15
  self._is_top_func: Callable = is_top_func
15
- self._phi_maker: Optional[Callable] = phi_maker
16
+ self._phi_maker: Callable | None = phi_maker
16
17
 
17
18
  super().__init__(*args, **kwargs)
18
19
 
19
- def _merge_values(self, values: Iterable[Tuple[Any, Any]], merged_size: int, **kwargs):
20
+ def _merge_values(self, values: Iterable[tuple[Any, Any]], merged_size: int, **kwargs):
20
21
  values_set = {v for v, _ in values}
21
22
  if self._phi_maker is not None:
22
23
  phi_var = self._phi_maker(values_set)
@@ -1,5 +1,6 @@
1
1
  from mmap import mmap
2
- from typing import Union, List, Generator, Tuple
2
+ from typing import Union
3
+ from collections.abc import Generator
3
4
  import logging
4
5
 
5
6
  import claripy
@@ -9,8 +10,8 @@ from .paged_memory_mixin import PagedMemoryMixin
9
10
 
10
11
  l = logging.getLogger(__name__)
11
12
 
12
- BackerType = Union[bytes, bytearray, List[int]]
13
- BackerIterType = Generator[Tuple[int, BackerType], None, None]
13
+ BackerType = Union[bytes, bytearray, list[int]]
14
+ BackerIterType = Generator[tuple[int, BackerType], None, None]
14
15
 
15
16
 
16
17
  # since memoryview isn't pickleable, we make do...
@@ -28,7 +29,7 @@ class NotMemoryview:
28
29
 
29
30
 
30
31
  class ClemoryBackerMixin(PagedMemoryMixin):
31
- def __init__(self, cle_memory_backer: Union[None, cle.Loader, cle.Clemory] = None, **kwargs):
32
+ def __init__(self, cle_memory_backer: None | cle.Loader | cle.Clemory = None, **kwargs):
32
33
  super().__init__(**kwargs)
33
34
 
34
35
  if isinstance(cle_memory_backer, cle.Loader):
@@ -96,7 +97,7 @@ class ClemoryBackerMixin(PagedMemoryMixin):
96
97
  return self._data_from_lists_backer(addr, backer, backer_start, backer_iter)
97
98
  raise TypeError("Unsupported backer type %s." % type(backer))
98
99
 
99
- def _calc_page_starts(self, addr: int, backer_start: int, backer_length: int) -> Tuple[int, int, int]:
100
+ def _calc_page_starts(self, addr: int, backer_start: int, backer_length: int) -> tuple[int, int, int]:
100
101
  # lord help me. why do I keep having to write code that looks like this
101
102
  # why have I found myself entangled in a briar patch of address spaces embedded in other address spaces
102
103
  if addr >= backer_start:
@@ -115,9 +116,9 @@ class ClemoryBackerMixin(PagedMemoryMixin):
115
116
  def _data_from_bytes_backer(
116
117
  self,
117
118
  addr: int,
118
- backer: Union[bytes, bytearray],
119
+ backer: bytes | bytearray,
119
120
  backer_start: int,
120
- backer_iter: Generator[Tuple[int, Union[bytes, bytearray]], None, None],
121
+ backer_iter: Generator[tuple[int, bytes | bytearray], None, None],
121
122
  ) -> claripy.ast.BV:
122
123
  if backer_start <= addr and backer_start + len(backer) >= addr + self.page_size:
123
124
  # fast case
@@ -144,7 +145,7 @@ class ClemoryBackerMixin(PagedMemoryMixin):
144
145
  return data
145
146
 
146
147
  def _data_from_lists_backer(
147
- self, addr: int, backer: List[int], backer_start: int, backer_iter: Generator[Tuple[int, List[int]], None, None]
148
+ self, addr: int, backer: list[int], backer_start: int, backer_iter: Generator[tuple[int, list[int]], None, None]
148
149
  ) -> claripy.ast.BV:
149
150
  page_data = [0] * self.page_size
150
151
  while backer_start < addr + self.page_size:
@@ -1,5 +1,6 @@
1
1
  import cffi
2
- from typing import Tuple, Type, Dict, Optional, Iterable, Set, Any
2
+ from typing import Any
3
+ from collections.abc import Iterable
3
4
  import logging
4
5
  from collections import defaultdict
5
6
 
@@ -22,7 +23,7 @@ class PagedMemoryMixin(MemoryMixin):
22
23
  """
23
24
 
24
25
  SUPPORTS_CONCRETE_LOAD = True
25
- PAGE_TYPE: Type[PageType] = None # must be provided in subclass
26
+ PAGE_TYPE: type[PageType] = None # must be provided in subclass
26
27
 
27
28
  def __init__(self, page_size=0x1000, default_permissions=3, permissions_map=None, page_kwargs=None, **kwargs):
28
29
  super().__init__(**kwargs)
@@ -31,7 +32,7 @@ class PagedMemoryMixin(MemoryMixin):
31
32
 
32
33
  self._permissions_map = permissions_map if permissions_map is not None else {}
33
34
  self._default_permissions = default_permissions
34
- self._pages: Dict[int, Optional[PageType]] = {}
35
+ self._pages: dict[int, PageType | None] = {}
35
36
 
36
37
  @MemoryMixin.memo
37
38
  def copy(self, memo):
@@ -105,7 +106,7 @@ class PagedMemoryMixin(MemoryMixin):
105
106
  memory=self, memory_id="%s_%d" % (self.id, pageno), permissions=permissions, **self._extra_page_kwargs
106
107
  )
107
108
 
108
- def _divide_addr(self, addr: int) -> Tuple[int, int]:
109
+ def _divide_addr(self, addr: int) -> tuple[int, int]:
109
110
  return divmod(addr, self.page_size)
110
111
 
111
112
  def load(self, addr: int, size: int = None, endness=None, **kwargs):
@@ -252,7 +253,7 @@ class PagedMemoryMixin(MemoryMixin):
252
253
  pageoff = 0
253
254
 
254
255
  def merge(self, others: Iterable["PagedMemoryMixin"], merge_conditions, common_ancestor=None) -> bool:
255
- changed_pages_and_offsets: Dict[int, Optional[Set[int]]] = {}
256
+ changed_pages_and_offsets: dict[int, set[int] | None] = {}
256
257
  for o in others:
257
258
  for changed_page, changed_offsets in self.changed_pages(o).items():
258
259
  if changed_offsets is None:
@@ -295,7 +296,7 @@ class PagedMemoryMixin(MemoryMixin):
295
296
  return bool(merged_bytes)
296
297
 
297
298
  def compare(self, other: "PagedMemoryMixin") -> bool:
298
- changed_pages_and_offsets: Dict[int, Optional[Set[int]]] = dict(self.changed_pages(other))
299
+ changed_pages_and_offsets: dict[int, set[int] | None] = dict(self.changed_pages(other))
299
300
 
300
301
  for page_no in sorted(changed_pages_and_offsets):
301
302
  page = self._get_page(page_no, False)
@@ -555,7 +556,7 @@ class PagedMemoryMixin(MemoryMixin):
555
556
 
556
557
  return data
557
558
 
558
- def changed_bytes(self, other) -> Set[int]:
559
+ def changed_bytes(self, other) -> set[int]:
559
560
  my_pages = set(self._pages)
560
561
  other_pages = set(other._pages)
561
562
  intersection = my_pages.intersection(other_pages)
@@ -583,12 +584,12 @@ class PagedMemoryMixin(MemoryMixin):
583
584
 
584
585
  return changes
585
586
 
586
- def changed_pages(self, other) -> Dict[int, Optional[Set[int]]]:
587
+ def changed_pages(self, other) -> dict[int, set[int] | None]:
587
588
  my_pages = set(self._pages)
588
589
  other_pages = set(other._pages)
589
590
  intersection = my_pages.intersection(other_pages)
590
591
  difference = my_pages.symmetric_difference(other_pages)
591
- changes: Dict[int, Optional[Set[int]]] = {d: None for d in difference}
592
+ changes: dict[int, set[int] | None] = {d: None for d in difference}
592
593
 
593
594
  for pageno in intersection:
594
595
  my_page = self._pages[pageno]
@@ -608,7 +609,7 @@ class PagedMemoryMixin(MemoryMixin):
608
609
  return changes
609
610
 
610
611
  def _replace_all(self, addrs: Iterable[int], old: claripy.ast.BV, new: claripy.ast.BV):
611
- page_offsets: Dict[Set[int]] = defaultdict(set)
612
+ page_offsets: dict[set[int]] = defaultdict(set)
612
613
  for addr in addrs:
613
614
  page_no, page_offset = self._divide_addr(addr)
614
615
  page_offsets[page_no].add(page_offset)
@@ -657,7 +658,7 @@ class PagedMemoryMixin(MemoryMixin):
657
658
  class LabeledPagesMixin(PagedMemoryMixin):
658
659
  def load_with_labels(
659
660
  self, addr: int, size: int = None, endness=None, **kwargs
660
- ) -> Tuple[claripy.ast.Base, Tuple[Tuple[int, int, int, Any]]]:
661
+ ) -> tuple[claripy.ast.Base, tuple[tuple[int, int, int, Any]]]:
661
662
  if endness is None:
662
663
  endness = self.endness
663
664
 
@@ -1,4 +1,4 @@
1
- from typing import List, Tuple, Set, Dict, Union, Optional, Any
1
+ from typing import Any
2
2
 
3
3
  import claripy
4
4
 
@@ -19,7 +19,7 @@ class CooperationBase:
19
19
  """
20
20
 
21
21
  @classmethod
22
- def _decompose_objects(cls, addr, data, endness, **kwargs) -> Tuple[Any, int, int]:
22
+ def _decompose_objects(cls, addr, data, endness, **kwargs) -> tuple[Any, int, int]:
23
23
  """
24
24
  A bidirectional generator. No idea if this is overengineered. Usage is that you send it a size to use
25
25
  and it yields a tuple of three elements: the object to store for the next n bytes, the base address of the
@@ -58,11 +58,11 @@ class MemoryObjectMixin(CooperationBase):
58
58
  @classmethod
59
59
  def _compose_objects(
60
60
  cls,
61
- objects: List[List[Tuple[int, SimMemoryObject]]],
61
+ objects: list[list[tuple[int, SimMemoryObject]]],
62
62
  size,
63
63
  endness=None,
64
64
  memory=None,
65
- labels: Optional[List] = None,
65
+ labels: list | None = None,
66
66
  **kwargs,
67
67
  ):
68
68
  c_objects = []
@@ -168,16 +168,16 @@ class MemoryObjectSetMixin(CooperationBase):
168
168
 
169
169
  @classmethod
170
170
  def _compose_objects(
171
- cls, objects: List[List[Tuple[int, Set[SimMemoryObject]]]], size, endness=None, memory=None, **kwargs
171
+ cls, objects: list[list[tuple[int, set[SimMemoryObject]]]], size, endness=None, memory=None, **kwargs
172
172
  ):
173
- c_objects: List[Tuple[int, Union[SimMemoryObject, Set[SimMemoryObject]]]] = []
173
+ c_objects: list[tuple[int, SimMemoryObject | set[SimMemoryObject]]] = []
174
174
  for objlist in objects:
175
175
  for element in objlist:
176
176
  if not c_objects or element[1] is not c_objects[-1][1]:
177
177
  c_objects.append(element)
178
178
 
179
179
  mask = (1 << memory.state.arch.bits) - 1
180
- elements: List[Set[claripy.ast.Base]] = []
180
+ elements: list[set[claripy.ast.Base]] = []
181
181
  for i, (a, objs) in enumerate(c_objects):
182
182
  chopped_set = set()
183
183
  if type(objs) is not set:
@@ -245,7 +245,7 @@ class MemoryObjectSetMixin(CooperationBase):
245
245
  assert label is None # TODO: Support labels
246
246
 
247
247
  size = yield
248
- offset_to_mos: Dict[int, Set[SimMemoryObject]] = {}
248
+ offset_to_mos: dict[int, set[SimMemoryObject]] = {}
249
249
  for offset, vs in data.items():
250
250
  offset_to_mos[offset] = set()
251
251
  for v in vs:
@@ -1,5 +1,4 @@
1
1
  # pylint:disable=arguments-differ,unused-argument,no-member
2
- from typing import Set, Optional
3
2
 
4
3
  from angr.storage.memory_mixins import MemoryMixin
5
4
  from angr.utils.segment_list import SegmentList
@@ -50,8 +49,8 @@ class HistoryTrackingMixin(RefcountMixin, MemoryMixin):
50
49
  yield parent
51
50
  parent = parent._parent
52
51
 
53
- def changed_bytes(self, other, **kwargs) -> Optional[Set[int]]:
54
- candidates: Set[int] = set()
52
+ def changed_bytes(self, other, **kwargs) -> set[int] | None:
53
+ candidates: set[int] = set()
55
54
 
56
55
  self_history_list = [self] + list(self.parents())
57
56
  other_history_list = [other] + list(other.parents())
@@ -1,6 +1,5 @@
1
1
  # pylint:disable=abstract-method,arguments-differ
2
2
  import logging
3
- from typing import Optional, List, Set, Tuple
4
3
 
5
4
  import claripy
6
5
 
@@ -21,16 +20,16 @@ class ListPage(MemoryObjectMixin, PageBase):
21
20
  def __init__(self, memory=None, content=None, sinkhole=None, mo_cmp=None, **kwargs):
22
21
  super().__init__(**kwargs)
23
22
 
24
- self.content: Optional[DynamicDictList[Optional[SimMemoryObject]]] = (
23
+ self.content: DynamicDictList[SimMemoryObject | None] | None = (
25
24
  DynamicDictList(max_size=memory.page_size, content=content) if content is not None else None
26
25
  )
27
26
  self.stored_offset = set()
28
27
  if self.content is None:
29
28
  if memory is not None:
30
- self.content: DynamicDictList[Optional[SimMemoryObject]] = DynamicDictList(max_size=memory.page_size)
29
+ self.content: DynamicDictList[SimMemoryObject | None] = DynamicDictList(max_size=memory.page_size)
31
30
  self._mo_cmp = mo_cmp
32
31
 
33
- self.sinkhole: Optional[SimMemoryObject] = sinkhole
32
+ self.sinkhole: SimMemoryObject | None = sinkhole
34
33
 
35
34
  def copy(self, memo):
36
35
  o = super().copy(memo)
@@ -114,19 +113,19 @@ class ListPage(MemoryObjectMixin, PageBase):
114
113
 
115
114
  def merge(
116
115
  self,
117
- others: List["ListPage"],
116
+ others: list["ListPage"],
118
117
  merge_conditions,
119
118
  common_ancestor=None,
120
119
  page_addr: int = None,
121
120
  memory=None,
122
- changed_offsets: Optional[Set[int]] = None,
121
+ changed_offsets: set[int] | None = None,
123
122
  ):
124
123
  if changed_offsets is None:
125
124
  changed_offsets = set()
126
125
  for other in others:
127
126
  changed_offsets |= self.changed_bytes(other, page_addr)
128
127
 
129
- all_pages: List["ListPage"] = [self] + others
128
+ all_pages: list["ListPage"] = [self] + others
130
129
  if merge_conditions is None:
131
130
  merge_conditions = [None] * len(all_pages)
132
131
 
@@ -244,7 +243,7 @@ class ListPage(MemoryObjectMixin, PageBase):
244
243
  def changed_bytes(self, other: "ListPage", page_addr: int = None):
245
244
  candidates = super().changed_bytes(other)
246
245
  if candidates is None:
247
- candidates: Set[int] = set()
246
+ candidates: set[int] = set()
248
247
  if self.sinkhole is None:
249
248
  candidates |= self.stored_offset
250
249
  else:
@@ -260,7 +259,7 @@ class ListPage(MemoryObjectMixin, PageBase):
260
259
  candidates.add(i)
261
260
 
262
261
  byte_width = 8 # TODO: Introduce self.state if we want to use self.state.arch.byte_width
263
- differences: Set[int] = set()
262
+ differences: set[int] = set()
264
263
  for c in candidates:
265
264
  s_contains = self._contains(c, page_addr)
266
265
  o_contains = other._contains(c, page_addr)
@@ -331,14 +330,14 @@ class ListPage(MemoryObjectMixin, PageBase):
331
330
  return new_mo
332
331
 
333
332
  @staticmethod
334
- def _resolve_range(mo: SimMemoryObject, page_addr: int, page_size) -> Tuple[int, int]:
333
+ def _resolve_range(mo: SimMemoryObject, page_addr: int, page_size) -> tuple[int, int]:
335
334
  start = max(mo.base, page_addr)
336
335
  end = min(mo.last_addr + 1, page_addr + page_size)
337
336
  if end <= start:
338
337
  l.warning("Nothing left of the memory object to store in SimPage.")
339
338
  return start, end
340
339
 
341
- def _get_object(self, start: int, page_addr: int) -> Optional[SimMemoryObject]:
340
+ def _get_object(self, start: int, page_addr: int) -> SimMemoryObject | None:
342
341
  mo = self.content[start]
343
342
  if mo is None:
344
343
  return None