[Stackless-checkins] CVS: slpdev/src/2.2/src/Objects frameobject.c, 1.17, 1.18 iterobject.c, 1.3, 1.4 methodobject.c, 1.3, 1.4 moduleobject.c, 1.2, 1.3 object.c, 1.3, 1.4 typeobject.c, 1.5, 1.6 unicodeobject.c, 1.2, 1.3
Christian Tismer
tismer at centera.de
Sat May 1 02:44:40 CEST 2004
Update of /home/cvs/slpdev/src/2.2/src/Objects
In directory centera.de:/home/tismer/slpdev/src/2.2/src/Objects
Modified Files:
frameobject.c iterobject.c methodobject.c moduleobject.c
object.c typeobject.c unicodeobject.c
Log Message:
hopefully this is now a base version
Index: frameobject.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Objects/frameobject.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** frameobject.c 6 Jan 2004 02:40:23 -0000 1.17
--- frameobject.c 1 May 2004 00:44:35 -0000 1.18
***************
*** 23,29 ****
{"f_exc_value", T_OBJECT, OFF(f_exc_value)},
{"f_exc_traceback", T_OBJECT, OFF(f_exc_traceback)},
- #ifdef STACKLESS
- STACKLESS_FRAME_MEMBERS
- #endif
{NULL} /* Sentinel */
};
--- 23,26 ----
***************
*** 101,107 ****
Py_XDECREF(f->f_exc_value);
Py_XDECREF(f->f_exc_traceback);
- #ifdef STACKLESS
- STACKLESS_FRAME_DEALLOC;
- #endif
if (numfree < MAXFREELIST) {
++numfree;
--- 98,101 ----
***************
*** 181,187 ****
}
}
- #ifdef STACKLESS
- STACKLESS_FRAME_CLEAR;
- #endif
}
--- 175,178 ----
***************
*** 238,246 ****
return NULL;
}
- #ifdef STACKLESS
- if ((back != NULL && !(PyFrame_Check(back) || PyBaseFrame_Check(back))) ||
- #else
if ((back != NULL && !PyFrame_Check(back)) ||
- #endif
code == NULL || !PyCode_Check(code) ||
globals == NULL || !PyDict_Check(globals) ||
--- 229,233 ----
***************
*** 318,324 ****
f->f_trace = NULL;
f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL;
- #ifndef STACKLESS
f->f_tstate = tstate;
! #endif
f->f_lasti = 0;
f->f_lineno = code->co_firstlineno;
--- 305,310 ----
f->f_trace = NULL;
f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL;
f->f_tstate = tstate;
!
f->f_lasti = 0;
f->f_lineno = code->co_firstlineno;
***************
*** 335,341 ****
f->f_valuestack = f->f_localsplus + extras;
f->f_stacktop = f->f_valuestack;
- #ifdef STACKLESS
- STACKLESS_FRAME_NEW;
- #endif
_PyObject_GC_TRACK(f);
return f;
--- 321,324 ----
Index: iterobject.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Objects/iterobject.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** iterobject.c 14 Jan 2004 18:48:04 -0000 1.3
--- iterobject.c 1 May 2004 00:44:35 -0000 1.4
***************
*** 88,92 ****
}
-
static PyMethodDef iter_methods[] = {
{"next", (PyCFunction)iter_next, METH_NOARGS,
--- 88,91 ----
Index: methodobject.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Objects/methodobject.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** methodobject.c 19 May 2003 18:11:27 -0000 1.3
--- methodobject.c 1 May 2004 00:44:35 -0000 1.4
***************
*** 21,30 ****
}
op->m_ml = ml;
- #ifdef STACKLESS
- {
- int nr_dist = ml->ml_flags >> METH_SHIFT;
- op->m_meth_nr = (ml+nr_dist)->ml_meth;
- }
- #endif
Py_XINCREF(self);
op->m_self = self;
--- 21,24 ----
***************
*** 59,67 ****
return -1;
}
- #ifdef STACKLESS
- return ((PyCFunctionObject *)op) -> m_ml -> ml_flags & METH_MASK;
- #else
return ((PyCFunctionObject *)op) -> m_ml -> ml_flags;
- #endif
}
--- 53,57 ----
Index: moduleobject.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Objects/moduleobject.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** moduleobject.c 2 Jun 2003 01:58:47 -0000 1.2
--- moduleobject.c 1 May 2004 00:44:35 -0000 1.3
***************
*** 5,12 ****
#include "structmember.h"
- #ifdef STACKLESS
- #include "prickelpit.h"
- #endif
-
typedef struct {
PyObject_HEAD
--- 5,8 ----
***************
*** 28,36 ****
return NULL;
nameobj = PyString_FromString(name);
- #ifdef STACKLESS
- m->md_dict = PyModuleDict_New(nameobj);
- #else
m->md_dict = PyDict_New();
- #endif
if (m->md_dict == NULL || nameobj == NULL)
goto fail;
--- 24,28 ----
Index: object.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Objects/object.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** object.c 17 Nov 2003 01:07:15 -0000 1.3
--- object.c 1 May 2004 00:44:35 -0000 1.4
***************
*** 1797,1805 ****
static PyObject refchain = {&refchain, &refchain};
- #ifdef STACKLESS
- /* track refcount problems down */
- PyObject *_Py_RefChain = &refchain;
- #endif
-
void
_Py_ResetReferences(void)
--- 1797,1800 ----
Index: typeobject.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Objects/typeobject.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** typeobject.c 21 Aug 2003 16:59:16 -0000 1.5
--- typeobject.c 1 May 2004 00:44:35 -0000 1.6
***************
*** 7,10 ****
--- 7,22 ----
#include <ctype.h>
+ /* The *real* layout of a type object when allocated on the heap */
+ /* XXX Should we publish this in a header file? */
+ typedef struct {
+ PyTypeObject type;
+ PyNumberMethods as_number;
+ PySequenceMethods as_sequence;
+ PyMappingMethods as_mapping;
+ PyBufferProcs as_buffer;
+ PyObject *name, *slots;
+ PyMemberDef members[1];
+ } etype;
+
static PyMemberDef type_members[] = {
{"__basicsize__", T_INT, offsetof(PyTypeObject,tp_basicsize),READONLY},
***************
*** 197,205 ****
{
PyObject *obj;
! const size_t size = _PyObject_VAR_SIZE(type, nitems+1);
! /* note that we need to add one, for the sentinel */
if (PyType_IS_GC(type))
! obj = _PyObject_GC_Malloc(type, nitems+1);
else
obj = PyObject_MALLOC(size);
--- 209,216 ----
{
PyObject *obj;
! const size_t size = _PyObject_VAR_SIZE(type, nitems);
if (PyType_IS_GC(type))
! obj = _PyObject_GC_Malloc(type, nitems);
else
obj = PyObject_MALLOC(size);
***************
*** 238,242 ****
n = type->ob_size;
! mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
for (i = 0; i < n; i++, mp++) {
if (mp->type == T_OBJECT_EX) {
--- 249,253 ----
n = type->ob_size;
! mp = ((etype *)type)->members;
for (i = 0; i < n; i++, mp++) {
if (mp->type == T_OBJECT_EX) {
***************
*** 303,307 ****
n = type->ob_size;
! mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type);
for (i = 0; i < n; i++, mp++) {
if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) {
--- 314,318 ----
n = type->ob_size;
! mp = ((etype *)type)->members;
for (i = 0; i < n; i++, mp++) {
if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) {
***************
*** 491,495 ****
}
else {
! /* a is not completely initialized yet; follow tp_base */
do {
if (a == b)
--- 502,506 ----
}
else {
! /* a is not completely initilized yet; follow tp_base */
do {
if (a == b)
***************
*** 963,967 ****
PyObject *slots, *tmp;
PyTypeObject *type, *base, *tmptype, *winner;
! PyHeapTypeObject *et;
PyMemberDef *mp;
int i, nbases, nslots, slotoffset, add_dict, add_weak;
--- 974,978 ----
PyObject *slots, *tmp;
PyTypeObject *type, *base, *tmptype, *winner;
! etype *et;
PyMemberDef *mp;
int i, nbases, nslots, slotoffset, add_dict, add_weak;
***************
*** 1062,1067 ****
return NULL;
nslots = PyTuple_GET_SIZE(slots);
! if (nslots > 0 && base->tp_itemsize != 0 && !PyType_Check(base)) {
! /* for the special case of meta types, allow slots */
PyErr_Format(PyExc_TypeError,
"nonempty __slots__ "
--- 1073,1077 ----
return NULL;
nslots = PyTuple_GET_SIZE(slots);
! if (nslots > 0 && base->tp_itemsize != 0) {
PyErr_Format(PyExc_TypeError,
"nonempty __slots__ "
***************
*** 1121,1125 ****
/* Keep name and slots alive in the extended type object */
! et = (PyHeapTypeObject *)type;
Py_INCREF(name);
et->name = name;
--- 1131,1135 ----
/* Keep name and slots alive in the extended type object */
! et = (etype *)type;
Py_INCREF(name);
et->name = name;
***************
*** 1201,1205 ****
/* Add descriptors for custom slots from __slots__, or for __dict__ */
! mp = PyHeapType_GET_MEMBERS(et);
slotoffset = base->tp_basicsize;
if (slots != NULL) {
--- 1211,1215 ----
/* Add descriptors for custom slots from __slots__, or for __dict__ */
! mp = et->members;
slotoffset = base->tp_basicsize;
if (slots != NULL) {
***************
*** 1241,1245 ****
type->tp_basicsize = slotoffset;
type->tp_itemsize = base->tp_itemsize;
! type->tp_members = PyHeapType_GET_MEMBERS(et);
/* Special case some slots */
--- 1251,1255 ----
type->tp_basicsize = slotoffset;
type->tp_itemsize = base->tp_itemsize;
! type->tp_members = et->members;
/* Special case some slots */
***************
*** 1384,1388 ****
type_dealloc(PyTypeObject *type)
{
! PyHeapTypeObject *et;
/* Assert this is a heap-allocated type object */
--- 1394,1398 ----
type_dealloc(PyTypeObject *type)
{
! etype *et;
/* Assert this is a heap-allocated type object */
***************
*** 1390,1394 ****
_PyObject_GC_UNTRACK(type);
PyObject_ClearWeakRefs((PyObject *)type);
! et = (PyHeapTypeObject *)type;
Py_XDECREF(type->tp_base);
Py_XDECREF(type->tp_dict);
--- 1400,1404 ----
_PyObject_GC_UNTRACK(type);
PyObject_ClearWeakRefs((PyObject *)type);
! et = (etype *)type;
Py_XDECREF(type->tp_base);
Py_XDECREF(type->tp_dict);
***************
*** 1533,1537 ****
0, /* ob_size */
"type", /* tp_name */
! sizeof(PyHeapTypeObject), /* tp_basicsize */
sizeof(PyMemberDef), /* tp_itemsize */
(destructor)type_dealloc, /* tp_dealloc */
--- 1543,1547 ----
0, /* ob_size */
"type", /* tp_name */
! sizeof(etype), /* tp_basicsize */
sizeof(PyMemberDef), /* tp_itemsize */
(destructor)type_dealloc, /* tp_dealloc */
***************
*** 1716,1722 ****
return -1;
}
! Py_INCREF(new);
self->ob_type = new;
! Py_DECREF(old);
return 0;
}
--- 1726,1732 ----
return -1;
}
! Py_INCREF(new);
self->ob_type = new;
! Py_DECREF(old);
return 0;
}
***************
*** 2778,2782 ****
return Py_None;
}
!
static PyObject *
wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped)
--- 2788,2792 ----
return Py_None;
}
!
static PyObject *
wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped)
***************
*** 3082,3086 ****
func = lookup_maybe(self, "__contains__", &contains_str);
-
if (func != NULL) {
args = Py_BuildValue("(O)", value);
--- 3092,3095 ----
***************
*** 3095,3103 ****
result = PyObject_IsTrue(res);
Py_DECREF(res);
! }
}
else if (! PyErr_Occurred()) {
result = _PySequence_IterSearch(self, value,
! PY_ITERSEARCH_CONTAINS);
}
return result;
--- 3104,3112 ----
result = PyObject_IsTrue(res);
Py_DECREF(res);
! }
}
else if (! PyErr_Occurred()) {
result = _PySequence_IterSearch(self, value,
! PY_ITERSEARCH_CONTAINS);
}
return result;
***************
*** 3676,3683 ****
/* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper
! functions. The offsets here are relative to the 'PyHeapTypeObject'
! structure, which incorporates the additional structures used for numbers,
! sequences and mappings.
! Note that multiple names may map to the same slot (e.g. __eq__,
__ne__ etc. all map to tp_richcompare) and one name may map to multiple
slots (e.g. __str__ affects tp_str as well as tp_repr). */
--- 3685,3691 ----
/* Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper
! functions. The offsets here are relative to the 'etype' structure, which
! incorporates the additional structures used for numbers, sequences and
! mappings. Note that multiple names may map to the same slot (e.g. __eq__,
__ne__ etc. all map to tp_richcompare) and one name may map to multiple
slots (e.g. __str__ affects tp_str as well as tp_repr). */
***************
*** 3702,3706 ****
DOC, FLAGS}
#define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
! {NAME, offsetof(PyHeapTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, DOC}
#define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC)
--- 3710,3714 ----
DOC, FLAGS}
#define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
! {NAME, offsetof(etype, SLOT), (void *)(FUNCTION), WRAPPER, DOC}
#define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC)
***************
*** 3916,3931 ****
assert(offset >= 0);
! assert(offset < offsetof(PyHeapTypeObject, as_buffer));
! if (offset >= offsetof(PyHeapTypeObject, as_mapping)) {
ptr = (void *)type->tp_as_mapping;
! offset -= offsetof(PyHeapTypeObject, as_mapping);
}
! else if (offset >= offsetof(PyHeapTypeObject, as_sequence)) {
ptr = (void *)type->tp_as_sequence;
! offset -= offsetof(PyHeapTypeObject, as_sequence);
}
! else if (offset >= offsetof(PyHeapTypeObject, as_number)) {
ptr = (void *)type->tp_as_number;
! offset -= offsetof(PyHeapTypeObject, as_number);
}
else {
--- 3924,3939 ----
assert(offset >= 0);
! assert(offset < offsetof(etype, as_buffer));
! if (offset >= offsetof(etype, as_mapping)) {
ptr = (void *)type->tp_as_mapping;
! offset -= offsetof(etype, as_mapping);
}
! else if (offset >= offsetof(etype, as_sequence)) {
ptr = (void *)type->tp_as_sequence;
! offset -= offsetof(etype, as_sequence);
}
! else if (offset >= offsetof(etype, as_number)) {
ptr = (void *)type->tp_as_number;
! offset -= offsetof(etype, as_number);
}
else {
Index: unicodeobject.c
===================================================================
RCS file: /home/cvs/slpdev/src/2.2/src/Objects/unicodeobject.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** unicodeobject.c 21 Aug 2003 16:59:16 -0000 1.2
--- unicodeobject.c 1 May 2004 00:44:35 -0000 1.3
***************
*** 5254,5261 ****
'g' formats:
! fmt = %#.<prec>g
! buf = '-' + [0-9]*prec + '.' + 'e+' + (longest exp
! for any double rep.)
! len = 1 + prec + 1 + 2 + 5 = 9 + prec
'f' formats:
--- 5254,5261 ----
'g' formats:
! fmt = %#.<prec>g
! buf = '-' + [0-9]*prec + '.' + 'e+' + (longest exp
! for any double rep.)
! len = 1 + prec + 1 + 2 + 5 = 9 + prec
'f' formats:
_______________________________________________
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