@@ -273,8 +273,7 @@ static PyObject* THPIInfo_str(THPIInfo* self) {
273
273
return !PyErr_Occurred () ? THPUtils_packString (oss.str ().c_str ()) : nullptr ;
274
274
}
275
275
276
- // NOLINTNEXTLINE(modernize-avoid-c-arrays,cppcoreguidelines-avoid-non-const-global-variables,cppcoreguidelines-avoid-c-arrays)
277
- static struct PyGetSetDef THPFInfo_properties[] = {
276
+ static const std::initializer_list<PyGetSetDef> THPFInfo_properties = {
278
277
{" bits" , (getter)THPDTypeInfo_bits, nullptr , nullptr , nullptr },
279
278
{" eps" , (getter)THPFInfo_eps, nullptr , nullptr , nullptr },
280
279
{" max" , (getter)THPFInfo_max, nullptr , nullptr , nullptr },
@@ -289,11 +288,6 @@ static struct PyGetSetDef THPFInfo_properties[] = {
289
288
{" dtype" , (getter)THPFInfo_dtype, nullptr , nullptr , nullptr },
290
289
{nullptr }};
291
290
292
- // NOLINTNEXTLINE(modernize-avoid-c-arrays,cppcoreguidelines-avoid-non-const-global-variables,cppcoreguidelines-avoid-c-arrays)
293
- static PyMethodDef THPFInfo_methods[] = {
294
- {nullptr } /* Sentinel */
295
- };
296
-
297
291
PyTypeObject THPFInfoType = {
298
292
PyVarObject_HEAD_INIT (nullptr , 0 )
299
293
" torch.finfo" , /* tp_name */
@@ -322,9 +316,10 @@ PyTypeObject THPFInfoType = {
322
316
0 , /* tp_weaklistoffset */
323
317
nullptr , /* tp_iter */
324
318
nullptr , /* tp_iternext */
325
- THPFInfo_methods , /* tp_methods */
319
+ nullptr , /* tp_methods */
326
320
nullptr , /* tp_members */
327
- THPFInfo_properties, /* tp_getset */
321
+ // NOLINTNEXTLINE(*const-cast)
322
+ const_cast <PyGetSetDef*>(std::data (THPFInfo_properties)), /* tp_getset */
328
323
nullptr , /* tp_base */
329
324
nullptr , /* tp_dict */
330
325
nullptr , /* tp_descr_get */
@@ -335,19 +330,13 @@ PyTypeObject THPFInfoType = {
335
330
THPFInfo_pynew, /* tp_new */
336
331
};
337
332
338
- // NOLINTNEXTLINE(modernize-avoid-c-arrays,cppcoreguidelines-avoid-non-const-global-variables,cppcoreguidelines-avoid-c-arrays)
339
- static struct PyGetSetDef THPIInfo_properties[] = {
333
+ static const std::initializer_list<PyGetSetDef> THPIInfo_properties = {
340
334
{" bits" , (getter)THPDTypeInfo_bits, nullptr , nullptr , nullptr },
341
335
{" max" , (getter)THPIInfo_max, nullptr , nullptr , nullptr },
342
336
{" min" , (getter)THPIInfo_min, nullptr , nullptr , nullptr },
343
337
{" dtype" , (getter)THPIInfo_dtype, nullptr , nullptr , nullptr },
344
338
{nullptr }};
345
339
346
- // NOLINTNEXTLINE(modernize-avoid-c-arrays,cppcoreguidelines-avoid-non-const-global-variables,cppcoreguidelines-avoid-c-arrays)
347
- static PyMethodDef THPIInfo_methods[] = {
348
- {nullptr } /* Sentinel */
349
- };
350
-
351
340
PyTypeObject THPIInfoType = {
352
341
PyVarObject_HEAD_INIT (nullptr , 0 )
353
342
" torch.iinfo" , /* tp_name */
@@ -376,9 +365,10 @@ PyTypeObject THPIInfoType = {
376
365
0 , /* tp_weaklistoffset */
377
366
nullptr , /* tp_iter */
378
367
nullptr , /* tp_iternext */
379
- THPIInfo_methods , /* tp_methods */
368
+ nullptr , /* tp_methods */
380
369
nullptr , /* tp_members */
381
- THPIInfo_properties, /* tp_getset */
370
+ // NOLINTNEXTLINE(*const-cast)
371
+ const_cast <PyGetSetDef*>(std::data (THPIInfo_properties)), /* tp_getset */
382
372
nullptr , /* tp_base */
383
373
nullptr , /* tp_dict */
384
374
nullptr , /* tp_descr_get */
0 commit comments