Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpType(Enum) falls down on python 3.11.1 #615

Merged
merged 3 commits into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
container: python:${{ matrix.python }}
strategy:
matrix:
python: ["3.10"]
python: ["3.10", "3.11"]
steps:
- run: python3 --version
- name: Check out code
Expand All @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [ "3.10" ]
python: ["3.10", "3.11"]
steps:
- name: Check out code
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Introducing `AbstractVar` to abstract value access: store, load, and stack type. ([#584](https://github.com/algorand/pyteal/pull/584))
* NOTE: a backwards incompatable change was imposed in this PR: previous ABI value's public member `stored_value` with type `ScratchVar`, is now changed to protected member `_stored_value` with type `AbstractVar`.
* Starting with program version 9, when `scratch_slots` flag isn't provided to `OptimizeOptions`, default to optimizing. For versions 8 and earlier the default is and remains to _not_ optimize. ([#613](https://github.com/algorand/pyteal/pull/613))
* Replaced the usage of `typing.NamedTuple` with `dataclass` for `class OpType` in the **ir** package in order to avoid [a regression coming in Python 3.11.1](https://github.com/python/cpython/issues/100098) ([#615](https://github.com/algorand/pyteal/pull/615)).

# 0.20.1

Expand Down
9 changes: 7 additions & 2 deletions pyteal/ir/ops.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import NamedTuple
from dataclasses import dataclass
from enum import Enum, Flag, auto


Expand All @@ -11,7 +11,12 @@ class Mode(Flag):

Mode.__module__ = "pyteal"

OpType = NamedTuple("OpType", [("value", str), ("mode", Mode), ("min_version", int)])

@dataclass
class OpType:
value: str
mode: Mode
min_version: int


class Op(Enum):
Expand Down