Skip to content

Commit

Permalink
Merge pull request #1561 from brian-team/python3.13
Browse files Browse the repository at this point in the history
Fix compatibility with Python3.13
  • Loading branch information
mstimberg authored Sep 13, 2024
2 parents 8f0214d + 4eaa340 commit c089311
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
8 changes: 4 additions & 4 deletions brian2/codegen/optimisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,11 @@ def reduced_node(terms, op):
--------
>>> import ast
>>> nodes = [ast.Name(id='x'), ast.Name(id='y'), ast.Name(id='z')]
>>> ast.dump(reduced_node(nodes, ast.Mult), annotate_fields=False)
"BinOp(BinOp(Name('x'), Mult(), Name('y')), Mult(), Name('z'))"
>>> ast.unparse(reduced_node(nodes, ast.Mult))
'x * y * z'
>>> nodes = [ast.Name(id='x')]
>>> ast.dump(reduced_node(nodes, ast.Add), annotate_fields=False)
"Name('x')"
>>> ast.unparse(reduced_node(nodes, ast.Add))
'x'
"""
# Remove None terms
terms = [term for term in terms if term is not None]
Expand Down
6 changes: 3 additions & 3 deletions brian2/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
from brian2.units import ms


def pytest_ignore_collect(path, config):
def pytest_ignore_collect(collection_path, config):
if config.option.doctestmodules:
if "tests" in str(path):
if "tests" in collection_path.parts:
return True # Ignore tests package for doctests
# Do not test brian2.hears bridge (needs Brian1)
if str(path).endswith("hears.py"):
if collection_path.name == "hears.py":
return True


Expand Down
2 changes: 0 additions & 2 deletions brian2/parsing/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ def visit_Call(self, node):
func=ast.Name(id=node.func.id, ctx=ast.Load()),
args=args,
keywords=[],
starargs=None,
kwargs=None,
)


Expand Down
3 changes: 1 addition & 2 deletions brian2/parsing/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ def render_Call(self, node):
raise ValueError("Keyword arguments not supported")
else:
if node.func.id in self.auto_vectorise:
vectorisation_idx = ast.Name()
vectorisation_idx.id = "_vectorisation_idx"
vectorisation_idx = ast.Name("_vectorisation_idx")
args = node.args + [vectorisation_idx]
else:
args = node.args
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ classifiers = [
]

[project.optional-dependencies]
test = ['pytest', 'pytest-xdist>=1.22.3', 'pytest-cov>=2.0', 'pytest-timeout']
test = ['pytest>=8', 'pytest-xdist>=1.22.3', 'pytest-cov>=2.0', 'pytest-timeout']
docs = ['sphinx>=7', 'ipython>=5', 'sphinx-tabs']

[project.urls]
Expand Down

0 comments on commit c089311

Please sign in to comment.