summaryrefslogtreecommitdiffstats
path: root/Python/getversion.c
Commit message (Expand)AuthorAgeFilesLines
* Use PyOS_snprintf instead of sprintf.Jeremy Hylton2001-11-281-2/+2
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-1/+1
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
* Allow longer strings (up to 80 chars each) for version, build,Guido van Rossum1999-04-221-2/+2
* Patches by William Lewis for Nextstep descendants.Guido van Rossum1999-01-271-2/+2
* Use PY_VERSION instead of PATCHLEVEL.Guido van Rossum1999-01-031-1/+2
* Make it return a _const_ char*.Guido van Rossum1997-07-191-3/+0
* get build info from elsewhereGuido van Rossum1997-01-201-9/+2
* New permission notice, includes CNRI.Guido van Rossum1996-10-251-13/+20
* grand renaming; added copyright to some filesGuido van Rossum1996-05-281-3/+27
* set date to oct 13Guido van Rossum1995-10-121-1/+1
* include Python.hGuido van Rossum1995-09-181-0/+2
* Initial revisionGuido van Rossum1995-08-041-0/+21
ect *unused) { - if (self->ob_size <= PY_SSIZE_T_MAX / self->ob_descr->itemsize) { + if (Py_SIZE(self) <= PY_SSIZE_T_MAX / self->ob_descr->itemsize) { return PyString_FromStringAndSize(self->ob_item, Py_SIZE(self) * self->ob_descr->itemsize); } else { @@ -2289,8 +2289,8 @@ initarray(void) { PyObject *m; - Arraytype.ob_type = &PyType_Type; - PyArrayIter_Type.ob_type = &PyType_Type; + Py_TYPE(&Arraytype) = &PyType_Type; + Py_TYPE(&PyArrayIter_Type) = &PyType_Type; m = Py_InitModule3("array", a_methods, module_doc); if (m == NULL) return; diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index 4573637..34b8ed4 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -3039,8 +3039,7 @@ static char tzinfo_doc[] = PyDoc_STR("Abstract base class for time zone info objects."); statichere PyTypeObject PyDateTime_TZInfoType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "datetime.tzinfo", /* tp_name */ sizeof(PyDateTime_TZInfo), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -3564,8 +3563,7 @@ static PyNumberMethods time_as_number = { }; statichere PyTypeObject PyDateTime_TimeType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "datetime.time", /* tp_name */ sizeof(PyDateTime_Time), /* tp_basicsize */ 0, /* tp_itemsize */ @@ -4692,8 +4690,7 @@ static PyNumberMethods datetime_as_number = { }; statichere PyTypeObject PyDateTime_DateTimeType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ + PyVarObject_HEAD_INIT(NULL, 0) "datetime.datetime", /* tp_name */ sizeof(PyDateTime_DateTime), /* tp_basicsize */ 0, /* tp_itemsize */ diff --git a/Objects/bufferobject.c b/Objects/bufferobject.c index 65857bf..d2297f3 100644 --- a/Objects/bufferobject.c +++ b/Objects/bufferobject.c @@ -34,7 +34,7 @@ get_buf(PyBufferObject *self, void **ptr, Py_ssize_t *size, else { Py_ssize_t count, offset; readbufferproc proc = 0; - PyBufferProcs *bp = self->b_base->ob_type->tp_as_buffer; + PyBufferProcs *bp = Py_TYPE(self->b_base)->tp_as_buffer; if ((*bp->bf_getsegcount)(self->b_base, NULL) != 1) { PyErr_SetString(PyExc_TypeError, "single-segment buffer object expected"); @@ -47,7 +47,7 @@ get_buf(PyBufferObject *self, void **ptr, Py_ssize_t *size, (buffer_type == ANY_BUFFER)) proc = (readbufferproc)bp->bf_getwritebuffer; else if (buffer_type == CHAR_BUFFER) { - if (!PyType_HasFeature(self->ob_type, + if (!PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HAVE_GETCHARBUFFER)) { PyErr_SetString(PyExc_TypeError, "Py_TPFLAGS_HAVE_GETCHARBUFFER needed"); diff --git a/Objects/classobject.c b/Objects/classobject.c index 738e613..5b64578 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -88,9 +88,9 @@ PyClass_New(PyObject *bases, PyObject *dict, PyObject *name) base = PyTuple_GET_ITEM(bases, i); if (!PyClass_Check(base)) { if (PyCallable_Check( - (PyObject *) base->ob_type)) + (PyObject *) Py_TYPE(base))) return PyObject_CallFunctionObjArgs( - (PyObject *) base->ob_type, + (PyObject *) Py_TYPE(base), name, bases, dict, NULL); PyErr_SetString(PyExc_TypeError, "PyClass_New: base must be a class"); @@ -265,7 +265,7 @@ class_getattr(register PyClassObject *op, PyObject *name) PyString_AS_STRING(op->cl_name), sname); return NULL; } - f = TP_DESCR_GET(v->ob_type); + f = TP_DESCR_GET(Py_TYPE(v)); if (f == NULL) Py_INCREF(v); else @@ -442,8 +442,7 @@ class_traverse(PyClassObject *o, visitproc visit, void *arg) } PyTypeObject PyClass_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, + PyVarObject_HEAD_INIT(&PyType_Type, 0) "classobj", sizeof(PyClassObject), 0, @@ -639,9 +638,9 @@ instance_dealloc(register PyInstanceObject *inst) PyObject_ClearWeakRefs((PyObject *) inst); /* Temporarily resurrect the object. */ - assert(inst->ob_type == &PyInstance_Type); - assert(inst->ob_refcnt == 0); - inst->ob_refcnt = 1; + assert(Py_TYPE(inst) == &PyInstance_Type); + assert(Py_REFCNT(inst) == 0); + Py_REFCNT(inst) = 1; /* Save the current exception, if any. */ PyErr_Fetch(&error_type, &error_value, &error_traceback); @@ -665,8 +664,8 @@ instance_dealloc(register PyInstanceObject *inst) /* Undo the temporary resurrection; can't use DECREF here, it would * cause a recursive call. */ - assert(inst->ob_refcnt > 0); - if (--inst->ob_refcnt == 0) { + assert(Py_REFCNT(inst) > 0); + if (--Py_REFCNT(inst) == 0) { /* New weakrefs could be created during the finalizer call. If this occurs, clear them out without calling their @@ -682,12 +681,12 @@ instance_dealloc(register PyInstanceObject *inst) PyObject_GC_Del(inst); } else { - Py_ssize_t refcnt = inst->ob_refcnt; + Py_ssize_t refcnt = Py_REFCNT(inst); /* __del__ resurrected it! Make it look like the original * Py_DECREF never happened. */ _Py_NewReference((PyObject *)inst); - inst->ob_refcnt = refcnt; + Py_REFCNT(inst) = refcnt; _PyObject_GC_TRACK(inst); /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so * we need to undo that. */ @@ -699,8 +698,8 @@ instance_dealloc(register PyInstanceObject *inst) * undone. */ #ifdef COUNT_ALLOCS - --inst->ob_type->tp_frees; - --inst->ob_type->tp_allocs; + --Py_TYPE(inst)->tp_frees; + --Py_TYPE(inst)->tp_allocs; #endif } } @@ -756,7 +755,7 @@ instance_getattr2(register PyInstanceObject *inst, PyObject *name) v = class_lookup(inst->in_class, name, &klass); if (v != NULL) { Py_INCREF(v); - f = TP_DESCR_GET(v->