Closed
Description
Bug report
This came up while testing numpy on 3.12. A bug report has been filed on numpy/numpy#23766. It's happening due to #103912, which introduced an additional check for tp_bases
not being NULL in type_ready_set_bases
, which is called from PyType_Ready
.
numpy sets tp_bases
manually before calling PyType_Ready
, which means that the afore-mentioned check succeeds, and so, the line that sets ob_type
does not get executed (it used to before #103912), which leads to a segmentation fault later on, when trying to set mro
.
This looks like a bug, but I'm not sure whether that's expected and numpy should be adjusted. If the latter is true, should a note be added in the What's new
document?
Linked PRs
- gh-104614: Make Sure ob_type is Always Set Correctly by PyType_Ready() #105122
- [3.12] gh-104614: Make Sure ob_type is Always Set Correctly by PyType_Ready() (gh-105122) #105211
- gh-104614: Fix potential ref. leak in _testcapimodule/get_basic_static_type() #105225
- [3.12] gh-104614: Fix potential ref. leak in _testcapimodule/get_basic_static_type() (GH-105225) #105248