@@ -356,9 +356,18 @@ PyRuby_getattro_with_gvl(PyRubyObject *pyro, PyObject *pyobj_name)
356
356
357
357
VALUE cPyRubyPtr ;
358
358
359
- rb_data_type_t pycall_pyrubyptr_data_type = {
359
+ static rb_data_type_t pycall_pyrubyptr_data_type = {
360
360
"PyCall::PyRubyPtr" ,
361
- { 0 , pycall_pyptr_free , pycall_pyptr_memsize , }
361
+ {
362
+ 0 ,
363
+ pycall_pyptr_free ,
364
+ pycall_pyptr_memsize ,
365
+ },
366
+ #ifdef RUBY_TYPED_FREE_IMMEDIATELY
367
+ PYCALL_PYPTR_PARENT ,
368
+ 0 ,
369
+ RUBY_TYPED_FREE_IMMEDIATELY
370
+ #endif
362
371
};
363
372
364
373
static inline int
@@ -460,18 +469,13 @@ pycall_init_ruby_wrapper(void)
460
469
/* PyCall::PyRubyPtr */
461
470
462
471
// This cannot be defined above because MSVC 2019 results in error C2099: initializer is not a constant
463
- #ifdef RUBY_TYPED_FREE_IMMEDIATELY
464
- pycall_pyrubyptr_data_type .parent = & pycall_pyptr_data_type ;
465
- pycall_pyrubyptr_data_type .data = 0 ;
466
- pycall_pyrubyptr_data_type .flags = RUBY_TYPED_FREE_IMMEDIATELY ;
467
- #endif
472
+ PYCALL_PYPTR_DATA_INIT_PARENT (pycall_pyrubyptr_data_type );
468
473
469
474
cPyRubyPtr = rb_define_class_under (mPyCall , "PyRubyPtr" , cPyPtr );
470
475
rb_define_alloc_func (cPyRubyPtr , pycall_pyruby_allocate );
471
476
rb_define_method (cPyRubyPtr , "__ruby_object_id__" , pycall_pyruby_get_ruby_object_id , 0 );
472
477
473
478
rb_define_module_function (mPyCall , "wrap_ruby_object" , pycall_m_wrap_ruby_object , 1 );
474
-
475
479
}
476
480
477
481
/* --- File internal utilities --- */
0 commit comments