Skip to content

Commit e4f1fe6

Browse files
authored
bpo-41123: Remove PyLong_FromUnicode() (pythonGH-21204)
1 parent d9f2a13 commit e4f1fe6

File tree

7 files changed

+5
-30
lines changed

7 files changed

+5
-30
lines changed

Doc/c-api/long.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,6 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
9494
are no digits, :exc:`ValueError` will be raised.
9595
9696
97-
.. c:function:: PyObject* PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
98-
99-
Convert a sequence of Unicode digits to a Python integer value. The Unicode
100-
string is first encoded to a byte string using :c:func:`PyUnicode_EncodeDecimal`
101-
and then converted using :c:func:`PyLong_FromString`.
102-
103-
.. deprecated-removed:: 3.3 4.0
104-
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
105-
:c:func:`PyLong_FromUnicodeObject`.
106-
107-
10897
.. c:function:: PyObject* PyLong_FromUnicodeObject(PyObject *u, int base)
10998
11099
Convert a sequence of Unicode digits in the string *u* to a Python integer

Doc/data/refcounts.dat

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,11 +1205,6 @@ PyLong_FromString:const char*:str::
12051205
PyLong_FromString:char**:pend::
12061206
PyLong_FromString:int:base::
12071207

1208-
PyLong_FromUnicode:PyObject*::+1:
1209-
PyLong_FromUnicode:Py_UNICODE*:u::
1210-
PyLong_FromUnicode:Py_ssize_t:length::
1211-
PyLong_FromUnicode:int:base::
1212-
12131208
PyLong_FromUnicodeObject:PyObject*::+1:
12141209
PyLong_FromUnicodeObject:PyObject*:u:0:
12151210
PyLong_FromUnicodeObject:int:base::

Doc/whatsnew/3.10.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,6 @@ Removed
226226

227227
* Removed ``PyUnicode_GetMax()``. Please migrate to new (:pep:`393`) APIs.
228228
(Contributed by Inada Naoki in :issue:`41103`.)
229+
230+
* Removed ``PyLong_FromUnicode()``. Please migrate to :c:func:`PyLong_FromUnicodeObject`.
231+
(Contributed by Inada Naoki in :issue:`41103`.)

Include/longobject.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ PyAPI_FUNC(long long) PyLong_AsLongLongAndOverflow(PyObject *, int *);
102102

103103
PyAPI_FUNC(PyObject *) PyLong_FromString(const char *, char **, int);
104104
#ifndef Py_LIMITED_API
105-
Py_DEPRECATED(3.3)
106-
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
107105
PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
108106
PyAPI_FUNC(PyObject *) _PyLong_FromBytes(const char *, Py_ssize_t, int);
109107
#endif
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed ``PyLong_FromUnicode()``.

Objects/abstract.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,7 +1429,7 @@ PyNumber_Long(PyObject *o)
14291429
return NULL;
14301430

14311431
if (PyUnicode_Check(o))
1432-
/* The below check is done in PyLong_FromUnicode(). */
1432+
/* The below check is done in PyLong_FromUnicodeObject(). */
14331433
return PyLong_FromUnicodeObject(o, 10);
14341434

14351435
if (PyBytes_Check(o))

Objects/longobject.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,17 +2503,6 @@ _PyLong_FromBytes(const char *s, Py_ssize_t len, int base)
25032503
return NULL;
25042504
}
25052505

2506-
PyObject *
2507-
PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base)
2508-
{
2509-
PyObject *v, *unicode = PyUnicode_FromWideChar(u, length);
2510-
if (unicode == NULL)
2511-
return NULL;
2512-
v = PyLong_FromUnicodeObject(unicode, base);
2513-
Py_DECREF(unicode);
2514-
return v;
2515-
}
2516-
25172506
PyObject *
25182507
PyLong_FromUnicodeObject(PyObject *u, int base)
25192508
{

0 commit comments

Comments
 (0)