patsy: FTBFS against python 3.15rc1

Maximiliano Curia <[email protected]>
Newsgroups gmane.linux.debian.devel.python
Message-ID <[email protected]>
Package: src:patsy
Version: 1.0.2-1
User: [email protected]
Usertags: python3.15
Tags: patch

Hi!

While rebuilding the python related packages against the Python 3.15rc1
version we found that patsy fails to build from source [1]. 

We found that the necessary fixes have recently been applied in the
upstream repository [2].

I applied the upstream fix in the sandbox [3] to be able to build the
packages that depend on patsy, please consider applying the patch to
support the upcoming 3.15 version.

Happy hacking,

[1]: https://debusine.debian.net/debian/r-python-python3.15/artifact/4446312/
[2]: https://github.com/pydata/patsy/commit/85f23252caf6c36f4ad91f57e3e983751b50d498
[3]: https://debusine.debian.net/debian/r-python-python3.15/

-- 
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
fix-re-scanner-capturing-group.patch (text/x-diff, 985 B)
From 24675f8da0747ad3bfd4da406373054931f1f8ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <[email protected]>
Date: Mon, 27 Apr 2026 14:15:54 +0200
Subject: [PATCH] Fix re.Scanner capturing group for Python 3.15 compatibility

Python 3.15 forbids capturing groups in re.Scanner lexicon patterns.
Convert the capturing group to a non-capturing group in num_re.

Assisted-by: Cursor
---
 patsy/constraint.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/patsy/constraint.py b/patsy/constraint.py
index 6c044144..17ee1dee 100644
--- a/patsy/constraint.py
+++ b/patsy/constraint.py
@@ -187,7 +187,7 @@ def _tokenize_constraint(string, variable_names):
     lparen_re = r"\("
     rparen_re = r"\)"
     op_re = "|".join([re.escape(op.token_type) for op in _ops])
-    num_re = r"[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?"
+    num_re = r"[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?"
     whitespace_re = r"\s+"
 
     # Prefer long matches:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.