Skip to content

Commit bed4817

Browse files
authored
Make PyXXX_Fini() functions private (GH-15531)
For example, rename PyTuple_Fini() to _PyTuple_Fini(). These functions are only declared in the internal C API.
1 parent d3cc189 commit bed4817

File tree

14 files changed

+38
-36
lines changed

14 files changed

+38
-36
lines changed

Include/internal/pycore_pylifecycle.h

Lines changed: 13 additions & 12 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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
}

0 commit comments

Comments
 (0)