mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +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
|
|
@ -376,7 +376,7 @@ PyObject *
|
|||
PyInt_FromUnicode(Py_UNICODE *s, Py_ssize_t length, int base)
|
||||
{
|
||||
PyObject *result;
|
||||
char *buffer = PyMem_MALLOC(length+1);
|
||||
char *buffer = (char *)PyMem_MALLOC(length+1);
|
||||
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
|
@ -982,7 +982,7 @@ int_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
static PyObject *
|
||||
int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
PyObject *tmp, *new;
|
||||
PyObject *tmp, *newobj;
|
||||
long ival;
|
||||
|
||||
assert(PyType_IsSubtype(type, &PyInt_Type));
|
||||
|
|
@ -999,14 +999,14 @@ int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
ival = ((PyIntObject *)tmp)->ob_ival;
|
||||
}
|
||||
|
||||
new = type->tp_alloc(type, 0);
|
||||
if (new == NULL) {
|
||||
newobj = type->tp_alloc(type, 0);
|
||||
if (newobj == NULL) {
|
||||
Py_DECREF(tmp);
|
||||
return NULL;
|
||||
}
|
||||
((PyIntObject *)new)->ob_ival = ival;
|
||||
((PyIntObject *)newobj)->ob_ival = ival;
|
||||
Py_DECREF(tmp);
|
||||
return new;
|
||||
return newobj;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue