Skip to content

Commit

Permalink
[3.12] Add extern "C" around PyTraceMalloc_ functions. (#127772) (#…
Browse files Browse the repository at this point in the history
…127817)

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 2cdeb61)

Co-authored-by: Peter Hawkins <[email protected]>
  • Loading branch information
vstinner and hawkinsp authored Dec 11, 2024
1 parent 0964f9f commit 65bca19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Include/tracemalloc.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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 */

0 comments on commit 65bca19

Please sign in to comment.