diff --git a/psll/__init__.py b/psll/__init__.py index 49d802c..9a038e5 100755 --- a/psll/__init__.py +++ b/psll/__init__.py @@ -2,7 +2,7 @@ Macro-driven metalanguage which compiles to Pyramid Scheme. """ -__version__ = "0.1.8" +__version__ = "0.1.9" class PsllSyntaxError(SyntaxError): diff --git a/psll/build.py b/psll/build.py index 3dd4162..cbff88c 100755 --- a/psll/build.py +++ b/psll/build.py @@ -1,9 +1,33 @@ import operator +import sys from functools import lru_cache, reduce, singledispatch from typing import Union, overload from .ascii_trees import AbstractTree, Pyramid +if sys.version_info >= (3, 14): + # Fix for lru_cache in Python 3.14+ + # See: https://github.com/python/cpython/issues/132064 + from functools import wraps + from typing import Any, Callable, TypeVar + + _old_lru_cache = lru_cache + + _T = TypeVar("_T", bound=Callable) + + def wrapped_lru_cache(*lar: Any, **lkw: Any) -> Callable[[_T], _T]: + def decorator(func: _T) -> _T: + @wraps(func) + def wrapper(*ar: Any, **kw: Any) -> Any: + return _old_lru_cache(*lar, **lkw)(func)(*ar, **kw) + + return wrapper # type: ignore + + return decorator + + lru_cache = wrapped_lru_cache # type: ignore + + # =================================================================================== # # ##### ## ## #### ## ##### diff --git a/tox.ini b/tox.ini index 5d4a696..715175f 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ min_version = 4.0 env_list = ; py314t - ; py314 # FIXME: BROKEN!! + py314 ; py313t py313 py312