bpo-35081: Add Include/internal/pycore_object.h (GH-10640) · python/cpython@bcda8f1 (original) (raw)

`@@ -323,51 +323,6 @@ typedef struct {

`

323

323

` _PyGCHead_SET_FINALIZED(_Py_AS_GC(o))

`

324

324

`#endif /* !defined(Py_LIMITED_API) */

`

325

325

``

326

``

-

327

``

`-

#if defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN)

`

328

``

`-

/* Tell the GC to track this object.

`

329

``

`-

`

330

``

`-

`

331

``

`-

`

332

``

`-

`

333

``

`-

`

334

``

`-

`

335

``

`-

`

336

``

`-

`

337

``

`-

`

338

``

`-

*/

`

339

``

`-

#define _PyObject_GC_TRACK(o) do { \

`

340

``

`-

PyGC_Head *g = _Py_AS_GC(o); \

`

341

``

`-

if (g->_gc_next != 0) { \

`

342

``

`-

Py_FatalError("GC object already tracked"); \

`

343

``

`-

} \

`

344

``

`-

assert((g->_gc_prev & _PyGC_PREV_MASK_COLLECTING) == 0); \

`

345

``

`-

PyGC_Head last = (PyGC_Head)(_PyRuntime.gc.generation0->_gc_prev); \

`

346

``

`-

_PyGCHead_SET_NEXT(last, g); \

`

347

``

`-

_PyGCHead_SET_PREV(g, last); \

`

348

``

`-

_PyGCHead_SET_NEXT(g, _PyRuntime.gc.generation0); \

`

349

``

`-

_PyRuntime.gc.generation0->_gc_prev = (uintptr_t)g; \

`

350

``

`-

} while (0);

`

351

``

-

352

``

`-

/* Tell the GC to stop tracking this object.

`

353

``

`-

`

354

``

`-

`

355

``

`-

`

356

``

`-

`

357

``

`-

`

358

``

`-

*/

`

359

``

`-

#define _PyObject_GC_UNTRACK(o) do { \

`

360

``

`-

PyGC_Head *g = _Py_AS_GC(o); \

`

361

``

`-

PyGC_Head *prev = _PyGCHead_PREV(g); \

`

362

``

`-

PyGC_Head *next = _PyGCHead_NEXT(g); \

`

363

``

`-

assert(next != NULL); \

`

364

``

`-

_PyGCHead_SET_NEXT(prev, next); \

`

365

``

`-

_PyGCHead_SET_PREV(next, prev); \

`

366

``

`-

g->_gc_next = 0; \

`

367

``

`-

g->_gc_prev &= _PyGC_PREV_MASK_FINALIZED; \

`

368

``

`-

} while (0);

`

369

``

`-

#endif /* defined(Py_BUILD_CORE) || defined(Py_BUILD_CORE_BUILTIN) */

`

370

``

-

371

326

`#ifndef Py_LIMITED_API

`

372

327

`PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t size);

`

373

328

`PyAPI_FUNC(PyObject *) _PyObject_GC_Calloc(size_t size);

`