[Stackless-checkins] CVS: slpdev/src/2.2/src/Modules Setup.dist, 1.11, 1.12 cPickle.c, 1.7, 1.8 socketmodule.c, 1.2, 1.3
Christian Tismer
tismer at centera.de
Sat May 1 03:21:14 CEST 2004
- Previous message: [Stackless-checkins] CVS: slpdev/src/2.2/src .cvsignore, 1.8, 1.9 Makefile.pre.in, 1.17, 1.18 README, 1.4, 1.5 configure, 1.11, 1.12 configure.in, 1.4, 1.5 setup.py, 1.21, 1.22
- Next message: [Stackless-checkins] CVS: slpdev/src/2.2/src/PC config.c,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/slpdev/src/2.2/src/Modules
In directory centera.de:/tmp/cvs-serv18709/src/Modules
Modified Files:
Setup.dist cPickle.c socketmodule.c
Log Message:
initial patches from diffs (merge) plus a little Visual Studio
Index: Setup.dist
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Modules/Setup.dist,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Setup.dist 1 May 2004 00:44:34 -0000 1.11
--- Setup.dist 1 May 2004 01:21:10 -0000 1.12
***************
*** 461,462 ****
--- 461,467 ----
# Another example -- the 'xxsubtype' module shows C-level subtyping in action
xxsubtype xxsubtype.c
+
+ # uncomment if you'd like to compile stackless statically.
+ # Note that the static build puts the .o files into Modules.
+ #SLP=./Stackless
+ #stackless $(SLP)/stacklessmodule.c $(SLP)/atomicobject.c $(SLP)/cframeobject.c $(SLP)/channelobject.c $(SLP)/flextype.c $(SLP)/scheduling.c $(SLP)/schedulerobject.c $(SLP)/stackless_debug.c $(SLP)/stackless_util.c $(SLP)/taskletobject.c
Index: cPickle.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Modules/cPickle.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** cPickle.c 30 Apr 2004 22:11:26 -0000 1.7
--- cPickle.c 1 May 2004 01:21:10 -0000 1.8
***************
*** 8,11 ****
--- 8,12 ----
#include "cStringIO.h"
#include "structmember.h"
+ #include "core/stackless_impl.h"
#ifndef Py_eval_input
***************
*** 256,259 ****
--- 257,261 ----
typedef struct Picklerobject {
+ <<<<<<< ../../2.2/src/./Modules/cPickle.c
PyObject_HEAD
FILE *fp;
***************
*** 273,276 ****
--- 275,306 ----
int fast_container; /* count nested container dumps */
PyObject *fast_memo;
+ =======
+ PyObject_HEAD
+ FILE *fp;
+ PyObject *write;
+ PyObject *file;
+ PyObject *memo;
+ PyObject *arg;
+ PyObject *pers_func;
+ PyObject *inst_pers_func;
+
+ /* pickle protocol number, >= 0 */
+ int proto;
+
+ /* bool, true if proto > 0 */
+ int bin;
+
+ int fast; /* Fast mode doesn't save in memo, don't use if circ ref */
+ int nesting;
+ int (*write_func)(struct Picklerobject *, char *, int);
+ char *write_buf;
+ int buf_size;
+ PyObject *dispatch_table;
+ int fast_container; /* count nested container dumps */
+ PyObject *fast_memo;
+ #ifdef STACKLESS
+ PyObject *module_dict_ids;
+ #endif
+ >>>>>>> ././Modules/cPickle.c
} Picklerobject;
***************
*** 1501,1505 ****
--- 1531,1554 ----
}
+ <<<<<<< ../../2.2/src/./Modules/cPickle.c
res = 0;
+ =======
+ #ifdef STACKLESS
+ {
+ static int
+ save_reduce(Picklerobject *self, PyObject *args, PyObject *ob);
+ PyObject *ret = PyStackless_Pickle_ModuleDict((PyObject *) self, args);
+ if (ret == NULL) return -1;
+ if (ret != Py_None) {
+ res = save_reduce(self, ret, args);
+ Py_DECREF(ret);
+ return res;
+ }
+ Py_DECREF(ret);
+ }
+ #endif
+ if (self->fast && !fast_save_enter(self, args))
+ goto finally;
+ >>>>>>> ././Modules/cPickle.c
finally:
***************
*** 1817,1820 ****
--- 1866,1870 ----
static int
+ <<<<<<< ../../2.2/src/./Modules/cPickle.c
save(Picklerobject *self, PyObject *args, int pers_save) {
PyTypeObject *type;
***************
*** 1828,1831 ****
--- 1878,1903 ----
goto finally;
}
+ =======
+ save(Picklerobject *self, PyObject *args, int pers_save)
+ {
+ PyTypeObject *type;
+ PyObject *py_ob_id = 0, *__reduce__ = 0, *t = 0;
+ PyObject *arg_tup;
+ int res = -1;
+ int tmp, size;
+
+ #ifdef STACKLESS
+ if (++self->nesting % 20 == 0){
+ res = slp_safe_pickling((void *)&save, (PyObject *)self, args, pers_save);
+ goto finally;
+ }
+ #else
+ if (self->nesting++ > Py_GetRecursionLimit()){
+ PyErr_SetString(PyExc_RuntimeError,
+ "maximum recursion depth exceeded");
+ goto finally;
+ }
+ #endif
+ >>>>>>> ././Modules/cPickle.c
if (!pers_save && self->pers_func) {
***************
*** 1958,1961 ****
--- 2030,2034 ----
case 'f':
+ <<<<<<< ../../2.2/src/./Modules/cPickle.c
if (type == &PyFunction_Type) {
res = save_global(self, args, NULL);
***************
*** 1963,1966 ****
--- 2036,2051 ----
}
break;
+ =======
+ if (type == &PyFunction_Type) {
+ res = save_global(self, args, NULL);
+ if (res && PyErr_ExceptionMatches(PickleError)) {
+ /* fall back to reduce */
+ PyErr_Clear();
+ break;
+ }
+ goto finally;
+ }
+ break;
+ >>>>>>> ././Modules/cPickle.c
case 'b':
***************
*** 2252,2257 ****
--- 2337,2445 ----
static Picklerobject *
+ <<<<<<< ../../2.2/src/./Modules/cPickle.c
newPicklerobject(PyObject *file, int bin) {
Picklerobject *self;
+ =======
+ newPicklerobject(PyObject *file, int proto)
+ {
+ Picklerobject *self;
+
+ if (proto < 0)
+ proto = HIGHEST_PROTOCOL;
+ if (proto > HIGHEST_PROTOCOL) {
+ PyErr_Format(PyExc_ValueError, "pickle protocol %d asked for; "
+ "the highest available protocol is %d",
+ proto, HIGHEST_PROTOCOL);
+ return NULL;
+ }
+
+ self = PyObject_GC_New(Picklerobject, &Picklertype);
+ if (self == NULL)
+ return NULL;
+ self->proto = proto;
+ self->bin = proto > 0;
+ self->fp = NULL;
+ self->write = NULL;
+ self->memo = NULL;
+ self->arg = NULL;
+ self->pers_func = NULL;
+ self->inst_pers_func = NULL;
+ self->write_buf = NULL;
+ self->fast = 0;
+ self->nesting = 0;
+ self->fast_container = 0;
+ self->fast_memo = NULL;
+ self->buf_size = 0;
+ self->dispatch_table = NULL;
+ #ifdef STACKLESS
+ self->module_dict_ids = NULL;
+ #endif
+
+ self->file = NULL;
+ if (file)
+ Py_INCREF(file);
+ else {
+ file = Pdata_New();
+ if (file == NULL)
+ goto err;
+ }
+ self->file = file;
+
+ if (!( self->memo = PyDict_New()))
+ goto err;
+
+ if (PyFile_Check(file)) {
+ self->fp = PyFile_AsFile(file);
+ if (self->fp == NULL) {
+ PyErr_SetString(PyExc_ValueError,
+ "I/O operation on closed file");
+ goto err;
+ }
+ self->write_func = write_file;
+ }
+ else if (PycStringIO_OutputCheck(file)) {
+ self->write_func = write_cStringIO;
+ }
+ else if (file == Py_None) {
+ self->write_func = write_none;
+ }
+ else {
+ self->write_func = write_other;
+
+ if (! Pdata_Check(file)) {
+ self->write = PyObject_GetAttr(file, write_str);
+ if (!self->write) {
+ PyErr_Clear();
+ PyErr_SetString(PyExc_TypeError,
+ "argument must have 'write' "
+ "attribute");
+ goto err;
+ }
+ }
+
+ self->write_buf = (char *)PyMem_Malloc(WRITE_BUF_SIZE);
+ if (self->write_buf == NULL) {
+ PyErr_NoMemory();
+ goto err;
+ }
+ }
+
+ if (PyEval_GetRestricted()) {
+ /* Restricted execution, get private tables */
+ PyObject *m = PyImport_Import(copy_reg_str);
+
+ if (m == NULL)
+ goto err;
+ self->dispatch_table = PyObject_GetAttr(m, dispatch_table_str);
+ Py_DECREF(m);
+ if (self->dispatch_table == NULL)
+ goto err;
+ }
+ else {
+ self->dispatch_table = dispatch_table;
+ Py_INCREF(dispatch_table);
+ }
+ PyObject_GC_Track(self);
+ >>>>>>> ././Modules/cPickle.c
UNLESS (self = PyObject_GC_New(Picklerobject, &Picklertype))
***************
*** 2355,2358 ****
--- 2543,2547 ----
static void
+ <<<<<<< ../../2.2/src/./Modules/cPickle.c
Pickler_dealloc(Picklerobject *self) {
PyObject_GC_UnTrack(self);
***************
*** 2371,2374 ****
--- 2560,2581 ----
self->ob_type->tp_free((PyObject *)self);
+ =======
+ Pickler_dealloc(Picklerobject *self)
+ {
+ PyObject_GC_UnTrack(self);
+ Py_XDECREF(self->write);
+ Py_XDECREF(self->memo);
+ Py_XDECREF(self->fast_memo);
+ Py_XDECREF(self->arg);
+ Py_XDECREF(self->file);
+ Py_XDECREF(self->pers_func);
+ Py_XDECREF(self->inst_pers_func);
+ Py_XDECREF(self->dispatch_table);
+ PyMem_Free(self->write_buf);
+ #ifdef STACKLESS
+ Py_XDECREF(self->module_dict_ids);
+ #endif
+ self->ob_type->tp_free((PyObject *)self);
+ >>>>>>> ././Modules/cPickle.c
}
***************
*** 2391,2394 ****
--- 2598,2604 ----
VISIT(self->inst_pers_func);
VISIT(self->dispatch_table);
+ #ifdef STACKLESS
+ VISIT(self->module_dict_ids);
+ #endif
#undef VISIT
return 0;
***************
*** 2407,2410 ****
--- 2617,2623 ----
CLEAR(self->inst_pers_func);
CLEAR(self->dispatch_table);
+ #ifdef STACKLESS
+ CLEAR(self->module_dict_ids);
+ #endif
#undef CLEAR
return 0;
***************
*** 2477,2480 ****
--- 2690,2723 ----
}
+ #ifdef STACKLESS
+ static PyObject *
+ Pickler_get_module_dict_ids(Picklerobject *p)
+ {
+ if (p->module_dict_ids == NULL)
+ PyErr_SetString(PyExc_AttributeError, "module_dict_ids");
+ else
+ Py_INCREF(p->module_dict_ids);
+ return p->module_dict_ids;
+ }
+
+ static int
+ Pickler_set_module_dict_ids(Picklerobject *p, PyObject *v)
+ {
+ if (v == NULL) {
+ PyErr_SetString(PyExc_TypeError,
+ "attribute deletion is not supported");
+ return -1;
+ }
+ if (!PyDict_Check(v)) {
+ PyErr_SetString(PyExc_TypeError, "module-dict-ids must be a dictionary");
+ return -1;
+ }
+ Py_XDECREF(p->module_dict_ids);
+ Py_INCREF(v);
+ p->module_dict_ids = v;
+ return 0;
+ }
+ #endif
+
static PyObject *
Pickler_get_error(Picklerobject *p)
***************
*** 2497,2500 ****
--- 2740,2746 ----
{"memo", (getter)Pickler_get_memo, (setter)Pickler_set_memo},
{"PicklingError", (getter)Pickler_get_error, NULL},
+ #ifdef STACKLESS
+ {"module_dict_ids", (getter)Pickler_get_module_dict_ids, (setter)Pickler_set_module_dict_ids},
+ #endif
{NULL}
};
Index: socketmodule.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Modules/socketmodule.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** socketmodule.c 21 Aug 2003 16:59:16 -0000 1.2
--- socketmodule.c 1 May 2004 01:21:10 -0000 1.3
***************
*** 148,151 ****
--- 148,156 ----
#endif
+ /* This declaration is required for HPUX 10 */
+ #if defined(__hpux) && !defined(h_errno)
+ extern int h_errno;
+ #endif
+
/* Headers needed for inet_ntoa() and inet_addr() */
#ifdef __BEOS__
_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins
- Previous message: [Stackless-checkins] CVS: slpdev/src/2.2/src .cvsignore, 1.8, 1.9 Makefile.pre.in, 1.17, 1.18 README, 1.4, 1.5 configure, 1.11, 1.12 configure.in, 1.4, 1.5 setup.py, 1.21, 1.22
- Next message: [Stackless-checkins] CVS: slpdev/src/2.2/src/PC config.c,1.6,1.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Stackless-checkins
mailing list