[Stackless-checkins] CVS: slpdev/src/2.3/dev/Stackless/pickling prickelpit.c, 1.77, 1.78
Christian Tismer
tismer at centera.de
Mon May 3 18:53:41 CEST 2004
Update of /home/cvs/slpdev/src/2.3/dev/Stackless/pickling
In directory centera.de:/tmp/cvs-serv20367/pickling
Modified Files:
prickelpit.c
Log Message:
completely back-ported Stackless to Python 2.2.3.
It passes all relevant tests, supports pickling etc.
The gola is to keep the core files identical as long
as possible. This caused a few changes to the test files,
which need to figure out which tests to omit, for instance.
This 2.2.3 versiion is almost identical to the original, but
a few changes:
- Pickling does not check for __safe_for_unpickling__
- Generators don't need from __future__ import generators
- code objects have a builtin tp_new method.
These changes *all* vanish if STACKLESS_OFF is defined.
Index: prickelpit.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.3/dev/Stackless/pickling/prickelpit.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -d -r1.77 -r1.78
*** prickelpit.c 2 May 2004 15:05:25 -0000 1.77
--- prickelpit.c 3 May 2004 16:53:39 -0000 1.78
***************
*** 248,252 ****
retval = PyMapping_GetItemString(globals, retname);
}
- /* clear cycles early. Py 2.2.3 doesn't like GC during Type_Ready */
PyDict_Clear(globals);
Py_DECREF(globals);
--- 248,251 ----
***************
*** 511,515 ****
static PyObject *
! codeobject_reduce(PyCodeObject * co)
{
PyObject *tup = Py_BuildValue(
--- 510,514 ----
static PyObject *
! code_reduce(PyCodeObject * co)
{
PyObject *tup = Py_BuildValue(
***************
*** 535,539 ****
}
! MAKE_WRAPPERTYPE(PyCode_Type, code, "code", codeobject_reduce, generic_new,
generic_setstate)
--- 534,538 ----
}
! MAKE_WRAPPERTYPE(PyCode_Type, code, "code", code_reduce, generic_new,
generic_setstate)
***************
*** 1688,1693 ****
******************************************************/
- #if PY_VERSION_HEX >= 0x02030000
-
/*
* unfortunately we have to copy here.
--- 1687,1690 ----
***************
*** 1729,1734 ****
#define initchain init_rangetype
- #endif /* PY_VERSION_HEX < 0x02030000 */
-
/******************************************************
--- 1726,1729 ----
***************
*** 1848,1852 ****
******************************************************/
! /* XXX should we make this a global definition? */
typedef struct {
--- 1843,1851 ----
******************************************************/
! /* Note: this definition is not compatible to 2.2.3, since
! the gi_weakreflist does not exist. Therefore, we don't
! create the object ourselves, but use the provided function
! with a fake frame. The gi_weakreflist is not touched.
! */
typedef struct {
***************
*** 1883,1894 ****
if (is_wrong_type(type)) return NULL;
! gen = PyObject_GC_New(genobject, &wrap_PyGenerator_Type);
if (gen == NULL)
return NULL;
Py_INCREF(Py_None);
! gen->gi_frame = (PyFrameObject *) Py_None;
! gen->gi_running = 0;
! gen->gi_weakreflist = NULL;
! _PyObject_GC_TRACK(gen);
return (PyObject *) gen;
}
--- 1882,1890 ----
if (is_wrong_type(type)) return NULL;
! gen = (genobject *) PyGenerator_New((PyFrameObject *) Py_None);
if (gen == NULL)
return NULL;
Py_INCREF(Py_None);
! gen->ob_type = type;
return (PyObject *) gen;
}
***************
*** 1953,1959 ****
int res;
genobject *gen = (genobject *) run_script(
- #if PY_VERSION_HEX < 0x02030000
- "from __future__ import generators\n"
- #endif
"def f(): yield 42\n" /* define a generator */
"g = f()\n" /* instanciate it */
--- 1949,1952 ----
_______________________________________________
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