Skip to content

Commit 90f186d

Browse files
committed
gh-150907: Fix dynamic_annotations.h when built with C++ and Valgrind
Add extern "C++" scope for the C++ template.
1 parent 3ff2117 commit 90f186d

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)