Skip to content

Commit

Permalink
Drop support for Python 3.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfng committed Oct 12, 2024
1 parent 746709e commit 5c43cf5
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 37 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ jobs:
strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- 'pypy-3.8'
- '3.13'
- 'pypy-3.9'
- 'pypy-3.10'
# this version range needs to be synchronized with the one in pyproject.toml
Expand Down
7 changes: 0 additions & 7 deletions amaranth_soc/csr/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ class Signature(wiring.Signature):
def __init__(self, width, access):
if not isinstance(width, int) or width < 0:
raise TypeError(f"Width must be a non-negative integer, not {width!r}")
# TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
# instead of cls.__qualname__.
# Element.Access(access)
try:
Element.Access(access)
except ValueError as e:
raise ValueError(f"{access!r} is not a valid Element.Access") from e

self._width = width
self._access = Element.Access(access)
Expand Down
21 changes: 2 additions & 19 deletions amaranth_soc/csr/reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ class Signature(wiring.Signature):
def __init__(self, shape, access):
if not isinstance(shape, ShapeLike):
raise TypeError(f"Field shape must be a shape-like object, not {shape!r}")
# TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
# instead of cls.__qualname__.
# FieldPort.Access(access)
try:
FieldPort.Access(access)
except ValueError as e:
raise ValueError(f"{access!r} is not a valid FieldPort.Access") from e

self._shape = Shape.cast(shape)
self._access = FieldPort.Access(access)
Expand Down Expand Up @@ -461,13 +454,7 @@ class Register(wiring.Component):

def __init_subclass__(cls, *, access=None, **kwargs):
if access is not None:
# TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
# instead of cls.__qualname__.
# cls._access = Element.Access(access)
try:
cls._access = Element.Access(access)
except ValueError as e:
raise ValueError(f"{access!r} is not a valid Element.Access") from e
cls._access = Element.Access(access)
cls.__doc__ = cls._doc_template.format(parameters="")
super().__init_subclass__(**kwargs)

Expand All @@ -493,11 +480,7 @@ def filter_fields(src):
f"field annotations: {', '.join(annot_fields)}")

if access is not None:
# TODO(py3.9): Remove this (see above).
try:
access = Element.Access(access)
except ValueError as e:
raise ValueError(f"{access!r} is not a valid Element.Access") from e
access = Element.Access(access)
if hasattr(self, "_access") and access != self._access:
raise ValueError(f"Element access mode {access} conflicts with the value "
f"provided during class creation: {self._access}")
Expand Down
8 changes: 0 additions & 8 deletions amaranth_soc/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ class Signature(wiring.Signature):
Event trigger. Asserted when an event occurs, according to the trigger mode.
"""
def __init__(self, *, trigger="level"):
# TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
# instead of cls.__qualname__.
# Source.Trigger(trigger)
try:
Source.Trigger(trigger)
except ValueError as e:
raise ValueError(f"{trigger!r} is not a valid Source.Trigger") from e

super().__init__({
"i": Out(1),
"trg": In(1),
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description = "System on Chip toolkit for Amaranth HDL"
authors = [{name = "Amaranth HDL contributors"}]
license = {file = "LICENSE.txt"}

requires-python = "~=3.8"
requires-python = "~=3.9"
dependencies = [
# this version requirement needs to be synchronized with the one in .github/workflows/main.yml
"amaranth>=0.5,<0.6",
Expand Down

0 comments on commit 5c43cf5

Please sign in to comment.