Skip to content

Commit

Permalink
Make PyXXX_Fini() functions private (pythonGH-15531)
Browse files Browse the repository at this point in the history
For example, rename PyTuple_Fini() to _PyTuple_Fini().

These functions are only declared in the internal C API.
  • Loading branch information
vstinner authored Aug 26, 2019
1 parent d3cc189 commit bed4817
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 36 deletions.
25 changes: 13 additions & 12 deletions Include/internal/pycore_pylifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,19 @@ extern PyStatus _PyImportZip_Init(PyThreadState *tstate);

/* Various internal finalizers */

extern void PyMethod_Fini(void);
extern void PyFrame_Fini(void);
extern void PyCFunction_Fini(void);
extern void PyDict_Fini(void);
extern void PyTuple_Fini(void);
extern void PyList_Fini(void);
extern void PySet_Fini(void);
extern void PyBytes_Fini(void);
extern void PyFloat_Fini(void);
extern void _PyMethod_Fini(void);
extern void _PyFrame_Fini(void);
extern void _PyCFunction_Fini(void);
extern void _PyDict_Fini(void);
extern void _PyTuple_Fini(void);
extern void _PyList_Fini(void);
extern void _PySet_Fini(void);
extern void _PyBytes_Fini(void);
extern void _PyFloat_Fini(void);
extern void _PySlice_Fini(void);
extern void _PyAsyncGen_Fini(void);

extern void PyOS_FiniInterrupts(void);
extern void PySlice_Fini(void);
extern void PyAsyncGen_Fini(void);

extern void _PyExc_Fini(void);
extern void _PyImport_Fini(void);
Expand All @@ -82,7 +83,7 @@ extern void _PyGC_Fini(_PyRuntimeState *runtime);
extern void _PyType_Fini(void);
extern void _Py_HashRandomization_Fini(void);
extern void _PyUnicode_Fini(void);
extern void PyLong_Fini(void);
extern void _PyLong_Fini(void);
extern void _PyFaulthandler_Fini(void);
extern void _PyHash_Fini(void);
extern int _PyTraceMalloc_Fini(void);
Expand Down
2 changes: 1 addition & 1 deletion Objects/bytesobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -3047,7 +3047,7 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize)
}

void
PyBytes_Fini(void)
_PyBytes_Fini(void)
{
int i;
for (i = 0; i < UCHAR_MAX + 1; i++)
Expand Down
2 changes: 1 addition & 1 deletion Objects/classobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ PyMethod_ClearFreeList(void)
}

void
PyMethod_Fini(void)
_PyMethod_Fini(void)
{
(void)PyMethod_ClearFreeList();
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ _PyDict_DebugMallocStats(FILE *out)


void
PyDict_Fini(void)
_PyDict_Fini(void)
{
PyDict_ClearFreeList();
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/floatobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ PyFloat_ClearFreeList(void)
}

void
PyFloat_Fini(void)
_PyFloat_Fini(void)
{
(void)PyFloat_ClearFreeList();
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/frameobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ PyFrame_ClearFreeList(void)
}

void
PyFrame_Fini(void)
_PyFrame_Fini(void)
{
(void)PyFrame_ClearFreeList();
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/genobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ PyAsyncGen_ClearFreeLists(void)
}

void
PyAsyncGen_Fini(void)
_PyAsyncGen_Fini(void)
{
PyAsyncGen_ClearFreeLists();
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ PyList_ClearFreeList(void)
}

void
PyList_Fini(void)
_PyList_Fini(void)
{
PyList_ClearFreeList();
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/longobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -5869,7 +5869,7 @@ _PyLong_Init(void)
}

void
PyLong_Fini(void)
_PyLong_Fini(void)
{
/* Integers are currently statically allocated. Py_DECREF is not
needed, but Python must forget about the reference or multiple
Expand Down
2 changes: 1 addition & 1 deletion Objects/methodobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ PyCFunction_ClearFreeList(void)
}

void
PyCFunction_Fini(void)
_PyCFunction_Fini(void)
{
(void)PyCFunction_ClearFreeList();
}
Expand Down
2 changes: 1 addition & 1 deletion Objects/setobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -2318,7 +2318,7 @@ PySet_ClearFreeList(void)
}

void
PySet_Fini(void)
_PySet_Fini(void)
{
Py_CLEAR(emptyfrozenset);
}
Expand Down
3 changes: 2 additions & 1 deletion Objects/sliceobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ PyObject _Py_EllipsisObject = {
* created and then deleted again
*/
static PySliceObject *slice_cache = NULL;
void PySlice_Fini(void)

void _PySlice_Fini(void)
{
PySliceObject *obj = slice_cache;
if (obj != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion Objects/tupleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ PyTuple_ClearFreeList(void)
}

void
PyTuple_Fini(void)
_PyTuple_Fini(void)
{
#if PyTuple_MAXSAVESIZE > 0
/* empty tuples are used all over the place and applications may
Expand Down
24 changes: 12 additions & 12 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,22 +1307,22 @@ Py_FinalizeEx(void)
_PyExc_Fini();

/* Sundry finalizers */
PyMethod_Fini();
PyFrame_Fini();
PyCFunction_Fini();
PyTuple_Fini();
PyList_Fini();
PySet_Fini();
PyBytes_Fini();
PyLong_Fini();
PyFloat_Fini();
PyDict_Fini();
PySlice_Fini();
_PyMethod_Fini();
_PyFrame_Fini();
_PyCFunction_Fini();
_PyTuple_Fini();
_PyList_Fini();
_PySet_Fini();
_PyBytes_Fini();
_PyLong_Fini();
_PyFloat_Fini();
_PyDict_Fini();
_PySlice_Fini();
_PyGC_Fini(runtime);
_PyWarnings_Fini(interp);
_Py_HashRandomization_Fini();
_PyArg_Fini();
PyAsyncGen_Fini();
_PyAsyncGen_Fini();
_PyContext_Fini();

/* Cleanup Unicode implementation */
Expand Down

0 comments on commit bed4817

Please sign in to comment.