| 1 |
From: Josenilson Ferreira da Silva <[email protected]> |
| 2 |
Date: Mon, 27 Apr 2025 22:00:00 -0300 |
| 3 |
Subject: Fix compatibility with Python 3.14 |
| 4 |
Forwarded: not-needed |
| 5 |
|
| 6 |
Python 3.14 introduced breaking changes in error messages and internal APIs. |
| 7 |
This patch updates handlers and unpacking to accommodate the new behavior. |
| 8 |
|
| 9 |
--- |
| 10 |
Index: python-friendly-traceback/friendly_traceback/token_utils.py |
| 11 |
=================================================================== |
| 12 |
--- python-friendly-traceback.orig/friendly_traceback/token_utils.py |
| 13 |
+++ python-friendly-traceback/friendly_traceback/token_utils.py |
| 14 |
@@ -297,7 +297,8 @@ def tokenize(source: str) -> List[Token] |
| 15 |
tokens.append(token) |
| 16 |
except IndentationError as e: |
| 17 |
try: |
| 18 |
- _ignore, linenumber, col, line = e.args[1] |
| 19 |
+ # Python 3.14+ expanded IndentationError.args[1] from 4 to 6 elements. |
| 20 |
+ _ignore, linenumber, col, line, *_ = e.args[1] |
| 21 |
type_ = py_tokenize.NAME # Not really relevant what we set here |
| 22 |
# except that ERRORTOKEN would cause problems later on. |
| 23 |
start = (linenumber, col) |