@@ -330,11 +330,13 @@ struct type_record {
330
330
331
331
bases.append ((PyObject *) base_info->type );
332
332
333
- if (base_info->type ->tp_dictoffset != 0 )
333
+ if (base_info->type ->tp_dictoffset != 0 ) {
334
334
dynamic_attr = true ;
335
+ }
335
336
336
- if (caster)
337
+ if (caster) {
337
338
base_info->implicit_casts .emplace_back (type, caster);
339
+ }
338
340
}
339
341
};
340
342
@@ -410,13 +412,16 @@ template <> struct process_attribute<is_new_style_constructor> : process_attribu
410
412
};
411
413
412
414
inline void check_kw_only_arg (const arg &a, function_record *r) {
413
- if (r->args .size () > r->nargs_pos && (!a.name || a.name [0 ] == ' \0 ' ))
414
- pybind11_fail (" arg(): cannot specify an unnamed argument after a kw_only() annotation or args() argument" );
415
+ if (r->args .size () > r->nargs_pos && (!a.name || a.name [0 ] == ' \0 ' )) {
416
+ pybind11_fail (" arg(): cannot specify an unnamed argument after a kw_only() annotation or "
417
+ " args() argument" );
418
+ }
415
419
}
416
420
417
421
inline void append_self_arg_if_needed (function_record *r) {
418
- if (r->is_method && r->args .empty ())
419
- r->args .emplace_back (" self" , nullptr , handle (), /* convert=*/ true , /* none=*/ false );
422
+ if (r->is_method && r->args .empty ()) {
423
+ r->args .emplace_back (" self" , nullptr , handle (), /* convert=*/ true , /* none=*/ false );
424
+ }
420
425
}
421
426
422
427
// / Process a keyword argument attribute (*without* a default value)
@@ -432,8 +437,10 @@ template <> struct process_attribute<arg> : process_attribute_default<arg> {
432
437
// / Process a keyword argument attribute (*with* a default value)
433
438
template <> struct process_attribute <arg_v> : process_attribute_default<arg_v> {
434
439
static void init (const arg_v &a, function_record *r) {
435
- if (r->is_method && r->args .empty ())
436
- r->args .emplace_back (" self" , /* descr=*/ nullptr , /* parent=*/ handle (), /* convert=*/ true , /* none=*/ false );
440
+ if (r->is_method && r->args .empty ()) {
441
+ r->args .emplace_back (
442
+ " self" , /* descr=*/ nullptr , /* parent=*/ handle (), /* convert=*/ true , /* none=*/ false );
443
+ }
437
444
438
445
if (!a.value ) {
439
446
#if !defined(NDEBUG)
@@ -466,8 +473,10 @@ template <> struct process_attribute<arg_v> : process_attribute_default<arg_v> {
466
473
template <> struct process_attribute <kw_only> : process_attribute_default<kw_only> {
467
474
static void init (const kw_only &, function_record *r) {
468
475
append_self_arg_if_needed (r);
469
- if (r->has_args && r->nargs_pos != static_cast <std::uint16_t >(r->args .size ()))
470
- pybind11_fail (" Mismatched args() and kw_only(): they must occur at the same relative argument location (or omit kw_only() entirely)" );
476
+ if (r->has_args && r->nargs_pos != static_cast <std::uint16_t >(r->args .size ())) {
477
+ pybind11_fail (" Mismatched args() and kw_only(): they must occur at the same relative "
478
+ " argument location (or omit kw_only() entirely)" );
479
+ }
471
480
r->nargs_pos = static_cast <std::uint16_t >(r->args .size ());
472
481
}
473
482
};
@@ -477,8 +486,9 @@ template <> struct process_attribute<pos_only> : process_attribute_default<pos_o
477
486
static void init (const pos_only &, function_record *r) {
478
487
append_self_arg_if_needed (r);
479
488
r->nargs_pos_only = static_cast <std::uint16_t >(r->args .size ());
480
- if (r->nargs_pos_only > r->nargs_pos )
489
+ if (r->nargs_pos_only > r->nargs_pos ) {
481
490
pybind11_fail (" pos_only(): cannot follow a py::args() argument" );
491
+ }
482
492
// It also can't follow a kw_only, but a static_assert in pybind11.h checks that
483
493
}
484
494
};
0 commit comments