Commit b0ce0a8
committed
PYCBC-1854: Migrate _core to the stable ABI (abi3)
Changes
--------
* Convert every C-extension type (logger, exceptions, result/streamed
result/scan iterator, connection, transactions, hdr_histogram,
kv_request) from static PyTypeObject structs to PyType_Spec/
PyType_FromSpec heap types, using PyType_GenericAlloc for allocation
and a shared free_heap_type_instance() helper for teardown: heap-type
instances hold a reference to their type, so every tp_dealloc must
free through the type's own Py_tp_free slot (a Python subclass is
GC-allocated and needs PyObject_GC_Del) and then release that
reference
* Regenerate pycbc_kv_request.cxx/.hxx via autogen from updated
jinja2 templates carrying the same heap-type conversion
* Modernize module init: PyModule_AddType/PyModule_AddObjectRef
replace the now-dead register_pytype/register_heap_type helpers
(deleted) at all call sites; spot-sweep Py_INCREF+assign pairs to
Py_NewRef
* Add limited-API compatibility shims in pytype_utils.hxx (Py_T_*
PyMemberDef macros, a PyUnicode_AsUTF8 shim pre-3.13) and fix a
missing include in pytocbpp_defs.hxx that needed it
* Add PYCBC_PY_LIMITED_API build option (default on, floor 3.10):
CMakeLists.txt/setup.py/pycbc_build_setup.py wire it through to
abi3 wheel tagging and bdist_wheel's --py-limited-api;
python_requires corrected to >=3.10
* Build pycbc_core with hidden default visibility (no-op under MSVC),
leaving PyInit__core -- which carries its own visibility("default")
via PyMODINIT_FUNC -- as the module's only exported symbol
* Link python3.lib rather than the version-specific python3XY.lib on
Windows for a limited-API build; explicitly-listed libraries beat
the /DEFAULTLIB that pyconfig.h's auto-link pragma injects, so the
old link would have bound an abi3-tagged .pyd to one interpreter
* Fix get_ext_filename/CMake filename agreement: a limited-API build
emits <name>.abi3.<so|pyd>, and a non-limited build keeps the
interpreter-specific suffix instead of an untagged .so that any
interpreter's import machinery would load with no version check
* pycbc_build_setup.py: pass the package directory once, on every
platform, as -DPYCBC_MODULE_OUTPUT_DIRECTORY, replacing the global
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY[_<CONFIG>] and the Windows-only
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG>, which retargeted every
library, executable and DLL in the build tree rather than just the
extension module (on Windows that pulled BoringSSL's bssl.exe into
the wheel)
* CMakeLists.txt: apply that path as a per-target property on
pycbc_core only, selecting the category by platform (RUNTIME for the
Windows DLL, LIBRARY everywhere else) and pointing
PDB_OUTPUT_DIRECTORY at the build tree, including the per-config
variants that multi-config generators require
* CMakeLists.txt: warn when PYCBC_MODULE_OUTPUT_DIRECTORY is unset;
nothing else places the module, so the wheel would otherwise be
packed without an extension and fail at import instead of at build
time
* Modernize license metadata to SPDX (license="Apache-2.0",
license_files), drop the now-deprecated OSI classifier, and raise
the setuptools floor to >=70.1
Change-Id: I0f80fa57dd775df007600bf51f10007529a91c9b
Reviewed-on: https://review.couchbase.org/c/couchbase-python-client/+/250742
Tested-by: Build Bot <build@couchbase.com>
Reviewed-by: Dimitris Christodoulou <dimitris.christodoulou@couchbase.com>1 parent cf977c7 commit b0ce0a8
27 files changed
Lines changed: 774 additions & 605 deletions
File tree
- src
- transactions
- tools/autogen/templates/bindings
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
254 | 259 | | |
255 | 260 | | |
256 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
257 | 292 | | |
258 | 293 | | |
259 | 294 | | |
| |||
264 | 299 | | |
265 | 300 | | |
266 | 301 | | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
267 | 320 | | |
268 | 321 | | |
269 | 322 | | |
270 | | - | |
| 323 | + | |
271 | 324 | | |
272 | 325 | | |
273 | 326 | | |
| |||
299 | 352 | | |
300 | 353 | | |
301 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
302 | 358 | | |
303 | 359 | | |
304 | 360 | | |
305 | | - | |
306 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
46 | 97 | | |
47 | 98 | | |
48 | 99 | | |
| |||
120 | 171 | | |
121 | 172 | | |
122 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
123 | 195 | | |
124 | 196 | | |
125 | 197 | | |
| |||
143 | 215 | | |
144 | 216 | | |
145 | 217 | | |
| 218 | + | |
| 219 | + | |
146 | 220 | | |
147 | 221 | | |
148 | 222 | | |
149 | | - | |
150 | | - | |
| 223 | + | |
151 | 224 | | |
152 | 225 | | |
153 | 226 | | |
| |||
207 | 280 | | |
208 | 281 | | |
209 | 282 | | |
210 | | - | |
211 | | - | |
212 | 283 | | |
213 | 284 | | |
214 | 285 | | |
| |||
232 | 303 | | |
233 | 304 | | |
234 | 305 | | |
235 | | - | |
236 | | - | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
237 | 310 | | |
238 | 311 | | |
239 | 312 | | |
| |||
288 | 361 | | |
289 | 362 | | |
290 | 363 | | |
291 | | - | |
292 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
293 | 383 | | |
294 | 384 | | |
295 | 385 | | |
| |||
340 | 430 | | |
341 | 431 | | |
342 | 432 | | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
343 | 460 | | |
344 | 461 | | |
345 | 462 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
0 commit comments