Fix Python 3.10 (PEP-620) incompatibility. · boostorg/python@500194e (original) (raw)

`@@ -208,7 +208,7 @@ namespace objects

`

208

208

` {

`

209

209

`if (static_data_object.tp_dict == 0)

`

210

210

` {

`

211

``

`-

Py_TYPE(&static_data_object) = &PyType_Type;

`

``

211

`+

Py_SET_TYPE(&static_data_object, &PyType_Type);

`

212

212

` static_data_object.tp_base = &PyProperty_Type;

`

213

213

`if (PyType_Ready(&static_data_object))

`

214

214

`return 0;

`

`@@ -316,7 +316,7 @@ namespace objects

`

316

316

` {

`

317

317

`if (class_metatype_object.tp_dict == 0)

`

318

318

` {

`

319

``

`-

Py_TYPE(&class_metatype_object) = &PyType_Type;

`

``

319

`+

Py_SET_TYPE(&class_metatype_object, &PyType_Type);

`

320

320

` class_metatype_object.tp_base = &PyType_Type;

`

321

321

`if (PyType_Ready(&class_metatype_object))

`

322

322

`return type_handle();

`

`@@ -374,12 +374,7 @@ namespace objects

`

374

374

`// like, so we'll store the total size of the object

`

375

375

`// there. A negative number indicates that the extra

`

376

376

`// instance memory is not yet allocated to any holders.

`

377

``

`-

#if PY_VERSION_HEX >= 0x02060000

`

378

``

`-

Py_SIZE(result) =

`

379

``

`-

#else

`

380

``

`-

result->ob_size =

`

381

``

`-

#endif

`

382

``

`-

-(static_cast(offsetof(instance<>,storage) + instance_size));

`

``

377

`+

Py_SET_SIZE(result,-static_cast(offsetof(instance<>,storage) + instance_size));

`

383

378

` }

`

384

379

`return (PyObject*)result;

`

385

380

` }

`

`@@ -470,7 +465,7 @@ namespace objects

`

470

465

` {

`

471

466

`if (class_type_object.tp_dict == 0)

`

472

467

` {

`

473

``

`-

Py_TYPE(&class_type_object) = incref(class_metatype().get());

`

``

468

`+

Py_SET_TYPE(&class_type_object, incref(class_metatype().get()));

`

474

469

` class_type_object.tp_base = &PyBaseObject_Type;

`

475

470

`if (PyType_Ready(&class_type_object))

`

476

471

`return type_handle();

`

`@@ -739,7 +734,7 @@ void* instance_holder::allocate(PyObject* self_, std::size_t holder_offset, std:

`

739

734

`assert(holder_offset >= offsetof(objects::instance<>,storage));

`

740

735

``

741

736

`// Record the fact that the storage is occupied, noting where it starts

`

742

``

`-

Py_SIZE(self) = holder_offset;

`

``

737

`+

Py_SET_SIZE(self, holder_offset);

`

743

738

`return (char*)self + holder_offset;

`

744

739

` }

`

745

740

`else

`