Skip to content

Commit d68b592

Browse files
authored
bpo-38896: Remove PyUnicode_ClearFreeList() function (GH-17354)
Remove PyUnicode_ClearFreeList() function: the Unicode free list has been removed in Python 3.3.
1 parent 14a89c4 commit d68b592

File tree

7 files changed

+6
-27
lines changed

7 files changed

+6
-27
lines changed

Doc/c-api/unicode.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,6 @@ access internal read-only data of Unicode objects:
197197
.. versionadded:: 3.3
198198
199199
200-
.. c:function:: int PyUnicode_ClearFreeList()
201-
202-
Clear the free list. Return the total number of freed items.
203-
204-
205200
.. c:function:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o)
206201
207202
Return the size of the deprecated :c:type:`Py_UNICODE` representation, in

Doc/whatsnew/3.9.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ Build and C API Changes
235235
functions: the free lists of bound method objects have been removed.
236236
(Contributed by Inada Naoki and Victor Stinner in :issue:`37340`.)
237237

238+
* Remove ``PyUnicode_ClearFreeList()`` function: the Unicode free list has been
239+
removed in Python 3.3.
240+
(Contributed by Victor Stinner in :issue:`38896`.)
241+
238242

239243
Deprecated
240244
==========

Include/unicodeobject.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,17 +328,6 @@ PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString(
328328

329329
PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);
330330

331-
/* --- Free-list management ----------------------------------------------- */
332-
333-
/* Clear the free list used by the Unicode implementation.
334-
335-
This can be used to release memory used for objects on the free
336-
list back to the Python memory allocator.
337-
338-
*/
339-
340-
PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);
341-
342331
/* === Builtin Codecs =====================================================
343332
344333
Many of these APIs take two arguments encoding and errors. These
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Remove ``PyUnicode_ClearFreeList()`` function: the Unicode free list has
2+
been removed in Python 3.3.

Modules/gcmodule.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,6 @@ clear_freelists(void)
10311031
{
10321032
(void)PyFrame_ClearFreeList();
10331033
(void)PyTuple_ClearFreeList();
1034-
(void)PyUnicode_ClearFreeList();
10351034
(void)PyFloat_ClearFreeList();
10361035
(void)PyList_ClearFreeList();
10371036
(void)PyDict_ClearFreeList();

Objects/unicodeobject.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15332,14 +15332,6 @@ _PyUnicode_Init(void)
1533215332
return _PyStatus_OK();
1533315333
}
1533415334

15335-
/* Finalize the Unicode implementation */
15336-
15337-
int
15338-
PyUnicode_ClearFreeList(void)
15339-
{
15340-
return 0;
15341-
}
15342-
1534315335

1534415336
void
1534515337
PyUnicode_InternInPlace(PyObject **p)
@@ -15951,7 +15943,6 @@ _PyUnicode_Fini(PyThreadState *tstate)
1595115943
Py_CLEAR(unicode_latin1[i]);
1595215944
}
1595315945
_PyUnicode_ClearStaticStrings();
15954-
(void)PyUnicode_ClearFreeList();
1595515946
}
1595615947

1595715948
PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();

PC/python3.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ EXPORTS
649649
PyUnicode_AsWideChar=python39.PyUnicode_AsWideChar
650650
PyUnicode_AsWideCharString=python39.PyUnicode_AsWideCharString
651651
PyUnicode_BuildEncodingMap=python39.PyUnicode_BuildEncodingMap
652-
PyUnicode_ClearFreeList=python39.PyUnicode_ClearFreeList
653652
PyUnicode_Compare=python39.PyUnicode_Compare
654653
PyUnicode_CompareWithASCIIString=python39.PyUnicode_CompareWithASCIIString
655654
PyUnicode_Concat=python39.PyUnicode_Concat

0 commit comments

Comments
 (0)