Skip to content

Commit 293bf98

Browse files
committed
add PyObject for no-GIL builds (abiflag=t)
also drop Py_TRACE_REFS support for older than 3.13
1 parent 1571abe commit 293bf98

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

sqlitefts/tokenizer.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,32 @@
2626
except:
2727
dll = ffi.dlopen(find_library("sqlite3"))
2828

29-
if hasattr(sys, "getobjects"):
29+
if "t" in sys.abiflags:
30+
ffi.cdef(
31+
"""
32+
typedef struct sqlite3 sqlite3;
33+
typedef struct {
34+
uintptr_t ob_tid;
35+
uint16_t _padding;
36+
uint8_t ob_mutex;
37+
uint8_t ob_gc_bits;
38+
uint32_t ob_ref_local;
39+
ssize_t ob_ref_shared;
40+
void *ob_type;
41+
sqlite3 *db;
42+
} PyObject;
43+
"""
44+
)
45+
elif hasattr(sys, "getobjects"):
3046
# for a python built with Py_TRACE_REFS
3147
ffi.cdef(
3248
"""
3349
typedef struct sqlite3 sqlite3;
3450
typedef struct {
35-
void *_ob_next;
36-
void *_ob_prev;
37-
size_t ob_refcnt;
51+
union {
52+
ssize_t ob_refcnt;
53+
uint32_t ob_refcnt_split[2];
54+
};
3855
void *ob_type;
3956
sqlite3 *db;
4057
} PyObject;

0 commit comments

Comments
 (0)