@@ -66,7 +66,7 @@ inline PyTypeObject *make_static_property_type() {
6666 issue no Python C API calls which could potentially invoke the
6767 garbage collector (the GC will call type_traverse(), which will in
6868 turn find the newly constructed type in an invalid state) */
69- auto heap_type = (PyHeapTypeObject *) PyType_Type.tp_alloc (&PyType_Type, 0 );
69+ auto * heap_type = (PyHeapTypeObject *) PyType_Type.tp_alloc (&PyType_Type, 0 );
7070 if (!heap_type)
7171 pybind11_fail (" make_static_property_type(): error allocating type!" );
7272
@@ -75,7 +75,7 @@ inline PyTypeObject *make_static_property_type() {
7575 heap_type->ht_qualname = name_obj.inc_ref ().ptr ();
7676# endif
7777
78- auto type = &heap_type->ht_type ;
78+ auto * type = &heap_type->ht_type ;
7979 type->tp_name = name;
8080 type->tp_base = type_incref (&PyProperty_Type);
8181 type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HEAPTYPE;
@@ -131,7 +131,7 @@ extern "C" inline int pybind11_meta_setattro(PyObject *obj, PyObject *name, PyOb
131131 // 1. `Type.static_prop = value` --> descr_set: `Type.static_prop.__set__(value)`
132132 // 2. `Type.static_prop = other_static_prop` --> setattro: replace existing `static_prop`
133133 // 3. `Type.regular_attribute = value` --> setattro: regular attribute assignment
134- const auto static_prop = (PyObject *) get_internals ().static_property_type ;
134+ auto * const static_prop = (PyObject *) get_internals ().static_property_type ;
135135 const auto call_descr_set = (descr != nullptr ) && (value != nullptr )
136136 && (PyObject_IsInstance (descr, static_prop) != 0 )
137137 && (PyObject_IsInstance (value, static_prop) == 0 );
@@ -180,7 +180,7 @@ extern "C" inline PyObject *pybind11_meta_call(PyObject *type, PyObject *args, P
180180 }
181181
182182 // This must be a pybind11 instance
183- auto instance = reinterpret_cast <detail::instance *>(self);
183+ auto * instance = reinterpret_cast <detail::instance *>(self);
184184
185185 // Ensure that the base __init__ function(s) were called
186186 for (const auto &vh : values_and_holders (instance)) {
@@ -244,7 +244,7 @@ inline PyTypeObject *make_default_metaclass() {
244244 issue no Python C API calls which could potentially invoke the
245245 garbage collector (the GC will call type_traverse(), which will in
246246 turn find the newly constructed type in an invalid state) */
247- auto heap_type = (PyHeapTypeObject *) PyType_Type.tp_alloc (&PyType_Type, 0 );
247+ auto * heap_type = (PyHeapTypeObject *) PyType_Type.tp_alloc (&PyType_Type, 0 );
248248 if (!heap_type)
249249 pybind11_fail (" make_default_metaclass(): error allocating metaclass!" );
250250
@@ -253,7 +253,7 @@ inline PyTypeObject *make_default_metaclass() {
253253 heap_type->ht_qualname = name_obj.inc_ref ().ptr ();
254254#endif
255255
256- auto type = &heap_type->ht_type ;
256+ auto * type = &heap_type->ht_type ;
257257 type->tp_name = name;
258258 type->tp_base = type_incref (&PyType_Type);
259259 type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HEAPTYPE;
@@ -285,7 +285,7 @@ inline void traverse_offset_bases(void *valueptr,
285285 instance *self,
286286 bool (*f)(void * /* parentptr*/ , instance * /* self*/ )) {
287287 for (handle h : reinterpret_borrow<tuple>(tinfo->type ->tp_bases )) {
288- if (auto parent_tinfo = get_type_info ((PyTypeObject *) h.ptr ())) {
288+ if (auto * parent_tinfo = get_type_info ((PyTypeObject *) h.ptr ())) {
289289 for (auto &c : parent_tinfo->implicit_casts ) {
290290 if (c.first == tinfo->cpptype ) {
291291 auto *parentptr = c.second (valueptr);
@@ -341,7 +341,7 @@ inline PyObject *make_new_instance(PyTypeObject *type) {
341341 }
342342#endif
343343 PyObject *self = type->tp_alloc (type, 0 );
344- auto inst = reinterpret_cast <instance *>(self);
344+ auto * inst = reinterpret_cast <instance *>(self);
345345 // Allocate the value/holder internals:
346346 inst->allocate_layout ();
347347
@@ -366,14 +366,14 @@ extern "C" inline int pybind11_object_init(PyObject *self, PyObject *, PyObject
366366
367367inline void add_patient (PyObject *nurse, PyObject *patient) {
368368 auto &internals = get_internals ();
369- auto instance = reinterpret_cast <detail::instance *>(nurse);
369+ auto * instance = reinterpret_cast <detail::instance *>(nurse);
370370 instance->has_patients = true ;
371371 Py_INCREF (patient);
372372 internals.patients [nurse].push_back (patient);
373373}
374374
375375inline void clear_patients (PyObject *self) {
376- auto instance = reinterpret_cast <detail::instance *>(self);
376+ auto * instance = reinterpret_cast <detail::instance *>(self);
377377 auto &internals = get_internals ();
378378 auto pos = internals.patients .find (self);
379379 assert (pos != internals.patients .end ());
@@ -390,7 +390,7 @@ inline void clear_patients(PyObject *self) {
390390// / Clears all internal data from the instance and removes it from registered instances in
391391// / preparation for deallocation.
392392inline void clear_instance (PyObject *self) {
393- auto instance = reinterpret_cast <detail::instance *>(self);
393+ auto * instance = reinterpret_cast <detail::instance *>(self);
394394
395395 // Deallocate any values/holders, if present:
396396 for (auto &v_h : values_and_holders (instance)) {
@@ -426,7 +426,7 @@ inline void clear_instance(PyObject *self) {
426426extern " C" inline void pybind11_object_dealloc (PyObject *self) {
427427 clear_instance (self);
428428
429- auto type = Py_TYPE (self);
429+ auto * type = Py_TYPE (self);
430430 type->tp_free (self);
431431
432432#if PY_VERSION_HEX < 0x03080000
@@ -455,7 +455,7 @@ inline PyObject *make_object_base_type(PyTypeObject *metaclass) {
455455 issue no Python C API calls which could potentially invoke the
456456 garbage collector (the GC will call type_traverse(), which will in
457457 turn find the newly constructed type in an invalid state) */
458- auto heap_type = (PyHeapTypeObject *) metaclass->tp_alloc (metaclass, 0 );
458+ auto * heap_type = (PyHeapTypeObject *) metaclass->tp_alloc (metaclass, 0 );
459459 if (!heap_type)
460460 pybind11_fail (" make_object_base_type(): error allocating type!" );
461461
@@ -464,7 +464,7 @@ inline PyObject *make_object_base_type(PyTypeObject *metaclass) {
464464 heap_type->ht_qualname = name_obj.inc_ref ().ptr ();
465465#endif
466466
467- auto type = &heap_type->ht_type ;
467+ auto * type = &heap_type->ht_type ;
468468 type->tp_name = name;
469469 type->tp_base = type_incref (&PyBaseObject_Type);
470470 type->tp_basicsize = static_cast <ssize_t >(sizeof (instance));
@@ -527,7 +527,7 @@ extern "C" inline int pybind11_clear(PyObject *self) {
527527
528528// / Give instances of this type a `__dict__` and opt into garbage collection.
529529inline void enable_dynamic_attributes (PyHeapTypeObject *heap_type) {
530- auto type = &heap_type->ht_type ;
530+ auto * type = &heap_type->ht_type ;
531531 type->tp_flags |= Py_TPFLAGS_HAVE_GC;
532532 type->tp_dictoffset = type->tp_basicsize ; // place dict at the end
533533 type->tp_basicsize += (ssize_t ) sizeof (PyObject *); // and allocate enough space for it
@@ -622,7 +622,7 @@ inline PyObject *make_new_python_type(const type_record &rec) {
622622 module_ = rec.scope .attr (" __name__" );
623623 }
624624
625- auto full_name = c_str (
625+ const auto * full_name = c_str (
626626#if !defined(PYPY_VERSION)
627627 module_ ? str (module_).cast <std::string>() + " ." + rec.name :
628628#endif
@@ -639,16 +639,16 @@ inline PyObject *make_new_python_type(const type_record &rec) {
639639
640640 auto &internals = get_internals ();
641641 auto bases = tuple (rec.bases );
642- auto base = (bases.empty ()) ? internals.instance_base : bases[0 ].ptr ();
642+ auto * base = (bases.empty ()) ? internals.instance_base : bases[0 ].ptr ();
643643
644644 /* Danger zone: from now (and until PyType_Ready), make sure to
645645 issue no Python C API calls which could potentially invoke the
646646 garbage collector (the GC will call type_traverse(), which will in
647647 turn find the newly constructed type in an invalid state) */
648- auto metaclass
648+ auto * metaclass
649649 = rec.metaclass .ptr () ? (PyTypeObject *) rec.metaclass .ptr () : internals.default_metaclass ;
650650
651- auto heap_type = (PyHeapTypeObject *) metaclass->tp_alloc (metaclass, 0 );
651+ auto * heap_type = (PyHeapTypeObject *) metaclass->tp_alloc (metaclass, 0 );
652652 if (!heap_type)
653653 pybind11_fail (std::string (rec.name ) + " : Unable to create type object!" );
654654
@@ -657,7 +657,7 @@ inline PyObject *make_new_python_type(const type_record &rec) {
657657 heap_type->ht_qualname = qualname.inc_ref ().ptr ();
658658#endif
659659
660- auto type = &heap_type->ht_type ;
660+ auto * type = &heap_type->ht_type ;
661661 type->tp_name = full_name;
662662 type->tp_doc = tp_doc;
663663 type->tp_base = type_incref ((PyTypeObject *) base);
0 commit comments