Commit 0269b7a
committed
[mypyc] Fix separate=True under free-threading (Py_GIL_DISABLED)
Two gaps in the preceding commit that only showed up on the py314t CI
matrix (free-threading Python + compiled-mypy test harness):
1. The ensure_deps capsule call was only added to module_shim.tmpl,
not to module_shim_no_gil_multiphase.tmpl. Free-threaded builds use
the latter template, so cross-group exports tables were never
populated on py314t and consumers called through NULL function
pointers on the first cross-group invocation. Mirroring the
non-GIL-disabled template fixes it.
2. The `_free_instance` slot (free-list for per-class fast allocation)
was declared with needs_export=True, which puts it into the
exports-table struct. Under Py_GIL_DISABLED, CPyThreadLocal
expands to __thread, which can't legally appear inside a struct
field (clang: "type name does not allow storage class to be
specified"). The slot is only read/written by the class's own
setup/dealloc code inside the defining group -- no cross-group
access is needed -- so dropping needs_export is the right fix.1 parent 7ab4c16 commit 0269b7a
2 files changed
Lines changed: 37 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
232 | | - | |
233 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
234 | 236 | | |
235 | 237 | | |
236 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
7 | 38 | | |
8 | 39 | | |
9 | 40 | | |
| |||
0 commit comments