Skip to content

Commit 43d7271

Browse files
vstinnerlisroach
authored andcommitted
Make PyXXX_Fini() functions private (pythonGH-15531)
For example, rename PyTuple_Fini() to _PyTuple_Fini(). These functions are only declared in the internal C API.
1 parent d42a74d commit 43d7271

14 files changed

+38
-36
lines changed

Include/internal/pycore_pylifecycle.h

+13-12
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,19 @@ extern PyStatus _PyImportZip_Init(PyThreadState *tstate);
6262

6363
/* Various internal finalizers */
6464

65-
extern void PyMethod_Fini(void);
66-
extern void PyFrame_Fini(void);
67-
extern void PyCFunction_Fini(void);
68-
extern void PyDict_Fini(void);
69-
extern void PyTuple_Fini(void);
70-
extern void PyList_Fini(void);
71-
extern void PySet_Fini(void);
72-
extern void PyBytes_Fini(void);
73-
extern void PyFloat_Fini(void);
65+
extern void _PyMethod_Fini(void);
66+
extern void _PyFrame_Fini(void);
67+
extern void _PyCFunction_Fini(void);
68+
extern void _PyDict_Fini(void);
69+
extern void _PyTuple_Fini(void);
70+
extern void _PyList_Fini(void);
71+
extern void _PySet_Fini(void);
72+
extern void _PyBytes_Fini(void);
73+
extern void _PyFloat_Fini(void);
74+
extern void _PySlice_Fini(void);
75+
extern void _PyAsyncGen_Fini(void);
76+
7477
extern void PyOS_FiniInterrupts(void);
75-
extern void PySlice_Fini(void);
76-
extern void PyAsyncGen_Fini(void);
7778

7879
extern void _PyExc_Fini(void);
7980
extern void _PyImport_Fini(void);
@@ -82,7 +83,7 @@ extern void _PyGC_Fini(_PyRuntimeState *runtime);
8283
extern void _PyType_Fini(void);
8384
extern void _Py_HashRandomization_Fini(void);
8485
extern void _PyUnicode_Fini(void);
85-
extern void PyLong_Fini(void);
86+
extern void _PyLong_Fini(void);
8687
extern void _PyFaulthandler_Fini(void);
8788
extern void _PyHash_Fini(void);
8889
extern int _PyTraceMalloc_Fini(void);

Objects/bytesobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -3047,7 +3047,7 @@ _PyBytes_Resize(PyObject **pv, Py_ssize_t newsize)
30473047
}
30483048

30493049
void
3050-
PyBytes_Fini(void)
3050+
_PyBytes_Fini(void)
30513051
{
30523052
int i;
30533053
for (i = 0; i < UCHAR_MAX + 1; i++)

Objects/classobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ PyMethod_ClearFreeList(void)
375375
}
376376

377377
void
378-
PyMethod_Fini(void)
378+
_PyMethod_Fini(void)
379379
{
380380
(void)PyMethod_ClearFreeList();
381381
}

Objects/dictobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ _PyDict_DebugMallocStats(FILE *out)
282282

283283

284284
void
285-
PyDict_Fini(void)
285+
_PyDict_Fini(void)
286286
{
287287
PyDict_ClearFreeList();
288288
}

Objects/floatobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2031,7 +2031,7 @@ PyFloat_ClearFreeList(void)
20312031
}
20322032

20332033
void
2034-
PyFloat_Fini(void)
2034+
_PyFloat_Fini(void)
20352035
{
20362036
(void)PyFloat_ClearFreeList();
20372037
}

Objects/frameobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ PyFrame_ClearFreeList(void)
997997
}
998998

999999
void
1000-
PyFrame_Fini(void)
1000+
_PyFrame_Fini(void)
10011001
{
10021002
(void)PyFrame_ClearFreeList();
10031003
}

Objects/genobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ PyAsyncGen_ClearFreeLists(void)
14631463
}
14641464

14651465
void
1466-
PyAsyncGen_Fini(void)
1466+
_PyAsyncGen_Fini(void)
14671467
{
14681468
PyAsyncGen_ClearFreeLists();
14691469
}

Objects/listobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ PyList_ClearFreeList(void)
138138
}
139139

140140
void
141-
PyList_Fini(void)
141+
_PyList_Fini(void)
142142
{
143143
PyList_ClearFreeList();
144144
}

Objects/longobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -5869,7 +5869,7 @@ _PyLong_Init(void)
58695869
}
58705870

58715871
void
5872-
PyLong_Fini(void)
5872+
_PyLong_Fini(void)
58735873
{
58745874
/* Integers are currently statically allocated. Py_DECREF is not
58755875
needed, but Python must forget about the reference or multiple

Objects/methodobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ PyCFunction_ClearFreeList(void)
319319
}
320320

321321
void
322-
PyCFunction_Fini(void)
322+
_PyCFunction_Fini(void)
323323
{
324324
(void)PyCFunction_ClearFreeList();
325325
}

Objects/setobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2318,7 +2318,7 @@ PySet_ClearFreeList(void)
23182318
}
23192319

23202320
void
2321-
PySet_Fini(void)
2321+
_PySet_Fini(void)
23222322
{
23232323
Py_CLEAR(emptyfrozenset);
23242324
}

Objects/sliceobject.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ PyObject _Py_EllipsisObject = {
100100
* created and then deleted again
101101
*/
102102
static PySliceObject *slice_cache = NULL;
103-
void PySlice_Fini(void)
103+
104+
void _PySlice_Fini(void)
104105
{
105106
PySliceObject *obj = slice_cache;
106107
if (obj != NULL) {

Objects/tupleobject.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ PyTuple_ClearFreeList(void)
989989
}
990990

991991
void
992-
PyTuple_Fini(void)
992+
_PyTuple_Fini(void)
993993
{
994994
#if PyTuple_MAXSAVESIZE > 0
995995
/* empty tuples are used all over the place and applications may

Python/pylifecycle.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -1307,22 +1307,22 @@ Py_FinalizeEx(void)
13071307
_PyExc_Fini();
13081308

13091309
/* Sundry finalizers */
1310-
PyMethod_Fini();
1311-
PyFrame_Fini();
1312-
PyCFunction_Fini();
1313-
PyTuple_Fini();
1314-
PyList_Fini();
1315-
PySet_Fini();
1316-
PyBytes_Fini();
1317-
PyLong_Fini();
1318-
PyFloat_Fini();
1319-
PyDict_Fini();
1320-
PySlice_Fini();
1310+
_PyMethod_Fini();
1311+
_PyFrame_Fini();
1312+
_PyCFunction_Fini();
1313+
_PyTuple_Fini();
1314+
_PyList_Fini();
1315+
_PySet_Fini();
1316+
_PyBytes_Fini();
1317+
_PyLong_Fini();
1318+
_PyFloat_Fini();
1319+
_PyDict_Fini();
1320+
_PySlice_Fini();
13211321
_PyGC_Fini(runtime);
13221322
_PyWarnings_Fini(interp);
13231323
_Py_HashRandomization_Fini();
13241324
_PyArg_Fini();
1325-
PyAsyncGen_Fini();
1325+
_PyAsyncGen_Fini();
13261326
_PyContext_Fini();
13271327

13281328
/* Cleanup Unicode implementation */

0 commit comments

Comments
 (0)