From d06cd80323e75441c90a211d1acf84fa251c53d0 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 28 Apr 2022 08:49:41 +0200 Subject: [PATCH 1/2] gh-89479: Export _Py_GetSpecializationStats() internal function When Python is built with "./configure --enable-pystats" (if the Py_STATS macro is defined), the _Py_GetSpecializationStats() function must be exported, since it's used by the _opcode extension which is built as a shared library. --- Include/internal/pycore_code.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Include/internal/pycore_code.h b/Include/internal/pycore_code.h index 3059db465e7d25..8a599c4246cfc2 100644 --- a/Include/internal/pycore_code.h +++ b/Include/internal/pycore_code.h @@ -316,7 +316,8 @@ extern PyStats _py_stats; extern void _Py_PrintSpecializationStats(int to_file); -extern PyObject* _Py_GetSpecializationStats(void); +// Used by the _opcode extension which is built as a shared library +PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void); #else #define STAT_INC(opname, name) ((void)0) @@ -324,7 +325,7 @@ extern PyObject* _Py_GetSpecializationStats(void); #define OPCODE_EXE_INC(opname) ((void)0) #define CALL_STAT_INC(name) ((void)0) #define OBJECT_STAT_INC(name) ((void)0) -#endif +#endif // !Py_STATS // Cache values are only valid in memory, so use native endianness. #ifdef WORDS_BIGENDIAN From 1798b905c8618235f3d836b0972f3dd7b5756ad6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 28 Apr 2022 08:56:51 +0200 Subject: [PATCH 2/2] Fix --enable-pystats doc --- Doc/using/configure.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/using/configure.rst b/Doc/using/configure.rst index 057efa3bd077c3..2321d24663f684 100644 --- a/Doc/using/configure.rst +++ b/Doc/using/configure.rst @@ -139,7 +139,7 @@ General Options The statistics will be dumped to a arbitrary (probably unique) file in ``/tmp/py_stats/``, or ``C:\temp\py_stats\`` on Windows. - Use ``Tools//summarize_stats.py`` to read the stats. + Use ``Tools/scripts/summarize_stats.py`` to read the stats. .. versionadded:: 3.11