cpython/Modules/_testcapi/clinic/float.c.h
Victor Stinner ad73674283
gh-107603: Argument Clinic: Only include pycore_gc.h if needed (#108726)
Argument Clinic now only includes pycore_gc.h if PyGC_Head is needed,
and only includes pycore_runtime.h if _Py_ID() is needed.

* Add 'condition' optional argument to Clinic.add_include().
* deprecate_keyword_use() includes pycore_runtime.h when using
  the _PyID() function.
* Fix rendering of includes: comments start at the column 35.
* Mark PC/clinic/_wmimodule.cpp.h and
  "Objects/stringlib/clinic/*.h.h" header files as generated in
  .gitattributes.

Effects:

* 42 header files generated by AC no longer include the internal C
  API, instead of 4 header files before. For example,
  Modules/clinic/_abc.c.h no longer includes the internal C API.
* Fix _testclinic_depr.c.h: it now always includes pycore_runtime.h
  to get _Py_ID().
2023-08-31 23:42:34 +02:00

82 lines
2.2 KiB
C
Generated

/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(_testcapi_float_pack__doc__,
"float_pack($module, size, d, le, /)\n"
"--\n"
"\n"
"Test PyFloat_Pack2(), PyFloat_Pack4() and PyFloat_Pack8()");
#define _TESTCAPI_FLOAT_PACK_METHODDEF \
{"float_pack", _PyCFunction_CAST(_testcapi_float_pack), METH_FASTCALL, _testcapi_float_pack__doc__},
static PyObject *
_testcapi_float_pack_impl(PyObject *module, int size, double d, int le);
static PyObject *
_testcapi_float_pack(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
int size;
double d;
int le;
if (!_PyArg_CheckPositional("float_pack", nargs, 3, 3)) {
goto exit;
}
size = PyLong_AsInt(args[0]);
if (size == -1 && PyErr_Occurred()) {
goto exit;
}
if (PyFloat_CheckExact(args[1])) {
d = PyFloat_AS_DOUBLE(args[1]);
}
else
{
d = PyFloat_AsDouble(args[1]);
if (d == -1.0 && PyErr_Occurred()) {
goto exit;
}
}
le = PyLong_AsInt(args[2]);
if (le == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = _testcapi_float_pack_impl(module, size, d, le);
exit:
return return_value;
}
PyDoc_STRVAR(_testcapi_float_unpack__doc__,
"float_unpack($module, data, le, /)\n"
"--\n"
"\n"
"Test PyFloat_Unpack2(), PyFloat_Unpack4() and PyFloat_Unpack8()");
#define _TESTCAPI_FLOAT_UNPACK_METHODDEF \
{"float_unpack", _PyCFunction_CAST(_testcapi_float_unpack), METH_FASTCALL, _testcapi_float_unpack__doc__},
static PyObject *
_testcapi_float_unpack_impl(PyObject *module, const char *data,
Py_ssize_t data_length, int le);
static PyObject *
_testcapi_float_unpack(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
const char *data;
Py_ssize_t data_length;
int le;
if (!_PyArg_ParseStack(args, nargs, "y#i:float_unpack",
&data, &data_length, &le)) {
goto exit;
}
return_value = _testcapi_float_unpack_impl(module, data, data_length, le);
exit:
return return_value;
}
/*[clinic end generated code: output=50146051f1341cce input=a9049054013a1b77]*/