void-packages/srcpkgs/python3-sympy/patches/01.python3.12.patch

28 lines
1.0 KiB
Diff
Raw Normal View History

2023-09-24 03:01:37 +02:00
From 4b82eae46164afb468bb8995d87cbc643dc9e7a6 Mon Sep 17 00:00:00 2001
From: Pablo Galindo <pablogsal@gmail.com>
Date: Fri, 9 Jun 2023 11:22:20 +0100
Subject: [PATCH 1/4] Fix factorial parsing for Python 3.12
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
---
.mailmap | 1 +
sympy/parsing/sympy_parser.py | 5 ++++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/sympy/parsing/sympy_parser.py b/sympy/parsing/sympy_parser.py
index 7e3a0e8067ce..1c89f0d25b9a 100644
--- a/sympy/parsing/sympy_parser.py
+++ b/sympy/parsing/sympy_parser.py
@@ -627,7 +627,10 @@ def factorial_notation(tokens: List[TOKEN], local_dict: DICT, global_dict: DICT)
result: List[TOKEN] = []
nfactorial = 0
for toknum, tokval in tokens:
- if toknum == ERRORTOKEN:
+ if toknum == OP and tokval == "!":
+ # In Python 3.12 "!" are OP instead of ERRORTOKEN
+ nfactorial += 1
+ elif toknum == ERRORTOKEN:
op = tokval
if op == '!':
nfactorial += 1