diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 66e300d..d932b39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ on: jobs: build_sdist: name: Build sdist - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -37,7 +37,7 @@ jobs: build_generic_wheel: name: Build generic wheel (without speedups) - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 env: # Build a wheel without speedups that can run on pure Python GENSHI_BUILD_SPEEDUP: 0 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a25af71..2037fa0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,10 +4,10 @@ on: [push, pull_request] jobs: tests: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: matrix: - python-version: [2.7, 3.6, 3.7, 3.8, 3.9, "3.10", "3.11-dev", pypy2, pypy3] + python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11", pypy2, pypy3] steps: - uses: actions/checkout@v2 diff --git a/genshi/compat.py b/genshi/compat.py index 2f8c481..2abca13 100644 --- a/genshi/compat.py +++ b/genshi/compat.py @@ -20,6 +20,7 @@ except ImportError: import _ast as ast import sys +import warnings from types import CodeType import six @@ -137,13 +138,15 @@ def build_code_chunk(code, filename, name, lineno): # In Python 3.8, Str and Ellipsis was replaced by Constant -try: - _ast_Ellipsis = ast.Ellipsis - _ast_Str = ast.Str - _ast_Str_value = lambda obj: obj.s -except AttributeError: - _ast_Ellipsis = _ast_Str = ast.Constant - _ast_Str_value = lambda obj: obj.value +with warnings.catch_warnings(): + warnings.filterwarnings('error', category=DeprecationWarning) + try: + _ast_Ellipsis = ast.Ellipsis + _ast_Str = ast.Str + _ast_Str_value = lambda obj: obj.s + except (AttributeError, DeprecationWarning): + _ast_Ellipsis = _ast_Str = ast.Constant + _ast_Str_value = lambda obj: obj.value class _DummyASTItem(object): pass