Skip to content

fix: make vm.py compatible with Python 3.9 (stock macOS)#852

Merged
zerosnacks merged 3 commits intomasterfrom
fix/vm-py-python39-compat
Apr 23, 2026
Merged

fix: make vm.py compatible with Python 3.9 (stock macOS)#852
zerosnacks merged 3 commits intomasterfrom
fix/vm-py-python39-compat

Conversation

@zerosnacks
Copy link
Copy Markdown
Member

Problem

scripts/vm.py uses Python 3.10+ union type syntax (int | str, X | None) which fails on macOS stock Python 3.9.6:

TypeError: unsupported operand type(s) for |: 'type' and 'type'

Fix

  • Replace int | str with Union[int, str] and Cheatcodes | None with Optional[Cheatcodes]
  • Import Union and Optional from typing
  • Regenerated src/Vm.sol via vm.py
  • Updated interface ID hashes in test/Vm.t.sol

zerosnacks and others added 2 commits April 23, 2026 11:05
Replace Python 3.10+ union type syntax (int | str, X | None) with
typing.Union and typing.Optional for compatibility with the stock
macOS Python 3.9.6.

Also regenerated src/Vm.sol via vm.py.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019db99b-87a5-7768-9a12-803d0db1baa2
@zerosnacks zerosnacks merged commit 8987040 into master Apr 23, 2026
22 checks passed
@zerosnacks zerosnacks deleted the fix/vm-py-python39-compat branch April 23, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant