File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -452,12 +452,19 @@ PyGccCfg_get_block_for_label(PyObject *s, PyObject *args)
452452 return PyGccBasicBlock_New (gcc_private_make_cfg_block (bb ));
453453}
454454
455+ union gcc_cfg_as_ptr {
456+ gcc_cfg cfg ;
457+ void * ptr ;
458+ };
459+
455460PyObject *
456- PyGccCfg_New ( gcc_cfg cfg )
461+ real_make_cfg_wrapper ( void * ptr )
457462{
458463 struct PyGccCfg * obj ;
464+ union gcc_cfg_as_ptr u ;
465+ u .ptr = ptr ;
459466
460- if (!cfg .inner ) {
467+ if (!u . cfg .inner ) {
461468 Py_RETURN_NONE ;
462469 }
463470
@@ -466,14 +473,25 @@ PyGccCfg_New(gcc_cfg cfg)
466473 goto error ;
467474 }
468475
469- obj -> cfg = cfg ;
476+ obj -> cfg = u . cfg ;
470477
471478 return (PyObject * )obj ;
472479
473480error :
474481 return NULL ;
475482}
476483
484+ static PyObject * cfg_wrapper_cache = NULL ;
485+ PyObject *
486+ PyGccCfg_New (gcc_cfg cfg )
487+ {
488+ union gcc_cfg_as_ptr u ;
489+ u .cfg = cfg ;
490+ return PyGcc_LazilyCreateWrapper (& cfg_wrapper_cache ,
491+ u .ptr ,
492+ real_make_cfg_wrapper );
493+ }
494+
477495void
478496PyGcc_WrtpMarkForPyGccCfg (PyGccCfg * wrapper )
479497{
You can’t perform that action at this time.
0 commit comments