[Python-checkins] bpo-42157: Rename unicodedata.ucnhash_CAPI (GH-22994)

vstinner webhook-mailer at python.org
Mon Oct 26 23:36:31 EDT 2020


https://github.com/python/cpython/commit/84f7382215b9e024a5590454726b6ae4b0ca70a0
commit: 84f7382215b9e024a5590454726b6ae4b0ca70a0
branch: master
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2020-10-27T04:36:22+01:00
summary:

bpo-42157: Rename unicodedata.ucnhash_CAPI (GH-22994)

Removed the unicodedata.ucnhash_CAPI attribute which was an internal
PyCapsule object. The related private _PyUnicode_Name_CAPI structure
was moved to the internal C API.

Rename unicodedata.ucnhash_CAPI as unicodedata._ucnhash_CAPI.

files:
A Misc/NEWS.d/next/Library/2020-10-26-23-29-16.bpo-42157.4wuwTe.rst
M Doc/whatsnew/3.10.rst
M Include/internal/pycore_ucnhash.h
M Misc/NEWS.d/next/C API/2020-10-16-10-47-17.bpo-42157.e3BcPM.rst
M Modules/unicodedata.c

diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 2ef2b5d19e585..b2c6d10ba8deb 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -300,6 +300,11 @@ Removed
   Python 3.5.
   (Contributed by Berker Peksag in :issue:`31844`.)
 
+* Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal
+  PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was
+  moved to the internal C API.
+  (Contributed by Victor Stinner in :issue:`42157`.)
+
 
 Porting to Python 3.10
 ======================
@@ -408,7 +413,7 @@ Porting to Python 3.10
   (Contributed by Inada Naoki in :issue:`36346`.)
 
 * The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API
-  ``unicodedata.ucnhash_CAPI`` moves to the internal C API.
+  ``unicodedata.ucnhash_CAPI`` has been moved to the internal C API.
   (Contributed by Victor Stinner in :issue:`42157`.)
 
 Deprecated
diff --git a/Include/internal/pycore_ucnhash.h b/Include/internal/pycore_ucnhash.h
index 5e7c035f81d2a..187dd68e7347f 100644
--- a/Include/internal/pycore_ucnhash.h
+++ b/Include/internal/pycore_ucnhash.h
@@ -11,7 +11,7 @@ extern "C" {
 
 /* revised ucnhash CAPI interface (exported through a "wrapper") */
 
-#define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI"
+#define PyUnicodeData_CAPSULE_NAME "unicodedata._ucnhash_CAPI"
 
 typedef struct {
 
diff --git a/Misc/NEWS.d/next/C API/2020-10-16-10-47-17.bpo-42157.e3BcPM.rst b/Misc/NEWS.d/next/C API/2020-10-16-10-47-17.bpo-42157.e3BcPM.rst
index 1f05186d9e0ef..65a56188fa0ad 100644
--- a/Misc/NEWS.d/next/C API/2020-10-16-10-47-17.bpo-42157.e3BcPM.rst	
+++ b/Misc/NEWS.d/next/C API/2020-10-16-10-47-17.bpo-42157.e3BcPM.rst	
@@ -1,3 +1,3 @@
 The private ``_PyUnicode_Name_CAPI`` structure of the PyCapsule API
-``unicodedata.ucnhash_CAPI`` moves to the internal C API.
+``unicodedata.ucnhash_CAPI`` has been moved to the internal C API.
 Patch by Victor Stinner.
diff --git a/Misc/NEWS.d/next/Library/2020-10-26-23-29-16.bpo-42157.4wuwTe.rst b/Misc/NEWS.d/next/Library/2020-10-26-23-29-16.bpo-42157.4wuwTe.rst
new file mode 100644
index 0000000000000..39365677ecd19
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-10-26-23-29-16.bpo-42157.4wuwTe.rst
@@ -0,0 +1,3 @@
+Removed the ``unicodedata.ucnhash_CAPI`` attribute which was an internal
+PyCapsule object. The related private ``_PyUnicode_Name_CAPI`` structure was
+moved to the internal C API. Patch by Victor Stinner.
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 18b0a9af9d21c..fcf801dc9e4ad 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -1463,7 +1463,7 @@ unicodedata_exec(PyObject *module)
         return -1;
     }
 
-    /* Previous versions */
+    // Unicode database version 3.2.0 used by the IDNA encoding
     PyObject *v;
     v = new_previous_version(ucd_type, "3.2.0",
                              get_change_3_2_0, normalization_3_2_0);
@@ -1482,7 +1482,7 @@ unicodedata_exec(PyObject *module)
     if (v == NULL) {
         return -1;
     }
-    if (PyModule_AddObject(module, "ucnhash_CAPI", v) < 0) {
+    if (PyModule_AddObject(module, "_ucnhash_CAPI", v) < 0) {
         Py_DECREF(v);
         return -1;
     }



More information about the Python-checkins mailing list