Skip to content

Commit c0e08b6

Browse files
committed
fix
1 parent 8ec4d73 commit c0e08b6

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Include/internal/pycore_mmap.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,24 @@ extern "C" {
99
# error "this header requires Py_BUILD_CORE define"
1010
#endif
1111

12-
#if defined(Py_DEBUG) && defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
12+
#include "pycore_pystate.h"
13+
14+
#if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
1315
# include <linux/prctl.h>
1416
# include <sys/prctl.h>
1517
#endif
1618

1719
static inline int
1820
_PyAnnotateMemoryMap(void *addr, size_t size, const char *name)
1921
{
20-
#if defined(Py_DEBUG) && defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
21-
assert(strlen(name) < 80);
22-
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name);
23-
// Ignore errno from prctl
24-
// See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746
25-
errno = 0;
22+
#if defined(HAVE_PR_SET_VMA_ANON_NAME) && defined(__linux__)
23+
if (_Py_GetConfig()->dev_mode) {
24+
assert(strlen(name) < 80);
25+
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name);
26+
// Ignore errno from prctl
27+
// See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746
28+
errno = 0;
29+
}
2630
#endif
2731
return 0;
2832
}

0 commit comments

Comments
 (0)