]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] Add `extern "C"` around `PyTraceMalloc_` functions. (#127772) (#127817)
authorVictor Stinner <vstinner@python.org>
Wed, 11 Dec 2024 13:08:23 +0000 (14:08 +0100)
committerGitHub <noreply@github.com>
Wed, 11 Dec 2024 13:08:23 +0000 (14:08 +0100)
Add `extern "C"` around `PyTraceMalloc_` functions. (#127772)

Pretty much everything else exported by Python.h has an extern "C"
annotation, yet this header appears to be missing one.

(cherry picked from commit 2cdeb61b57e638ae46a04386330a12abe9cddf2c)

Co-authored-by: Peter Hawkins <hawkinsp@cs.stanford.edu>
Include/tracemalloc.h

index 580027a8e365e508c28674f9bd37c6cb466a5c0e..b6865f1f6835cb21c4637dbd66b3c5634ce3eba6 100644 (file)
@@ -1,5 +1,8 @@
 #ifndef Py_TRACEMALLOC_H
 #define Py_TRACEMALLOC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 #ifndef Py_LIMITED_API
 /* Track an allocated memory block in the tracemalloc module.
@@ -67,6 +70,8 @@ PyAPI_FUNC(PyObject *) _PyTraceMalloc_GetTracedMemory(void);
 /* Set the peak size of traced memory blocks to the current size */
 PyAPI_FUNC(void) _PyTraceMalloc_ResetPeak(void);
 
+#ifdef __cplusplus
+}
 #endif
-
+#endif /* !Py_LIMITED_API */
 #endif /* !Py_TRACEMALLOC_H */