[Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/pickling prickelpit.c, 1.71, 1.72
Christian Tismer
tismer at centera.de
Thu Apr 29 21:01:10 CEST 2004
Update of /home/cvs/slpdev/src/2.3/dev/Stackless/pickling
In directory centera.de:/tmp/cvs-serv8760/Stackless/pickling
Modified Files:
prickelpit.c
Log Message:
Merging the whole Stackless back into 2.2.3 !!!
built a chain of initializers using a macro, to make it easier
to comment parts out.
Index: prickelpit.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/pickling/prickelpit.c,v
retrieving revision 1.71
retrieving revision 1.72
diff -C2 -d -r1.71 -r1.72
*** prickelpit.c 29 Apr 2004 17:58:59 -0000 1.71
--- prickelpit.c 29 Apr 2004 19:01:08 -0000 1.72
***************
*** 186,190 ****
};
! static int init_type(PyTypeObject *t)
{
PyMethodDescrObject *reduce;
--- 186,190 ----
};
! static int init_type(PyTypeObject *t, int (*initchain)(void))
{
PyMethodDescrObject *reduce;
***************
*** 221,227 ****
--- 221,233 ----
Py_XDECREF(retval);
Py_XDECREF(args);
+ if (ret == 0 && initchain != NULL)
+ ret = initchain();
return ret;
}
+ /* root of init function chain */
+
+ #define initchain NULL
+
/* helper to execute a bit of code which simplifies things */
***************
*** 532,537 ****
static int init_codetype(void)
{
! return init_type(&wrap_PyCode_Type);
}
/******************************************************
--- 538,546 ----
static int init_codetype(void)
{
! return init_type(&wrap_PyCode_Type, initchain);
}
+ #undef initchain
+ #define initchain init_codetype
+
/******************************************************
***************
*** 600,605 ****
static int init_celltype(void)
{
! return init_type(&wrap_PyCell_Type);
}
--- 609,616 ----
static int init_celltype(void)
{
! return init_type(&wrap_PyCell_Type, initchain);
}
+ #undef initchain
+ #define initchain init_celltype
***************
*** 678,683 ****
static int init_functype(void)
{
! return init_type(&wrap_PyFunction_Type);
}
--- 689,696 ----
static int init_functype(void)
{
! return init_type(&wrap_PyFunction_Type, initchain);
}
+ #undef initchain
+ #define initchain init_functype
***************
*** 1014,1027 ****
static int init_frametype(void)
{
! return init_type(&wrap_PyFrame_Type)
! || slp_register_execute(&PyFrame_Type, "eval_frame",
! PyEval_EvalFrame, REF_INVALID_EXEC(eval_frame))
|| slp_register_execute(&PyFrame_Type, "eval_frame_value",
! PyEval_EvalFrame_value, REF_INVALID_EXEC(eval_frame_value))
|| slp_register_execute(&PyFrame_Type, "eval_frame_noval",
! PyEval_EvalFrame_noval, REF_INVALID_EXEC(eval_frame_noval))
|| slp_register_execute(&PyFrame_Type, "eval_frame_iter",
! PyEval_EvalFrame_iter, REF_INVALID_EXEC(eval_frame_iter));
}
/******************************************************
--- 1027,1043 ----
static int init_frametype(void)
{
! return slp_register_execute(&PyFrame_Type, "eval_frame",
! PyEval_EvalFrame, REF_INVALID_EXEC(eval_frame))
|| slp_register_execute(&PyFrame_Type, "eval_frame_value",
! PyEval_EvalFrame_value, REF_INVALID_EXEC(eval_frame_value))
|| slp_register_execute(&PyFrame_Type, "eval_frame_noval",
! PyEval_EvalFrame_noval, REF_INVALID_EXEC(eval_frame_noval))
|| slp_register_execute(&PyFrame_Type, "eval_frame_iter",
! PyEval_EvalFrame_iter, REF_INVALID_EXEC(eval_frame_iter))
! || init_type(&wrap_PyFrame_Type, initchain);
}
+ #undef initchain
+ #define initchain init_frametype
+
/******************************************************
***************
*** 1112,1117 ****
static int init_tracebacktype(void)
{
! return init_type(&wrap_PyTraceBack_Type);
}
/******************************************************
--- 1128,1136 ----
static int init_tracebacktype(void)
{
! return init_type(&wrap_PyTraceBack_Type, initchain);
}
+ #undef initchain
+ #define initchain init_tracebacktype
+
/******************************************************
***************
*** 1191,1196 ****
static int init_moduletype(void)
{
! return init_type(&wrap_PyModule_Type);
}
--- 1210,1217 ----
static int init_moduletype(void)
{
! return init_type(&wrap_PyModule_Type, initchain);
}
+ #undef initchain
+ #define initchain init_moduletype
***************
*** 1285,1291 ****
static int init_itertype(void)
{
! return init_type(&wrap_PySeqIter_Type)
! || init_type(&wrap_PyCallIter_Type);
}
--- 1306,1314 ----
static int init_itertype(void)
{
! return init_type(&wrap_PySeqIter_Type, NULL)
! || init_type(&wrap_PyCallIter_Type, initchain);
}
+ #undef initchain
+ #define initchain init_itertype
***************
*** 1320,1325 ****
static int init_methodtype(void)
{
! return init_type(&wrap_PyMethod_Type);
}
--- 1343,1350 ----
static int init_methodtype(void)
{
! return init_type(&wrap_PyMethod_Type, initchain);
}
+ #undef initchain
+ #define initchain init_methodtype
***************
*** 1401,1406 ****
static int init_dictitertype(void)
{
! return init_type(&wrap_PyDictIter_Type);
}
/******************************************************
--- 1426,1434 ----
static int init_dictitertype(void)
{
! return init_type(&wrap_PyDictIter_Type, initchain);
}
+ #undef initchain
+ #define initchain init_dictitertype
+
/******************************************************
***************
*** 1454,1459 ****
static int init_enumtype(void)
{
! return init_type(&wrap_PyEnum_Type);
}
--- 1482,1489 ----
static int init_enumtype(void)
{
! return init_type(&wrap_PyEnum_Type, initchain);
}
+ #undef initchain
+ #define initchain init_enumtype
***************
*** 1507,1512 ****
static int init_listitertype(void)
{
! return init_type(&wrap_PyListIter_Type);
}
/******************************************************
--- 1537,1545 ----
static int init_listitertype(void)
{
! return init_type(&wrap_PyListIter_Type, initchain);
}
+ #undef initchain
+ #define initchain init_listitertype
+
/******************************************************
***************
*** 1570,1575 ****
static int init_rangeitertype(void)
{
! return init_type(&wrap_PyRangeIter_Type);
}
/******************************************************
--- 1603,1611 ----
static int init_rangeitertype(void)
{
! return init_type(&wrap_PyRangeIter_Type, initchain);
}
+ #undef initchain
+ #define initchain init_rangeitertype
+
/******************************************************
***************
*** 1623,1628 ****
static int init_tupleitertype(void)
{
! return init_type(&wrap_PyTupleIter_Type);
}
--- 1659,1666 ----
static int init_tupleitertype(void)
{
! return init_type(&wrap_PyTupleIter_Type, initchain);
}
+ #undef initchain
+ #define initchain init_tupleitertype
***************
*** 1667,1672 ****
static int init_rangetype(void)
{
! return init_type(&wrap_PyRange_Type);
}
--- 1705,1712 ----
static int init_rangetype(void)
{
! return init_type(&wrap_PyRange_Type, initchain);
}
+ #undef initchain
+ #define initchain init_rangetype
***************
*** 1775,1780 ****
static int init_methodwrappertype(void)
{
! return init_type(&wrap_PyMethodWrapper_Type);
}
/******************************************************
--- 1815,1823 ----
static int init_methodwrappertype(void)
{
! return init_type(&wrap_PyMethodWrapper_Type, initchain);
}
+ #undef initchain
+ #define initchain init_methodwrappertype
+
/******************************************************
***************
*** 1885,1890 ****
static int init_generatortype(void)
{
! return init_type(&wrap_PyGenerator_Type);
}
--- 1928,1935 ----
static int init_generatortype(void)
{
! return init_type(&wrap_PyGenerator_Type, initchain);
}
+ #undef initchain
+ #define initchain init_generatortype
***************
*** 1998,2019 ****
}
PyErr_Clear();
! if (0
! || init_codetype()
! || init_functype()
! || init_celltype()
! || init_frametype()
! || init_tracebacktype()
! || init_moduletype()
! || init_itertype()
! || init_methodtype()
! || init_dictitertype()
! || init_enumtype()
! || init_listitertype()
! || init_rangeitertype()
! || init_tupleitertype()
! || init_rangetype()
! || init_methodwrappertype()
! || init_generatortype()
! )
ret = -1;
--- 2043,2047 ----
}
PyErr_Clear();
! if (initchain())
ret = -1;
_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins
More information about the Stackless-checkins
mailing list