https://github.com/python/cpython/commit/4d3e8c1c8512739ea6fafb8f81093dbe59665f3c
commit: 4d3e8c1c8512739ea6fafb8f81093dbe59665f3c
branch: 3.14
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-02-12T08:38:27Z
summary:

[3.14] gh-84424: Use numeric_changed for UCD.numeric (GH-19457) (GH-144731)

This was causing ucd_3_2_0.numeric() to pick up only decimal
changes between Unicode 3.2.0 and the current version.
(cherry picked from commit 3e0322ff16f47caa3e273d453f007d3918b8ac80)

Co-authored-by: William Meehan <[email protected]>

files:
A Misc/NEWS.d/next/Library/2020-04-10-14-29-53.bpo-40243.85HRib.rst
M Lib/test/test_unicodedata.py
M Modules/unicodedata.c

diff --git a/Lib/test/test_unicodedata.py b/Lib/test/test_unicodedata.py
index e98539deb99d20..f66c45d6d4d338 100644
--- a/Lib/test/test_unicodedata.py
+++ b/Lib/test/test_unicodedata.py
@@ -170,10 +170,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
@@ -584,9 +588,9 @@ def test_east_asian_width_unassigned(self):
 class Unicode_3_2_0_FunctionsTest(UnicodeFunctionsTest):
     db = unicodedata.ucd_3_2_0
     old = True
-    expectedchecksum = ('76b126d719d52ba11788a627d058163106da7d56'
+    expectedchecksum = ('4154d8d1232837e255edf3cdcbb5ab184d71f4a4'
                         if quicktest else
-                        'ed843cb7ab5aaf149466498db27fefce81c4214c')
+                        'b0a8df4ce8cf910def4e75f2d03c93defcc9bb09')
 
 
 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 ef8cf3d0d27459..97367aaba21911 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -230,9 +230,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;
         }
     }
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to