Commit 800c126
committed
[lldb] Require at least Python 3.11 when targeting the Limited C API
This is a continuation of my effort [1] to eliminate uses of the private
Python API in LLDB. I found 3 more issues that were hidden in the
typemap, because those were included before we defined Py_LIMITED_API.
The primary motivator for bumping the minimum required Python version is
our use of `pybuffer` (i.e. the Buffer Protocol).
- For Python versions prior to Python 3.11, your only option was to
target the "Old Buffer Protocol" [2], which has been deprecated since
Python 3 and removed in Python 3.13, though the symbols still exist
for ABI compatibility.
- For Python versions 3.13 and later, because of the removal, your only
option is to target the "New Buffer Protocol" [3] which was only
added to the stable API in Python 3.11.
This leads to certain combination of Python versions for building
against and targeting with the limited API that are not compatible. For
example, you cannot target the 3.8 stable API when building against
Python 3.13 because the new version of Python doesn't declare the old
APIs and you cannot use the new APIs yet.
To make this more complicated, the use of the buffer protocol is coming
from SWIG. Furthermore, all released versions of SWIG get this wrong.
For unrelated reasons, to work around a bug in SWIG < 4.1, we already
reimplement the swig type wrapper for the Buffer Protocol in a way
that's compatible with Python 3.11 and later. Instead of waiting for a
SWIG release that fixes this issue (it's already fixed on the master
branch) we can keep the workaround and bump the minimum Python version
when targeting the limited C API.
[1] #151617
[2] https://docs.python.org/3.12/c-api/objbuffer.html
[3] https://docs.python.org/3/c-api/buffer.html1 parent 36848a3 commit 800c126
File tree
5 files changed
+27
-17
lines changed- lldb
- bindings/python
- cmake/modules
- source/Plugins/ScriptInterpreter/Python
5 files changed
+27
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | | - | |
| 223 | + | |
224 | 224 | | |
225 | | - | |
| 225 | + | |
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | 232 | | |
233 | | - | |
| 233 | + | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| |||
628 | 628 | | |
629 | 629 | | |
630 | 630 | | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
637 | 636 | | |
638 | 637 | | |
639 | 638 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
133 | 136 | | |
134 | 137 | | |
135 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
62 | 67 | | |
63 | 68 | | |
64 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
183 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
187 | 189 | | |
188 | | - | |
| 190 | + | |
189 | 191 | | |
190 | 192 | | |
191 | 193 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | 48 | | |
52 | 49 | | |
| 50 | + | |
| 51 | + | |
53 | 52 | | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
0 commit comments