Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8f5526

Browse files
authored
gh-134486: Fix missing alloca() symbol in _ctypes on NetBSD (#134487)
Previously the module would fail to load because the `alloca()` symbolwas undefined. Now we check for GCC/Clang builtins for systems who donot define `alloca()` in headers.
1 parent99a9ab1 commitb8f5526

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The:mod:`ctypes` module now performs a more portable test for the
2+
definition of:manpage:`alloca(3)`, fixing a compilation failure on
3+
NetBSD.

‎Modules/_ctypes/callbacks.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,9 @@
1111
#include"pycore_call.h"// _PyObject_CallNoArgs()
1212
#include"pycore_runtime.h"// _Py_ID()
1313

14-
#ifdefMS_WIN32
15-
# include<malloc.h>
16-
#endif
17-
1814
#include<ffi.h>
1915
#include"ctypes.h"
2016

21-
#ifdefHAVE_ALLOCA_H
22-
/* AIX needs alloca.h for alloca() */
23-
#include<alloca.h>
24-
#endif
25-
2617
/**************************************************************/
2718

2819
staticint

‎Modules/_ctypes/callproc.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,8 @@ module _ctypes
7777
#include<mach-o/dyld.h>
7878
#endif
7979

80-
#ifdefMS_WIN32
81-
#include<malloc.h>
82-
#endif
83-
8480
#include<ffi.h>
8581
#include"ctypes.h"
86-
#ifdefHAVE_ALLOCA_H
87-
/* AIX needs alloca.h for alloca() */
88-
#include<alloca.h>
89-
#endif
9082

9183
#ifdef_Py_MEMORY_SANITIZER
9284
#include<sanitizer/msan_interface.h>

‎Modules/_ctypes/ctypes.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1-
#if defined (__SVR4)&& defined (__sun)
1+
/* Get a definition of alloca(). */
2+
#if (defined (__SVR4)&& defined (__sun))|| defined(HAVE_ALLOCA_H)
23
# include<alloca.h>
4+
#elif defined(MS_WIN32)
5+
# include<malloc.h>
6+
#endif
7+
8+
/* If the system does not define alloca(), we have to hope for a compiler builtin. */
9+
#ifndefalloca
10+
# if defined__GNUC__|| (__clang_major__ >=4)
11+
# definealloca __builtin_alloca
12+
# else
13+
# error "Could not define alloca() on your platform."
14+
# endif
315
#endif
416

517
#include<stdbool.h>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp