Skip to content

Commit 10bb719

Browse files
committed
pythongh-141784: Fix _remote_debugging_module.c compilation on 32-bit Linux (python#141796)
Include Python.h before system headers to make sure that _remote_debugging_module.c uses the same types (ABI) than Python. (cherry picked from commit 722f4bb)
1 parent 1253a8b commit 10bb719

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Fix ``_remote_debugging_module.c`` compilation on 32-bit Linux. Include
2+
Python.h before system headers to make sure that
3+
``_remote_debugging_module.c`` uses the same types (ABI) than Python. Patch
4+
by Victor Stinner.

Modules/_remote_debugging_module.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111
* HEADERS AND INCLUDES
1212
* ============================================================================ */
1313

14-
#include <errno.h>
15-
#include <fcntl.h>
16-
#include <stddef.h>
17-
#include <stdint.h>
18-
#include <stdio.h>
19-
#include <stdlib.h>
20-
#include <string.h>
21-
2214
#ifndef Py_BUILD_CORE_BUILTIN
2315
# define Py_BUILD_CORE_MODULE 1
2416
#endif
@@ -30,6 +22,17 @@
3022
#include <internal/pycore_stackref.h> // Py_TAG_BITS
3123
#include "../Python/remote_debug.h"
3224

25+
// gh-141784: Python.h header must be included first, before system headers.
26+
// Otherwise, some types such as ino_t can be defined differently, causing ABI
27+
// issues.
28+
#include <errno.h>
29+
#include <fcntl.h>
30+
#include <stddef.h>
31+
#include <stdint.h>
32+
#include <stdio.h>
33+
#include <stdlib.h>
34+
#include <string.h>
35+
3336
#ifndef HAVE_PROCESS_VM_READV
3437
# define HAVE_PROCESS_VM_READV 0
3538
#endif

0 commit comments

Comments
 (0)