def get_c_sync(r, name, sub):
 return ('\n    if (!%(failure_var)s) {\n      %(sync)s\n      PyObject* old = PyList_GET_ITEM(storage_%(name)s, 0);\n      {Py_XINCREF(py_%(name)s);}\n      PyList_SET_ITEM(storage_%(name)s, 0, py_%(name)s);\n      {Py_XDECREF(old);}\n    }\n    ' % dict(sync=r.type.c_sync(name, sub), name=name, **sub))

def get_c_sync ( r , name , sub ) : return ( '\n    if (!%(failure_var)s) {\n      %(sync)s\n      PyObject* old = PyList_GET_ITEM(storage_%(name)s, 0);\n      {Py_XINCREF(py_%(name)s);}\n      PyList_SET_ITEM(storage_%(name)s, 0, py_%(name)s);\n      {Py_XDECREF(old);}\n    }\n    ' % dict ( sync = r . type . c_sync ( name , sub ) , name = name , ** sub ) )
wrapper around c_sync that syncs py_name with storage .