14
0
forked from pool/micropython
Files
micropython/fix_re_sub_test_on_python3.13.patch
Dominik Heidler 4c23be5abb - Version 1.26.0
* Added machine.I2CTarget for creating I2C target devices on multiple ports.
  * New MCU support: STM32N6xx (800 MHz, ML accel) & ESP32-C2 (WiFi + BLE).
  * Major float accuracy boost (~28% → ~98%), constant folding in compiler.
  * Optimized native/Viper emitters; reduced heap use for slices.
  * Time functions standardized (1970–2099); new boards across ESP32, SAMD, STM32, Zephyr.
  * ESP32: ESP-IDF 5.4.2, flash auto-detect, PCNT class, LAN8670 PHY.
  * RP2: compressed errors, better lightsleep, hard IRQ timers.
  * Zephyr v4.0.0: PWM, SoftI2C/SPI, BLE runtime services, boot.py/main.py support.
  * mpremote adds fs tree, improved df, portable config paths.
  * Updated lwIP, LittleFS, libhydrogen, stm32lib; expanded hardware/CI tests.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/micropython?expand=0&rev=53
2025-08-15 08:25:38 +00:00

47 lines
1.5 KiB
Diff

From e73cf71a246ee456aac0f4d16167e0856846db6b Mon Sep 17 00:00:00 2001
From: Alessandro Gatti <a.gatti@frob.it>
Date: Sat, 4 Jan 2025 15:00:28 +0100
Subject: [PATCH] tests/extmod/re_sub.py: Fix test execution on Python 3.13.
This commit fixes a test failure for `extmod/re_sub.py` where the code,
whilst being correct, would not make the test pass due to a newer
Python version than expected.
On Python 3.13, running `tests/extmod/re_sub.py` would yield a
deprecation warning about `re.sub` not providing the match count as a
keyword parameter. This warning would be embedded in the expected test
result and thus the test would always fail.
Co-authored-by: stijn <stijn@ignitron.net>
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
---
tests/extmod/re_sub.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tests/extmod/re_sub.py b/tests/extmod/re_sub.py
index 2c7c6c10f1a49..ecaa66d83d8a7 100644
--- a/tests/extmod/re_sub.py
+++ b/tests/extmod/re_sub.py
@@ -10,6 +10,8 @@
print("SKIP")
raise SystemExit
+import sys
+
def multiply(m):
return str(int(m.group(0)) * 2)
@@ -47,7 +49,11 @@ def A():
print(re.sub("a", "b", "c"))
# with maximum substitution count specified
-print(re.sub("a", "b", "1a2a3a", 2))
+if sys.implementation.name != "micropython":
+ # On CPython 3.13 and later the substitution count must be a keyword argument.
+ print(re.sub("a", "b", "1a2a3a", count=2))
+else:
+ print(re.sub("a", "b", "1a2a3a", 2))
# invalid group
try: