Skip to content

Commit 979ce02

Browse files
committed
nit
1 parent 816d962 commit 979ce02

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Include/internal/pycore_pymem.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ static inline int _PyMem_Annotate_Mmap(void *addr, size_t size, const char *name
9999
{
100100
#if defined(Py_DEBUG) && defined(HAVE_PR_SET_VMA_ANON_NAME)
101101
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, (unsigned long)addr, size, name);
102+
// Ignore errno from prctl
103+
// See: https://bugzilla.redhat.com/show_bug.cgi?id=2302746
104+
errno = 0;
102105
return 0;
103106
#else
104107
return 0;

Modules/_ctypes/malloc_closure.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,16 @@ static void more_core(void)
7575
if (item == NULL)
7676
return;
7777
#else
78+
size_t mem_size = count * sizeof(ITEM);
7879
item = (ITEM *)mmap(NULL,
79-
count * sizeof(ITEM),
80+
mem_size,
8081
PROT_READ | PROT_WRITE | PROT_EXEC,
8182
MAP_PRIVATE | MAP_ANONYMOUS,
8283
-1,
8384
0);
8485
if (item == (void *)MAP_FAILED)
8586
return;
86-
_PyMem_Annotate_Mmap(item, count * sizeof(ITEM), "Python:more_core");
87+
_PyMem_Annotate_Mmap(item, mem_size, "Python:more_core");
8788
#endif
8889

8990
#ifdef MALLOC_CLOSURE_DEBUG

0 commit comments

Comments
 (0)