mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
More C++-compliance. Note especially listobject.c - to get C++ to accept the
PyTypeObject structures, I had to make prototypes for the functions, and move the structure definition ahead of the functions. I'd dearly like a better way to do this - to change this would make for a massive set of changes to the codebase. There's still some warnings - this is purely to get rid of errors first.
This commit is contained in:
parent
bbfe4fad36
commit
377be11ee1
8 changed files with 148 additions and 137 deletions
|
@ -959,21 +959,21 @@ float_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
static PyObject *
|
||||
float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PyObject *tmp, *new;
|
||||
PyObject *tmp, *newobj;
|
||||
|
||||
assert(PyType_IsSubtype(type, &PyFloat_Type));
|
||||
tmp = float_new(&PyFloat_Type, args, kwds);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
assert(PyFloat_CheckExact(tmp));
|
||||
new = type->tp_alloc(type, 0);
|
||||
if (new == NULL) {
|
||||
newobj = type->tp_alloc(type, 0);
|
||||
if (newobj == NULL) {
|
||||
Py_DECREF(tmp);
|
||||
return NULL;
|
||||
}
|
||||
((PyFloatObject *)new)->ob_fval = ((PyFloatObject *)tmp)->ob_fval;
|
||||
((PyFloatObject *)newobj)->ob_fval = ((PyFloatObject *)tmp)->ob_fval;
|
||||
Py_DECREF(tmp);
|
||||
return new;
|
||||
return newobj;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue