From 5c43cf58f15d9cd9c69ff83c97997708d386b2dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Nguyen?= Date: Thu, 5 Sep 2024 17:30:35 +0200 Subject: [PATCH] Drop support for Python 3.8. --- .github/workflows/main.yaml | 3 +-- amaranth_soc/csr/bus.py | 7 ------- amaranth_soc/csr/reg.py | 21 ++------------------- amaranth_soc/event.py | 8 -------- pyproject.toml | 2 +- 5 files changed, 4 insertions(+), 37 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b511c5c..6c9c5ca 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -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 diff --git a/amaranth_soc/csr/bus.py b/amaranth_soc/csr/bus.py index 0ba354b..a41f276 100644 --- a/amaranth_soc/csr/bus.py +++ b/amaranth_soc/csr/bus.py @@ -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) diff --git a/amaranth_soc/csr/reg.py b/amaranth_soc/csr/reg.py index c7515a4..d6a4284 100644 --- a/amaranth_soc/csr/reg.py +++ b/amaranth_soc/csr/reg.py @@ -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) @@ -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) @@ -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}") diff --git a/amaranth_soc/event.py b/amaranth_soc/event.py index 67a92f2..a808cd1 100644 --- a/amaranth_soc/event.py +++ b/amaranth_soc/event.py @@ -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), diff --git a/pyproject.toml b/pyproject.toml index 073c3c7..4249548 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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",