@@ -229,13 +229,13 @@ struct value_and_holder {
229
229
bool holder_constructed () const {
230
230
return inst->simple_layout
231
231
? inst->simple_holder_constructed
232
- : ( bool ) inst->nonsimple .holder_constructed [index ];
232
+ : inst->nonsimple .holder_constructed [index ];
233
233
}
234
234
void set_holder_constructed () {
235
235
if (inst->simple_layout )
236
236
inst->simple_holder_constructed = true ;
237
237
else
238
- inst->nonsimple .holder_constructed [index ] = 1 ;
238
+ inst->nonsimple .holder_constructed [index ] = true ;
239
239
}
240
240
};
241
241
@@ -350,7 +350,7 @@ PYBIND11_NOINLINE inline void instance::allocate_layout() {
350
350
space += t->holder_size_in_ptrs ; // holder instance
351
351
}
352
352
size_t flags_at = space;
353
- space += size_in_ptrs (n_types); // holder constructed flags
353
+ space += size_in_ptrs (n_types * sizeof ( bool ) ); // holder constructed flags
354
354
355
355
// Allocate space for flags, values, and holders, and initialize it to 0 (flags and values,
356
356
// in particular, need to be 0). Use Python's memory allocation functions: in Python 3.6
@@ -365,7 +365,7 @@ PYBIND11_NOINLINE inline void instance::allocate_layout() {
365
365
if (!nonsimple.values_and_holders ) throw std::bad_alloc ();
366
366
std::memset (nonsimple.values_and_holders , 0 , space * sizeof (void *));
367
367
#endif
368
- nonsimple.holder_constructed = reinterpret_cast <unsigned char *>(&nonsimple.values_and_holders [flags_at]);
368
+ nonsimple.holder_constructed = reinterpret_cast <bool *>(&nonsimple.values_and_holders [flags_at]);
369
369
}
370
370
owned = true ;
371
371
}
0 commit comments