@@ -356,9 +356,18 @@ PyRuby_getattro_with_gvl(PyRubyObject *pyro, PyObject *pyobj_name)
356356
357357VALUE  cPyRubyPtr ;
358358
359- rb_data_type_t  pycall_pyrubyptr_data_type  =  {
359+ static   rb_data_type_t  pycall_pyrubyptr_data_type  =  {
360360  "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 
362371};
363372
364373static  inline  int 
@@ -460,18 +469,13 @@ pycall_init_ruby_wrapper(void)
460469  /* PyCall::PyRubyPtr */ 
461470
462471// 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 );
468473
469474  cPyRubyPtr  =  rb_define_class_under (mPyCall , "PyRubyPtr" , cPyPtr );
470475  rb_define_alloc_func (cPyRubyPtr , pycall_pyruby_allocate );
471476  rb_define_method (cPyRubyPtr , "__ruby_object_id__" , pycall_pyruby_get_ruby_object_id , 0 );
472477
473478  rb_define_module_function (mPyCall , "wrap_ruby_object" , pycall_m_wrap_ruby_object , 1 );
474-    
475479}
476480
477481/* --- File internal utilities --- */ 
0 commit comments