From c6e418d1744aed95a6f25d22565204649dde29c7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 11 Feb 2026 18:38:23 +0100 Subject: [PATCH 1/2] gh-141563: Enable test_cppext internal C API tests on macOS (#144711) Build the C API in C++11 mode on macOS. --- Lib/test/test_cppext/__init__.py | 14 +++++++++++--- Lib/test/test_cppext/extension.cpp | 5 ++--- Lib/test/test_cppext/setup.py | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_cppext/__init__.py b/Lib/test/test_cppext/__init__.py index 9013503995bdce..1fd01702f64029 100644 --- a/Lib/test/test_cppext/__init__.py +++ b/Lib/test/test_cppext/__init__.py @@ -4,6 +4,7 @@ import shlex import shutil import subprocess +import sys import unittest from test import support @@ -27,9 +28,6 @@ class BaseTests: TEST_INTERNAL_C_API = False - def test_build(self): - self.check_build('_testcppext') - def check_build(self, extension_name, std=None, limited=False): venv_dir = 'env' with support.setup_venv_with_pip_setuptools(venv_dir) as python_exe: @@ -91,6 +89,9 @@ def run_cmd(operation, cmd): class TestPublicCAPI(BaseTests, unittest.TestCase): + def test_build(self): + self.check_build('_testcppext') + @support.requires_gil_enabled('incompatible with Free Threading') def test_build_limited_cpp03(self): self.check_build('_test_limited_cpp03ext', std='c++03', limited=True) @@ -119,6 +120,13 @@ def test_build_cpp14(self): class TestInteralCAPI(BaseTests, unittest.TestCase): TEST_INTERNAL_C_API = True + def test_build(self): + kwargs = {} + if sys.platform == 'darwin': + # Old Apple clang++ default C++ std is gnu++98 + kwargs['std'] = 'c++11' + self.check_build('_testcppext_internal', **kwargs) + if __name__ == "__main__": unittest.main() diff --git a/Lib/test/test_cppext/extension.cpp b/Lib/test/test_cppext/extension.cpp index 06ef997d57af46..92c4645039a03b 100644 --- a/Lib/test/test_cppext/extension.cpp +++ b/Lib/test/test_cppext/extension.cpp @@ -16,9 +16,8 @@ #ifdef TEST_INTERNAL_C_API // gh-135906: Check for compiler warnings in the internal C API # include "internal/pycore_frame.h" - // mimalloc emits compiler warnings when Python is built on Windows - // and macOS. -# if !defined(MS_WINDOWS) && !defined(__APPLE__) + // mimalloc emits compiler warnings on Windows. +# if !defined(MS_WINDOWS) # include "internal/pycore_backoff.h" # include "internal/pycore_cell.h" # endif diff --git a/Lib/test/test_cppext/setup.py b/Lib/test/test_cppext/setup.py index a3eec1c67e1556..2d9052a6b879da 100644 --- a/Lib/test/test_cppext/setup.py +++ b/Lib/test/test_cppext/setup.py @@ -59,7 +59,7 @@ def main(): else: cppflags.append(f'-std={std}') - if limited or (std != 'c++03'): + if limited or (std != 'c++03') and not internal: # See CPPFLAGS_PEDANTIC docstring cppflags.extend(CPPFLAGS_PEDANTIC) From 3e0322ff16f47caa3e273d453f007d3918b8ac80 Mon Sep 17 00:00:00 2001 From: William Meehan Date: Wed, 11 Feb 2026 15:58:24 -0500 Subject: [PATCH 2/2] gh-84424: Use numeric_changed for UCD.numeric (GH-19457) This was causing ucd_3_2_0.numeric() to pick up only decimal changes between Unicode 3.2.0 and the current version. --- Lib/test/test_unicodedata.py | 8 ++++++-- .../next/Library/2020-04-10-14-29-53.bpo-40243.85HRib.rst | 1 + Modules/unicodedata.c | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2020-04-10-14-29-53.bpo-40243.85HRib.rst diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py index a46ca034f3bfc9..83b94f97c22c9d 100644 --- a/Lib/test/test_unicodedata.py +++ b/Lib/test/test_unicodedata.py @@ -182,10 +182,14 @@ def test_numeric(self): # New in 4.1.0 self.assertEqual(self.db.numeric('\U0001012A', None), None if self.old else 9000) + # Changed in 4.1.0 + self.assertEqual(self.db.numeric('\u5793', None), 1e20 if self.old else None) # New in 5.0.0 self.assertEqual(self.db.numeric('\u07c0', None), None if self.old else 0.0) # New in 5.1.0 self.assertEqual(self.db.numeric('\ua627', None), None if self.old else 7.0) + # Changed in 5.2.0 + self.assertEqual(self.db.numeric('\u09f6'), 3.0 if self.old else 3/16) # New in 6.0.0 self.assertEqual(self.db.numeric('\u0b72', None), None if self.old else 0.25) # New in 12.0.0 @@ -857,9 +861,9 @@ def graphemes(*args): class Unicode_3_2_0_FunctionsTest(unittest.TestCase, BaseUnicodeFunctionsTest): db = unicodedata.ucd_3_2_0 old = True - expectedchecksum = ('f4526159891a4b766dd48045646547178737ba09' + expectedchecksum = ('4154d8d1232837e255edf3cdcbb5ab184d71f4a4' if quicktest else - 'f217b8688d7bdff31db4207e078a96702f091597') + '3aabaf66823b21b3d305dad804a62f6f6387c93e') class UnicodeMiscTest(unittest.TestCase): diff --git a/Misc/NEWS.d/next/Library/2020-04-10-14-29-53.bpo-40243.85HRib.rst b/Misc/NEWS.d/next/Library/2020-04-10-14-29-53.bpo-40243.85HRib.rst new file mode 100644 index 00000000000000..1f48525cdbecd0 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-04-10-14-29-53.bpo-40243.85HRib.rst @@ -0,0 +1 @@ +Fix :meth:`!unicodedata.ucd_3_2_0.numeric` for non-decimal values. diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index 586ce8d36dd46f..091e6bcb9f3f49 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -270,9 +270,9 @@ unicodedata_UCD_numeric_impl(PyObject *self, int chr, have_old = 1; rc = -1.0; } - else if (old->decimal_changed != 0xFF) { + else if (old->numeric_changed != 0.0) { have_old = 1; - rc = old->decimal_changed; + rc = old->numeric_changed; } }