]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-89479: Export _Py_GetSpecializationStats() internal function (#92011)
authorVictor Stinner <vstinner@python.org>
Thu, 28 Apr 2022 12:02:45 +0000 (14:02 +0200)
committerGitHub <noreply@github.com>
Thu, 28 Apr 2022 12:02:45 +0000 (14:02 +0200)
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.

Doc/using/configure.rst
Include/internal/pycore_code.h

index 057efa3bd077c3ad0da3b1896d21277c7ba0f93d..2321d24663f684e85a10efc153011f7a73ca1573 100644 (file)
@@ -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
 
index 3059db465e7d2565b5a6d84ddfe15087082c85e7..8a599c4246cfc26d8e341e32c4326da7a000cc4a 100644 (file)
@@ -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