Commit 6797dc1
swig: fix Py_NewRef compatibility with Python < 3.10
SWIG >= 4.1 generates calls to Py_NewRef() in its runtime boilerplate.
Py_NewRef was introduced in Python 3.10, causing an undefined symbol
error on older distributions (e.g. SLES 15.6/15.7 with Python 3.6).
Add a static inline shim inside the %begin block, guarded by
PY_VERSION_HEX, so it precedes SWIG's own runtime in the generated C
file. Python.h is included explicitly at that point to make PyObject
available. A meson warning is emitted at configure time when the older
Python is detected.
Signed-off-by: Martin Belanger <[email protected]>
Assisted-by: Claude Sonnet 4.6 <[email protected]>1 parent 3894be8 commit 6797dc1
2 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
13 | 27 | | |
14 | 28 | | |
15 | 29 | | |
| |||
0 commit comments