diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf7e0a1..9c86c73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04, windows-2019, macos-11] - python-version: ["3.10", "3.11", "3.12-dev", "pypy3.10"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy3.10", "pypy3.9"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/once.py b/once.py index 9ed01c2..b79e0af 100644 --- a/once.py +++ b/once.py @@ -94,7 +94,8 @@ def __get__(self, obj, cls): func = functools.partial(self.func.__func__, cls) return functools.partial(self._execute_call_once, func) if isinstance(self.func, staticmethod): - return functools.partial(self._execute_call_once, self.func) + # The additional __func__ is required for python <= 3.9 + return functools.partial(self._execute_call_once, self.func.__func__) return functools.partial(self._execute_call_once, self.func, obj) diff --git a/pyproject.toml b/pyproject.toml index 1495215..629e68f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ authors = [ description = "Utility for initialization ensuring functions are called only once" readme = "README.md" license = "MIT" -requires-python = ">=3.10" +requires-python = ">=3.8" classifiers = [ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License",