[Python-checkins] Make PyXXX_Fini() functions private (GH-15531)

Victor Stinner webhook-mailer at python.org
Mon Aug 26 18:12:36 EDT 2019


https://github.com/python/cpython/commit/bed4817d52d7b5a383b1b61269c1337b61acc493
commit: bed4817d52d7b5a383b1b61269c1337b61acc493
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-08-27T00:12:32+02:00
summary:

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.

files:
M Include/internal/pycore_pylifecycle.h
M Objects/bytesobject.c
M Objects/classobject.c
M Objects/dictobject.c
M Objects/floatobject.c
M Objects/frameobject.c
M Objects/genobject.c
M Objects/listobject.c
M Objects/longobject.c
M Objects/methodobject.c
M Objects/setobject.c
M Objects/sliceobject.c
M Objects/tupleobject.c
M Python/pylifecycle.c

diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h
index bdc4bf5a46d4..495742959433 100644
--- a/Include/internal/pycore_pylifecycle.h
+++ b/Include/internal/pycore_pylifecycle.h
@@ -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);
@@ -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);
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index c4edcca4f761..6d553304a403 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -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++)
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 40cbeaa9f2aa..4a9add1229e3 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -375,7 +375,7 @@ PyMethod_ClearFreeList(void)
 }
 
 void
-PyMethod_Fini(void)
+_PyMethod_Fini(void)
 {
     (void)PyMethod_ClearFreeList();
 }
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index fec3a87e9f5d..73956df4ab2a 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -282,7 +282,7 @@ _PyDict_DebugMallocStats(FILE *out)
 
 
 void
-PyDict_Fini(void)
+_PyDict_Fini(void)
 {
     PyDict_ClearFreeList();
 }
diff --git a/Objects/floatobject.c b/Objects/floatobject.c
index 689e92907d03..6643ff340ea5 100644
--- a/Objects/floatobject.c
+++ b/Objects/floatobject.c
@@ -2031,7 +2031,7 @@ PyFloat_ClearFreeList(void)
 }
 
 void
-PyFloat_Fini(void)
+_PyFloat_Fini(void)
 {
     (void)PyFloat_ClearFreeList();
 }
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index a796a59eee9e..27ef9ff25902 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -997,7 +997,7 @@ PyFrame_ClearFreeList(void)
 }
 
 void
-PyFrame_Fini(void)
+_PyFrame_Fini(void)
 {
     (void)PyFrame_ClearFreeList();
 }
diff --git a/Objects/genobject.c b/Objects/genobject.c
index 5d1f9c7dd13e..5e0bfa4f43de 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -1463,7 +1463,7 @@ PyAsyncGen_ClearFreeLists(void)
 }
 
 void
-PyAsyncGen_Fini(void)
+_PyAsyncGen_Fini(void)
 {
     PyAsyncGen_ClearFreeLists();
 }
diff --git a/Objects/listobject.c b/Objects/listobject.c
index cea9b24a3b2f..5fca08ea363a 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -138,7 +138,7 @@ PyList_ClearFreeList(void)
 }
 
 void
-PyList_Fini(void)
+_PyList_Fini(void)
 {
     PyList_ClearFreeList();
 }
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 74037be7a1ea..475b9bda59f9 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -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
diff --git a/Objects/methodobject.c b/Objects/methodobject.c
index b9977467ac08..7d70cc04a238 100644
--- a/Objects/methodobject.c
+++ b/Objects/methodobject.c
@@ -319,7 +319,7 @@ PyCFunction_ClearFreeList(void)
 }
 
 void
-PyCFunction_Fini(void)
+_PyCFunction_Fini(void)
 {
     (void)PyCFunction_ClearFreeList();
 }
diff --git a/Objects/setobject.c b/Objects/setobject.c
index 8cd95ba890dd..56858dbccfe1 100644
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -2318,7 +2318,7 @@ PySet_ClearFreeList(void)
 }
 
 void
-PySet_Fini(void)
+_PySet_Fini(void)
 {
     Py_CLEAR(emptyfrozenset);
 }
diff --git a/Objects/sliceobject.c b/Objects/sliceobject.c
index 7c10eb6f638d..e884a5894356 100644
--- a/Objects/sliceobject.c
+++ b/Objects/sliceobject.c
@@ -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) {
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 79a5d55749be..3419baa529a6 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -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
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index e3333db4328a..7cda44dc29d3 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -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 */



More information about the Python-checkins mailing list