mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
Correct some value converting strangenesses.
This commit is contained in:
parent
162997efb1
commit
2cfaa34dfa
4 changed files with 7 additions and 7 deletions
|
@ -644,7 +644,7 @@ binascii_rledecode_hqx(PyObject *self, PyObject *args)
|
||||||
|
|
||||||
/* Empty string is a special case */
|
/* Empty string is a special case */
|
||||||
if ( in_len == 0 )
|
if ( in_len == 0 )
|
||||||
return Py_BuildValue("s", "");
|
return PyString_FromString("");
|
||||||
|
|
||||||
/* Allocate a buffer of reasonable size. Resized when needed */
|
/* Allocate a buffer of reasonable size. Resized when needed */
|
||||||
out_len = in_len*2;
|
out_len = in_len*2;
|
||||||
|
|
|
@ -477,7 +477,7 @@ mmap_tell_method(mmap_object *self, PyObject *args)
|
||||||
CHECK_VALID(NULL);
|
CHECK_VALID(NULL);
|
||||||
if (!PyArg_ParseTuple(args, ":tell"))
|
if (!PyArg_ParseTuple(args, ":tell"))
|
||||||
return NULL;
|
return NULL;
|
||||||
return Py_BuildValue("l", (long) self->pos);
|
return PyInt_FromLong((long) self->pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -493,7 +493,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
return Py_BuildValue("l", (long)
|
return PyInt_FromLong((long)
|
||||||
FlushViewOfFile(self->data+offset, size));
|
FlushViewOfFile(self->data+offset, size));
|
||||||
#endif /* MS_WINDOWS */
|
#endif /* MS_WINDOWS */
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
|
@ -505,7 +505,7 @@ mmap_flush_method(mmap_object *self, PyObject *args)
|
||||||
PyErr_SetFromErrno(mmap_module_error);
|
PyErr_SetFromErrno(mmap_module_error);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return Py_BuildValue("l", (long) 0);
|
return PyInt_FromLong(0);
|
||||||
#endif /* UNIX */
|
#endif /* UNIX */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1136,9 +1136,9 @@ instance_ass_item(PyInstanceObject *inst, Py_ssize_t i, PyObject *item)
|
||||||
if (func == NULL)
|
if (func == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
arg = Py_BuildValue("i", i);
|
arg = PyInt_FromSsize_t(i);
|
||||||
else
|
else
|
||||||
arg = Py_BuildValue("(iO)", i, item);
|
arg = Py_BuildValue("(nO)", i, item);
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -112,7 +112,7 @@ get_counts(void)
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
for (tp = type_list; tp; tp = tp->tp_next) {
|
for (tp = type_list; tp; tp = tp->tp_next) {
|
||||||
v = Py_BuildValue("(siii)", tp->tp_name, tp->tp_allocs,
|
v = Py_BuildValue("(snnn)", tp->tp_name, tp->tp_allocs,
|
||||||
tp->tp_frees, tp->tp_maxalloc);
|
tp->tp_frees, tp->tp_maxalloc);
|
||||||
if (v == NULL) {
|
if (v == NULL) {
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue