From 6c6936ee0b8c8bd75d4dd02c2dd08cdefcbc36db75c23fa9ab86fa4b1edc6a27 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 4 Dec 2024 05:33:50 +0000 Subject: [PATCH] - Add patch support-python-313.patch: * Support Python 3.13's grammar changes. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pegen?expand=0&rev=7 --- python-pegen.changes | 6 ++++ python-pegen.spec | 2 ++ support-python-313.patch | 60 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 support-python-313.patch diff --git a/python-pegen.changes b/python-pegen.changes index 864063d..c30eed2 100644 --- a/python-pegen.changes +++ b/python-pegen.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Dec 4 05:33:17 UTC 2024 - Steve Kowalik + +- Add patch support-python-313.patch: + * Support Python 3.13's grammar changes. + ------------------------------------------------------------------- Wed Feb 21 05:47:35 UTC 2024 - Steve Kowalik diff --git a/python-pegen.spec b/python-pegen.spec index 31bbc5e..7bd8882 100644 --- a/python-pegen.spec +++ b/python-pegen.spec @@ -23,6 +23,8 @@ Summary: CPython's PEG parser generator License: MIT URL: https://github.com/we-like-parsers/pegen Source: https://files.pythonhosted.org/packages/source/p/pegen/pegen-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#we-like-parsers/pegen#104 +Patch0: support-python-313.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools_scm} diff --git a/support-python-313.patch b/support-python-313.patch new file mode 100644 index 0000000..cca1bb7 --- /dev/null +++ b/support-python-313.patch @@ -0,0 +1,60 @@ +From 47ae0a4c96a23bc086c712870ff831f42484bdf5 Mon Sep 17 00:00:00 2001 +From: Daniel Fremont +Date: Wed, 16 Oct 2024 15:37:42 -0700 +Subject: [PATCH 1/2] fix Python grammar to compile under Python 3.13 + +--- + data/python.gram | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/data/python.gram b/data/python.gram +index 4777ebb..5b52b30 100644 +--- a/data/python.gram ++++ b/data/python.gram +@@ -2354,7 +2354,7 @@ invalid_while_stmt[NoReturn]: + ) + } + invalid_for_stmt[NoReturn]: +- | [ASYNC] 'for' star_targets 'in' star_expressions NEWLINE { self.raise_syntax_error("expected ':'") } ++ | ['async'] 'for' star_targets 'in' star_expressions NEWLINE { self.raise_syntax_error("expected ':'") } + | ['async'] a='for' star_targets 'in' star_expressions ':' NEWLINE !INDENT { + self.raise_indentation_error( + f"expected an indented block after 'for' statement on line {a.start[0]}" + +From c46fc0bc0747a7967b7efd88b6f9b290c021d788 Mon Sep 17 00:00:00 2001 +From: Daniel Fremont +Date: Wed, 16 Oct 2024 15:53:27 -0700 +Subject: [PATCH 2/2] update Python classifiers and add 3.13 to CI + +--- + .github/workflows/test.yml | 2 +- + pyproject.toml | 3 +++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml +index b0214c7..f5db48e 100644 +--- a/.github/workflows/test.yml ++++ b/.github/workflows/test.yml +@@ -13,7 +13,7 @@ jobs: + runs-on: ubuntu-latest + strategy: + matrix: +- python-version: ['3.8','3.9','3.10', '3.11', '3.12'] ++ python-version: ['3.8','3.9','3.10', '3.11', '3.12', '3.13'] + steps: + - uses: actions/checkout@v4 + - name: Get history and tags for SCM versioning to work +diff --git a/pyproject.toml b/pyproject.toml +index 1aeb3da..951da71 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -21,6 +21,9 @@ classifiers = [ + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", ++ "Programming Language :: Python :: 3.11", ++ "Programming Language :: Python :: 3.12", ++ "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3 :: Only", + ] + keywords = ["parser", "CPython", "PEG", "pegen"]