Skip to content

bpo-38896: Remove PyUnicode_ClearFreeList() function #17354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Doc/c-api/unicode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ access internal read-only data of Unicode objects:
.. versionadded:: 3.3


.. c:function:: int PyUnicode_ClearFreeList()

Clear the free list. Return the total number of freed items.


.. c:function:: Py_ssize_t PyUnicode_GET_SIZE(PyObject *o)

Return the size of the deprecated :c:type:`Py_UNICODE` representation, in
Expand Down
4 changes: 4 additions & 0 deletions Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ Build and C API Changes
functions: the free lists of bound method objects have been removed.
(Contributed by Inada Naoki and Victor Stinner in :issue:`37340`.)

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


Deprecated
==========
Expand Down
11 changes: 0 additions & 11 deletions Include/unicodeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,17 +328,6 @@ PyAPI_FUNC(wchar_t*) PyUnicode_AsWideCharString(

PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal);

/* --- Free-list management ----------------------------------------------- */

/* Clear the free list used by the Unicode implementation.

This can be used to release memory used for objects on the free
list back to the Python memory allocator.

*/

PyAPI_FUNC(int) PyUnicode_ClearFreeList(void);

/* === Builtin Codecs =====================================================

Many of these APIs take two arguments encoding and errors. These
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove ``PyUnicode_ClearFreeList()`` function: the Unicode free list has
been removed in Python 3.3.
1 change: 0 additions & 1 deletion Modules/gcmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,6 @@ clear_freelists(void)
{
(void)PyFrame_ClearFreeList();
(void)PyTuple_ClearFreeList();
(void)PyUnicode_ClearFreeList();
(void)PyFloat_ClearFreeList();
(void)PyList_ClearFreeList();
(void)PyDict_ClearFreeList();
Expand Down
9 changes: 0 additions & 9 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -15332,14 +15332,6 @@ _PyUnicode_Init(void)
return _PyStatus_OK();
}

/* Finalize the Unicode implementation */

int
PyUnicode_ClearFreeList(void)
{
return 0;
}


void
PyUnicode_InternInPlace(PyObject **p)
Expand Down Expand Up @@ -15951,7 +15943,6 @@ _PyUnicode_Fini(PyThreadState *tstate)
Py_CLEAR(unicode_latin1[i]);
}
_PyUnicode_ClearStaticStrings();
(void)PyUnicode_ClearFreeList();
}

PyInterpreterState *interp = _PyInterpreterState_GET_UNSAFE();
Expand Down
1 change: 0 additions & 1 deletion PC/python3.def
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ EXPORTS
PyUnicode_AsWideChar=python39.PyUnicode_AsWideChar
PyUnicode_AsWideCharString=python39.PyUnicode_AsWideCharString
PyUnicode_BuildEncodingMap=python39.PyUnicode_BuildEncodingMap
PyUnicode_ClearFreeList=python39.PyUnicode_ClearFreeList
PyUnicode_Compare=python39.PyUnicode_Compare
PyUnicode_CompareWithASCIIString=python39.PyUnicode_CompareWithASCIIString
PyUnicode_Concat=python39.PyUnicode_Concat
Expand Down