File: 0005-pythoncapi_compat-don-t-define-Py_NULL-if-it-is-alre.patch

package info (click to toggle)
mypy 1.15.0-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 20,576 kB
  • sloc: python: 105,159; cpp: 11,380; ansic: 6,629; makefile: 247; sh: 20
file content (30 lines) | stat: -rw-r--r-- 924 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From: "Michael R. Crusoe" <crusoe@debian.org>
Date: Mon, 17 Feb 2025 19:40:07 +0100
Subject: pythoncapi_compat: don't define Py_NULL if it is already defined

Forwarded: https://github.com/python/mypy/pull/18699

---
 mypyc/lib-rt/pythoncapi_compat.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mypyc/lib-rt/pythoncapi_compat.h b/mypyc/lib-rt/pythoncapi_compat.h
index cee282d..c49af7a 100644
--- a/mypyc/lib-rt/pythoncapi_compat.h
+++ b/mypyc/lib-rt/pythoncapi_compat.h
@@ -33,6 +33,7 @@ extern "C" {
 #  define _Py_CAST(type, expr) ((type)(expr))
 #endif
 
+#ifndef _Py_NULL
 // Static inline functions should use _Py_NULL rather than using directly NULL
 // to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer,
 // _Py_NULL is defined as nullptr.
@@ -42,6 +43,7 @@ extern "C" {
 #else
 #  define _Py_NULL NULL
 #endif
+#endif
 
 // Cast argument to PyObject* type.
 #ifndef _PyObject_CAST