mirror of
https://github.com/python/cpython.git
synced 2025-09-05 00:11:10 +00:00
gh-117764: Fix and add signatures for many builtins (GH-117769)
This commit is contained in:
parent
94e9c35cd0
commit
3a8c1ca7e7
11 changed files with 45 additions and 30 deletions
|
@ -475,7 +475,7 @@ builtin_breakpoint(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
|
|||
}
|
||||
|
||||
PyDoc_STRVAR(breakpoint_doc,
|
||||
"breakpoint(*args, **kws)\n\
|
||||
"breakpoint($module, /, *args, **kws)\n\
|
||||
--\n\
|
||||
\n\
|
||||
Call sys.breakpointhook(*args, **kws). sys.breakpointhook() must accept\n\
|
||||
|
@ -1703,16 +1703,16 @@ anext as builtin_anext
|
|||
default: object = NULL
|
||||
/
|
||||
|
||||
async anext(aiterator[, default])
|
||||
Return the next item from the async iterator.
|
||||
|
||||
Return the next item from the async iterator. If default is given and the async
|
||||
iterator is exhausted, it is returned instead of raising StopAsyncIteration.
|
||||
If default is given and the async iterator is exhausted,
|
||||
it is returned instead of raising StopAsyncIteration.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
builtin_anext_impl(PyObject *module, PyObject *aiterator,
|
||||
PyObject *default_value)
|
||||
/*[clinic end generated code: output=f02c060c163a81fa input=8f63f4f78590bb4c]*/
|
||||
/*[clinic end generated code: output=f02c060c163a81fa input=2900e4a370d39550]*/
|
||||
{
|
||||
PyTypeObject *t;
|
||||
PyObject *awaitable;
|
||||
|
|
8
Python/clinic/bltinmodule.c.h
generated
8
Python/clinic/bltinmodule.c.h
generated
|
@ -693,10 +693,10 @@ PyDoc_STRVAR(builtin_anext__doc__,
|
|||
"anext($module, aiterator, default=<unrepresentable>, /)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"async anext(aiterator[, default])\n"
|
||||
"Return the next item from the async iterator.\n"
|
||||
"\n"
|
||||
"Return the next item from the async iterator. If default is given and the async\n"
|
||||
"iterator is exhausted, it is returned instead of raising StopAsyncIteration.");
|
||||
"If default is given and the async iterator is exhausted,\n"
|
||||
"it is returned instead of raising StopAsyncIteration.");
|
||||
|
||||
#define BUILTIN_ANEXT_METHODDEF \
|
||||
{"anext", _PyCFunction_CAST(builtin_anext), METH_FASTCALL, builtin_anext__doc__},
|
||||
|
@ -1193,4 +1193,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=643a8d5f900e0c36 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=6d15edfc194b2c08 input=a9049054013a1b77]*/
|
||||
|
|
8
Python/clinic/traceback.c.h
generated
8
Python/clinic/traceback.c.h
generated
|
@ -9,7 +9,7 @@ preserve
|
|||
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
|
||||
|
||||
PyDoc_STRVAR(tb_new__doc__,
|
||||
"TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)\n"
|
||||
"traceback(tb_next, tb_frame, tb_lasti, tb_lineno)\n"
|
||||
"--\n"
|
||||
"\n"
|
||||
"Create a new traceback object.");
|
||||
|
@ -43,7 +43,7 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
static const char * const _keywords[] = {"tb_next", "tb_frame", "tb_lasti", "tb_lineno", NULL};
|
||||
static _PyArg_Parser _parser = {
|
||||
.keywords = _keywords,
|
||||
.fname = "TracebackType",
|
||||
.fname = "traceback",
|
||||
.kwtuple = KWTUPLE,
|
||||
};
|
||||
#undef KWTUPLE
|
||||
|
@ -61,7 +61,7 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
}
|
||||
tb_next = fastargs[0];
|
||||
if (!PyObject_TypeCheck(fastargs[1], &PyFrame_Type)) {
|
||||
_PyArg_BadArgument("TracebackType", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]);
|
||||
_PyArg_BadArgument("traceback", "argument 'tb_frame'", (&PyFrame_Type)->tp_name, fastargs[1]);
|
||||
goto exit;
|
||||
}
|
||||
tb_frame = (PyFrameObject *)fastargs[1];
|
||||
|
@ -78,4 +78,4 @@ tb_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
|
|||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=4e2f6b935841b09c input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=916a759875507c5a input=a9049054013a1b77]*/
|
||||
|
|
|
@ -34,9 +34,9 @@
|
|||
extern char* _PyTokenizer_FindEncodingFilename(int, PyObject *);
|
||||
|
||||
/*[clinic input]
|
||||
class TracebackType "PyTracebackObject *" "&PyTraceback_Type"
|
||||
class traceback "PyTracebackObject *" "&PyTraceback_Type"
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=928fa06c10151120]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=cf96294b2bebc811]*/
|
||||
|
||||
#include "clinic/traceback.c.h"
|
||||
|
||||
|
@ -63,7 +63,7 @@ tb_create_raw(PyTracebackObject *next, PyFrameObject *frame, int lasti,
|
|||
|
||||
/*[clinic input]
|
||||
@classmethod
|
||||
TracebackType.__new__ as tb_new
|
||||
traceback.__new__ as tb_new
|
||||
|
||||
tb_next: object
|
||||
tb_frame: object(type='PyFrameObject *', subclass_of='&PyFrame_Type')
|
||||
|
@ -76,7 +76,7 @@ Create a new traceback object.
|
|||
static PyObject *
|
||||
tb_new_impl(PyTypeObject *type, PyObject *tb_next, PyFrameObject *tb_frame,
|
||||
int tb_lasti, int tb_lineno)
|
||||
/*[clinic end generated code: output=fa077debd72d861a input=01cbe8ec8783fca7]*/
|
||||
/*[clinic end generated code: output=fa077debd72d861a input=b88143145454cb59]*/
|
||||
{
|
||||
if (tb_next == Py_None) {
|
||||
tb_next = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue