mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Changes to compile with 3.13 (#126033)
This is mainly:
- Fix refcount access macro
- Hide all the Dynamo code that needs update as usual
- Add _PyWeakref_ClearRef as an extern provided by CPython. Including the pycore header that defines it would require raw c include shenanigans that I don't think are worth it.
This allows to build both with regular and nogil version of cpython. Both
Note that this requires the 3.13 branch at least past [d3094744d40de2deefbda9b1996d5029c9ebf0b0](d3094744d4
) which we need for mimalloc include and weakref function being exposed.
debug-only issues in pybind11 with PyMem_MALLOC vs PyObject_MALLOC being should be synced either by updating pybind or cpython. @colesbury I can send a PR to ifdef the proper use in pybind if you think that this is the best solution here?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/126033
Approved by: https://github.com/colesbury
This commit is contained in:
@ -1931,7 +1931,7 @@ void THPVariable_subclass_dealloc(PyObject* self) {
|
||||
if (type->tp_del) {
|
||||
PyObject_GC_Track(self);
|
||||
type->tp_del(self);
|
||||
if (self->ob_refcnt > 0) {
|
||||
if (Py_REFCNT(self) > 0) {
|
||||
/* Resurrected */
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user