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

Appearance settings

Commit 632d1aa

Browse filesBrowse files
authored
Don't redefine _Py_NULL macro if already defined (#138)
Original mypy fix by Michael R. Crusoe.
1 parent c84545f commit 632d1aa
Copy full SHA for 632d1aa

File tree

1 file changed

+7
-5
lines changed
Filter options

1 file changed

+7
-5
lines changed

‎pythoncapi_compat.h

Copy file name to clipboardExpand all lines: pythoncapi_compat.h
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ extern "C" {
3737
// Static inline functions should use _Py_NULL rather than using directly NULL
3838
// to prevent C++ compiler warnings. On C23 and newer and on C++11 and newer,
3939
// _Py_NULL is defined as nullptr.
40-
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \
41-
|| (defined(__cplusplus) && __cplusplus >= 201103)
42-
# define _Py_NULL nullptr
43-
#else
44-
# define _Py_NULL NULL
40+
#ifndef _Py_NULL
41+
# if (defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L) \
42+
|| (defined(__cplusplus) && __cplusplus >= 201103)
43+
# define _Py_NULL nullptr
44+
# else
45+
# define _Py_NULL NULL
46+
# endif
4547
#endif
4648

4749
// Cast argument to PyObject* type.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.