Add capstone 6 compatibility for ARM64 and S390X architectures - #353
Merged
Conversation
Contributor
Author
|
Thanks for taking a look. I'll be more active tomorrow to address any feedback — appreciate your time reviewing this. |
Member
|
@rhelmot what if we bump our capstone minimum version requirement to 6.0? |
Member
|
The world would be a better place |
Contributor
Author
|
@rhelmot I could do my best to bump it and fix any emergent issues? |
Member
|
Yes please! |
Contributor
Author
|
I'll be on it later today and tomorrow! Happy to help! |
Contributor
Author
Contributor
Author
pyright does not understand try/except AttributeError for module-level attribute access. Using getattr() tells the type checker that both the new and old constant names are valid paths.
getattr(obj, name, default) evaluates all arguments before the call. On capstone 6, the fallback _capstone.CS_ARCH_ARM64 raises AttributeError during argument evaluation even though CS_ARCH_AARCH64 exists. Same issue for CS_ARCH_SYSZ on capstone 6. hasattr() short-circuits with a ternary if/else, so the fallback branch is never evaluated when the new name exists. pyright understands hasattr for type narrowing.
twizmwazin
force-pushed
the
fix/capstone-v6-compat
branch
from
June 24, 2026 15:55
fdb1890 to
691c6a8
Compare
Member
|
Thanks, @kripticni ! |
Contributor
Author
|
@ltfish please respond to the 6.0.0 questions I posted here, I'm still planning to try to bump capstone in seperate pr and I need the info, thanks! |
Member
|
@kripticni If bumping capstone to 6.0, please do remove the compat code for capstone<6. It should remain an optional dependency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Capstone 6 renamed CS_ARCH_ARM64 -> CS_ARCH_AARCH64 and CS_ARCH_SYSZ -> CS_ARCH_SYSTEMZ
in its Python bindings (old names removed entirely).
This adds try/except fallback so archinfo works with both capstone 5.x and 6.x.
The new constant name is tried first, with a fallback to the old name for older
capstone versions.