openSUSE Commits
Threads by month
- ----- 2024 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
August 2024
- 2 participants
- 1399 discussions
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-ptyprocess for openSUSE:Factory checked in at 2024-08-01 22:03:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-ptyprocess (Old)
and /work/SRC/openSUSE:Factory/.python-ptyprocess.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ptyprocess"
Thu Aug 1 22:03:18 2024 rev:10 rq:1190529 version:0.7.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-ptyprocess/python-ptyprocess.changes 2023-04-22 22:00:16.513150007 +0200
+++ /work/SRC/openSUSE:Factory/.python-ptyprocess.new.7232/python-ptyprocess.changes 2024-08-01 22:03:27.250053188 +0200
@@ -1,0 +2,6 @@
+Tue Jul 30 12:03:04 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz(a)suse.com>
+
+- Cherry-pick upstream patch to fix tests with Python 3.13.
+ * remove-old-unittest-functions.patch
+
+-------------------------------------------------------------------
New:
----
remove-old-unittest-functions.patch
BETA DEBUG BEGIN:
New:- Cherry-pick upstream patch to fix tests with Python 3.13.
* remove-old-unittest-functions.patch
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-ptyprocess.spec ++++++
--- /var/tmp/diff_new_pack.bp0AAB/_old 2024-08-01 22:03:29.518146743 +0200
+++ /var/tmp/diff_new_pack.bp0AAB/_new 2024-08-01 22:03:29.522146908 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-ptyprocess
#
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,6 +26,8 @@
Group: Development/Languages/Python
URL: https://github.com/pexpect/ptyprocess
Source: https://files.pythonhosted.org/packages/source/p/ptyprocess/ptyprocess-%{ve…
+# PATCH-FIX-UPSTREAM - gh/pexpect/ptyprocess#75 - Remove unittest.makeSuite, gone from Python 3.13
+Patch: https://github.com/pexpect/ptyprocess/pull/75.patch#/remove-old-unittest-fu…
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -44,6 +46,7 @@
%prep
%setup -q -n ptyprocess-%{version}
+%patch -P0 -p1
%build
%python_build
++++++ remove-old-unittest-functions.patch ++++++
From a44312974bd9084aa568d2e18ce5b2a7e0e45983 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro(a)hroncok.cz>
Date: Mon, 23 Oct 2023 15:18:02 +0200
Subject: [PATCH] Remove unittest.makeSuite, gone from Python 3.13
See https://docs.python.org/3.13/whatsnew/3.13.html
"""
Removed the following unittest functions, deprecated in Python 3.11:
unittest.findTestCases()
unittest.makeSuite()
unittest.getTestCaseNames()
"""
The removed call does not seem to have any effect when the file is executed
directly, run trough unittest discover or pytest.
---
tests/test_invalid_binary.py | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tests/test_invalid_binary.py b/tests/test_invalid_binary.py
index cf28098..545f9f7 100755
--- a/tests/test_invalid_binary.py
+++ b/tests/test_invalid_binary.py
@@ -69,6 +69,3 @@ def test_invalid_binary(self):
if __name__ == '__main__':
unittest.main()
-
-suite = unittest.makeSuite(InvalidBinaryChars,'test')
-
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-munch for openSUSE:Factory checked in at 2024-08-01 22:03:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-munch (Old)
and /work/SRC/openSUSE:Factory/.python-munch.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-munch"
Thu Aug 1 22:03:17 2024 rev:7 rq:1190528 version:4.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-munch/python-munch.changes 2023-12-17 21:29:20.075068373 +0100
+++ /work/SRC/openSUSE:Factory/.python-munch.new.7232/python-munch.changes 2024-08-01 22:03:26.458020518 +0200
@@ -1,0 +2,6 @@
+Tue Jul 30 11:14:38 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz(a)suse.com>
+
+- Cherry-pick upstream patch to adjust tests for Python 3.13
+ * adjust-tests-for-python3.13.patch
+
+-------------------------------------------------------------------
New:
----
adjust-tests-for-python3.13.patch
BETA DEBUG BEGIN:
New:- Cherry-pick upstream patch to adjust tests for Python 3.13
* adjust-tests-for-python3.13.patch
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-munch.spec ++++++
--- /var/tmp/diff_new_pack.dFPsUY/_old 2024-08-01 22:03:27.130048238 +0200
+++ /var/tmp/diff_new_pack.dFPsUY/_new 2024-08-01 22:03:27.130048238 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-munch
#
-# Copyright (c) 2023 SUSE LLC
+# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -25,6 +25,8 @@
Group: Development/Languages/Python
URL: https://github.com/Infinidat/munch
Source: https://files.pythonhosted.org/packages/source/m/munch/munch-%{version}.tar…
+# PATCH-FIX-UPSTREAM - gh/Infinidat/munch#104 - Adjust tests for Python 3.13
+Patch: https://patch-diff.githubusercontent.com/raw/Infinidat/munch/pull/104.patch…
BuildRequires: %{python_module pbr}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
++++++ adjust-tests-for-python3.13.patch ++++++
From 84651ee872f9ea6dbaed986fd3818202933a8b50 Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma(a)redhat.com>
Date: Wed, 5 Jun 2024 09:49:49 +0200
Subject: [PATCH] Adjust tests for Python 3.13
---
tests/test_munch.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tests/test_munch.py b/tests/test_munch.py
index c80b757..5886fdd 100644
--- a/tests/test_munch.py
+++ b/tests/test_munch.py
@@ -225,6 +225,15 @@ def test_reserved_attributes(attrname):
assert attr == 'munch'
elif attrname == '__dict__':
assert attr == {}
+ elif attrname == '__static_attributes__':
+ # Python 3.13: added __static_attributes__ attribute, populated by the
+ # compiler, containing a tuple of names of attributes of this class
+ # which are accessed through self.X from any function in its body.
+ assert isinstance(attr, tuple)
+ elif attrname == '__firstlineno__':
+ # Python 3.13: added __firstlineno__ attribute, populated by the
+ # compiler, containing the line number of the first line of the class definition
+ assert isinstance(attr, int)
else:
assert callable(attr)
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-Jinja2 for openSUSE:Factory checked in at 2024-08-01 22:03:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Jinja2 (Old)
and /work/SRC/openSUSE:Factory/.python-Jinja2.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Jinja2"
Thu Aug 1 22:03:17 2024 rev:54 rq:1190527 version:3.1.4
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Jinja2/python-Jinja2.changes 2024-05-07 18:02:54.573428764 +0200
+++ /work/SRC/openSUSE:Factory/.python-Jinja2.new.7232/python-Jinja2.changes 2024-08-01 22:03:25.761991808 +0200
@@ -1,0 +2,7 @@
+Tue Jul 30 10:44:01 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz(a)suse.com>
+
+- Cherry-pick patch from Fedora to fix FTBFS with Python 3.13
+ * fix-ftbfs-with-python313.patch
+- Add new build dependency python-trio to BuildRequires
+
+-------------------------------------------------------------------
New:
----
fix-ftbfs-with-python313.patch
BETA DEBUG BEGIN:
New:- Cherry-pick patch from Fedora to fix FTBFS with Python 3.13
* fix-ftbfs-with-python313.patch
- Add new build dependency python-trio to BuildRequires
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-Jinja2.spec ++++++
--- /var/tmp/diff_new_pack.yCWu3B/_old 2024-08-01 22:03:26.186009298 +0200
+++ /var/tmp/diff_new_pack.yCWu3B/_new 2024-08-01 22:03:26.186009298 +0200
@@ -29,11 +29,14 @@
License: BSD-3-Clause
URL: https://jinja.palletsprojects.com
Source: https://files.pythonhosted.org/packages/source/J/Jinja2/jinja2-%{version}.t…
+# PATCH-FIX-UPSTREAM - gh/pallets/jinja#1960 and gh/pallets/jinja#1977 - Fix FTBFS with Python 3.13
+Patch: https://src.fedoraproject.org/rpms/python-jinja2/raw/rawhide/f/python3.13.p…
BuildRequires: %{python_module MarkupSafe >= 0.23}
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module flit-core}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
+BuildRequires: %{python_module trio}
BuildRequires: %{python_module wheel}
BuildRequires: dos2unix
BuildRequires: fdupes
@@ -53,6 +56,7 @@
%prep
%setup -q -n jinja2-%{version}
+%patch -P0 -p1
%build
%pyproject_wheel
++++++ fix-ftbfs-with-python313.patch ++++++
From d44af7635fa97e980673f29c6192d9fc5cbfc85a Mon Sep 17 00:00:00 2001
From: Thomas Grainger <tagrain(a)gmail.com>
Date: Thu, 23 May 2024 15:30:36 +0200
Subject: [PATCH] Python 3.13 fixes
Combined from:
- https://github.com/pallets/jinja/pull/1960
- https://github.com/pallets/jinja/pull/1977
Co-Authored-By: David Lord <davidism(a)gmail.com>
---
src/jinja2/async_utils.py | 25 ++++++--
src/jinja2/compiler.py | 46 +++++++++-----
src/jinja2/environment.py | 12 +++-
tests/test_async.py | 122 +++++++++++++++++++++++++++++-------
tests/test_async_filters.py | 67 ++++++++++++++++----
tests/test_loader.py | 5 +-
6 files changed, 214 insertions(+), 63 deletions(-)
diff --git a/src/jinja2/async_utils.py b/src/jinja2/async_utils.py
index e65219e..b0d277d 100644
--- a/src/jinja2/async_utils.py
+++ b/src/jinja2/async_utils.py
@@ -6,6 +6,9 @@ from functools import wraps
from .utils import _PassArg
from .utils import pass_eval_context
+if t.TYPE_CHECKING:
+ import typing_extensions as te
+
V = t.TypeVar("V")
@@ -67,15 +70,27 @@ async def auto_await(value: t.Union[t.Awaitable["V"], "V"]) -> "V":
return t.cast("V", value)
-async def auto_aiter(
+class _IteratorToAsyncIterator(t.Generic[V]):
+ def __init__(self, iterator: "t.Iterator[V]"):
+ self._iterator = iterator
+
+ def __aiter__(self) -> "te.Self":
+ return self
+
+ async def __anext__(self) -> V:
+ try:
+ return next(self._iterator)
+ except StopIteration as e:
+ raise StopAsyncIteration(e.value) from e
+
+
+def auto_aiter(
iterable: "t.Union[t.AsyncIterable[V], t.Iterable[V]]",
) -> "t.AsyncIterator[V]":
if hasattr(iterable, "__aiter__"):
- async for item in t.cast("t.AsyncIterable[V]", iterable):
- yield item
+ return iterable.__aiter__()
else:
- for item in iterable:
- yield item
+ return _IteratorToAsyncIterator(iter(iterable))
async def auto_to_list(
diff --git a/src/jinja2/compiler.py b/src/jinja2/compiler.py
index 2740717..91720c5 100644
--- a/src/jinja2/compiler.py
+++ b/src/jinja2/compiler.py
@@ -55,7 +55,7 @@ def optimizeconst(f: F) -> F:
return f(self, node, frame, **kwargs)
- return update_wrapper(t.cast(F, new_func), f)
+ return update_wrapper(new_func, f) # type: ignore[return-value]
def _make_binop(op: str) -> t.Callable[["CodeGenerator", nodes.BinExpr, "Frame"], None]:
@@ -902,12 +902,15 @@ class CodeGenerator(NodeVisitor):
if not self.environment.is_async:
self.writeline("yield from parent_template.root_render_func(context)")
else:
- self.writeline(
- "async for event in parent_template.root_render_func(context):"
- )
+ self.writeline("agen = parent_template.root_render_func(context)")
+ self.writeline("try:")
+ self.indent()
+ self.writeline("async for event in agen:")
self.indent()
self.writeline("yield event")
self.outdent()
+ self.outdent()
+ self.writeline("finally: await agen.aclose()")
self.outdent(1 + (not self.has_known_extends))
# at this point we now have the blocks collected and can visit them too.
@@ -977,14 +980,20 @@ class CodeGenerator(NodeVisitor):
f"yield from context.blocks[{node.name!r}][0]({context})", node
)
else:
+ self.writeline(f"gen = context.blocks[{node.name!r}][0]({context})")
+ self.writeline("try:")
+ self.indent()
self.writeline(
- f"{self.choose_async()}for event in"
- f" context.blocks[{node.name!r}][0]({context}):",
+ f"{self.choose_async()}for event in gen:",
node,
)
self.indent()
self.simple_write("event", frame)
self.outdent()
+ self.outdent()
+ self.writeline(
+ f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}"
+ )
self.outdent(level)
@@ -1057,26 +1066,33 @@ class CodeGenerator(NodeVisitor):
self.writeline("else:")
self.indent()
- skip_event_yield = False
+ def loop_body() -> None:
+ self.indent()
+ self.simple_write("event", frame)
+ self.outdent()
+
if node.with_context:
self.writeline(
- f"{self.choose_async()}for event in template.root_render_func("
+ f"gen = template.root_render_func("
"template.new_context(context.get_all(), True,"
- f" {self.dump_local_context(frame)})):"
+ f" {self.dump_local_context(frame)}))"
+ )
+ self.writeline("try:")
+ self.indent()
+ self.writeline(f"{self.choose_async()}for event in gen:")
+ loop_body()
+ self.outdent()
+ self.writeline(
+ f"finally: {self.choose_async('await gen.aclose()', 'gen.close()')}"
)
elif self.environment.is_async:
self.writeline(
"for event in (await template._get_default_module_async())"
"._body_stream:"
)
+ loop_body()
else:
self.writeline("yield from template._get_default_module()._body_stream")
- skip_event_yield = True
-
- if not skip_event_yield:
- self.indent()
- self.simple_write("event", frame)
- self.outdent()
if node.ignore_missing:
self.outdent()
diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py
index 1d3be0b..bdd6a2b 100644
--- a/src/jinja2/environment.py
+++ b/src/jinja2/environment.py
@@ -1358,7 +1358,7 @@ class Template:
async def generate_async(
self, *args: t.Any, **kwargs: t.Any
- ) -> t.AsyncIterator[str]:
+ ) -> t.AsyncGenerator[str, object]:
"""An async version of :meth:`generate`. Works very similarly but
returns an async iterator instead.
"""
@@ -1370,8 +1370,14 @@ class Template:
ctx = self.new_context(dict(*args, **kwargs))
try:
- async for event in self.root_render_func(ctx): # type: ignore
- yield event
+ agen = self.root_render_func(ctx)
+ try:
+ async for event in agen: # type: ignore
+ yield event
+ finally:
+ # we can't use async with aclosing(...) because that's only
+ # in 3.10+
+ await agen.aclose() # type: ignore
except Exception:
yield self.environment.handle_exception()
diff --git a/tests/test_async.py b/tests/test_async.py
index c9ba70c..4edced9 100644
--- a/tests/test_async.py
+++ b/tests/test_async.py
@@ -1,6 +1,7 @@
import asyncio
import pytest
+import trio
from jinja2 import ChainableUndefined
from jinja2 import DictLoader
@@ -13,7 +14,16 @@ from jinja2.exceptions import UndefinedError
from jinja2.nativetypes import NativeEnvironment
-def test_basic_async():
+def _asyncio_run(async_fn, *args):
+ return asyncio.run(async_fn(*args))
+
+
+(a)pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"])
+def run_async_fn(request):
+ return request.param
+
+
+def test_basic_async(run_async_fn):
t = Template(
"{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True
)
@@ -21,11 +31,11 @@ def test_basic_async():
async def func():
return await t.render_async()
- rv = asyncio.run(func())
+ rv = run_async_fn(func)
assert rv == "[1][2][3]"
-def test_await_on_calls():
+def test_await_on_calls(run_async_fn):
t = Template("{{ async_func() + normal_func() }}", enable_async=True)
async def async_func():
@@ -37,7 +47,7 @@ def test_await_on_calls():
async def func():
return await t.render_async(async_func=async_func, normal_func=normal_func)
- rv = asyncio.run(func())
+ rv = run_async_fn(func)
assert rv == "65"
@@ -54,7 +64,7 @@ def test_await_on_calls_normal_render():
assert rv == "65"
-def test_await_and_macros():
+def test_await_and_macros(run_async_fn):
t = Template(
"{% macro foo(x) %}[{{ x }}][{{ async_func() }}]{% endmacro %}{{ foo(42) }}",
enable_async=True,
@@ -66,11 +76,11 @@ def test_await_and_macros():
async def func():
return await t.render_async(async_func=async_func)
- rv = asyncio.run(func())
+ rv = run_async_fn(func)
assert rv == "[42][42]"
-def test_async_blocks():
+def test_async_blocks(run_async_fn):
t = Template(
"{% block foo %}<Test>{% endblock %}{{ self.foo() }}",
enable_async=True,
@@ -80,7 +90,7 @@ def test_async_blocks():
async def func():
return await t.render_async()
- rv = asyncio.run(func())
+ rv = run_async_fn(func)
assert rv == "<Test><Test>"
@@ -156,8 +166,8 @@ class TestAsyncImports:
test_env_async.from_string('{% from "foo" import bar, with, context %}')
test_env_async.from_string('{% from "foo" import bar, with with context %}')
- def test_exports(self, test_env_async):
- coro = test_env_async.from_string(
+ def test_exports(self, test_env_async, run_async_fn):
+ coro_fn = test_env_async.from_string(
"""
{% macro toplevel() %}...{% endmacro %}
{% macro __private() %}...{% endmacro %}
@@ -166,9 +176,9 @@ class TestAsyncImports:
{% macro notthere() %}{% endmacro %}
{% endfor %}
"""
- )._get_default_module_async()
- m = asyncio.run(coro)
- assert asyncio.run(m.toplevel()) == "..."
+ )._get_default_module_async
+ m = run_async_fn(coro_fn)
+ assert run_async_fn(m.toplevel) == "..."
assert not hasattr(m, "__missing")
assert m.variable == 42
assert not hasattr(m, "notthere")
@@ -457,17 +467,19 @@ class TestAsyncForLoop:
)
assert tmpl.render(items=reversed([3, 2, 1])) == "1,2,3"
- def test_loop_errors(self, test_env_async):
+ def test_loop_errors(self, test_env_async, run_async_fn):
tmpl = test_env_async.from_string(
"""{% for item in [1] if loop.index
== 0 %}...{% endfor %}"""
)
- pytest.raises(UndefinedError, tmpl.render)
+ with pytest.raises(UndefinedError):
+ run_async_fn(tmpl.render_async)
+
tmpl = test_env_async.from_string(
"""{% for item in [] %}...{% else
%}{{ loop }}{% endfor %}"""
)
- assert tmpl.render() == ""
+ assert run_async_fn(tmpl.render_async) == ""
def test_loop_filter(self, test_env_async):
tmpl = test_env_async.from_string(
@@ -597,7 +609,7 @@ class TestAsyncForLoop:
assert t.render(a=dict(b=[1, 2, 3])) == "1"
-def test_namespace_awaitable(test_env_async):
+def test_namespace_awaitable(test_env_async, run_async_fn):
async def _test():
t = test_env_async.from_string(
'{% set ns = namespace(foo="Bar") %}{{ ns.foo }}'
@@ -605,10 +617,10 @@ def test_namespace_awaitable(test_env_async):
actual = await t.render_async()
assert actual == "Bar"
- asyncio.run(_test())
+ run_async_fn(_test)
-def test_chainable_undefined_aiter():
+def test_chainable_undefined_aiter(run_async_fn):
async def _test():
t = Template(
"{% for x in a['b']['c'] %}{{ x }}{% endfor %}",
@@ -618,7 +630,7 @@ def test_chainable_undefined_aiter():
rv = await t.render_async(a={})
assert rv == ""
- asyncio.run(_test())
+ run_async_fn(_test)
@pytest.fixture
@@ -626,22 +638,22 @@ def async_native_env():
return NativeEnvironment(enable_async=True)
-def test_native_async(async_native_env):
+def test_native_async(async_native_env, run_async_fn):
async def _test():
t = async_native_env.from_string("{{ x }}")
rv = await t.render_async(x=23)
assert rv == 23
- asyncio.run(_test())
+ run_async_fn(_test)
-def test_native_list_async(async_native_env):
+def test_native_list_async(async_native_env, run_async_fn):
async def _test():
t = async_native_env.from_string("{{ x }}")
rv = await t.render_async(x=list(range(3)))
assert rv == [0, 1, 2]
- asyncio.run(_test())
+ run_async_fn(_test)
def test_getitem_after_filter():
@@ -658,3 +670,65 @@ def test_getitem_after_call():
t = env.from_string("{{ add_each(a, 2)[1:] }}")
out = t.render(a=range(3))
assert out == "[3, 4]"
+
+
+def test_basic_generate_async(run_async_fn):
+ t = Template(
+ "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True
+ )
+
+ async def func():
+ agen = t.generate_async()
+ try:
+ return await agen.__anext__()
+ finally:
+ await agen.aclose()
+
+ rv = run_async_fn(func)
+ assert rv == "["
+
+
+def test_include_generate_async(run_async_fn, test_env_async):
+ t = test_env_async.from_string('{% include "header" %}')
+
+ async def func():
+ agen = t.generate_async()
+ try:
+ return await agen.__anext__()
+ finally:
+ await agen.aclose()
+
+ rv = run_async_fn(func)
+ assert rv == "["
+
+
+def test_blocks_generate_async(run_async_fn):
+ t = Template(
+ "{% block foo %}<Test>{% endblock %}{{ self.foo() }}",
+ enable_async=True,
+ autoescape=True,
+ )
+
+ async def func():
+ agen = t.generate_async()
+ try:
+ return await agen.__anext__()
+ finally:
+ await agen.aclose()
+
+ rv = run_async_fn(func)
+ assert rv == "<Test>"
+
+
+def test_async_extend(run_async_fn, test_env_async):
+ t = test_env_async.from_string('{% extends "header" %}')
+
+ async def func():
+ agen = t.generate_async()
+ try:
+ return await agen.__anext__()
+ finally:
+ await agen.aclose()
+
+ rv = run_async_fn(func)
+ assert rv == "["
diff --git a/tests/test_async_filters.py b/tests/test_async_filters.py
index f5b2627..e8cc350 100644
--- a/tests/test_async_filters.py
+++ b/tests/test_async_filters.py
@@ -1,6 +1,9 @@
+import asyncio
+import contextlib
from collections import namedtuple
import pytest
+import trio
from markupsafe import Markup
from jinja2 import Environment
@@ -26,10 +29,39 @@ def env_async():
return Environment(enable_async=True)
+def _asyncio_run(async_fn, *args):
+ return asyncio.run(async_fn(*args))
+
+
+(a)pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"])
+def run_async_fn(request):
+ return request.param
+
+
+(a)contextlib.asynccontextmanager
+async def closing_factory():
+ async with contextlib.AsyncExitStack() as stack:
+
+ def closing(maybe_agen):
+ try:
+ aclose = maybe_agen.aclose
+ except AttributeError:
+ pass
+ else:
+ stack.push_async_callback(aclose)
+ return maybe_agen
+
+ yield closing
+
+
@mark_dualiter("foo", lambda: range(10))
-def test_first(env_async, foo):
- tmpl = env_async.from_string("{{ foo()|first }}")
- out = tmpl.render(foo=foo)
+def test_first(env_async, foo, run_async_fn):
+ async def test():
+ async with closing_factory() as closing:
+ tmpl = env_async.from_string("{{ closing(foo())|first }}")
+ return await tmpl.render_async(foo=foo, closing=closing)
+
+ out = run_async_fn(test)
assert out == "0"
@@ -245,18 +277,23 @@ def test_slice(env_async, items):
)
-def test_custom_async_filter(env_async):
+def test_custom_async_filter(env_async, run_async_fn):
async def customfilter(val):
return str(val)
- env_async.filters["customfilter"] = customfilter
- tmpl = env_async.from_string("{{ 'static'|customfilter }} {{ arg|customfilter }}")
- out = tmpl.render(arg="dynamic")
+ async def test():
+ env_async.filters["customfilter"] = customfilter
+ tmpl = env_async.from_string(
+ "{{ 'static'|customfilter }} {{ arg|customfilter }}"
+ )
+ return await tmpl.render_async(arg="dynamic")
+
+ out = run_async_fn(test)
assert out == "static dynamic"
@mark_dualiter("items", lambda: range(10))
-def test_custom_async_iteratable_filter(env_async, items):
+def test_custom_async_iteratable_filter(env_async, items, run_async_fn):
async def customfilter(iterable):
items = []
async for item in auto_aiter(iterable):
@@ -265,9 +302,13 @@ def test_custom_async_iteratable_filter(env_async, items):
break
return ",".join(items)
- env_async.filters["customfilter"] = customfilter
- tmpl = env_async.from_string(
- "{{ items()|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}"
- )
- out = tmpl.render(items=items)
+ async def test():
+ async with closing_factory() as closing:
+ env_async.filters["customfilter"] = customfilter
+ tmpl = env_async.from_string(
+ "{{ closing(items())|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}"
+ )
+ return await tmpl.render_async(items=items, closing=closing)
+
+ out = run_async_fn(test)
assert out == "0,1,2 .. 3,4,5"
diff --git a/tests/test_loader.py b/tests/test_loader.py
index 77d686e..3e64f62 100644
--- a/tests/test_loader.py
+++ b/tests/test_loader.py
@@ -2,7 +2,6 @@ import importlib.abc
import importlib.machinery
import importlib.util
import os
-import platform
import shutil
import sys
import tempfile
@@ -364,8 +363,8 @@ def test_package_zip_source(package_zip_loader, template, expect):
@pytest.mark.xfail(
- platform.python_implementation() == "PyPy",
- reason="PyPy's zipimporter doesn't have a '_files' attribute.",
+ sys.implementation.name == "pypy" or sys.version_info > (3, 13),
+ reason="zipimporter doesn't have a '_files' attribute",
raises=TypeError,
)
def test_package_zip_list(package_zip_loader):
--
2.45.0
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-xmlschema for openSUSE:Factory checked in at 2024-08-01 22:03:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-xmlschema (Old)
and /work/SRC/openSUSE:Factory/.python-xmlschema.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-xmlschema"
Thu Aug 1 22:03:16 2024 rev:25 rq:1190526 version:3.3.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-xmlschema/python-xmlschema.changes 2024-07-03 20:29:53.080152376 +0200
+++ /work/SRC/openSUSE:Factory/.python-xmlschema.new.7232/python-xmlschema.changes 2024-08-01 22:03:24.793951878 +0200
@@ -1,0 +2,6 @@
+Mon Jul 29 17:31:54 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz(a)suse.com>
+
+- Update to 3.3.2
+ * Fix UNC path tests (issues #405 and #408)
+
+-------------------------------------------------------------------
Old:
----
xmlschema-3.3.1.tar.gz
New:
----
xmlschema-3.3.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-xmlschema.spec ++++++
--- /var/tmp/diff_new_pack.6EglZB/_old 2024-08-01 22:03:25.385976299 +0200
+++ /var/tmp/diff_new_pack.6EglZB/_new 2024-08-01 22:03:25.389976464 +0200
@@ -18,7 +18,7 @@
%{?sle15_python_module_pythons}
Name: python-xmlschema
-Version: 3.3.1
+Version: 3.3.2
Release: 0
Summary: An XML Schema validator and decoder
License: MIT
++++++ xmlschema-3.3.1.tar.gz -> xmlschema-3.3.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/CHANGELOG.rst new/xmlschema-3.3.2/CHANGELOG.rst
--- old/xmlschema-3.3.1/CHANGELOG.rst 2024-04-28 10:15:54.000000000 +0200
+++ new/xmlschema-3.3.2/CHANGELOG.rst 2024-07-29 17:10:41.000000000 +0200
@@ -2,6 +2,10 @@
CHANGELOG
*********
+`v3.3.2`_ (2024-07-29)
+======================
+* Fix UNC path tests (issues #405 and #408)
+
`v3.3.1`_ (2024-04-27)
======================
* Update validation errors with logging stacktrace in debug mode
@@ -704,3 +708,4 @@
.. _v3.2.1: https://github.com/brunato/xmlschema/compare/v3.2.0...v3.2.1
.. _v3.3.0: https://github.com/brunato/xmlschema/compare/v3.2.1...v3.3.0
.. _v3.3.1: https://github.com/brunato/xmlschema/compare/v3.3.0...v3.3.1
+.. _v3.3.2: https://github.com/brunato/xmlschema/compare/v3.3.1...v3.3.2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/PKG-INFO new/xmlschema-3.3.2/PKG-INFO
--- old/xmlschema-3.3.1/PKG-INFO 2024-04-28 10:22:28.897755900 +0200
+++ new/xmlschema-3.3.2/PKG-INFO 2024-07-29 18:02:27.487871600 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: xmlschema
-Version: 3.3.1
+Version: 3.3.2
Summary: An XML Schema validator and decoder
Home-page: https://github.com/sissaschool/xmlschema
Author: Davide Brunato
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/doc/conf.py new/xmlschema-3.3.2/doc/conf.py
--- old/xmlschema-3.3.1/doc/conf.py 2024-04-28 10:15:54.000000000 +0200
+++ new/xmlschema-3.3.2/doc/conf.py 2024-07-29 17:10:41.000000000 +0200
@@ -81,7 +81,7 @@
# The short X.Y version.
version = '3.3'
# The full version, including alpha/beta/rc tags.
-release = '3.3.1'
+release = '3.3.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/setup.py new/xmlschema-3.3.2/setup.py
--- old/xmlschema-3.3.1/setup.py 2024-04-28 10:15:54.000000000 +0200
+++ new/xmlschema-3.3.2/setup.py 2024-07-29 17:10:41.000000000 +0200
@@ -18,7 +18,7 @@
setup(
name='xmlschema',
- version='3.3.1',
+ version='3.3.2',
packages=find_packages(include=['xmlschema*']),
package_data={
'xmlschema': ['py.typed', 'locale/**/*.mo', 'locale/**/*.po', 'schemas/*/*.xsd'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/tests/test_locations.py new/xmlschema-3.3.2/tests/test_locations.py
--- old/xmlschema-3.3.1/tests/test_locations.py 2024-04-28 10:15:54.000000000 +0200
+++ new/xmlschema-3.3.2/tests/test_locations.py 2024-07-29 17:10:41.000000000 +0200
@@ -12,6 +12,7 @@
import os
import pathlib
import platform
+import sys
from urllib.parse import urlsplit, uses_relative
from pathlib import Path, PurePath, PureWindowsPath, PurePosixPath
@@ -280,7 +281,10 @@
self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
url = normalize_url(r'dev\XMLSCHEMA\test.xsd', base_url=base_url_host_in_path)
- self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
+ if sys.version_info < (3, 12, 4):
+ self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
+ else:
+ self.assertEqual(url, 'file://////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
with patch.object(os, 'name', 'posix'):
self.assertEqual(os.name, 'posix')
@@ -294,7 +298,10 @@
self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
url = normalize_url(r'dev/XMLSCHEMA/test.xsd', base_url=base_url_host_in_path)
- self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
+ if sys.version_info < (3, 12, 4):
+ self.assertEqual(url, 'file:////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
+ else:
+ self.assertEqual(url, 'file://////filer01/MY_HOME/dev/XMLSCHEMA/test.xsd')
def test_normalize_url_slashes(self):
# Issue #116
@@ -311,10 +318,16 @@
self.assertRegex(normalize_url('/root/dir1/schema.xsd'),
f'file://{DRIVE_REGEX}/root/dir1/schema.xsd')
- self.assertRegex(normalize_url('////root/dir1/schema.xsd'),
- f'file://{DRIVE_REGEX}//root/dir1/schema.xsd')
- self.assertRegex(normalize_url('dir2/schema.xsd', '////root/dir1'),
- f'file://{DRIVE_REGEX}//root/dir1/dir2/schema.xsd')
+ if sys.version_info < (3, 12, 4):
+ self.assertRegex(normalize_url('////root/dir1/schema.xsd'),
+ f'file://{DRIVE_REGEX}//root/dir1/schema.xsd')
+ self.assertRegex(normalize_url('dir2/schema.xsd', '////root/dir1'),
+ f'file://{DRIVE_REGEX}//root/dir1/dir2/schema.xsd')
+ else:
+ self.assertRegex(normalize_url('////root/dir1/schema.xsd'),
+ f'file://{DRIVE_REGEX}////root/dir1/schema.xsd')
+ self.assertRegex(normalize_url('dir2/schema.xsd', '////root/dir1'),
+ f'file://{DRIVE_REGEX}////root/dir1/dir2/schema.xsd')
self.assertEqual(normalize_url('//root/dir1/schema.xsd'),
'file:////root/dir1/schema.xsd')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/tox.ini new/xmlschema-3.3.2/tox.ini
--- old/xmlschema-3.3.1/tox.ini 2024-04-28 10:15:54.000000000 +0200
+++ new/xmlschema-3.3.2/tox.ini 2024-07-29 17:10:41.000000000 +0200
@@ -48,7 +48,7 @@
[testenv:mypy-py{38,39,310,311,312,py3}]
deps =
- mypy==1.10.0
+ mypy==1.11.0
elementpath==4.4.0
lxml-stubs
jinja2
@@ -69,7 +69,7 @@
elementpath>=4.4.0, <5.0.0
lxml
jinja2
- mypy==1.10.0
+ mypy==1.11.0
lxml-stubs
commands =
pytest tests -ra
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/xmlschema/__init__.py new/xmlschema-3.3.2/xmlschema/__init__.py
--- old/xmlschema-3.3.1/xmlschema/__init__.py 2024-04-28 10:15:54.000000000 +0200
+++ new/xmlschema-3.3.2/xmlschema/__init__.py 2024-07-29 17:10:41.000000000 +0200
@@ -33,7 +33,7 @@
XMLSchema, XMLSchema10, XMLSchema11, XsdComponent, XsdType, XsdElement, XsdAttribute
)
-__version__ = '3.3.1'
+__version__ = '3.3.2'
__author__ = "Davide Brunato"
__contact__ = "brunato(a)sissa.it"
__copyright__ = "Copyright 2016-2024, SISSA"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/xmlschema/locations.py new/xmlschema-3.3.2/xmlschema/locations.py
--- old/xmlschema-3.3.1/xmlschema/locations.py 2024-04-28 10:15:54.000000000 +0200
+++ new/xmlschema-3.3.2/xmlschema/locations.py 2024-07-29 17:10:41.000000000 +0200
@@ -71,9 +71,12 @@
return LocationPosixPath(unquote(parts.path))
if parts.scheme == 'file':
- if path.startswith('/') and ntpath.splitdrive(path[1:])[0]:
+ path_start = path[:4].replace('\\', '/')
+ if path_start.startswith(('////', '///')):
+ pass
+ elif path_start.startswith('/') and ntpath.splitdrive(path[1:])[0]:
return LocationWindowsPath(unquote(path[1:]))
- elif path.startswith(('//', '/\\')) and ntpath.splitdrive(path[2:])[0]:
+ elif path_start.startswith('//') and ntpath.splitdrive(path[2:])[0]:
raise XMLSchemaValueError(f"Invalid URI {uri!r}")
if ntpath.splitdrive(path)[0] or '\\' in path:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlschema-3.3.1/xmlschema.egg-info/PKG-INFO new/xmlschema-3.3.2/xmlschema.egg-info/PKG-INFO
--- old/xmlschema-3.3.1/xmlschema.egg-info/PKG-INFO 2024-04-28 10:22:28.000000000 +0200
+++ new/xmlschema-3.3.2/xmlschema.egg-info/PKG-INFO 2024-07-29 18:02:27.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: xmlschema
-Version: 3.3.1
+Version: 3.3.2
Summary: An XML Schema validator and decoder
Home-page: https://github.com/sissaschool/xmlschema
Author: Davide Brunato
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-frozenlist for openSUSE:Factory checked in at 2024-08-01 22:03:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-frozenlist (Old)
and /work/SRC/openSUSE:Factory/.python-frozenlist.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-frozenlist"
Thu Aug 1 22:03:15 2024 rev:9 rq:1190524 version:1.4.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-frozenlist/python-frozenlist.changes 2024-01-17 22:14:48.201902607 +0100
+++ /work/SRC/openSUSE:Factory/.python-frozenlist.new.7232/python-frozenlist.changes 2024-08-01 22:03:17.853665605 +0200
@@ -1,0 +2,6 @@
+Mon Jul 29 14:27:41 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz(a)suse.com>
+
+- Cherry-pick patch from Fedora to fix testsuite with Python 3.13
+ * skip-some-attributes.patch
+
+-------------------------------------------------------------------
New:
----
skip-some-attributes.patch
BETA DEBUG BEGIN:
New:- Cherry-pick patch from Fedora to fix testsuite with Python 3.13
* skip-some-attributes.patch
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-frozenlist.spec ++++++
--- /var/tmp/diff_new_pack.J5VgMJ/_old 2024-08-01 22:03:20.097758169 +0200
+++ /var/tmp/diff_new_pack.J5VgMJ/_new 2024-08-01 22:03:20.097758169 +0200
@@ -27,6 +27,8 @@
Patch1: no-pytest-cov.patch
# PATCH-FIX-OPENSUSE - avoid embedding random tmp dir in .so
Patch2: reproducible.patch
+# PATCH-FIX-UPSTREAM gh#aio-libs/frozenlist#588 - Skip some attributes when testing
+Patch3: skip-some-attributes.patch
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module devel >= 3.8}
BuildRequires: %{python_module expandvars}
++++++ skip-some-attributes.patch ++++++
From c6e8550ff462a6e299df35a935d2ffbf2777894e Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma(a)redhat.com>
Date: Thu, 30 May 2024 10:46:25 +0200
Subject: [PATCH] Skip some attributes when testing
---
tests/test_frozenlist.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/test_frozenlist.py b/tests/test_frozenlist.py
index 403d3ec..90ea84b 100644
--- a/tests/test_frozenlist.py
+++ b/tests/test_frozenlist.py
@@ -11,7 +11,7 @@ from frozenlist import FrozenList, PyFrozenList
class FrozenListMixin:
FrozenList = NotImplemented
- SKIP_METHODS = {"__abstractmethods__", "__slots__"}
+ SKIP_METHODS = {"__abstractmethods__", "__slots__", "__static_attributes__", "__firstlineno__"}
def test_subclass(self) -> None:
assert issubclass(self.FrozenList, MutableSequence)
--
2.44.0
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package benchmark for openSUSE:Factory checked in at 2024-08-01 22:03:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/benchmark (Old)
and /work/SRC/openSUSE:Factory/.benchmark.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "benchmark"
Thu Aug 1 22:03:14 2024 rev:24 rq:1190505 version:1.8.5
Changes:
--------
--- /work/SRC/openSUSE:Factory/benchmark/benchmark.changes 2024-01-25 18:39:21.938715142 +0100
+++ /work/SRC/openSUSE:Factory/.benchmark.new.7232/benchmark.changes 2024-08-01 22:03:16.233598780 +0200
@@ -1,0 +2,204 @@
+Tue Jul 30 09:23:50 UTC 2024 - Martin Pluskal <mpluskal(a)suse.com>
+
+- Update to version 1.8.5:
+ * preparing for v1.8.5
+ * clang format yet again
+ * update actions/checkout to v4
+ * another reversal of something that breaks on wasm
+ * clang format header fixes
+ * clang-format fixes
+ * roll back fatal error that breaks some platform (wasm) expectations
+ * revert perf counters change until we can do the full version
+ * remove old travis config
+ * [FR] Add API to provide custom profilers #1807 (#1809)
+ * Clarify the difference between `BENCHMARK_TEMPLATE_F` and `BENCHMARK_TEMPLATE_DEFINE_F` + `BENCHMARK_REGISTER_F` (#1815)
+ * add PERF_FORMAT_TOTAL_TIME_{ENABLED,RUNNING} to support multiplexing (#1814)
+ * Add -lkstat to the .pc for Solaris (#1801)
+ * Find libpfm dependency in installed CMake configs (#1806)
+ * [bazel] Use `includes` instead of `strip_include_prefix` (#1803)
+ * cycleclock: Fix type conversion to match function return type on riscv64 (#1802)
+ * Bump minimum required C++ version from C++11 to C++14 (#1800)
+ * bump standard to C++14 (#1799)
+ * cycleclock: Fix type conversion to match function return type (#1794)
+ * CMake: unbreak version handling for tarballs (#1793)
+ * hotfix: Correct pypi-publishing action tag to v1.8.14 (#1791)
+ * Improve compatibility with Hexagon hardware (#1785)
+ * preparing for v1.8.4 (#1788)
+ * Modernize wheel building job config (#1783)
+ * Switch git override to stable BCR tag for nanobind_bazel (#1778)
+ * Add `benchmark_main.pc` to link `main()` containing library (#1779)
+ * Refactor: Return frequency as double (#1782)
+ * Remove COMPILER_IBMXL macro for z/OS (#1777)
+ * Fix OpenBSD build (#1772)
+ * allow BENCHMARK_VERSION to be undefined (#1769)
+ * clang-tidy broke the world (#1766)
+ * Fix implicit conversion changes signess warning in perf_counters.cc (#1765)
+ * Add Python bindings build using bzlmod (#1764)
+ * mitigate clang build warnings -Wconversion (#1763)
+ * Fixed LTO issue on no discard variable (#1761)
+ * Revert "fix some warnings" (#1762)
+ * fix some warnings
+ * Rewrite complexity_test to use (hardcoded) manual time (#1757)
+ * sysinfo.cc: Always abort on GetNumCPUs failure (#1756)
+ * CycleClock: Add support for Alpha architecture (#1753)
+ * fix typo in GetBenchmarkVersion() (#1755)
+ * Deflake CI (#1751)
+ * Add `BENCHMARK_TEMPLATE[12]_CAPTURE`, fusion of `BENCHMARK_CAPTURE` and `BENCHMARK_TEMPLATE` (#1747)
+ * set library version in bazel (#1746)
+ * Output library / schema versions in JSON context block (#1742)
+ * ignore new bzlmod lock file
+ * changes to run bazel migration scripts
+ * Bump pre-commit dependencies (#1740)
+ * Fix C-style typecasting in QNX-specific code (#1739)
+ * Docs: `reducing_variance.md`: proofreading, fix typos (#1736)
+ * fix(cmakelists.txt): enforce CMake to find PFM or fail when BENCHMARK_ENABLE_LIBPFM is ON (#1705)
+ * Issue 1734: Streams not flushed if not running actual benchmarks (#1735)
+ * tools/compare: don't actually discard valid (but zero) `pvalue` (#1733)
+ * Issue1731 created console does not receive output (#1732)
+ * Change Fixture to use non-const SetUp and TearDown in example (#1723)
+ * Avoid leaking LFS flags to reverse dependencies (#1730)
+ * style: re-format BUILD file with buildifier.
+ * fix per-thread timing error on z/OS (#1719)
+ * Enable Large-file Support (#1726)
+ * CycleClock: use RDTIME instead of RDCYCLE on RISC-V (#1727)
+ * Update perf_counters_gtest.cc (#1728)
+ * Fix division by zero for low frequency timers for CV statistics (#1724)
+ * fix: fail to import gbench in bazel and python3.12
+ * define HOST_NAME_MAX for z/oS (#1717)
+ * Fix mis-matching argument in closing tag for cmake macro (#1714) (#1715)
+ * Check out repo at depth 0 for Python tests, bump Python and PyPI actions (#1713)
+ * Run `pre-commit autoupdate`, fix stale pyproject.toml comments (#1712)
+ * Upgrade core bazel dependencies (#1711)
+ * Fix editable install by unsetting `build_ext.copy_extensions_to_source` (#1710)
+ * [NFC] `complexity_n` is not of `IterationCount` type (#1709)
+ * Fix `pre-commit` GitHub Actions job (#1708)
+ * Support windows MSYS2 environments (#1704)
+ * [CI] Try to fix sanitizer builds by pinning the LLVM revision (#1703)
+ * Fix CMakeLists.txt for perf_counters_test (#1701)
+ * Add missing `\n` character at end of error log string (#1700)
+ * Switch out black for ruff format (#1698)
+ * Fixed compiler warnings (#1697)
+ * Fix unit tests compilation with non-gnu / non-msvc compilers with c++11 support. (#1691)
+ * Add `setuptools_scm` for dynamic zero-config Python versioning (#1690)
+ * Drop isort hook for ruff builtin import sorting (#1689)
+ * Add pre-commit config and GitHub Actions job (#1688)
+ * [bindings] Add LTO builds on Windows+MSVC (#1687)
+ * Reapply size optimizations for clang & MSVC, LTO for Mac+Linux (#1685)
+ * Change nanobind linkage to response file approach on macOS (#1638)
+ * Add Python 3.12 support (#1676)
+ * Add no-unititialized to tests (#1683)
+ * Set -Wno-unused-variable for tests (#1682)
+ * Increase the kMaxIterations limit (#1668)
+ * fix format in src/sysinfo
+ * add name to clang format job
+ * Fix building on MinGW: default `WINVER` is too old (#1681)
+ * Update bazel.yml (#1671)
+ * correct cli param in docs
+ * Make json and csv output consistent. (#1662)
+ * Audit MSVC references in cmake files to consider clang++ (#1669)
+ * bump version to 1.8.3
+ * tweak comment wording
+ * StatisticsMedian: Fix bug
+ * test: Use gtest_main only when needed (#1657)
+ * perf_counters: Initialize once only when needed (#1656)
+ * State: Initialize counters with kAvgIteration in constructor (#1652)
+ * perf-counters: Make tests pass on Android (#1653)
+ * add logo to github pages
+ * add black icon
+ * remove logo from generated docs
+ * remove icon from main README
+ * update logo path
+ * adding a logo to the docs
+ * benchmark.cc: Fix benchmarks_with_threads condition (#1651)
+ * sysinfo.cc: Call getloadavg for Android API >= 29 (#1) (#1649)
+ * [perf-counters] Fix pause/resume (#1643)
+ * fix: added benchmark_counters_tabular for file (#1645)
+ * Fix IntelLLVM compiler error (#1644)
+ * bug: Inconsistent suffixes console reporter 1009 (#1631)
+ * Mark internal deps as dev_depenencies so that downstream modules don't require those. (#1640)
+ * Fix `-Werror,-Wold-style-cast` build failure on Windows. (#1637)
+ * Re-enable windows-latest tests for newer Bazel (#1641)
+ * Update bzlmod support to new rules_python extension API (#1633)
+ * Delete unused requirements file, simplify nanobind build file (#1635)
+ * Add tests for Human Readable functionality (#1632)
+ * Downgrade bazel to windows-2019 (#1629)
+ * Bump scipy from 1.5.4 to 1.10.0 in /tools (#1630)
+ * Bump `nanobind` to stable v1.4.0 tag (#1626)
+ * missing cmake include
+ * add back package properties for PFM
+ * pfm: Use a more standard CMake approach for finding libpfm (#1628)
+ * Add pyproject.toml file for PEP518 compliance (#1625)
+ * Update tools.md for missing color meaning issue #1491 (#1624)
+ * Fix broken PFM-enabled tests (#1623)
+ * bump version to 1.8.2 ready for release
+ * Fix passing non-const lvalue refs to DoNotOptimize (#1622)
+ * Add more terminals with color support (#1621)
+ * Add discord server link to README
+ * bump version to 1.8.1 pre release
+ * Suppress intentional potential memory leak as detected by clang static analysis (#1618)
+ * Add a CI test for the new bzlmod integration (#1617)
+ * Add support for bzlmod (excluding Python bindings) (#1615)
+ * remove old-style (C-style) casts (#1614)
+ * Fix a typo in regex choice (#1610)
+ * Fix pass rvalue to DoNotOptimize (#1608)
+ * Add project name to version message
+ * Fixed a typo in docs (#1600)
+ * Update Python version to PY3, as indicated by the actual source file. (#1598)
+ * Fix code triggering -Wsign-conversion (#1596)
+ * Disable debug-only test in release builds to avoid expected failures. (#1595)
+ * update version to v1.8.0
+ * reenable msan sanitizer workflow (#1589)
+ * Guard NOMINMAX to prevent redefinition error (#1581) (#1582)
+ * Correct libpfm dep for integrators. (#1579)
+ * Fix compile warnings about ignoring a [[nodiscard]] type. (#1577)
+ * make libpfm dep work for integrators
+ * use 'new_git_repository' in external deps call to work with older bazel versions
+ * link to benchmark directly for tests that aren't link_main_test (#1576)
+ * Convert uses of `const char*` to `std::string` (#1567)
+ * add '@' to correctly reference build file for libpfm (#1575)
+ * Address warnings on NVIDIA nvc++ (#1573)
+ * simplify setting C++ standard
+ * [FR] Provide public accessors to benchmark name and arguments #1551 (#1563)
+ * use std::string for skip messages (#1571)
+ * [FR] state.SkipWithMessage #963 (#1564)
+ * Fix build break with nvc++ when -Werror is ON (#1569)
+ * Fix examples in user guide using deprecated `DoNotOptimize`-API (#1568)
+ * Bump nanobind to stable v0.2.0, change linker options (#1565)
+ * Refactoring of PerfCounters infrastructure (#1559)
+ * get rid of warnings in tests (#1562)
+ * Filter performance counter names, not invalidate all (#1554)
+ * Implement unlimited number of performance counters (#1552)
+ * add compiler to build-and-test and create min-cmake CI bot (#1550)
+ * Fix CPU frequency estimation on riscv (#1549)
+ * cleanup: support CMake >= 3.10 (#1544)
+ * Werror all the time (#1546)
+ * Add missing parentheses in ParseBenchMinTime() (#1545)
+ * Removing warnings appearing with C++20 / CLang 15 (#1542)
+ * update github actions to latest versions (#1541)
+ * replace complexity with simplicity for faster libc++ setup (#1539)
+ * Refactor links which include "master" and change it to "main" (#1540)
+ * Allow specifying number of iterations via --benchmark_min_time. (#1525)
+ * Support --benchmarks_filter in the compare.py 'benchmarks' command (#1486)
+ * get rid of some deprecation warnings from tests
+ * fix #1446 by removing the address operator (#1538)
+ * Fixing issue with ARM64EC and MSVC (#1514)
+ * Deprecate constant reference API to DoNotOptimize. (#1493)
+ * remove best effort support for ubuntu 18.04 (#1537)
+ * try disabling liquid for jekyll to fix curly braces (#1536)
+ * Switch bindings implementation to `nanobind` (#1526)
+ * Modernize setup.py, extend Python bindings CI (#1535)
+ * Add quick instructions on how to enable sans checks (#1529)
+ * Fix Clang-Tidy warnings readability-else-after-return (#1528)
+ * Include the benchmark's family-name in State (#1511)
+ * Fix typos found by codespell (#1519)
+ * Fix Clang-Tidy warnings related to modernize-use-override (#1523)
+ * Bug fix variable 'actual_iterations' set but not used (#1517)
+ * add more docs to index
+ * Add a `benchmark_deps.bzl` function to Google Benchmark (#1520)
+ * Try removing attempt to set the C++ standard (#1464)
+ * Fixes incorrect wide string conversion on win32 (#1516)
+ * Return option benchmark_perf_counters to help output (#1508)
+ * Removed deprecated function (#1506)
+- Drop no longer needed gcc12-disable-Werror=maybe-uninitialized.patch
+
+-------------------------------------------------------------------
Old:
----
benchmark-1.7.1.obscpio
gcc12-disable-Werror=maybe-uninitialized.patch
New:
----
benchmark-1.8.5.obscpio
BETA DEBUG BEGIN:
Old: * Removed deprecated function (#1506)
- Drop no longer needed gcc12-disable-Werror=maybe-uninitialized.patch
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ benchmark.spec ++++++
--- /var/tmp/diff_new_pack.kSgdaE/_old 2024-08-01 22:03:17.457649270 +0200
+++ /var/tmp/diff_new_pack.kSgdaE/_new 2024-08-01 22:03:17.461649435 +0200
@@ -19,13 +19,12 @@
%define soname lib%{name}
%define sover 1
Name: benchmark
-Version: 1.7.1
+Version: 1.8.5
Release: 0
Summary: A microbenchmark support library
License: Apache-2.0
URL: https://github.com/google/benchmark
Source: %{name}-%{version}.tar.gz
-Patch0: gcc12-disable-Werror=maybe-uninitialized.patch
BuildRequires: cmake >= 3.5.1
BuildRequires: gcc-c++
BuildRequires: git-core
@@ -80,8 +79,7 @@
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{_builddir}/%{name}-%{version}/build/src/
%ctest
-%post -n %{soname}%{sover} -p /sbin/ldconfig
-%postun -n %{soname}%{sover} -p /sbin/ldconfig
+%ldconfig_scriptlets -n %{soname}%{sover}
%files -n %{soname}%{sover}
%license LICENSE
@@ -95,6 +93,7 @@
%dir %{_libdir}/cmake/%{name}
%{_libdir}/cmake/%{name}/*.cmake
%{_libdir}/pkgconfig/%{name}.pc
+%{_libdir}/pkgconfig/%{name}_main.pc
%{_libdir}/%{soname}.so
%{_libdir}/%{soname}_main.so
%{_includedir}/%{name}
++++++ _service ++++++
--- /var/tmp/diff_new_pack.kSgdaE/_old 2024-08-01 22:03:17.517651745 +0200
+++ /var/tmp/diff_new_pack.kSgdaE/_new 2024-08-01 22:03:17.521651910 +0200
@@ -1,7 +1,7 @@
<services>
- <service name="obs_scm" mode="disabled">
- <param name="revision">v1.7.1</param>
- <param name="versionformat">1.7.1</param>
+ <service name="obs_scm" mode="manual">
+ <param name="revision">v1.8.5</param>
+ <param name="versionformat">1.8.5</param>
<param name="url">https://github.com/google/benchmark.git</param>
<param name="scm">git</param>
<param name="changesgenerate">enable</param>
@@ -12,7 +12,7 @@
<param name="compression">gz</param>
<param name="file">*.tar</param>
</service>
- <service name="set_version" mode="disabled">
+ <service name="set_version" mode="manual">
<param name="file">benchmark.spec</param>
</service>
</services>
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.kSgdaE/_old 2024-08-01 22:03:17.541652735 +0200
+++ /var/tmp/diff_new_pack.kSgdaE/_new 2024-08-01 22:03:17.545652900 +0200
@@ -1,6 +1,6 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/google/benchmark.git</param>
- <param name="changesrevision">d572f4777349d43653b21d6c2fc63020ab326db2</param></service></servicedata>
+ <param name="changesrevision">a6ad7fbbdc2e14fab82bb8a6d27760d700198cbf</param></service></servicedata>
(No newline at EOF)
++++++ benchmark-1.7.1.obscpio -> benchmark-1.8.5.obscpio ++++++
++++ 11821 lines of diff (skipped)
++++++ benchmark.obsinfo ++++++
--- /var/tmp/diff_new_pack.kSgdaE/_old 2024-08-01 22:03:17.733660655 +0200
+++ /var/tmp/diff_new_pack.kSgdaE/_new 2024-08-01 22:03:17.737660820 +0200
@@ -1,5 +1,5 @@
name: benchmark
-version: 1.7.1
-mtime: 1668175263
-commit: d572f4777349d43653b21d6c2fc63020ab326db2
+version: 1.8.5
+mtime: 1721297584
+commit: a6ad7fbbdc2e14fab82bb8a6d27760d700198cbf
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-gast for openSUSE:Factory checked in at 2024-08-01 22:03:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-gast (Old)
and /work/SRC/openSUSE:Factory/.python-gast.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-gast"
Thu Aug 1 22:03:14 2024 rev:12 rq:1189024 version:0.6.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-gast/python-gast.changes 2024-07-02 18:14:42.423593071 +0200
+++ /work/SRC/openSUSE:Factory/.python-gast.new.7232/python-gast.changes 2024-08-01 22:03:15.213556705 +0200
@@ -1,0 +2,17 @@
+Mon Jul 22 09:49:36 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz(a)suse.com>
+
+- Update to 0.6.0
+ * Harmonize gast.dump behavior across versions, following py3.13 behavior
+- from version 0.5.5
+ * Provide a bug and security bug section in the README
+ * Upgrade to py3.13 support
+ * Slightly speedup gast node creation
+ * Document ExceptHandler.name change
+ * Optimize node constructors
+ * Update unparser for py 3.12 and setup minimal testing
+ * Reflect AST changes to README
+ * Support py 3.12 type parameters
+ * Update CI configuration for python 3.12 (and 2.7!)
+ * Support Type aliases from Python 3.12
+
+-------------------------------------------------------------------
Old:
----
gast-0.5.4.tar.gz
New:
----
gast-0.6.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-gast.spec ++++++
--- /var/tmp/diff_new_pack.K4tSDV/_old 2024-08-01 22:03:15.909585415 +0200
+++ /var/tmp/diff_new_pack.K4tSDV/_new 2024-08-01 22:03:15.909585415 +0200
@@ -20,7 +20,7 @@
%define srcname gast
Name: python-gast
# only update when python-pythran is compatible
-Version: 0.5.4
+Version: 0.6.0
Release: 0
Summary: Python AST that abstracts the underlying Python version
License: BSD-3-Clause
++++++ gast-0.5.4.tar.gz -> gast-0.6.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/.github/workflows/core.yml new/gast-0.6.0/.github/workflows/core.yml
--- old/gast-0.5.4/.github/workflows/core.yml 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/.github/workflows/core.yml 2024-06-27 22:30:35.000000000 +0200
@@ -11,7 +11,7 @@
build:
strategy:
matrix:
- python-version: ["2.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13.0-beta.1"]
include:
- python-version: 3.6
os: ubuntu-20.04
@@ -26,6 +26,7 @@
- name: Install dependencies
run: |
python -m pip install --upgrade pip
+ pip install setuptools
pip install pytest
- name: Setup
run: |
@@ -33,3 +34,24 @@
- name: Testing sequential
run: |
pytest
+
+
+ build-27:
+ runs-on: ubuntu-20.04
+ container:
+ image: python:2.7.18-buster
+ env:
+ py27: 2.7
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install pytest
+ - name: Setup
+ run: |
+ python setup.py install
+ - name: Testing sequential
+ run: |
+ pytest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/README.rst new/gast-0.6.0/README.rst
--- old/gast-0.5.4/README.rst 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/README.rst 2024-06-27 22:30:35.000000000 +0200
@@ -64,6 +64,9 @@
notable exception of ``ast.arg`` being replaced by an ``ast.Name`` with an
``ast.Param`` context.
+The ``name`` field of ``ExceptHandler`` is represented as an ``ast.Name`` with
+an ``ast.Store`` context and not a ``str``.
+
For minor version before 3.9, please note that ``ExtSlice`` and ``Index`` are
not used.
@@ -138,20 +141,22 @@
stmt = FunctionDef(identifier name, arguments args,
stmt* body, expr* decorator_list, expr? returns,
- string? type_comment)
+ string? type_comment, type_param* type_params)
| AsyncFunctionDef(identifier name, arguments args,
stmt* body, expr* decorator_list, expr? returns,
- string? type_comment)
+ string? type_comment, type_param* type_params)
| ClassDef(identifier name,
expr* bases,
keyword* keywords,
stmt* body,
- expr* decorator_list)
+ expr* decorator_list,
+ type_param* type_params)
| Return(expr? value)
| Delete(expr* targets)
| Assign(expr* targets, expr value, string? type_comment)
+ | TypeAlias(expr name, type_param* type_params, expr value)
| AugAssign(expr target, operator op, expr value)
-- 'simple' indicates that we annotate simple name without parens
| AnnAssign(expr target, expr annotation, expr? value, int simple)
@@ -278,4 +283,22 @@
attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
type_ignore = TypeIgnore(int lineno, string tag)
+
+ type_param = TypeVar(identifier name, expr? bound)
+ | ParamSpec(identifier name)
+ | TypeVarTuple(identifier name)
+ attributes (int lineno, int col_offset, int end_lineno, int end_col_offset)
}
+
+
+Reporting Bugs
+--------------
+
+Bugs can be reported through `GitHub issues <https://github.com/serge-sans-paille/gast/issues>`_.
+
+Reporting Security Issues
+-------------------------
+
+If for some reason, you think your bug is security-related and should be subject
+to responsible disclosure, don't hesitate to `contact the maintainer
+<mailto:serge.guelton@telecom-bretagne.eu>`_ directly.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/SECURITY.rst new/gast-0.6.0/SECURITY.rst
--- old/gast-0.5.4/SECURITY.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/gast-0.6.0/SECURITY.rst 2024-06-27 22:30:35.000000000 +0200
@@ -0,0 +1,7 @@
+Reporting Security Issues
+-------------------------
+
+If for some reason, you think your bug is security-related and should be subject
+to responsible disclosure, don't hesitate to `contact the maintainer
+<mailto:serge.guelton@telecom-bretagne.eu>`_ directly.
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/gast/__init__.py new/gast-0.6.0/gast/__init__.py
--- old/gast-0.5.4/gast/__init__.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/gast/__init__.py 2024-06-27 22:30:35.000000000 +0200
@@ -1,3 +1,3 @@
from .gast import *
from .version import __version__
-from ast import NodeVisitor, NodeTransformer, iter_fields, dump
+from ast import NodeVisitor, NodeTransformer, iter_fields
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/gast/ast2.py new/gast-0.6.0/gast/ast2.py
--- old/gast-0.5.4/gast/ast2.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/gast/ast2.py 2024-06-27 22:30:35.000000000 +0200
@@ -22,6 +22,7 @@
self._visit(node.decorator_list),
None, # returns
None, # type_comment
+ [], # type_params
)
gast.copy_location(new_node, node)
new_node.end_lineno = new_node.end_col_offset = None
@@ -34,6 +35,7 @@
[], # keywords
self._visit(node.body),
self._visit(node.decorator_list),
+ [], # type_params
)
gast.copy_location(new_node, node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/gast/ast3.py new/gast-0.6.0/gast/ast3.py
--- old/gast-0.5.4/gast/ast3.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/gast/ast3.py 2024-06-27 22:30:35.000000000 +0200
@@ -82,6 +82,7 @@
self._visit(node.decorator_list),
self._visit(node.returns),
None, # type_comment
+ [], # type_params
)
return gast.copy_location(new_node, node)
@@ -93,6 +94,7 @@
self._visit(node.decorator_list),
self._visit(node.returns),
None, # type_comment
+ [], # type_params
)
return gast.copy_location(new_node, node)
@@ -223,6 +225,31 @@
)
return ast.copy_location(new_node, node)
+ if 8 <= sys.version_info.minor < 12:
+ def visit_FunctionDef(self, node):
+ new_node = gast.FunctionDef(
+ self._visit(node.name),
+ self._visit(node.args),
+ self._visit(node.body),
+ self._visit(node.decorator_list),
+ self._visit(node.returns),
+ self._visit(node.type_comment),
+ [], # type_params
+ )
+ return gast.copy_location(new_node, node)
+
+ def visit_AsyncFunctionDef(self, node):
+ new_node = gast.AsyncFunctionDef(
+ self._visit(node.name),
+ self._visit(node.args),
+ self._visit(node.body),
+ self._visit(node.decorator_list),
+ self._visit(node.returns),
+ self._visit(node.type_comment),
+ [], # type_params
+ )
+ return gast.copy_location(new_node, node)
+
class GAstToAst3(GAstToAst):
if sys.version_info.minor < 10:
@@ -423,6 +450,41 @@
self._visit(node.keywords),
)
return ast.copy_location(new_node, node)
+ if 5 <= sys.version_info.minor < 12:
+ def visit_ClassDef(self, node):
+ new_node = ast.ClassDef(
+ self._visit(node.name),
+ self._visit(node.bases),
+ self._visit(node.keywords),
+ self._visit(node.body),
+ self._visit(node.decorator_list),
+ )
+ return ast.copy_location(new_node, node)
+
+ if 8 <= sys.version_info.minor < 12:
+ def visit_FunctionDef(self, node):
+ new_node = ast.FunctionDef(
+ self._visit(node.name),
+ self._visit(node.args),
+ self._visit(node.body),
+ self._visit(node.decorator_list),
+ self._visit(node.returns),
+ self._visit(node.type_comment),
+ )
+ return ast.copy_location(new_node, node)
+
+ def visit_AsyncFunctionDef(self, node):
+ new_node = ast.AsyncFunctionDef(
+ self._visit(node.name),
+ self._visit(node.args),
+ self._visit(node.body),
+ self._visit(node.decorator_list),
+ self._visit(node.returns),
+ self._visit(node.type_comment),
+ )
+ return ast.copy_location(new_node, node)
+
+
def visit_arguments(self, node):
extra_args = [self._make_arg(node.vararg),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/gast/gast.py new/gast-0.6.0/gast/gast.py
--- old/gast-0.5.4/gast/gast.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/gast/gast.py 2024-06-27 22:30:35.000000000 +0200
@@ -17,20 +17,29 @@
pass
+try:
+ from ast import type_param
+except ImportError:
+ class type_param(AST):
+ pass
+
+
def _make_node(Name, Fields, Attributes, Bases):
- NBFields = len(Fields)
+ # This constructor is used a lot during conversion from ast to gast,
+ # then as the primary way to build ast nodes. So we tried to optimized it
+ # for speed and not for readability.
def create_node(self, *args, **kwargs):
- if args:
- if len(args) + len([k for k in kwargs if k in Fields]) != NBFields:
- raise TypeError(
- "{} constructor takes either 0 or {} mandatory arguments".
- format(Name, NBFields))
- for argname, argval in zip(Fields, args):
- setattr(self, argname, argval)
- if kwargs:
- for argname, argval in kwargs.items():
- setattr(self, argname, argval)
+ if len(args) > len(Fields):
+ raise TypeError(
+ "{} constructor takes at most {} positional arguments".
+ format(Name, len(Fields)))
+
+ # it's faster to iterate rather than zipping or enumerate
+ for i in range(len(args)):
+ setattr(self, Fields[i], args[i])
+ if kwargs: # cold branch
+ self.__dict__.update(kwargs)
setattr(_sys.modules[__name__],
Name,
@@ -51,16 +60,16 @@
# stmt
('FunctionDef', (('name', 'args', 'body', 'decorator_list', 'returns',
- 'type_comment'),
+ 'type_comment', 'type_params'),
('lineno', 'col_offset', 'end_lineno', 'end_col_offset',),
(stmt,))),
- ('AsyncFunctionDef', (('name', 'args', 'body',
- 'decorator_list', 'returns',
- 'type_comment'),
+ ('AsyncFunctionDef', (('name', 'args', 'body', 'decorator_list', 'returns',
+ 'type_comment', 'type_params',),
('lineno', 'col_offset',
'end_lineno', 'end_col_offset',),
(stmt,))),
- ('ClassDef', (('name', 'bases', 'keywords', 'body', 'decorator_list',),
+ ('ClassDef', (('name', 'bases', 'keywords', 'body', 'decorator_list',
+ 'type_params',),
('lineno', 'col_offset', 'end_lineno', 'end_col_offset',),
(stmt,))),
('Return', (('value',),
@@ -72,6 +81,9 @@
('Assign', (('targets', 'value', 'type_comment'),
('lineno', 'col_offset', 'end_lineno', 'end_col_offset',),
(stmt,))),
+ ('TypeAlias', (('name', 'type_params', 'value'),
+ ('lineno', 'col_offset', 'end_lineno', 'end_col_offset',),
+ (stmt,))),
('AugAssign', (('target', 'op', 'value',),
('lineno', 'col_offset', 'end_lineno', 'end_col_offset',),
(stmt,))),
@@ -340,8 +352,25 @@
# type_ignore
('type_ignore', ((), ('lineno', 'tag'), (TypeIgnore,))),
+
+ # type_param
+ ('TypeVar', (('name', 'bound',),
+ ('lineno', 'col_offset',
+ 'end_lineno', 'end_col_offset'),
+ (type_param,))),
+ ('ParamSpec', (('name',),
+ ('lineno', 'col_offset',
+ 'end_lineno', 'end_col_offset'),
+ (type_param,))),
+ ('TypeVarTuple', (('name',),
+ ('lineno', 'col_offset',
+ 'end_lineno', 'end_col_offset'),
+ (type_param,))),
)
+
+
+
for name, descr in _nodes:
_make_node(name, *descr)
@@ -440,3 +469,95 @@
if 'end_lineno' in child._attributes:
child.end_lineno = (getattr(child, 'end_lineno', 0) or 0) + n
return node
+
+if _sys.version_info.major == 3 and _sys.version_info.minor >= 13:
+ dump = _ast.dump
+else:
+ # Code import from Lib/ast.py
+ #
+ # minor changes: getattr(x, y, ...) is None => getattr(x, y, 42) is None
+ #
+ def dump(
+ node, annotate_fields=True, include_attributes=False,
+ # *, # removed for compatibility with python2 :-/
+ indent=None, show_empty=False,
+ ):
+ """
+ Return a formatted dump of the tree in node. This is mainly useful for
+ debugging purposes. If annotate_fields is true (by default),
+ the returned string will show the names and the values for fields.
+ If annotate_fields is false, the result string will be more compact by
+ omitting unambiguous field names. Attributes such as line
+ numbers and column offsets are not dumped by default. If this is wanted,
+ include_attributes can be set to true. If indent is a non-negative
+ integer or string, then the tree will be pretty-printed with that indent
+ level. None (the default) selects the single line representation.
+ If show_empty is False, then empty lists and fields that are None
+ will be omitted from the output for better readability.
+ """
+ def _format(node, level=0):
+ if indent is not None:
+ level += 1
+ prefix = '\n' + indent * level
+ sep = ',\n' + indent * level
+ else:
+ prefix = ''
+ sep = ', '
+ if isinstance(node, AST):
+ cls = type(node)
+ args = []
+ args_buffer = []
+ allsimple = True
+ keywords = annotate_fields
+ for name in node._fields:
+ try:
+ value = getattr(node, name)
+ except AttributeError:
+ keywords = True
+ continue
+ if value is None and getattr(cls, name, 42) is None:
+ keywords = True
+ continue
+ if (
+ not show_empty
+ and (value is None or value == [])
+ # Special cases:
+ # `Constant(value=None)` and `MatchSingleton(value=None)`
+ and not isinstance(node, (Constant, MatchSingleton))
+ ):
+ args_buffer.append(repr(value))
+ continue
+ elif not keywords:
+ args.extend(args_buffer)
+ args_buffer = []
+ value, simple = _format(value, level)
+ allsimple = allsimple and simple
+ if keywords:
+ args.append('%s=%s' % (name, value))
+ else:
+ args.append(value)
+ if include_attributes and node._attributes:
+ for name in node._attributes:
+ try:
+ value = getattr(node, name)
+ except AttributeError:
+ continue
+ if value is None and getattr(cls, name, 42) is None:
+ continue
+ value, simple = _format(value, level)
+ allsimple = allsimple and simple
+ args.append('%s=%s' % (name, value))
+ if allsimple and len(args) <= 3:
+ return '%s(%s)' % (node.__class__.__name__, ', '.join(args)), not args
+ return '%s(%s%s)' % (node.__class__.__name__, prefix, sep.join(args)), False
+ elif isinstance(node, list):
+ if not node:
+ return '[]', True
+ return '[%s%s]' % (prefix, sep.join(_format(x, level)[0] for x in node)), False
+ return repr(node), True
+
+ if not isinstance(node, AST):
+ raise TypeError('expected AST, got %r' % node.__class__.__name__)
+ if indent is not None and not isinstance(indent, str):
+ indent = ' ' * indent
+ return _format(node)[0]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/gast/unparser.py new/gast-0.6.0/gast/unparser.py
--- old/gast-0.5.4/gast/unparser.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/gast/unparser.py 2024-06-27 22:30:35.000000000 +0200
@@ -412,6 +412,8 @@
self.fill("@")
self.traverse(deco)
self.fill("class " + node.name)
+ if hasattr(node, "type_params"):
+ self._type_params_helper(node.type_params)
with self.delimit_if("(", ")", condition = node.bases or node.keywords):
comma = False
for e in node.bases:
@@ -443,6 +445,8 @@
self.traverse(deco)
def_str = fill_suffix + " " + node.name
self.fill(def_str)
+ if hasattr(node, "type_params"):
+ self._type_params_helper(node.type_params)
with self.delimit("(", ")"):
self.traverse(node.args)
if node.returns:
@@ -451,6 +455,30 @@
with self.block(extra=self.get_type_comment(node)):
self._write_docstring_and_traverse_body(node)
+ def _type_params_helper(self, type_params):
+ if type_params is not None and len(type_params) > 0:
+ with self.delimit("[", "]"):
+ self.interleave(lambda: self.write(", "), self.traverse, type_params)
+
+ def visit_TypeVar(self, node):
+ self.write(node.name)
+ if node.bound:
+ self.write(": ")
+ self.traverse(node.bound)
+
+ def visit_TypeVarTuple(self, node):
+ self.write("*" + node.name)
+
+ def visit_ParamSpec(self, node):
+ self.write("**" + node.name)
+
+ def visit_TypeAlias(self, node):
+ self.fill("type ")
+ self.traverse(node.name)
+ self._type_params_helper(node.type_params)
+ self.write(" = ")
+ self.traverse(node.value)
+
def visit_For(self, node):
self._for_helper("for ", node)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/gast/version.py new/gast-0.6.0/gast/version.py
--- old/gast-0.5.4/gast/version.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/gast/version.py 2024-06-27 22:30:35.000000000 +0200
@@ -1 +1 @@
-__version__ = '0.5.4'
+__version__ = '0.6.0'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/tests/test_api.py new/gast-0.6.0/tests/test_api.py
--- old/gast-0.5.4/tests/test_api.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/tests/test_api.py 2024-06-27 22:30:35.000000000 +0200
@@ -2,6 +2,11 @@
import ast
import gast
+import sys
+
+
+def dump(node):
+ return gast.dump(node, show_empty=True)
class APITestCase(unittest.TestCase):
@@ -33,7 +38,7 @@
def test_dump(self):
code = 'lambda x: x'
tree = gast.parse(code, mode='eval')
- dump = gast.dump(tree)
+ zdump = dump(tree)
norm = ("Expression(body=Lambda(args=arguments(args=[Name("
"id='x', ctx=Param(), "
"annotation=None, type_comment=None)], posonlyargs=[], "
@@ -41,16 +46,16 @@
"defaults=[]), body=Name(id='x', ctx=Load(), "
"annotation=None, type_comment=None)"
"))")
- self.assertEqual(dump, norm)
+ self.assertEqual(zdump, norm)
def test_walk(self):
code = 'x + 1'
tree = gast.parse(code, mode='eval')
- dump = gast.dump(tree)
+ zdump = dump(tree)
norm = ("Expression(body=BinOp(left=Name(id='x', ctx=Load(), "
"annotation=None, type_comment=None), op=Add(), "
"right=Constant(value=1, kind=None)))")
- self.assertEqual(dump, norm)
+ self.assertEqual(zdump, norm)
self.assertEqual(len(list(gast.walk(tree))), 6)
def test_iter_fields(self):
@@ -132,7 +137,8 @@
node1 = gast.Name('id', load, None, None)
node2 = gast.Name('id', load, None, type_comment=None)
with self.assertRaises(TypeError):
- node1 = gast.Name('id')
+ node1 = gast.Name('id', 'ctx', 'annotation', 'type_comment',
+ 'random_field')
for field in gast.Name._fields:
self.assertEqual(getattr(node1, field), getattr(node2, field))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/tests/test_compat.py new/gast-0.6.0/tests/test_compat.py
--- old/gast-0.5.4/tests/test_compat.py 2023-04-29 21:35:43.000000000 +0200
+++ new/gast-0.6.0/tests/test_compat.py 2024-06-27 22:30:35.000000000 +0200
@@ -4,8 +4,16 @@
import sys
+def dump(node):
+ return gast.dump(node, show_empty=True)
+
+
class CompatTestCase(unittest.TestCase):
+ def __init__(self, *args, **kwargs):
+ unittest.TestCase.__init__(self, *args, **kwargs)
+ self.maxDiff = None
+
if sys.version_info.major == 2:
def test_FunctionDef(self):
@@ -23,8 +31,9 @@
"Name(id='y', ctx=Load(), "
"annotation=None, type_comment=None"
")], ctx=Load()))], decorator_list="
- "[], returns=None, type_comment=None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "[], returns=None, type_comment=None, type_params=[])], "
+ "type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
else:
@@ -38,8 +47,9 @@
"), type_comment=None)], posonlyargs="
"[], vararg=None, kwonlyargs=[], kw_defaults=[], kwarg="
"None, defaults=[]), body=[Pass()], decorator_list=[], "
- "returns=None, type_comment=None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "returns=None, type_comment=None, type_params=[])], "
+ "type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_KeywordOnlyArgument(self):
code = 'def foo(*, x=1): pass'
@@ -50,8 +60,9 @@
"(id='x', ctx=Param(), annotation=None, type_comment=None"
")], kw_defaults=[Constant(value=1, kind=None)], kwarg="
"None, defaults=[]), body=[Pass()], decorator_list=[], "
- "returns=None, type_comment=None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "returns=None, type_comment=None, type_params=[])], "
+ "type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
if sys.version_info.minor >= 6:
@@ -67,7 +78,7 @@
"ctx=Load(), annotation=None, type_comment=None), "
"conversion=-1, format_spec=None)]))], "
"type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_JoinedStr(self):
code = 'e = 1; f"e = {e}"'
@@ -82,7 +93,7 @@
"annotation=None, type_comment=None), "
"conversion=-1, format_spec=None)]))], "
"type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
if sys.version_info.minor >= 8:
@@ -94,9 +105,9 @@
"args=[], posonlyargs=[], vararg=None, kwonlyargs=[], "
"kw_defaults=[], kwarg=None, defaults=[]), body=["
"Pass()], decorator_list=[], returns=None, "
- "type_comment=None)], type_ignores="
+ "type_comment=None, type_params=[])], type_ignores="
"[TypeIgnore(lineno=1, tag='[excuse]')])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_PosonlyArgs(self):
code = 'def foo(a, /, b): pass'
@@ -108,9 +119,9 @@
"ctx=Param(), annotation=None, type_comment=None)], "
"vararg=None, kwonlyargs=[], kw_defaults=[], "
"kwarg=None, defaults=[]), body=[Pass()], "
- "decorator_list=[], returns=None, type_comment=None)"
- "], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "decorator_list=[], returns=None, type_comment=None, "
+ "type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_NamedExpr(self):
code = '(x := 1) '
@@ -120,7 +131,7 @@
" ctx=Store(), annotation=None, type_comment=None), "
"value=Constant(value=1, kind=None)))], type_ignores="
"[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
if sys.version_info.minor >= 10:
@@ -135,10 +146,9 @@
"[Expr(value=Constant(value=Ellipsis, kind=None))]"
")])], type_ignores=[])"
)
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_MatchSingleton(self):
- self.maxDiff = None
code = 'match v:\n case None:...'
tree = gast.parse(code)
compile(gast.gast_to_ast(tree), '<test>', 'exec')
@@ -147,7 +157,7 @@
"match_case(pattern=MatchSingleton(value=None), "
"guard=None, body=[Expr(value=Constant(value="
"Ellipsis, kind=None))])])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_MatchSequence(self):
code = 'match v:\n case a, b:...'
@@ -160,7 +170,7 @@
"=None, name='b')]), guard=None, body=[Expr(value"
"=Constant(value=Ellipsis, kind=None))])])], "
"type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_MatchMapping(self):
code = 'match v:\n case {1: a}:...'
@@ -173,7 +183,7 @@
"=None, name='a')], rest=None), guard=None, body="
"[Expr(value=Constant(value=Ellipsis, kind=None))]"
")])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_MatchClass(self):
code = 'match v:\n case Cls(attr=1):...'
@@ -187,7 +197,7 @@
"=[MatchValue(value=Constant(value=1, kind=None))"
"]), guard=None, body=[Expr(value=Constant(value="
"Ellipsis, kind=None))])])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_MatchStar(self):
code = 'match v:\n case [1, *other]:...'
@@ -200,7 +210,7 @@
"MatchStar(name='other')]), guard=None, body="
"[Expr(value=Constant(value=Ellipsis, kind=None)"
")])])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_MatchAs(self):
code = 'match v:\n case 1, other:...'
@@ -213,7 +223,7 @@
"MatchAs(pattern=None, name='other')]), guard=None"
", body=[Expr(value=Constant(value=Ellipsis, kind"
"=None))])])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_MatchOr(self):
code = 'match v:\n case 1 | 2:...'
@@ -226,7 +236,7 @@
"value=Constant(value=2, kind=None))]), guard="
"None, body=[Expr(value=Constant(value=Ellipsis, "
"kind=None))])])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
if sys.version_info.minor >= 11:
@@ -251,7 +261,7 @@
compile(gast.gast_to_ast(tree), '<test>', 'exec')
norm = ("Module(body=[Expr(value=Constant(value=b'0012', "
"kind=None))], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
# common
@@ -263,7 +273,7 @@
"type=Name(id='e', ctx=Load(), annotation=None, "
"type_comment=None), name=None, body=[Pass()])]"
", orelse=[Pass()], finalbody=[])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_TryExceptNamed(self):
code = 'try:pass\nexcept e as f:pass\nelse:pass'
@@ -274,7 +284,7 @@
"type_comment=None), name=Name(id='f', ctx="
"Store(), annotation=None, type_comment=None), body=[Pass()])]"
", orelse=[Pass()], finalbody=[])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_Raise(self):
codes = ('raise Exception',
@@ -315,10 +325,9 @@
for code, norm in zip(codes, norms):
tree = gast.parse(code)
compile(gast.gast_to_ast(tree), '<test>', 'exec')
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_Call(self):
- self.maxDiff = None
code = 'foo(x, y=1, *args, **kwargs)'
tree = gast.parse(code)
compile(gast.gast_to_ast(tree), '<test>', 'exec')
@@ -331,7 +340,7 @@
"arg='y', value=Constant(value=1, kind=None)), keyword(arg"
"=None, value=Name(id='kwargs', ctx=Load(), annotation=None, "
"type_comment=None))]))], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_With(self):
code = 'with open("any"): pass'
@@ -342,7 +351,7 @@
"type_comment=None), args=[Constant(value='any', "
"kind=None)], keywords=[]), optional_vars=None)], body=["
"Pass()], type_comment=None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_TryFinally(self):
code = 'try:pass\nfinally:pass'
@@ -350,7 +359,7 @@
compile(gast.gast_to_ast(tree), '<test>', 'exec')
norm = ("Module(body=[Try(body=[Pass()], handlers=[], orelse=[], "
"finalbody=[Pass()])], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ self.assertEqual(dump(tree), norm)
def test_star_argument(self):
code = 'def foo(*a): pass'
@@ -361,8 +370,8 @@
"annotation=None, type_comment=None), "
"kwonlyargs=[], kw_defaults=[], kwarg=None, defaults=[]), "
"body=[Pass()], decorator_list=[], returns=None, "
- "type_comment=None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "type_comment=None, type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_keyword_argument(self):
code = 'def foo(**a): pass'
@@ -372,9 +381,9 @@
"posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[], "
"kwarg=Name(id='a', ctx=Param(), annotation=None, "
"type_comment=None), defaults=[]), body=[Pass()], "
- "decorator_list=[], returns=None, type_comment=None)], "
- "type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "decorator_list=[], returns=None, type_comment=None, "
+ "type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_Index(self):
code = 'def foo(a): a[1]'
@@ -386,12 +395,11 @@
", kwarg=None, defaults=[]), body=[Expr(value=Subscript(value="
"Name(id='a', ctx=Load(), annotation=None, type_comment=None)"
", slice=Constant(value=1, kind=None), ctx=Load()"
- "))], decorator_list=[], returns=None, type_comment=None)]"
- ", type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "))], decorator_list=[], returns=None, type_comment=None, "
+ "type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_ExtSlice(self):
- self.maxDiff = None
code = 'def foo(a): a[:,:]'
tree = gast.parse(code)
compile(gast.gast_to_ast(tree), '<test>', 'exec')
@@ -403,11 +411,10 @@
", slice=Tuple(elts=[Slice(lower=None, upper=None, step="
"None), Slice(lower=None, upper=None, step=None)], ctx=Load())"
", ctx=Load()))], decorator_list=[], returns=None, "
- "type_comment=None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "type_comment=None, type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_ExtSlices(self):
- self.maxDiff = None
code = 'def foo(a): a[1,:]'
tree = gast.parse(code)
compile(gast.gast_to_ast(tree), '<test>', 'exec')
@@ -419,11 +426,10 @@
", slice=Tuple(elts=[Constant(value=1, kind="
"None), Slice(lower=None, upper=None, step=None)], ctx=Load())"
", ctx=Load()))], decorator_list=[], returns=None, "
- "type_comment=None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "type_comment=None, type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_Ellipsis(self):
- self.maxDiff = None
code = 'def foo(a): a[...]'
tree = gast.parse(code)
compile(gast.gast_to_ast(tree), '<test>', 'exec')
@@ -433,12 +439,11 @@
", kwarg=None, defaults=[]), body=[Expr(value=Subscript(value="
"Name(id='a', ctx=Load(), annotation=None, type_comment=None)"
", slice=Constant(value=Ellipsis, kind=None), ctx=Load()))], "
- "decorator_list=[], returns=None, type_comment="
- "None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "decorator_list=[], returns=None, type_comment=None, "
+ "type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
def test_ExtSliceEllipsis(self):
- self.maxDiff = None
code = 'def foo(a): a[1, ...]'
tree = gast.parse(code)
compile(gast.gast_to_ast(tree), '<test>', 'exec')
@@ -450,8 +455,8 @@
", slice=Tuple(elts=[Constant(value=1, kind=None)"
", Constant(value=Ellipsis, kind=None)], ctx=Load()), ctx="
"Load()))], decorator_list=[], returns=None, type_comment="
- "None)], type_ignores=[])")
- self.assertEqual(gast.dump(tree), norm)
+ "None, type_params=[])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
if __name__ == '__main__':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/tests/test_py3_12.py new/gast-0.6.0/tests/test_py3_12.py
--- old/gast-0.5.4/tests/test_py3_12.py 1970-01-01 01:00:00.000000000 +0100
+++ new/gast-0.6.0/tests/test_py3_12.py 2024-06-27 22:30:35.000000000 +0200
@@ -0,0 +1,71 @@
+import unittest
+
+import ast
+import gast
+import sys
+
+def dump(node):
+ return gast.dump(node, show_empty=True)
+
+
+class Python3_12TestCase(unittest.TestCase):
+
+ def __init__(self, *args, **kwargs):
+ unittest.TestCase.__init__(self, *args, **kwargs)
+ self.maxDiff = None
+
+ def test_type_alias(self):
+ code = "type Point = tuple[float, float]"
+ tree = gast.parse(code)
+ compile(gast.gast_to_ast(tree), '<test>', 'exec')
+ norm = ("Module(body=[TypeAlias(name=Name(id='Point', ctx=Store(),"
+ " annotation=None, type_comment=None), type_params=[], "
+ "value=Subscript(value=Name(id='tuple', ctx=Load(), "
+ "annotation=None, type_comment=None), slice=Tuple(elts=["
+ "Name(id='float', ctx=Load(), annotation=None, "
+ "type_comment=None), Name(id='float', ctx=Load(), "
+ "annotation=None, type_comment=None)], ctx=Load()), "
+ "ctx=Load()))], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
+
+ def test_generic_type_alias(self):
+ code = "type Point[T] = tuple[T, float]"
+ tree = gast.parse(code)
+ compile(gast.gast_to_ast(tree), '<test>', 'exec')
+ norm = ("Module(body=[TypeAlias(name=Name(id='Point', ctx=Store(), "
+ "annotation=None, type_comment=None), type_params=[TypeVar("
+ "name='T', bound=None)], value=Subscript(value=Name(id='tuple'"
+ ", ctx=Load(), annotation=None, type_comment=None), "
+ "slice=Tuple(elts=[Name(id='T', ctx=Load(), annotation=None, "
+ "type_comment=None), Name(id='float', ctx=Load(), "
+ "annotation=None, type_comment=None)], ctx=Load()), ctx=Load()"
+ "))], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
+
+ def test_generic_function(self):
+ code = "def foo[T]():..."
+ tree = gast.parse(code)
+ compile(gast.gast_to_ast(tree), '<test>', 'exec')
+ norm = ("Module(body=[FunctionDef(name='foo', args=arguments(args=[], "
+ "posonlyargs=[], vararg=None, kwonlyargs=[], kw_defaults=[], "
+ "kwarg=None, defaults=[]), body=[Expr(value=Constant(value="
+ "Ellipsis, kind=None))], decorator_list=[], returns=None, "
+ "type_comment=None, type_params=[TypeVar(name='T', "
+ "bound=None)])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
+
+ def test_generic_class(self):
+ code = "class foo[T]:..."
+ tree = gast.parse(code)
+ compile(gast.gast_to_ast(tree), '<test>', 'exec')
+ norm = ("Module(body=[ClassDef(name='foo', bases=[], keywords=[], "
+ "body=[Expr(value=Constant(value=Ellipsis, kind=None))], "
+ "decorator_list=[], type_params=[TypeVar(name='T', bound=None)"
+ "])], type_ignores=[])")
+ self.assertEqual(dump(tree), norm)
+
+if sys.version_info < (3, 12):
+ del Python3_12TestCase
+
+if __name__ == '__main__':
+ unittest.main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gast-0.5.4/tests/test_unparser.py new/gast-0.6.0/tests/test_unparser.py
--- old/gast-0.5.4/tests/test_unparser.py 1970-01-01 01:00:00.000000000 +0100
+++ new/gast-0.6.0/tests/test_unparser.py 2024-06-27 22:30:35.000000000 +0200
@@ -0,0 +1,37 @@
+import unittest
+
+import ast
+import gast
+import sys
+
+
+class UnparserTestCase(unittest.TestCase):
+
+ def __init__(self, *args, **kwargs):
+ unittest.TestCase.__init__(self, *args, **kwargs)
+ self.maxDiff = None
+
+ def assertUnparse(self, code):
+ normalized_code = ast.unparse(ast.parse(code))
+ tree = gast.parse(normalized_code)
+ compile(gast.gast_to_ast(tree), '<test>', 'exec')
+ unparsed = gast.unparse(tree)
+ self.assertEqual(normalized_code, unparsed)
+
+ def test_FunctionDef(self):
+ self.assertUnparse('def foo(x, y): return x, y')
+
+ def test_BinaryOp(self):
+ self.assertUnparse('1 + 3')
+
+ if sys.version_info >= (3, 12):
+
+ def test_TypeParameter(self):
+ self.assertUnparse('type x[T] = list[T]')
+
+
+if sys.version_info < (3, 9):
+ del UnparserTestCase
+
+if __name__ == '__main__':
+ unittest.main()
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package livecd-openSUSE for openSUSE:Factory checked in at 2024-08-01 16:15:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/livecd-openSUSE (Old)
and /work/SRC/openSUSE:Factory/.livecd-openSUSE.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "livecd-openSUSE"
Thu Aug 1 16:15:28 2024 rev:250 rq: version:unknown
Changes:
--------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
livecd-leap-kde.kiwi: same change
livecd-leap-x11.kiwi: same change
livecd-leap-xfce.kiwi: same change
livecd-openSUSE.kiwi: same change
livecd-tumbleweed-gnome.kiwi: same change
livecd-tumbleweed-kde.kiwi: same change
livecd-tumbleweed-x11.kiwi: same change
livecd-tumbleweed-xfce.kiwi: same change
++++++ config.sh ++++++
--- /var/tmp/diff_new_pack.K4ds28/_old 2024-08-01 16:15:30.813602206 +0200
+++ /var/tmp/diff_new_pack.K4ds28/_new 2024-08-01 16:15:30.817602372 +0200
@@ -125,7 +125,7 @@
rm -rf /usr/share/doc/packages/*
# zypp solver test cases are not that common on Lives - save some MB
-rm -rf /usr/bin/zypp-NameReqPrv
+rm -rf /usr/bin/zypp-*
# Save more than 150 MiB by removing this, not very useful for lives
rm -rf /lib/firmware/{liquidio,netronome,qed,mrvl,mellanox,cypress,dpaa2,bnx2x,cxgb4,intel/vsc}
1
0
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package livecd-openSUSE for openSUSE:Factory checked in at 2024-08-01 16:00:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/livecd-openSUSE (Old)
and /work/SRC/openSUSE:Factory/.livecd-openSUSE.new.7232 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "livecd-openSUSE"
Thu Aug 1 16:00:21 2024 rev:249 rq: version:unknown
Changes:
--------
--- /work/SRC/openSUSE:Factory/livecd-openSUSE/livecd-openSUSE.changes 2024-05-29 12:52:02.258777258 +0200
+++ /work/SRC/openSUSE:Factory/.livecd-openSUSE.new.7232/livecd-openSUSE.changes 2024-08-01 16:00:22.347944503 +0200
@@ -1,0 +2,6 @@
+Thu Aug 1 13:59:47 UTC 2024 - Dominique Leuenberger <dleuenberger(a)suse.com>
+
+- Force remove zypp-NameReqPrv - statically linked, large binary;
+ only needed for zypp solver test cases.
+
+-------------------------------------------------------------------
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
livecd-leap-kde.kiwi: same change
livecd-leap-x11.kiwi: same change
livecd-leap-xfce.kiwi: same change
livecd-openSUSE.kiwi: same change
livecd-tumbleweed-gnome.kiwi: same change
livecd-tumbleweed-kde.kiwi: same change
livecd-tumbleweed-x11.kiwi: same change
livecd-tumbleweed-xfce.kiwi: same change
++++++ config.sh ++++++
--- /var/tmp/diff_new_pack.csQkCa/_old 2024-08-01 16:00:24.388028724 +0200
+++ /var/tmp/diff_new_pack.csQkCa/_new 2024-08-01 16:00:24.392028890 +0200
@@ -124,6 +124,9 @@
# Some packages really exaggerate here
rm -rf /usr/share/doc/packages/*
+# zypp solver test cases are not that common on Lives - save some MB
+rm -rf /usr/bin/zypp-NameReqPrv
+
# Save more than 150 MiB by removing this, not very useful for lives
rm -rf /lib/firmware/{liquidio,netronome,qed,mrvl,mellanox,cypress,dpaa2,bnx2x,cxgb4,intel/vsc}
if [ "$(arch)" == "aarch64" ]; then
1
0