#ifdef _WIN64
return PyLong_FromVoidPtr(hMod);
#else
- return Py_BuildValue("i", hMod);
+ return PyLong_FromLong((int)hMod);
#endif
}
#endif
/*[clinic input]
-_curses.napms
+_curses.napms -> int
ms: int
Duration in milliseconds.
Sleep for specified time.
[clinic start generated code]*/
-static PyObject *
+static int
_curses_napms_impl(PyObject *module, int ms)
-/*[clinic end generated code: output=a40a1da2e39ea438 input=20cd3af2b6900f56]*/
+/*[clinic end generated code: output=5f292a6a724491bd input=c6d6e01f2f1df9f7]*/
{
PyCursesInitialised;
- return Py_BuildValue("i", napms(ms));
+ return napms(ms);
}
timezone_getinitargs(PyDateTime_TimeZone *self, PyObject *Py_UNUSED(ignored))
{
if (self->name == NULL)
- return Py_BuildValue("(O)", self->offset);
- return Py_BuildValue("(OO)", self->offset, self->name);
+ return PyTuple_Pack(1, self->offset);
+ return PyTuple_Pack(2, self->offset, self->name);
}
static PyMethodDef timezone_methods[] = {
}
#define ADD_NB_OP(NUM, STR) \
do { \
- PyObject *pair = Py_BuildValue( \
- "NN", PyUnicode_FromString(#NUM), PyUnicode_FromString(STR)); \
+ PyObject *pair = Py_BuildValue("ss", #NUM, STR); \
if (pair == NULL) { \
Py_DECREF(list); \
return NULL; \
self.declare(data)
self.err_occurred_if("_return_value == PY_DWORD_MAX", data)
data.return_conversion.append(
- 'return_value = Py_BuildValue("k", _return_value);\n')
+ 'return_value = PyLong_FromUnsignedLong(_return_value);\n')
class LPVOID_return_converter(CReturnConverter):
type = 'LPVOID'
data.return_conversion.append(
'return_value = HANDLE_TO_PYNUM(_return_value);\n')
[python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=011ee0c3a2244bfe]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=ef52a757a1830d92]*/
#include "clinic/_winapi.c.h"
/*[clinic end generated code: output=556712fc709deecb input=6ac8c73eed3de316]*/
{
if (from_cache) {
- PyObject *val_args = Py_BuildValue("(O)", key);
+ PyObject *val_args = PyTuple_Pack(1, key);
if (val_args == NULL) {
return NULL;
}
#define _CURSES_NAPMS_METHODDEF \
{"napms", (PyCFunction)_curses_napms, METH_O, _curses_napms__doc__},
-static PyObject *
+static int
_curses_napms_impl(PyObject *module, int ms);
static PyObject *
{
PyObject *return_value = NULL;
int ms;
+ int _return_value;
ms = PyLong_AsInt(arg);
if (ms == -1 && PyErr_Occurred()) {
goto exit;
}
- return_value = _curses_napms_impl(module, ms);
+ _return_value = _curses_napms_impl(module, ms);
+ if ((_return_value == -1) && PyErr_Occurred()) {
+ goto exit;
+ }
+ return_value = PyLong_FromLong((long)_return_value);
exit:
return return_value;
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
-/*[clinic end generated code: output=24ad16254d1eef9c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=96887782374f070a input=a9049054013a1b77]*/
if ((_return_value == PY_DWORD_MAX) && PyErr_Occurred()) {
goto exit;
}
- return_value = Py_BuildValue("k", _return_value);
+ return_value = PyLong_FromUnsignedLong(_return_value);
exit:
return return_value;
if ((_return_value == PY_DWORD_MAX) && PyErr_Occurred()) {
goto exit;
}
- return_value = Py_BuildValue("k", _return_value);
+ return_value = PyLong_FromUnsignedLong(_return_value);
exit:
return return_value;
if ((_return_value == PY_DWORD_MAX) && PyErr_Occurred()) {
goto exit;
}
- return_value = Py_BuildValue("k", _return_value);
+ return_value = PyLong_FromUnsignedLong(_return_value);
exit:
return return_value;
return return_value;
}
-/*[clinic end generated code: output=aaf29735c47f55fe input=a9049054013a1b77]*/
+/*[clinic end generated code: output=e1a9908bb82a6379 input=a9049054013a1b77]*/
if (n) {
while (iswspace(lpMsgBuf[n-1]))
--n;
- lpMsgBuf[n] = L'\0';
- res = Py_BuildValue("u", lpMsgBuf);
+ res = PyUnicode_FromWideChar(lpMsgBuf, n);
} else {
res = PyUnicode_FromFormat("unknown error code %u", code);
}
done:
#if !defined(HAVE_LARGEFILE_SUPPORT)
- return Py_BuildValue("l", sbytes);
+ return PyLong_FromLong(sbytes);
#else
- return Py_BuildValue("L", sbytes);
+ return PyLong_FromLongLong(sbytes);
#endif
#else
} while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
if (ret < 0)
return (!async_err) ? posix_error() : NULL;
- return Py_BuildValue("n", ret);
+ return PyLong_FromSsize_t(ret);
}
#endif
off_t offset;
return (!async_err) ? posix_error() : NULL;
if (offset >= st.st_size) {
- return Py_BuildValue("i", 0);
+ return PyLong_FromLong(0);
}
// On illumos specifically sendfile() may perform a partial write but
} while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
if (ret < 0)
return (!async_err) ? posix_error() : NULL;
- return Py_BuildValue("n", ret);
+ return PyLong_FromSsize_t(ret);
#endif
}
#endif /* HAVE_SENDFILE */
pyexpat_xmlparser_GetBase_impl(xmlparseobject *self)
/*[clinic end generated code: output=2886cb21f9a8739a input=918d71c38009620e]*/
{
- return Py_BuildValue("z", XML_GetBase(self->itself));
+ return conv_string_to_unicode(XML_GetBase(self->itself));
}
/*[clinic input]
pyexpat_ErrorString_impl(PyObject *module, long code)
/*[clinic end generated code: output=2feae50d166f2174 input=cc67de010d9e62b3]*/
{
- return Py_BuildValue("z", XML_ErrorString((int)code));
+ return conv_string_to_unicode(XML_ErrorString((int)code));
}
/* List of methods defined in the module */
Py_RETURN_NONE;
#endif
- return Py_BuildValue("s", res);
+ return PyUnicode_FromString(res);
}
#ifdef HAVE_SIGINTERRUPT
#if defined(__NetBSD__) || defined(__DragonFly__)
return makebdaddr(&_BT_HCI_MEMB(a, bdaddr));
#else /* __NetBSD__ || __DragonFly__ */
- PyObject *ret = NULL;
- ret = Py_BuildValue("i", _BT_HCI_MEMB(a, dev));
- return ret;
+ return PyLong_FromLong(_BT_HCI_MEMB(a, dev));
#endif /* !(__NetBSD__ || __DragonFly__) */
}