Skip to content

Commit 7f009ed

Browse files
committed
Merge branch 'python'
* python: Define PY_SSIZE_T_CLEAN macro Python: define PY_SSIZE_T_CLEAN Conflicts: CHANGES.current
2 parents 34a2735 + abc8e0b commit 7f009ed

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGES.current

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
77
Version 4.1.0 (in progress)
88
===========================
99

10+
2022-05-27: xypron
11+
[Python] #2277 Define PY_SSIZE_T_CLEAN macro before #include "Python.h" as
12+
recommended in Python 3.7 and later.
13+
14+
To avoid this macro definition, add the following to your interface file so
15+
that SWIG_NO_PY_SSIZE_T_CLEAN is defined at the beginning of the C++ wrappers:
16+
17+
%begin %{
18+
#define SWIG_NO_PY_SSIZE_T_CLEAN
19+
%}
20+
1021
2022-05-26: rokups
1122
[C#] #1323 Modify SwigDerivedClassHasMethod for a more efficient director
1223
implementation when calling virtual methods that are not overidden.

Lib/python/embed.i

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ As far as I know, this module is C++ safe.
2929
#endif
3030

3131
%wrapper %{
32-
32+
#ifndef SWIG_NO_PY_SSIZE_T_CLEAN
33+
#define PY_SSIZE_T_CLEAN
34+
#endif
3335
#include <Python.h>
3436

3537
#ifdef __cplusplus

Lib/python/pyruntime.swg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# include <corecrt.h>
1212
#endif
1313

14+
#ifndef SWIG_NO_PY_SSIZE_T_CLEAN
15+
#define PY_SSIZE_T_CLEAN
16+
#endif
1417
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
1518
/* Use debug wrappers with the Python release dll */
1619
# undef _DEBUG

0 commit comments

Comments
 (0)