Skip to content
Merged
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- 3.12
- 3.13
# As per https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#pypy list of versions
- pypy-3.8
- pypy-3.9
- pypy-3.10
astroid-version:
Expand All @@ -45,6 +44,7 @@ jobs:
astroid-version: '<4'
- python-version: '3.12'
astroid-version: '<4'
- python-version: '3.14'

env:
COVERALLS_PARALLEL: true
Expand All @@ -60,13 +60,13 @@ jobs:

- name: Install dependencies
run: |
pip install --upgrade coveralls pytest setuptools setuptools_scm pep517
pip install --upgrade coveralls "pytest<9.0" setuptools setuptools_scm pep517
pip install .[test] 'astroid${{ matrix.astroid-version }}'

- name: Mypy testing
run: |
# Not an exact mypy version, as we need 0.942 for pypy-3.8 support, but it's not available on 3.5
pip install "mypy>=0.910,<=0.942"
pip install "mypy>=1.10"
python -m mypy asttokens tests/*.py

- name: Fast tests with coverage
Expand Down
4 changes: 3 additions & 1 deletion asttokens/mark_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,9 @@ def handle_num(self,

def visit_num(self, node, first_token, last_token):
# type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token]
return self.handle_num(node, cast(ast.Num, node).n, first_token, last_token)
n = node.n # type: ignore[union-attr] # ast.Num has been removed in python 3.14
assert isinstance(n, (complex, int, numbers.Number))
return self.handle_num(node, n, first_token, last_token)

def visit_const(self, node, first_token, last_token):
# type: (AstNode, util.Token, util.Token) -> Tuple[util.Token, util.Token]
Expand Down
4 changes: 3 additions & 1 deletion asttokens/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class EnhancedAST(AST):
first_token = None # type: Token
last_token = None # type: Token
lineno = 0 # type: int
end_lineno = 0 # type : int
end_col_offset = 0 # type : int

AstNode = Union[EnhancedAST, NodeNG]

Expand Down Expand Up @@ -404,7 +406,7 @@ def combine_tokens(group):


def last_stmt(node):
# type: (ast.AST) -> ast.AST
# type: (AstNode) -> AstNode
"""
If the given AST node contains multiple statements, return the last one.
Otherwise, just return the node.
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ classifiers =
Topic :: Software Development :: Pre-processors
Environment :: Console
Operating System :: OS Independent
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Expand All @@ -41,7 +40,7 @@ astroid =
astroid >=2, <5
test =
astroid >=2, <5
pytest
pytest < 9.0
pytest-cov
pytest-xdist

Expand Down
3 changes: 3 additions & 0 deletions tests/test_mark_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,9 @@ def test_sys_modules(self):
if time() - start > 13 * 60:
break

if 'annotationlib' == module.__name__:
break

try:
filename = inspect.getsourcefile(module)
except Exception: # some modules raise weird errors
Expand Down