[Python-checkins] bpo-41123: Remove PyLong_FromUnicode() (GH-21204)

Inada Naoki webhook-mailer at python.org
Mon Jun 29 00:00:56 EDT 2020


https://github.com/python/cpython/commit/e4f1fe6edb216e04da03ae80b462ca273f00255b
commit: e4f1fe6edb216e04da03ae80b462ca273f00255b
branch: master
author: Inada Naoki <songofacandy at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-06-29T13:00:43+09:00
summary:

bpo-41123: Remove PyLong_FromUnicode() (GH-21204)

files:
A Misc/NEWS.d/next/C API/2020-06-29-11-33-49.bpo-41123.qFevek.rst
M Doc/c-api/long.rst
M Doc/data/refcounts.dat
M Doc/whatsnew/3.10.rst
M Include/longobject.h
M Objects/abstract.c
M Objects/longobject.c

diff --git a/Doc/c-api/long.rst b/Doc/c-api/long.rst
index a7bd43df90689..3921a93843e42 100644
--- a/Doc/c-api/long.rst
+++ b/Doc/c-api/long.rst
@@ -94,17 +94,6 @@ distinguished from a number.  Use :c:func:`PyErr_Occurred` to disambiguate.
    are no digits, :exc:`ValueError` will be raised.
 
 
-.. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
-
-   Convert a sequence of Unicode digits to a Python integer value.  The Unicode
-   string is first encoded to a byte string using :c:func:`PyUnicode_EncodeDecimal`
-   and then converted using :c:func:`PyLong_FromString`.
-
-   .. deprecated-removed:: 3.3 4.0
-      Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
-      :c:func:`PyLong_FromUnicodeObject`.
-
-
 .. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base)
 
    Convert a sequence of Unicode digits in the string *u* to a Python integer
diff --git a/Doc/data/refcounts.dat b/Doc/data/refcounts.dat
index 1215c96cd5342..4d9aee370c61d 100644
--- a/Doc/data/refcounts.dat
+++ b/Doc/data/refcounts.dat
@@ -1205,11 +1205,6 @@ PyLong_FromString:const char*:str::
 PyLong_FromString:char**:pend::
 PyLong_FromString:int:base::
 
-PyLong_FromUnicode:PyObject*::+1:
-PyLong_FromUnicode:Py_UNICODE*:u::
-PyLong_FromUnicode:Py_ssize_t:length::
-PyLong_FromUnicode:int:base::
-
 PyLong_FromUnicodeObject:PyObject*::+1:
 PyLong_FromUnicodeObject:PyObject*:u:0:
 PyLong_FromUnicodeObject:int:base::
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index 0dd33131f0430..0c4ff026bd201 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -226,3 +226,6 @@ Removed
 
 * Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs.
   (Contributed by Inada Naoki in :issue:`41103`.)
+
+* Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:`PyLong_FromUnicodeObject`.
+  (Contributed by Inada Naoki in :issue:`41103`.)
diff --git a/Include/longobject.h b/Include/longobject.h
index dad08c23f8211..06e3e2490401e 100644
--- a/Include/longobject.h
+++ b/Include/longobject.h
@@ -102,8 +102,6 @@ PyAPI_FUNC(long long) PyLong_AsLongLongAndOverflow(PyObject *, int *);
 
 PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
 #ifndef Py_LIMITED_API
-Py_DEPRECATED(3.3)
-PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
 PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
 PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int);
 #endif
diff --git a/Misc/NEWS.d/next/C API/2020-06-29-11-33-49.bpo-41123.qFevek.rst b/Misc/NEWS.d/next/C API/2020-06-29-11-33-49.bpo-41123.qFevek.rst
new file mode 100644
index 0000000000000..1f5813594b0ec
--- /dev/null
+++ b/Misc/NEWS.d/next/C API/2020-06-29-11-33-49.bpo-41123.qFevek.rst	
@@ -0,0 +1 @@
+Removed ``PyLong_FromUnicode()``.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 0d3f4ac6e1747..3494f33ce380c 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1429,7 +1429,7 @@ PyNumber_Long(PyObject *o)
         return NULL;
 
     if (PyUnicode_Check(o))
-        /* The below check is done in PyLong_FromUnicode(). */
+        /* The below check is done in PyLong_FromUnicodeObject(). */
         return PyLong_FromUnicodeObject(o, 10);
 
     if (PyBytes_Check(o))
diff --git a/Objects/longobject.c b/Objects/longobject.c
index d00a7a048ddce..571f53a3c00eb 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -2503,17 +2503,6 @@ _PyLong_FromBytes(const char *s, Py_ssize_t len, int base)
     return NULL;
 }
 
-PyObject *
-PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
-{
-    PyObject *v, *unicode = PyUnicode_FromWideChar(u, length);
-    if (unicode == NULL)
-        return NULL;
-    v = PyLong_FromUnicodeObject(unicode, base);
-    Py_DECREF(unicode);
-    return v;
-}
-
 PyObject *
 PyLong_FromUnicodeObject(PyObject *u, int base)
 {



More information about the Python-checkins mailing list