Skip to content

Commit eb9474c

Browse files
[3.14] gh-150907: Fix dynamic_annotations.h when built with C++ and Valgrind (GH-150914) (#150963)
gh-150907: Fix dynamic_annotations.h when built with C++ and Valgrind (GH-150914) Add extern "C++" scope for the C++ template. Fix test_cppext when Python is built with --with-valgrind. (cherry picked from commit c325012) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 7e48fc1 commit eb9474c

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

Include/dynamic_annotations.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ int RunningOnValgrind(void);
461461

462462
#if DYNAMIC_ANNOTATIONS_ENABLED != 0 && defined(__cplusplus)
463463

464+
extern "C++" {
464465
/* _Py_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads.
465466
466467
Instead of doing
@@ -476,6 +477,8 @@ int RunningOnValgrind(void);
476477
_Py_ANNOTATE_IGNORE_READS_END();
477478
return res;
478479
}
480+
}
481+
479482
/* Apply _Py_ANNOTATE_BENIGN_RACE_SIZED to a static variable. */
480483
#define _Py_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \
481484
namespace { \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix ``dynamic_annotations.h`` header file when built with C++ and Valgrind:
2+
add ``extern "C++" scope`` for the C++ template. Patch by Victor Stinner.

0 commit comments

Comments
 (0)