Issue #23501: Argumen Clinic now generates code into separate files by default.

This commit is contained in:
Serhiy Storchaka 2015-04-03 23:53:51 +03:00
parent 0759f84d62
commit 1009bf18b3
54 changed files with 9262 additions and 8731 deletions

View File

@ -63,6 +63,8 @@ Library
Build
-----
- Issue #23501: Argumen Clinic now generates code into separate files by default.
Tests
-----

View File

@ -211,12 +211,11 @@ error:
}
/*[clinic input]
output preset file
module _bz2
class _bz2.BZ2Compressor "BZ2Compressor *" "&BZ2Compressor_Type"
class _bz2.BZ2Decompressor "BZ2Decompressor *" "&BZ2Decompressor_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e3b139924f5e18cc]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=dc7d7992a79f9cb7]*/
#include "clinic/_bz2module.c.h"

View File

@ -47,6 +47,7 @@ module _codecs
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e1390e3da3cb9deb]*/
#include "clinic/_codecsmodule.c.h"
/* --- Registry ----------------------------------------------------------- */
@ -153,37 +154,9 @@ _codecs._forget_codec
Purge the named codec from the internal codec lookup cache
[clinic start generated code]*/
PyDoc_STRVAR(_codecs__forget_codec__doc__,
"_forget_codec($module, encoding, /)\n"
"--\n"
"\n"
"Purge the named codec from the internal codec lookup cache");
#define _CODECS__FORGET_CODEC_METHODDEF \
{"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_VARARGS, _codecs__forget_codec__doc__},
static PyObject *
_codecs__forget_codec_impl(PyModuleDef *module, const char *encoding);
static PyObject *
_codecs__forget_codec(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
const char *encoding;
if (!PyArg_ParseTuple(args,
"s:_forget_codec",
&encoding))
goto exit;
return_value = _codecs__forget_codec_impl(module, encoding);
exit:
return return_value;
}
static PyObject *
_codecs__forget_codec_impl(PyModuleDef *module, const char *encoding)
/*[clinic end generated code: output=a75e631591702a5c input=18d5d92d0e386c38]*/
/*[clinic end generated code: output=b56a9b99d2d28080 input=18d5d92d0e386c38]*/
{
if (_PyCodec_Forget(encoding) < 0) {
return NULL;

View File

@ -12,6 +12,7 @@ module crypt
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=c6252cf4f2f2ae81]*/
#include "clinic/_cryptmodule.c.h"
/*[clinic input]
crypt.crypt
@ -29,43 +30,9 @@ results for a given *word*.
[clinic start generated code]*/
PyDoc_STRVAR(crypt_crypt__doc__,
"crypt($module, word, salt, /)\n"
"--\n"
"\n"
"Hash a *word* with the given *salt* and return the hashed password.\n"
"\n"
"*word* will usually be a user\'s password. *salt* (either a random 2 or 16\n"
"character string, possibly prefixed with $digit$ to indicate the method)\n"
"will be used to perturb the encryption algorithm and produce distinct\n"
"results for a given *word*.");
#define CRYPT_CRYPT_METHODDEF \
{"crypt", (PyCFunction)crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
static PyObject *
crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt);
static PyObject *
crypt_crypt(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
const char *word;
const char *salt;
if (!PyArg_ParseTuple(args,
"ss:crypt",
&word, &salt))
goto exit;
return_value = crypt_crypt_impl(module, word, salt);
exit:
return return_value;
}
static PyObject *
crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt)
/*[clinic end generated code: output=3eaacdf994a6ff23 input=4d93b6d0f41fbf58]*/
/*[clinic end generated code: output=995ad1e854d83069 input=4d93b6d0f41fbf58]*/
{
/* On some platforms (AtheOS) crypt returns NULL for an invalid
salt. Return None in that case. XXX Maybe raise an exception? */

View File

@ -140,6 +140,8 @@ class curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=88c860abdbb50e0c]*/
#include "clinic/_cursesmodule.c.h"
/* Definition of exception curses.error */
static PyObject *PyCursesError;
@ -583,75 +585,9 @@ By default, the character position and attributes are the
current settings for the window object.
[clinic start generated code]*/
PyDoc_STRVAR(curses_window_addch__doc__,
"addch([y, x,] ch, [attr])\n"
"Paint character ch at (y, x) with attributes attr.\n"
"\n"
" y\n"
" Y-coordinate.\n"
" x\n"
" X-coordinate.\n"
" ch\n"
" Character to add.\n"
" attr\n"
" Attributes for the character.\n"
"\n"
"Paint character ch at (y, x) with attributes attr,\n"
"overwriting any character previously painted at that location.\n"
"By default, the character position and attributes are the\n"
"current settings for the window object.");
#define CURSES_WINDOW_ADDCH_METHODDEF \
{"addch", (PyCFunction)curses_window_addch, METH_VARARGS, curses_window_addch__doc__},
static PyObject *
curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y, int x, PyObject *ch, int group_right_1, long attr);
static PyObject *
curses_window_addch(PyCursesWindowObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int group_left_1 = 0;
int y = 0;
int x = 0;
PyObject *ch;
int group_right_1 = 0;
long attr = 0;
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "O:addch", &ch))
goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr))
goto exit;
group_right_1 = 1;
break;
case 3:
if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch))
goto exit;
group_left_1 = 1;
break;
case 4:
if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr))
goto exit;
group_right_1 = 1;
group_left_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "curses.window.addch requires 1 to 4 arguments");
goto exit;
}
return_value = curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
exit:
return return_value;
}
static PyObject *
curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y, int x, PyObject *ch, int group_right_1, long attr)
/*[clinic end generated code: output=d4b97cc287010c54 input=5a41efb34a2de338]*/
/*[clinic end generated code: output=9fa34a5d80151f1a input=5a41efb34a2de338]*/
{
PyCursesWindowObject *cwself = (PyCursesWindowObject *)self;
int coordinates_group = group_left_1;

View File

@ -26,6 +26,8 @@ class datetime.datetime "PyDateTime_DateTime *" "&PyDateTime_DateTimeType"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=78142cb64b9e98bc]*/
#include "clinic/_datetimemodule.c.h"
/* We require that C int be at least 32 bits, and use int virtually
* everywhere. In just a few cases we use a temp long, where a Python
* API returns a C long. In such cases, we have to ensure that the
@ -4133,43 +4135,9 @@ Returns new datetime object representing current time local to tz.
If no tz is specified, uses local timezone.
[clinic start generated code]*/
PyDoc_STRVAR(datetime_datetime_now__doc__,
"now($type, /, tz=None)\n"
"--\n"
"\n"
"Returns new datetime object representing current time local to tz.\n"
"\n"
" tz\n"
" Timezone object.\n"
"\n"
"If no tz is specified, uses local timezone.");
#define DATETIME_DATETIME_NOW_METHODDEF \
{"now", (PyCFunction)datetime_datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
static PyObject *
datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
static PyObject *
datetime_datetime_now(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"tz", NULL};
PyObject *tz = Py_None;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:now", _keywords,
&tz))
goto exit;
return_value = datetime_datetime_now_impl(type, tz);
exit:
return return_value;
}
static PyObject *
datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz)
/*[clinic end generated code: output=583c5637e3c843fa input=80d09869c5267d00]*/
/*[clinic end generated code: output=b3386e5345e2b47a input=80d09869c5267d00]*/
{
PyObject *self;

View File

@ -40,6 +40,8 @@ typedef struct {
DBM *di_dbm;
} dbmobject;
#include "clinic/_dbmmodule.c.h"
static PyTypeObject Dbmtype;
#define is_dbmobject(v) (Py_TYPE(v) == &Dbmtype)
@ -277,39 +279,9 @@ dbm.dbm.get
Return the value for key if present, otherwise default.
[clinic start generated code]*/
PyDoc_STRVAR(dbm_dbm_get__doc__,
"get($self, key, default=None, /)\n"
"--\n"
"\n"
"Return the value for key if present, otherwise default.");
#define DBM_DBM_GET_METHODDEF \
{"get", (PyCFunction)dbm_dbm_get, METH_VARARGS, dbm_dbm_get__doc__},
static PyObject *
dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, PyObject *default_value);
static PyObject *
dbm_dbm_get(dbmobject *dp, PyObject *args)
{
PyObject *return_value = NULL;
const char *key;
Py_ssize_clean_t key_length;
PyObject *default_value = Py_None;
if (!PyArg_ParseTuple(args,
"s#|O:get",
&key, &key_length, &default_value))
goto exit;
return_value = dbm_dbm_get_impl(dp, key, key_length, default_value);
exit:
return return_value;
}
static PyObject *
dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, PyObject *default_value)
/*[clinic end generated code: output=452ea11394e7e92d input=aecf5efd2f2b1a3b]*/
/*[clinic end generated code: output=c2bdccaa734ad349 input=aecf5efd2f2b1a3b]*/
{
datum dbm_key, val;
@ -449,47 +421,9 @@ Return a database object.
[clinic start generated code]*/
PyDoc_STRVAR(dbmopen__doc__,
"open($module, filename, flags=\'r\', mode=0o666, /)\n"
"--\n"
"\n"
"Return a database object.\n"
"\n"
" filename\n"
" The filename to open.\n"
" flags\n"
" How to open the file. \"r\" for reading, \"w\" for writing, etc.\n"
" mode\n"
" If creating a new file, the mode bits for the new file\n"
" (e.g. os.O_RDWR).");
#define DBMOPEN_METHODDEF \
{"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
static PyObject *
dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode);
static PyObject *
dbmopen(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
const char *filename;
const char *flags = "r";
int mode = 438;
if (!PyArg_ParseTuple(args,
"s|si:open",
&filename, &flags, &mode))
goto exit;
return_value = dbmopen_impl(module, filename, flags, mode);
exit:
return return_value;
}
static PyObject *
dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode)
/*[clinic end generated code: output=9a7b725f9c4dcec2 input=6499ab0fab1333ac]*/
/*[clinic end generated code: output=8b618fe06b92bf86 input=6499ab0fab1333ac]*/
{
int iflags;

View File

@ -478,12 +478,11 @@ error:
/*[clinic input]
output preset file
module _lzma
class _lzma.LZMACompressor "Compressor *" "&Compressor_type"
class _lzma.LZMADecompressor "Decompressor *" "&Decompressor_type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f17afc786525d6c2]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=2c14bbe05ff0c147]*/
#include "clinic/_lzmamodule.c.h"

View File

@ -6,6 +6,8 @@ module _opcode
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=117442e66eb376e6]*/
#include "clinic/_opcode.c.h"
/*[clinic input]
_opcode.stack_effect -> int
@ -17,42 +19,9 @@ _opcode.stack_effect -> int
Compute the stack effect of the opcode.
[clinic start generated code]*/
PyDoc_STRVAR(_opcode_stack_effect__doc__,
"stack_effect($module, opcode, oparg=None, /)\n"
"--\n"
"\n"
"Compute the stack effect of the opcode.");
#define _OPCODE_STACK_EFFECT_METHODDEF \
{"stack_effect", (PyCFunction)_opcode_stack_effect, METH_VARARGS, _opcode_stack_effect__doc__},
static int
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, PyObject *oparg);
static PyObject *
_opcode_stack_effect(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
int opcode;
PyObject *oparg = Py_None;
int _return_value;
if (!PyArg_ParseTuple(args,
"i|O:stack_effect",
&opcode, &oparg))
goto exit;
_return_value = _opcode_stack_effect_impl(module, opcode, oparg);
if ((_return_value == -1) && PyErr_Occurred())
goto exit;
return_value = PyLong_FromLong((long)_return_value);
exit:
return return_value;
}
static int
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, PyObject *oparg)
/*[clinic end generated code: output=9e1133f8d587bc67 input=2d0a9ee53c0418f5]*/
/*[clinic end generated code: output=1fcafd5596c6b050 input=2d0a9ee53c0418f5]*/
{
int effect;
int oparg_int = 0;

View File

@ -5,14 +5,13 @@ PyDoc_STRVAR(pickle_module_doc,
"Optimized C implementation for the Python pickle module.");
/*[clinic input]
output preset file
module _pickle
class _pickle.Pickler "PicklerObject *" "&Pickler_Type"
class _pickle.PicklerMemoProxy "PicklerMemoProxyObject *" "&PicklerMemoProxyType"
class _pickle.Unpickler "UnpicklerObject *" "&Unpickler_Type"
class _pickle.UnpicklerMemoProxy "UnpicklerMemoProxyObject *" "&UnpicklerMemoProxyType"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=11c45248a41dd3fc]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=4b3e113468a58e6c]*/
/* Bump this when new opcodes are added to the pickle protocol. */
enum {

View File

@ -9,6 +9,8 @@ module _weakref
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ffec73b85846596d]*/
#include "clinic/_weakref.c.h"
/*[clinic input]
_weakref.getweakrefcount -> Py_ssize_t
@ -19,36 +21,9 @@ _weakref.getweakrefcount -> Py_ssize_t
Return the number of weak references to 'object'.
[clinic start generated code]*/
PyDoc_STRVAR(_weakref_getweakrefcount__doc__,
"getweakrefcount($module, object, /)\n"
"--\n"
"\n"
"Return the number of weak references to \'object\'.");
#define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \
{"getweakrefcount", (PyCFunction)_weakref_getweakrefcount, METH_O, _weakref_getweakrefcount__doc__},
static Py_ssize_t
_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object);
static PyObject *
_weakref_getweakrefcount(PyModuleDef *module, PyObject *object)
{
PyObject *return_value = NULL;
Py_ssize_t _return_value;
_return_value = _weakref_getweakrefcount_impl(module, object);
if ((_return_value == -1) && PyErr_Occurred())
goto exit;
return_value = PyLong_FromSsize_t(_return_value);
exit:
return return_value;
}
static Py_ssize_t
_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object)
/*[clinic end generated code: output=032eedbfd7d69e10 input=cedb69711b6a2507]*/
/*[clinic end generated code: output=6a6ad0b98285e468 input=cedb69711b6a2507]*/
{
PyWeakReference **list;

View File

@ -16,10 +16,9 @@
#endif /* !STDC_HEADERS */
/*[clinic input]
output preset file
module array
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=0909c1a148c69931]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=7d1b8d7f5958fd83]*/
struct arrayobject; /* Forward */

View File

@ -391,10 +391,9 @@ audioop_check_parameters(Py_ssize_t len, int size)
}
/*[clinic input]
output preset file
module audioop
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5619f935f269199a]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8fa8f6611be3591a]*/
/*[clinic input]
audioop.getsample

View File

@ -184,10 +184,9 @@ static unsigned short crctab_hqx[256] = {
};
/*[clinic input]
output preset file
module binascii
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=44c6f840ce708f0c]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=de89fb46bcaf3fec]*/
/*[python input]

View File

@ -11,15 +11,10 @@
#include "clinic/multibytecodec.c.h"
/*[clinic input]
output preset file
module _multibytecodec
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e0cf1b7f3c472d17]*/
/*[clinic input]
class _multibytecodec.MultibyteCodec "MultibyteCodecObject *" "&MultibyteCodec_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=d5b1fc1fec8eb003]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6ad689546cbb5450]*/
typedef struct {
PyObject *inobj;

View File

@ -0,0 +1,32 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(_codecs__forget_codec__doc__,
"_forget_codec($module, encoding, /)\n"
"--\n"
"\n"
"Purge the named codec from the internal codec lookup cache");
#define _CODECS__FORGET_CODEC_METHODDEF \
{"_forget_codec", (PyCFunction)_codecs__forget_codec, METH_VARARGS, _codecs__forget_codec__doc__},
static PyObject *
_codecs__forget_codec_impl(PyModuleDef *module, const char *encoding);
static PyObject *
_codecs__forget_codec(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
const char *encoding;
if (!PyArg_ParseTuple(args,
"s:_forget_codec",
&encoding))
goto exit;
return_value = _codecs__forget_codec_impl(module, encoding);
exit:
return return_value;
}
/*[clinic end generated code: output=cdea83e21d76a900 input=a9049054013a1b77]*/

View File

@ -0,0 +1,38 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(crypt_crypt__doc__,
"crypt($module, word, salt, /)\n"
"--\n"
"\n"
"Hash a *word* with the given *salt* and return the hashed password.\n"
"\n"
"*word* will usually be a user\'s password. *salt* (either a random 2 or 16\n"
"character string, possibly prefixed with $digit$ to indicate the method)\n"
"will be used to perturb the encryption algorithm and produce distinct\n"
"results for a given *word*.");
#define CRYPT_CRYPT_METHODDEF \
{"crypt", (PyCFunction)crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
static PyObject *
crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt);
static PyObject *
crypt_crypt(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
const char *word;
const char *salt;
if (!PyArg_ParseTuple(args,
"ss:crypt",
&word, &salt))
goto exit;
return_value = crypt_crypt_impl(module, word, salt);
exit:
return return_value;
}
/*[clinic end generated code: output=b5b8d977189d19ea input=a9049054013a1b77]*/

View File

@ -0,0 +1,70 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(curses_window_addch__doc__,
"addch([y, x,] ch, [attr])\n"
"Paint character ch at (y, x) with attributes attr.\n"
"\n"
" y\n"
" Y-coordinate.\n"
" x\n"
" X-coordinate.\n"
" ch\n"
" Character to add.\n"
" attr\n"
" Attributes for the character.\n"
"\n"
"Paint character ch at (y, x) with attributes attr,\n"
"overwriting any character previously painted at that location.\n"
"By default, the character position and attributes are the\n"
"current settings for the window object.");
#define CURSES_WINDOW_ADDCH_METHODDEF \
{"addch", (PyCFunction)curses_window_addch, METH_VARARGS, curses_window_addch__doc__},
static PyObject *
curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int y, int x, PyObject *ch, int group_right_1, long attr);
static PyObject *
curses_window_addch(PyCursesWindowObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int group_left_1 = 0;
int y = 0;
int x = 0;
PyObject *ch;
int group_right_1 = 0;
long attr = 0;
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "O:addch", &ch))
goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "Ol:addch", &ch, &attr))
goto exit;
group_right_1 = 1;
break;
case 3:
if (!PyArg_ParseTuple(args, "iiO:addch", &y, &x, &ch))
goto exit;
group_left_1 = 1;
break;
case 4:
if (!PyArg_ParseTuple(args, "iiOl:addch", &y, &x, &ch, &attr))
goto exit;
group_right_1 = 1;
group_left_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "curses.window.addch requires 1 to 4 arguments");
goto exit;
}
return_value = curses_window_addch_impl(self, group_left_1, y, x, ch, group_right_1, attr);
exit:
return return_value;
}
/*[clinic end generated code: output=660ab0ae6d8fbdda input=a9049054013a1b77]*/

View File

@ -0,0 +1,38 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(datetime_datetime_now__doc__,
"now($type, /, tz=None)\n"
"--\n"
"\n"
"Returns new datetime object representing current time local to tz.\n"
"\n"
" tz\n"
" Timezone object.\n"
"\n"
"If no tz is specified, uses local timezone.");
#define DATETIME_DATETIME_NOW_METHODDEF \
{"now", (PyCFunction)datetime_datetime_now, METH_VARARGS|METH_KEYWORDS|METH_CLASS, datetime_datetime_now__doc__},
static PyObject *
datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz);
static PyObject *
datetime_datetime_now(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"tz", NULL};
PyObject *tz = Py_None;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:now", _keywords,
&tz))
goto exit;
return_value = datetime_datetime_now_impl(type, tz);
exit:
return return_value;
}
/*[clinic end generated code: output=a5c51b96f10c462c input=a9049054013a1b77]*/

View File

@ -0,0 +1,72 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(dbm_dbm_get__doc__,
"get($self, key, default=None, /)\n"
"--\n"
"\n"
"Return the value for key if present, otherwise default.");
#define DBM_DBM_GET_METHODDEF \
{"get", (PyCFunction)dbm_dbm_get, METH_VARARGS, dbm_dbm_get__doc__},
static PyObject *
dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, PyObject *default_value);
static PyObject *
dbm_dbm_get(dbmobject *dp, PyObject *args)
{
PyObject *return_value = NULL;
const char *key;
Py_ssize_clean_t key_length;
PyObject *default_value = Py_None;
if (!PyArg_ParseTuple(args,
"s#|O:get",
&key, &key_length, &default_value))
goto exit;
return_value = dbm_dbm_get_impl(dp, key, key_length, default_value);
exit:
return return_value;
}
PyDoc_STRVAR(dbmopen__doc__,
"open($module, filename, flags=\'r\', mode=0o666, /)\n"
"--\n"
"\n"
"Return a database object.\n"
"\n"
" filename\n"
" The filename to open.\n"
" flags\n"
" How to open the file. \"r\" for reading, \"w\" for writing, etc.\n"
" mode\n"
" If creating a new file, the mode bits for the new file\n"
" (e.g. os.O_RDWR).");
#define DBMOPEN_METHODDEF \
{"open", (PyCFunction)dbmopen, METH_VARARGS, dbmopen__doc__},
static PyObject *
dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode);
static PyObject *
dbmopen(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
const char *filename;
const char *flags = "r";
int mode = 438;
if (!PyArg_ParseTuple(args,
"s|si:open",
&filename, &flags, &mode))
goto exit;
return_value = dbmopen_impl(module, filename, flags, mode);
exit:
return return_value;
}
/*[clinic end generated code: output=78d62d1aa3ddd13c input=a9049054013a1b77]*/

View File

@ -0,0 +1,37 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(_opcode_stack_effect__doc__,
"stack_effect($module, opcode, oparg=None, /)\n"
"--\n"
"\n"
"Compute the stack effect of the opcode.");
#define _OPCODE_STACK_EFFECT_METHODDEF \
{"stack_effect", (PyCFunction)_opcode_stack_effect, METH_VARARGS, _opcode_stack_effect__doc__},
static int
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, PyObject *oparg);
static PyObject *
_opcode_stack_effect(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
int opcode;
PyObject *oparg = Py_None;
int _return_value;
if (!PyArg_ParseTuple(args,
"i|O:stack_effect",
&opcode, &oparg))
goto exit;
_return_value = _opcode_stack_effect_impl(module, opcode, oparg);
if ((_return_value == -1) && PyErr_Occurred())
goto exit;
return_value = PyLong_FromLong((long)_return_value);
exit:
return return_value;
}
/*[clinic end generated code: output=dbe45148bc21ecdf input=a9049054013a1b77]*/

View File

@ -0,0 +1,31 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(_weakref_getweakrefcount__doc__,
"getweakrefcount($module, object, /)\n"
"--\n"
"\n"
"Return the number of weak references to \'object\'.");
#define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \
{"getweakrefcount", (PyCFunction)_weakref_getweakrefcount, METH_O, _weakref_getweakrefcount__doc__},
static Py_ssize_t
_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object);
static PyObject *
_weakref_getweakrefcount(PyModuleDef *module, PyObject *object)
{
PyObject *return_value = NULL;
Py_ssize_t _return_value;
_return_value = _weakref_getweakrefcount_impl(module, object);
if ((_return_value == -1) && PyErr_Occurred())
goto exit;
return_value = PyLong_FromSsize_t(_return_value);
exit:
return return_value;
}
/*[clinic end generated code: output=4da9aade63eed77f input=a9049054013a1b77]*/

View File

@ -0,0 +1,96 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(MD5Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define MD5TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)MD5Type_copy, METH_NOARGS, MD5Type_copy__doc__},
static PyObject *
MD5Type_copy_impl(MD5object *self);
static PyObject *
MD5Type_copy(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_copy_impl(self);
}
PyDoc_STRVAR(MD5Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define MD5TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)MD5Type_digest, METH_NOARGS, MD5Type_digest__doc__},
static PyObject *
MD5Type_digest_impl(MD5object *self);
static PyObject *
MD5Type_digest(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_digest_impl(self);
}
PyDoc_STRVAR(MD5Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define MD5TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)MD5Type_hexdigest, METH_NOARGS, MD5Type_hexdigest__doc__},
static PyObject *
MD5Type_hexdigest_impl(MD5object *self);
static PyObject *
MD5Type_hexdigest(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_hexdigest_impl(self);
}
PyDoc_STRVAR(MD5Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define MD5TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)MD5Type_update, METH_O, MD5Type_update__doc__},
PyDoc_STRVAR(_md5_md5__doc__,
"md5($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new MD5 hash object; optionally initialized with a string.");
#define _MD5_MD5_METHODDEF \
{"md5", (PyCFunction)_md5_md5, METH_VARARGS|METH_KEYWORDS, _md5_md5__doc__},
static PyObject *
_md5_md5_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_md5_md5(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:md5", _keywords,
&string))
goto exit;
return_value = _md5_md5_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=f72618edfd35d984 input=a9049054013a1b77]*/

File diff suppressed because it is too large Load Diff

289
Modules/clinic/pyexpat.c.h Normal file
View File

@ -0,0 +1,289 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__,
"Parse($self, data, isFinal=0, /)\n"
"--\n"
"\n"
"Parse XML data.\n"
"\n"
"`isfinal\' should be true at end of input.");
#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
{"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_VARARGS, pyexpat_xmlparser_Parse__doc__},
static PyObject *
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, int isFinal);
static PyObject *
pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *data;
int isFinal = 0;
if (!PyArg_ParseTuple(args,
"O|i:Parse",
&data, &isFinal))
goto exit;
return_value = pyexpat_xmlparser_Parse_impl(self, data, isFinal);
exit:
return return_value;
}
PyDoc_STRVAR(pyexpat_xmlparser_ParseFile__doc__,
"ParseFile($self, file, /)\n"
"--\n"
"\n"
"Parse XML data from file-like object.");
#define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF \
{"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
"SetBase($self, base, /)\n"
"--\n"
"\n"
"Set the base URL for the parser.");
#define PYEXPAT_XMLPARSER_SETBASE_METHODDEF \
{"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_VARARGS, pyexpat_xmlparser_SetBase__doc__},
static PyObject *
pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base);
static PyObject *
pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
const char *base;
if (!PyArg_ParseTuple(args,
"s:SetBase",
&base))
goto exit;
return_value = pyexpat_xmlparser_SetBase_impl(self, base);
exit:
return return_value;
}
PyDoc_STRVAR(pyexpat_xmlparser_GetBase__doc__,
"GetBase($self, /)\n"
"--\n"
"\n"
"Return base URL string for the parser.");
#define PYEXPAT_XMLPARSER_GETBASE_METHODDEF \
{"GetBase", (PyCFunction)pyexpat_xmlparser_GetBase, METH_NOARGS, pyexpat_xmlparser_GetBase__doc__},
static PyObject *
pyexpat_xmlparser_GetBase_impl(xmlparseobject *self);
static PyObject *
pyexpat_xmlparser_GetBase(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
{
return pyexpat_xmlparser_GetBase_impl(self);
}
PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
"GetInputContext($self, /)\n"
"--\n"
"\n"
"Return the untranslated text of the input that caused the current event.\n"
"\n"
"If the event was generated by a large amount of text (such as a start tag\n"
"for an element with many attributes), not all of the text may be available.");
#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
{"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
static PyObject *
pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self);
static PyObject *
pyexpat_xmlparser_GetInputContext(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
{
return pyexpat_xmlparser_GetInputContext_impl(self);
}
PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
"ExternalEntityParserCreate($self, context, encoding=None, /)\n"
"--\n"
"\n"
"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
{"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, const char *context, const char *encoding);
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
const char *context;
const char *encoding = NULL;
if (!PyArg_ParseTuple(args,
"z|s:ExternalEntityParserCreate",
&context, &encoding))
goto exit;
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
exit:
return return_value;
}
PyDoc_STRVAR(pyexpat_xmlparser_SetParamEntityParsing__doc__,
"SetParamEntityParsing($self, flag, /)\n"
"--\n"
"\n"
"Controls parsing of parameter entities (including the external DTD subset).\n"
"\n"
"Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n"
"XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n"
"XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n"
"was successful.");
#define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF \
{"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_VARARGS, pyexpat_xmlparser_SetParamEntityParsing__doc__},
static PyObject *
pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag);
static PyObject *
pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
int flag;
if (!PyArg_ParseTuple(args,
"i:SetParamEntityParsing",
&flag))
goto exit;
return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
exit:
return return_value;
}
#if (XML_COMBINED_VERSION >= 19505)
PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
"UseForeignDTD($self, flag=True, /)\n"
"--\n"
"\n"
"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
"\n"
"This readily allows the use of a \'default\' document type controlled by the\n"
"application, while still getting the advantage of providing document type\n"
"information to the parser. \'flag\' defaults to True if not provided.");
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
{"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__},
static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
static PyObject *
pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
int flag = 1;
if (!PyArg_ParseTuple(args,
"|p:UseForeignDTD",
&flag))
goto exit;
return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
exit:
return return_value;
}
#endif /* (XML_COMBINED_VERSION >= 19505) */
PyDoc_STRVAR(pyexpat_xmlparser___dir____doc__,
"__dir__($self, /)\n"
"--");
#define PYEXPAT_XMLPARSER___DIR___METHODDEF \
{"__dir__", (PyCFunction)pyexpat_xmlparser___dir__, METH_NOARGS, pyexpat_xmlparser___dir____doc__},
static PyObject *
pyexpat_xmlparser___dir___impl(xmlparseobject *self);
static PyObject *
pyexpat_xmlparser___dir__(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
{
return pyexpat_xmlparser___dir___impl(self);
}
PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
"ParserCreate($module, /, encoding=None, namespace_separator=None,\n"
" intern=None)\n"
"--\n"
"\n"
"Return a new XML parser object.");
#define PYEXPAT_PARSERCREATE_METHODDEF \
{"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_VARARGS|METH_KEYWORDS, pyexpat_ParserCreate__doc__},
static PyObject *
pyexpat_ParserCreate_impl(PyModuleDef *module, const char *encoding, const char *namespace_separator, PyObject *intern);
static PyObject *
pyexpat_ParserCreate(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"encoding", "namespace_separator", "intern", NULL};
const char *encoding = NULL;
const char *namespace_separator = NULL;
PyObject *intern = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|zzO:ParserCreate", _keywords,
&encoding, &namespace_separator, &intern))
goto exit;
return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
exit:
return return_value;
}
PyDoc_STRVAR(pyexpat_ErrorString__doc__,
"ErrorString($module, code, /)\n"
"--\n"
"\n"
"Returns string error for given number.");
#define PYEXPAT_ERRORSTRING_METHODDEF \
{"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_VARARGS, pyexpat_ErrorString__doc__},
static PyObject *
pyexpat_ErrorString_impl(PyModuleDef *module, long code);
static PyObject *
pyexpat_ErrorString(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
long code;
if (!PyArg_ParseTuple(args,
"l:ErrorString",
&code))
goto exit;
return_value = pyexpat_ErrorString_impl(module, code);
exit:
return return_value;
}
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
/*[clinic end generated code: output=0198390005e40e1c input=a9049054013a1b77]*/

View File

@ -0,0 +1,96 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(SHA1Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA1TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA1Type_copy, METH_NOARGS, SHA1Type_copy__doc__},
static PyObject *
SHA1Type_copy_impl(SHA1object *self);
static PyObject *
SHA1Type_copy(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_copy_impl(self);
}
PyDoc_STRVAR(SHA1Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define SHA1TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA1Type_digest, METH_NOARGS, SHA1Type_digest__doc__},
static PyObject *
SHA1Type_digest_impl(SHA1object *self);
static PyObject *
SHA1Type_digest(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_digest_impl(self);
}
PyDoc_STRVAR(SHA1Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA1TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA1Type_hexdigest, METH_NOARGS, SHA1Type_hexdigest__doc__},
static PyObject *
SHA1Type_hexdigest_impl(SHA1object *self);
static PyObject *
SHA1Type_hexdigest(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_hexdigest_impl(self);
}
PyDoc_STRVAR(SHA1Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA1TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA1Type_update, METH_O, SHA1Type_update__doc__},
PyDoc_STRVAR(_sha1_sha1__doc__,
"sha1($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA1 hash object; optionally initialized with a string.");
#define _SHA1_SHA1_METHODDEF \
{"sha1", (PyCFunction)_sha1_sha1, METH_VARARGS|METH_KEYWORDS, _sha1_sha1__doc__},
static PyObject *
_sha1_sha1_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha1_sha1(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha1", _keywords,
&string))
goto exit;
return_value = _sha1_sha1_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=b2890b9ca964b217 input=a9049054013a1b77]*/

View File

@ -0,0 +1,125 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(SHA256Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA256TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA256Type_copy, METH_NOARGS, SHA256Type_copy__doc__},
static PyObject *
SHA256Type_copy_impl(SHAobject *self);
static PyObject *
SHA256Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_copy_impl(self);
}
PyDoc_STRVAR(SHA256Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define SHA256TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA256Type_digest, METH_NOARGS, SHA256Type_digest__doc__},
static PyObject *
SHA256Type_digest_impl(SHAobject *self);
static PyObject *
SHA256Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_digest_impl(self);
}
PyDoc_STRVAR(SHA256Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA256TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA256Type_hexdigest, METH_NOARGS, SHA256Type_hexdigest__doc__},
static PyObject *
SHA256Type_hexdigest_impl(SHAobject *self);
static PyObject *
SHA256Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_hexdigest_impl(self);
}
PyDoc_STRVAR(SHA256Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA256TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA256Type_update, METH_O, SHA256Type_update__doc__},
PyDoc_STRVAR(_sha256_sha256__doc__,
"sha256($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-256 hash object; optionally initialized with a string.");
#define _SHA256_SHA256_METHODDEF \
{"sha256", (PyCFunction)_sha256_sha256, METH_VARARGS|METH_KEYWORDS, _sha256_sha256__doc__},
static PyObject *
_sha256_sha256_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha256_sha256(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha256", _keywords,
&string))
goto exit;
return_value = _sha256_sha256_impl(module, string);
exit:
return return_value;
}
PyDoc_STRVAR(_sha256_sha224__doc__,
"sha224($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-224 hash object; optionally initialized with a string.");
#define _SHA256_SHA224_METHODDEF \
{"sha224", (PyCFunction)_sha256_sha224, METH_VARARGS|METH_KEYWORDS, _sha256_sha224__doc__},
static PyObject *
_sha256_sha224_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha256_sha224(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha224", _keywords,
&string))
goto exit;
return_value = _sha256_sha224_impl(module, string);
exit:
return return_value;
}
/*[clinic end generated code: output=8a0520371b097358 input=a9049054013a1b77]*/

View File

@ -0,0 +1,173 @@
/*[clinic input]
preserve
[clinic start generated code]*/
#if defined(PY_LONG_LONG)
PyDoc_STRVAR(SHA512Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA512TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA512Type_copy, METH_NOARGS, SHA512Type_copy__doc__},
static PyObject *
SHA512Type_copy_impl(SHAobject *self);
static PyObject *
SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_copy_impl(self);
}
#endif /* defined(PY_LONG_LONG) */
#if defined(PY_LONG_LONG)
PyDoc_STRVAR(SHA512Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define SHA512TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA512Type_digest, METH_NOARGS, SHA512Type_digest__doc__},
static PyObject *
SHA512Type_digest_impl(SHAobject *self);
static PyObject *
SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_digest_impl(self);
}
#endif /* defined(PY_LONG_LONG) */
#if defined(PY_LONG_LONG)
PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA512TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA512Type_hexdigest, METH_NOARGS, SHA512Type_hexdigest__doc__},
static PyObject *
SHA512Type_hexdigest_impl(SHAobject *self);
static PyObject *
SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_hexdigest_impl(self);
}
#endif /* defined(PY_LONG_LONG) */
#if defined(PY_LONG_LONG)
PyDoc_STRVAR(SHA512Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA512TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
#endif /* defined(PY_LONG_LONG) */
#if defined(PY_LONG_LONG)
PyDoc_STRVAR(_sha512_sha512__doc__,
"sha512($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-512 hash object; optionally initialized with a string.");
#define _SHA512_SHA512_METHODDEF \
{"sha512", (PyCFunction)_sha512_sha512, METH_VARARGS|METH_KEYWORDS, _sha512_sha512__doc__},
static PyObject *
_sha512_sha512_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha512_sha512(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha512", _keywords,
&string))
goto exit;
return_value = _sha512_sha512_impl(module, string);
exit:
return return_value;
}
#endif /* defined(PY_LONG_LONG) */
#if defined(PY_LONG_LONG)
PyDoc_STRVAR(_sha512_sha384__doc__,
"sha384($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-384 hash object; optionally initialized with a string.");
#define _SHA512_SHA384_METHODDEF \
{"sha384", (PyCFunction)_sha512_sha384, METH_VARARGS|METH_KEYWORDS, _sha512_sha384__doc__},
static PyObject *
_sha512_sha384_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha512_sha384(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha384", _keywords,
&string))
goto exit;
return_value = _sha512_sha384_impl(module, string);
exit:
return return_value;
}
#endif /* defined(PY_LONG_LONG) */
#ifndef SHA512TYPE_COPY_METHODDEF
#define SHA512TYPE_COPY_METHODDEF
#endif /* !defined(SHA512TYPE_COPY_METHODDEF) */
#ifndef SHA512TYPE_DIGEST_METHODDEF
#define SHA512TYPE_DIGEST_METHODDEF
#endif /* !defined(SHA512TYPE_DIGEST_METHODDEF) */
#ifndef SHA512TYPE_HEXDIGEST_METHODDEF
#define SHA512TYPE_HEXDIGEST_METHODDEF
#endif /* !defined(SHA512TYPE_HEXDIGEST_METHODDEF) */
#ifndef SHA512TYPE_UPDATE_METHODDEF
#define SHA512TYPE_UPDATE_METHODDEF
#endif /* !defined(SHA512TYPE_UPDATE_METHODDEF) */
#ifndef _SHA512_SHA512_METHODDEF
#define _SHA512_SHA512_METHODDEF
#endif /* !defined(_SHA512_SHA512_METHODDEF) */
#ifndef _SHA512_SHA384_METHODDEF
#define _SHA512_SHA384_METHODDEF
#endif /* !defined(_SHA512_SHA384_METHODDEF) */
/*[clinic end generated code: output=de7bda19fde49310 input=a9049054013a1b77]*/

View File

@ -0,0 +1,37 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
"decimal($self, unichr, default=None, /)\n"
"--\n"
"\n"
"Converts a Unicode character into its equivalent decimal value.\n"
"\n"
"Returns the decimal value assigned to the Unicode character unichr\n"
"as integer. If no such value is defined, default is returned, or, if\n"
"not given, ValueError is raised.");
#define UNICODEDATA_UCD_DECIMAL_METHODDEF \
{"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__},
static PyObject *
unicodedata_UCD_decimal_impl(PreviousDBVersion *self, PyUnicodeObject *unichr, PyObject *default_value);
static PyObject *
unicodedata_UCD_decimal(PreviousDBVersion *self, PyObject *args)
{
PyObject *return_value = NULL;
PyUnicodeObject *unichr;
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args,
"O!|O:decimal",
&PyUnicode_Type, &unichr, &default_value))
goto exit;
return_value = unicodedata_UCD_decimal_impl(self, unichr, default_value);
exit:
return return_value;
}
/*[clinic end generated code: output=15b82651419cc823 input=a9049054013a1b77]*/

View File

@ -10,10 +10,9 @@
#include "clinic/cmathmodule.c.h"
/*[clinic input]
output preset file
module cmath
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ef7e0fdd8a143c03]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=308d6839f4a46333]*/
/*[python input]
class Py_complex_protected_converter(Py_complex_converter):

View File

@ -16,10 +16,9 @@
#endif
/*[clinic input]
output preset file
module fcntl
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=c7356fdb126a904a]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=124b58387c158179]*/
static int
conv_descriptor(PyObject *object, int *target)

View File

@ -8,10 +8,9 @@
#include "clinic/grpmodule.c.h"
/*[clinic input]
output preset file
module grp
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=68180a9a9efb8506]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=cade63f2ed1bd9f8]*/
static PyStructSequence_Field struct_group_type_fields[] = {
{"gr_name", "group name"},

View File

@ -53,6 +53,7 @@ typedef struct {
struct md5_state hash_state;
} MD5object;
#include "clinic/md5module.c.h"
/* ------------------------------------------------------------------------
*
@ -343,27 +344,9 @@ MD5Type.copy
Return a copy of the hash object.
[clinic start generated code]*/
PyDoc_STRVAR(MD5Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define MD5TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)MD5Type_copy, METH_NOARGS, MD5Type_copy__doc__},
static PyObject *
MD5Type_copy_impl(MD5object *self);
static PyObject *
MD5Type_copy(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_copy_impl(self);
}
static PyObject *
MD5Type_copy_impl(MD5object *self)
/*[clinic end generated code: output=3b3a88920b3dc7f4 input=2c09e6d2493f3079]*/
/*[clinic end generated code: output=596eb36852f02071 input=2c09e6d2493f3079]*/
{
MD5object *newobj;
@ -385,27 +368,9 @@ MD5Type.digest
Return the digest value as a string of binary data.
[clinic start generated code]*/
PyDoc_STRVAR(MD5Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define MD5TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)MD5Type_digest, METH_NOARGS, MD5Type_digest__doc__},
static PyObject *
MD5Type_digest_impl(MD5object *self);
static PyObject *
MD5Type_digest(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_digest_impl(self);
}
static PyObject *
MD5Type_digest_impl(MD5object *self)
/*[clinic end generated code: output=7a796b28fa89485f input=7b96e65389412a34]*/
/*[clinic end generated code: output=eb691dc4190a07ec input=7b96e65389412a34]*/
{
unsigned char digest[MD5_DIGESTSIZE];
struct md5_state temp;
@ -421,27 +386,9 @@ MD5Type.hexdigest
Return the digest value as a string of hexadecimal digits.
[clinic start generated code]*/
PyDoc_STRVAR(MD5Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define MD5TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)MD5Type_hexdigest, METH_NOARGS, MD5Type_hexdigest__doc__},
static PyObject *
MD5Type_hexdigest_impl(MD5object *self);
static PyObject *
MD5Type_hexdigest(MD5object *self, PyObject *Py_UNUSED(ignored))
{
return MD5Type_hexdigest_impl(self);
}
static PyObject *
MD5Type_hexdigest_impl(MD5object *self)
/*[clinic end generated code: output=daa73609f94f92e1 input=b60b19de644798dd]*/
/*[clinic end generated code: output=17badced1f3ac932 input=b60b19de644798dd]*/
{
unsigned char digest[MD5_DIGESTSIZE];
struct md5_state temp;
@ -482,18 +429,9 @@ MD5Type.update
Update this hash object's state with the provided string.
[clinic start generated code]*/
PyDoc_STRVAR(MD5Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define MD5TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)MD5Type_update, METH_O, MD5Type_update__doc__},
static PyObject *
MD5Type_update(MD5object *self, PyObject *obj)
/*[clinic end generated code: output=9d09b6c6cdc6cac3 input=6e1efcd9ecf17032]*/
/*[clinic end generated code: output=f6ad168416338423 input=6e1efcd9ecf17032]*/
{
Py_buffer buf;
@ -594,38 +532,9 @@ _md5.md5
Return a new MD5 hash object; optionally initialized with a string.
[clinic start generated code]*/
PyDoc_STRVAR(_md5_md5__doc__,
"md5($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new MD5 hash object; optionally initialized with a string.");
#define _MD5_MD5_METHODDEF \
{"md5", (PyCFunction)_md5_md5, METH_VARARGS|METH_KEYWORDS, _md5_md5__doc__},
static PyObject *
_md5_md5_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_md5_md5(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:md5", _keywords,
&string))
goto exit;
return_value = _md5_md5_impl(module, string);
exit:
return return_value;
}
static PyObject *
_md5_md5_impl(PyModuleDef *module, PyObject *string)
/*[clinic end generated code: output=1039e912d919880e input=d12ef8f72d684f7b]*/
/*[clinic end generated code: output=3527436a2090b956 input=d12ef8f72d684f7b]*/
{
MD5object *new;
Py_buffer buf;

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,9 @@
#include "clinic/pwdmodule.c.h"
/*[clinic input]
output preset file
module pwd
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=bbcf68b1f549f917]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=60f628ef356b97b6]*/
static PyStructSequence_Field struct_pwd_type_fields[] = {
{"pw_name", "user name"},

View File

@ -68,6 +68,8 @@ typedef struct {
PyObject **handlers;
} xmlparseobject;
#include "clinic/pyexpat.c.h"
#define CHARACTER_DATA_BUFFER_SIZE 8192
static PyTypeObject Xmlparsetype;
@ -713,40 +715,9 @@ Parse XML data.
`isfinal' should be true at end of input.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_Parse__doc__,
"Parse($self, data, isFinal=0, /)\n"
"--\n"
"\n"
"Parse XML data.\n"
"\n"
"`isfinal\' should be true at end of input.");
#define PYEXPAT_XMLPARSER_PARSE_METHODDEF \
{"Parse", (PyCFunction)pyexpat_xmlparser_Parse, METH_VARARGS, pyexpat_xmlparser_Parse__doc__},
static PyObject *
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, int isFinal);
static PyObject *
pyexpat_xmlparser_Parse(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *data;
int isFinal = 0;
if (!PyArg_ParseTuple(args,
"O|i:Parse",
&data, &isFinal))
goto exit;
return_value = pyexpat_xmlparser_Parse_impl(self, data, isFinal);
exit:
return return_value;
}
static PyObject *
pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyObject *data, int isFinal)
/*[clinic end generated code: output=65b1652b01f20856 input=e37b81b8948ca7e0]*/
/*[clinic end generated code: output=2d4dc77f4d434854 input=e37b81b8948ca7e0]*/
{
const char *s;
Py_ssize_t slen;
@ -836,18 +807,9 @@ pyexpat.xmlparser.ParseFile
Parse XML data from file-like object.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_ParseFile__doc__,
"ParseFile($self, file, /)\n"
"--\n"
"\n"
"Parse XML data from file-like object.");
#define PYEXPAT_XMLPARSER_PARSEFILE_METHODDEF \
{"ParseFile", (PyCFunction)pyexpat_xmlparser_ParseFile, METH_O, pyexpat_xmlparser_ParseFile__doc__},
static PyObject *
pyexpat_xmlparser_ParseFile(xmlparseobject *self, PyObject *file)
/*[clinic end generated code: output=2e13803c3d8c22b2 input=fbb5a12b6038d735]*/
/*[clinic end generated code: output=2adc6a13100cc42b input=fbb5a12b6038d735]*/
{
int rv = 1;
PyObject *readmethod = NULL;
@ -894,37 +856,9 @@ pyexpat.xmlparser.SetBase
Set the base URL for the parser.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_SetBase__doc__,
"SetBase($self, base, /)\n"
"--\n"
"\n"
"Set the base URL for the parser.");
#define PYEXPAT_XMLPARSER_SETBASE_METHODDEF \
{"SetBase", (PyCFunction)pyexpat_xmlparser_SetBase, METH_VARARGS, pyexpat_xmlparser_SetBase__doc__},
static PyObject *
pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base);
static PyObject *
pyexpat_xmlparser_SetBase(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
const char *base;
if (!PyArg_ParseTuple(args,
"s:SetBase",
&base))
goto exit;
return_value = pyexpat_xmlparser_SetBase_impl(self, base);
exit:
return return_value;
}
static PyObject *
pyexpat_xmlparser_SetBase_impl(xmlparseobject *self, const char *base)
/*[clinic end generated code: output=5bdb49f6689a5f93 input=c684e5de895ee1a8]*/
/*[clinic end generated code: output=c212ddceb607b539 input=c684e5de895ee1a8]*/
{
if (!XML_SetBase(self->itself, base)) {
return PyErr_NoMemory();
@ -938,27 +872,9 @@ pyexpat.xmlparser.GetBase
Return base URL string for the parser.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_GetBase__doc__,
"GetBase($self, /)\n"
"--\n"
"\n"
"Return base URL string for the parser.");
#define PYEXPAT_XMLPARSER_GETBASE_METHODDEF \
{"GetBase", (PyCFunction)pyexpat_xmlparser_GetBase, METH_NOARGS, pyexpat_xmlparser_GetBase__doc__},
static PyObject *
pyexpat_xmlparser_GetBase_impl(xmlparseobject *self);
static PyObject *
pyexpat_xmlparser_GetBase(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
{
return pyexpat_xmlparser_GetBase_impl(self);
}
static PyObject *
pyexpat_xmlparser_GetBase_impl(xmlparseobject *self)
/*[clinic end generated code: output=ef6046ee28f2b8ee input=918d71c38009620e]*/
/*[clinic end generated code: output=2886cb21f9a8739a input=918d71c38009620e]*/
{
return Py_BuildValue("z", XML_GetBase(self->itself));
}
@ -972,30 +888,9 @@ If the event was generated by a large amount of text (such as a start tag
for an element with many attributes), not all of the text may be available.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
"GetInputContext($self, /)\n"
"--\n"
"\n"
"Return the untranslated text of the input that caused the current event.\n"
"\n"
"If the event was generated by a large amount of text (such as a start tag\n"
"for an element with many attributes), not all of the text may be available.");
#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
{"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
static PyObject *
pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self);
static PyObject *
pyexpat_xmlparser_GetInputContext(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
{
return pyexpat_xmlparser_GetInputContext_impl(self);
}
static PyObject *
pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self)
/*[clinic end generated code: output=62ff03390f074cd2 input=034df8712db68379]*/
/*[clinic end generated code: output=a88026d683fc22cc input=034df8712db68379]*/
{
if (self->in_callback) {
int offset, size;
@ -1022,38 +917,9 @@ pyexpat.xmlparser.ExternalEntityParserCreate
Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_ExternalEntityParserCreate__doc__,
"ExternalEntityParserCreate($self, context, encoding=None, /)\n"
"--\n"
"\n"
"Create a parser for parsing an external entity based on the information passed to the ExternalEntityRefHandler.");
#define PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF \
{"ExternalEntityParserCreate", (PyCFunction)pyexpat_xmlparser_ExternalEntityParserCreate, METH_VARARGS, pyexpat_xmlparser_ExternalEntityParserCreate__doc__},
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, const char *context, const char *encoding);
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
const char *context;
const char *encoding = NULL;
if (!PyArg_ParseTuple(args,
"z|s:ExternalEntityParserCreate",
&context, &encoding))
goto exit;
return_value = pyexpat_xmlparser_ExternalEntityParserCreate_impl(self, context, encoding);
exit:
return return_value;
}
static PyObject *
pyexpat_xmlparser_ExternalEntityParserCreate_impl(xmlparseobject *self, const char *context, const char *encoding)
/*[clinic end generated code: output=4948c35f3dd01133 input=283206575d960272]*/
/*[clinic end generated code: output=942f300ed0e56054 input=283206575d960272]*/
{
xmlparseobject *new_parser;
int i;
@ -1127,42 +993,9 @@ XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag
was successful.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_SetParamEntityParsing__doc__,
"SetParamEntityParsing($self, flag, /)\n"
"--\n"
"\n"
"Controls parsing of parameter entities (including the external DTD subset).\n"
"\n"
"Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n"
"XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n"
"XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n"
"was successful.");
#define PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF \
{"SetParamEntityParsing", (PyCFunction)pyexpat_xmlparser_SetParamEntityParsing, METH_VARARGS, pyexpat_xmlparser_SetParamEntityParsing__doc__},
static PyObject *
pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag);
static PyObject *
pyexpat_xmlparser_SetParamEntityParsing(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
int flag;
if (!PyArg_ParseTuple(args,
"i:SetParamEntityParsing",
&flag))
goto exit;
return_value = pyexpat_xmlparser_SetParamEntityParsing_impl(self, flag);
exit:
return return_value;
}
static PyObject *
pyexpat_xmlparser_SetParamEntityParsing_impl(xmlparseobject *self, int flag)
/*[clinic end generated code: output=0f820882bc7768cc input=8aea19b4b15e9af1]*/
/*[clinic end generated code: output=18668ee8e760d64c input=8aea19b4b15e9af1]*/
{
flag = XML_SetParamEntityParsing(self->itself, flag);
return PyLong_FromLong(flag);
@ -1183,41 +1016,9 @@ application, while still getting the advantage of providing document type
information to the parser. 'flag' defaults to True if not provided.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
"UseForeignDTD($self, flag=True, /)\n"
"--\n"
"\n"
"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
"\n"
"This readily allows the use of a \'default\' document type controlled by the\n"
"application, while still getting the advantage of providing document type\n"
"information to the parser. \'flag\' defaults to True if not provided.");
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
{"UseForeignDTD", (PyCFunction)pyexpat_xmlparser_UseForeignDTD, METH_VARARGS, pyexpat_xmlparser_UseForeignDTD__doc__},
static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag);
static PyObject *
pyexpat_xmlparser_UseForeignDTD(xmlparseobject *self, PyObject *args)
{
PyObject *return_value = NULL;
int flag = 1;
if (!PyArg_ParseTuple(args,
"|p:UseForeignDTD",
&flag))
goto exit;
return_value = pyexpat_xmlparser_UseForeignDTD_impl(self, flag);
exit:
return return_value;
}
static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag)
/*[clinic end generated code: output=22e924ae6cad67d6 input=78144c519d116a6e]*/
/*[clinic end generated code: output=cfaa9aa50bb0f65c input=78144c519d116a6e]*/
{
enum XML_Error rc;
@ -1234,25 +1035,9 @@ pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, int flag)
pyexpat.xmlparser.__dir__
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_xmlparser___dir____doc__,
"__dir__($self, /)\n"
"--");
#define PYEXPAT_XMLPARSER___DIR___METHODDEF \
{"__dir__", (PyCFunction)pyexpat_xmlparser___dir__, METH_NOARGS, pyexpat_xmlparser___dir____doc__},
static PyObject *
pyexpat_xmlparser___dir___impl(xmlparseobject *self);
static PyObject *
pyexpat_xmlparser___dir__(xmlparseobject *self, PyObject *Py_UNUSED(ignored))
{
return pyexpat_xmlparser___dir___impl(self);
}
static PyObject *
pyexpat_xmlparser___dir___impl(xmlparseobject *self)
/*[clinic end generated code: output=1ed6efe83bc304cc input=76aa455f2a661384]*/
/*[clinic end generated code: output=bc22451efb9e4d17 input=76aa455f2a661384]*/
{
#define APPEND(list, str) \
do { \
@ -1765,41 +1550,9 @@ pyexpat.ParserCreate
Return a new XML parser object.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_ParserCreate__doc__,
"ParserCreate($module, /, encoding=None, namespace_separator=None,\n"
" intern=None)\n"
"--\n"
"\n"
"Return a new XML parser object.");
#define PYEXPAT_PARSERCREATE_METHODDEF \
{"ParserCreate", (PyCFunction)pyexpat_ParserCreate, METH_VARARGS|METH_KEYWORDS, pyexpat_ParserCreate__doc__},
static PyObject *
pyexpat_ParserCreate_impl(PyModuleDef *module, const char *encoding, const char *namespace_separator, PyObject *intern);
static PyObject *
pyexpat_ParserCreate(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"encoding", "namespace_separator", "intern", NULL};
const char *encoding = NULL;
const char *namespace_separator = NULL;
PyObject *intern = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|zzO:ParserCreate", _keywords,
&encoding, &namespace_separator, &intern))
goto exit;
return_value = pyexpat_ParserCreate_impl(module, encoding, namespace_separator, intern);
exit:
return return_value;
}
static PyObject *
pyexpat_ParserCreate_impl(PyModuleDef *module, const char *encoding, const char *namespace_separator, PyObject *intern)
/*[clinic end generated code: output=4fc027dd33b7a2ac input=71b9f471aa6f8f86]*/
/*[clinic end generated code: output=b839b60992d8ce71 input=71b9f471aa6f8f86]*/
{
PyObject *result;
int intern_decref = 0;
@ -1842,37 +1595,9 @@ pyexpat.ErrorString
Returns string error for given number.
[clinic start generated code]*/
PyDoc_STRVAR(pyexpat_ErrorString__doc__,
"ErrorString($module, code, /)\n"
"--\n"
"\n"
"Returns string error for given number.");
#define PYEXPAT_ERRORSTRING_METHODDEF \
{"ErrorString", (PyCFunction)pyexpat_ErrorString, METH_VARARGS, pyexpat_ErrorString__doc__},
static PyObject *
pyexpat_ErrorString_impl(PyModuleDef *module, long code);
static PyObject *
pyexpat_ErrorString(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
long code;
if (!PyArg_ParseTuple(args,
"l:ErrorString",
&code))
goto exit;
return_value = pyexpat_ErrorString_impl(module, code);
exit:
return return_value;
}
static PyObject *
pyexpat_ErrorString_impl(PyModuleDef *module, long code)
/*[clinic end generated code: output=c70f3cd82bfaf067 input=cc67de010d9e62b3]*/
/*[clinic end generated code: output=d87668108b6868e5 input=cc67de010d9e62b3]*/
{
return Py_BuildValue("z", XML_ErrorString((int)code));
}
@ -2252,8 +1977,4 @@ static struct HandlerInfo handler_info[] = {
/*[clinic input]
dump buffer
[clinic start generated code]*/
#ifndef PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
/*[clinic end generated code: output=a7880cb78bbd58ce input=524ce2e021e4eba6]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/

View File

@ -53,6 +53,7 @@ typedef struct {
struct sha1_state hash_state;
} SHA1object;
#include "clinic/sha1module.c.h"
/* ------------------------------------------------------------------------
*
@ -320,27 +321,9 @@ SHA1Type.copy
Return a copy of the hash object.
[clinic start generated code]*/
PyDoc_STRVAR(SHA1Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA1TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA1Type_copy, METH_NOARGS, SHA1Type_copy__doc__},
static PyObject *
SHA1Type_copy_impl(SHA1object *self);
static PyObject *
SHA1Type_copy(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_copy_impl(self);
}
static PyObject *
SHA1Type_copy_impl(SHA1object *self)
/*[clinic end generated code: output=1a320e75a7444098 input=b7eae10df6f89b36]*/
/*[clinic end generated code: output=b4e001264620f02a input=b7eae10df6f89b36]*/
{
SHA1object *newobj;
@ -357,27 +340,9 @@ SHA1Type.digest
Return the digest value as a string of binary data.
[clinic start generated code]*/
PyDoc_STRVAR(SHA1Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define SHA1TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA1Type_digest, METH_NOARGS, SHA1Type_digest__doc__},
static PyObject *
SHA1Type_digest_impl(SHA1object *self);
static PyObject *
SHA1Type_digest(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_digest_impl(self);
}
static PyObject *
SHA1Type_digest_impl(SHA1object *self)
/*[clinic end generated code: output=c4920f75228bfbfd input=205d47e1927fd009]*/
/*[clinic end generated code: output=2f05302a7aa2b5cb input=205d47e1927fd009]*/
{
unsigned char digest[SHA1_DIGESTSIZE];
struct sha1_state temp;
@ -393,27 +358,9 @@ SHA1Type.hexdigest
Return the digest value as a string of hexadecimal digits.
[clinic start generated code]*/
PyDoc_STRVAR(SHA1Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA1TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA1Type_hexdigest, METH_NOARGS, SHA1Type_hexdigest__doc__},
static PyObject *
SHA1Type_hexdigest_impl(SHA1object *self);
static PyObject *
SHA1Type_hexdigest(SHA1object *self, PyObject *Py_UNUSED(ignored))
{
return SHA1Type_hexdigest_impl(self);
}
static PyObject *
SHA1Type_hexdigest_impl(SHA1object *self)
/*[clinic end generated code: output=6e345aac201887b2 input=97691055c0c74ab0]*/
/*[clinic end generated code: output=4161fd71e68c6659 input=97691055c0c74ab0]*/
{
unsigned char digest[SHA1_DIGESTSIZE];
struct sha1_state temp;
@ -454,18 +401,9 @@ SHA1Type.update
Update this hash object's state with the provided string.
[clinic start generated code]*/
PyDoc_STRVAR(SHA1Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA1TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA1Type_update, METH_O, SHA1Type_update__doc__},
static PyObject *
SHA1Type_update(SHA1object *self, PyObject *obj)
/*[clinic end generated code: output=ab20a86a25e7d255 input=aad8e07812edbba3]*/
/*[clinic end generated code: output=d9902f0e5015e9ae input=aad8e07812edbba3]*/
{
Py_buffer buf;
@ -566,38 +504,9 @@ _sha1.sha1
Return a new SHA1 hash object; optionally initialized with a string.
[clinic start generated code]*/
PyDoc_STRVAR(_sha1_sha1__doc__,
"sha1($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA1 hash object; optionally initialized with a string.");
#define _SHA1_SHA1_METHODDEF \
{"sha1", (PyCFunction)_sha1_sha1, METH_VARARGS|METH_KEYWORDS, _sha1_sha1__doc__},
static PyObject *
_sha1_sha1_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha1_sha1(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha1", _keywords,
&string))
goto exit;
return_value = _sha1_sha1_impl(module, string);
exit:
return return_value;
}
static PyObject *
_sha1_sha1_impl(PyModuleDef *module, PyObject *string)
/*[clinic end generated code: output=c9068552f07b8954 input=27ea54281d995ec2]*/
/*[clinic end generated code: output=3e4e841386b9e8db input=27ea54281d995ec2]*/
{
SHA1object *new;
Py_buffer buf;

View File

@ -52,6 +52,8 @@ typedef struct {
int digestsize;
} SHAobject;
#include "clinic/sha256module.c.h"
/* When run on a little-endian CPU we need to perform byte reversal on an
array of longwords. */
@ -404,27 +406,9 @@ SHA256Type.copy
Return a copy of the hash object.
[clinic start generated code]*/
PyDoc_STRVAR(SHA256Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA256TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA256Type_copy, METH_NOARGS, SHA256Type_copy__doc__},
static PyObject *
SHA256Type_copy_impl(SHAobject *self);
static PyObject *
SHA256Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_copy_impl(self);
}
static PyObject *
SHA256Type_copy_impl(SHAobject *self)
/*[clinic end generated code: output=f716c39d3f81c27c input=f58840a618d4f2a7]*/
/*[clinic end generated code: output=1a8bbd66a0c9c168 input=f58840a618d4f2a7]*/
{
SHAobject *newobj;
@ -446,27 +430,9 @@ SHA256Type.digest
Return the digest value as a string of binary data.
[clinic start generated code]*/
PyDoc_STRVAR(SHA256Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define SHA256TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA256Type_digest, METH_NOARGS, SHA256Type_digest__doc__},
static PyObject *
SHA256Type_digest_impl(SHAobject *self);
static PyObject *
SHA256Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_digest_impl(self);
}
static PyObject *
SHA256Type_digest_impl(SHAobject *self)
/*[clinic end generated code: output=72d34723d7bb694c input=1fb752e58954157d]*/
/*[clinic end generated code: output=46616a5e909fbc3d input=1fb752e58954157d]*/
{
unsigned char digest[SHA_DIGESTSIZE];
SHAobject temp;
@ -482,27 +448,9 @@ SHA256Type.hexdigest
Return the digest value as a string of hexadecimal digits.
[clinic start generated code]*/
PyDoc_STRVAR(SHA256Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA256TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA256Type_hexdigest, METH_NOARGS, SHA256Type_hexdigest__doc__},
static PyObject *
SHA256Type_hexdigest_impl(SHAobject *self);
static PyObject *
SHA256Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA256Type_hexdigest_impl(self);
}
static PyObject *
SHA256Type_hexdigest_impl(SHAobject *self)
/*[clinic end generated code: output=3687aa6183c7d27f input=0cc4c714693010d1]*/
/*[clinic end generated code: output=725f8a7041ae97f3 input=0cc4c714693010d1]*/
{
unsigned char digest[SHA_DIGESTSIZE];
SHAobject temp;
@ -543,18 +491,9 @@ SHA256Type.update
Update this hash object's state with the provided string.
[clinic start generated code]*/
PyDoc_STRVAR(SHA256Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA256TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA256Type_update, METH_O, SHA256Type_update__doc__},
static PyObject *
SHA256Type_update(SHAobject *self, PyObject *obj)
/*[clinic end generated code: output=b47f53d7cbeabee4 input=b2d449d5b30f0f5a]*/
/*[clinic end generated code: output=0967fb2860c66af7 input=b2d449d5b30f0f5a]*/
{
Py_buffer buf;
@ -686,38 +625,9 @@ _sha256.sha256
Return a new SHA-256 hash object; optionally initialized with a string.
[clinic start generated code]*/
PyDoc_STRVAR(_sha256_sha256__doc__,
"sha256($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-256 hash object; optionally initialized with a string.");
#define _SHA256_SHA256_METHODDEF \
{"sha256", (PyCFunction)_sha256_sha256, METH_VARARGS|METH_KEYWORDS, _sha256_sha256__doc__},
static PyObject *
_sha256_sha256_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha256_sha256(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha256", _keywords,
&string))
goto exit;
return_value = _sha256_sha256_impl(module, string);
exit:
return return_value;
}
static PyObject *
_sha256_sha256_impl(PyModuleDef *module, PyObject *string)
/*[clinic end generated code: output=4b1263d1e2fcdb98 input=09cce3fb855056b2]*/
/*[clinic end generated code: output=d70e6e2d97112844 input=09cce3fb855056b2]*/
{
SHAobject *new;
Py_buffer buf;
@ -755,38 +665,9 @@ _sha256.sha224
Return a new SHA-224 hash object; optionally initialized with a string.
[clinic start generated code]*/
PyDoc_STRVAR(_sha256_sha224__doc__,
"sha224($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-224 hash object; optionally initialized with a string.");
#define _SHA256_SHA224_METHODDEF \
{"sha224", (PyCFunction)_sha256_sha224, METH_VARARGS|METH_KEYWORDS, _sha256_sha224__doc__},
static PyObject *
_sha256_sha224_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha256_sha224(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha224", _keywords,
&string))
goto exit;
return_value = _sha256_sha224_impl(module, string);
exit:
return return_value;
}
static PyObject *
_sha256_sha224_impl(PyModuleDef *module, PyObject *string)
/*[clinic end generated code: output=4dde0eb1cdaebc06 input=27a04ba24c353a73]*/
/*[clinic end generated code: output=f2822bf28416b42a input=27a04ba24c353a73]*/
{
SHAobject *new;
Py_buffer buf;

View File

@ -55,6 +55,8 @@ typedef struct {
int digestsize;
} SHAobject;
#include "clinic/sha512module.c.h"
/* When run on a little-endian CPU we need to perform byte reversal on an
array of longwords. */
@ -471,27 +473,9 @@ SHA512Type.copy
Return a copy of the hash object.
[clinic start generated code]*/
PyDoc_STRVAR(SHA512Type_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of the hash object.");
#define SHA512TYPE_COPY_METHODDEF \
{"copy", (PyCFunction)SHA512Type_copy, METH_NOARGS, SHA512Type_copy__doc__},
static PyObject *
SHA512Type_copy_impl(SHAobject *self);
static PyObject *
SHA512Type_copy(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_copy_impl(self);
}
static PyObject *
SHA512Type_copy_impl(SHAobject *self)
/*[clinic end generated code: output=14f8e6ce9c61ece0 input=9f5f31e6c457776a]*/
/*[clinic end generated code: output=adea896ed3164821 input=9f5f31e6c457776a]*/
{
SHAobject *newobj;
@ -513,27 +497,9 @@ SHA512Type.digest
Return the digest value as a string of binary data.
[clinic start generated code]*/
PyDoc_STRVAR(SHA512Type_digest__doc__,
"digest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of binary data.");
#define SHA512TYPE_DIGEST_METHODDEF \
{"digest", (PyCFunction)SHA512Type_digest, METH_NOARGS, SHA512Type_digest__doc__},
static PyObject *
SHA512Type_digest_impl(SHAobject *self);
static PyObject *
SHA512Type_digest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_digest_impl(self);
}
static PyObject *
SHA512Type_digest_impl(SHAobject *self)
/*[clinic end generated code: output=be8de024b232977e input=60c2cede9e023018]*/
/*[clinic end generated code: output=1080bbeeef7dde1b input=60c2cede9e023018]*/
{
unsigned char digest[SHA_DIGESTSIZE];
SHAobject temp;
@ -549,27 +515,9 @@ SHA512Type.hexdigest
Return the digest value as a string of hexadecimal digits.
[clinic start generated code]*/
PyDoc_STRVAR(SHA512Type_hexdigest__doc__,
"hexdigest($self, /)\n"
"--\n"
"\n"
"Return the digest value as a string of hexadecimal digits.");
#define SHA512TYPE_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)SHA512Type_hexdigest, METH_NOARGS, SHA512Type_hexdigest__doc__},
static PyObject *
SHA512Type_hexdigest_impl(SHAobject *self);
static PyObject *
SHA512Type_hexdigest(SHAobject *self, PyObject *Py_UNUSED(ignored))
{
return SHA512Type_hexdigest_impl(self);
}
static PyObject *
SHA512Type_hexdigest_impl(SHAobject *self)
/*[clinic end generated code: output=28a4ab2f9a1781b8 input=498b877b25cbe0a2]*/
/*[clinic end generated code: output=7373305b8601e18b input=498b877b25cbe0a2]*/
{
unsigned char digest[SHA_DIGESTSIZE];
SHAobject temp;
@ -610,18 +558,9 @@ SHA512Type.update
Update this hash object's state with the provided string.
[clinic start generated code]*/
PyDoc_STRVAR(SHA512Type_update__doc__,
"update($self, obj, /)\n"
"--\n"
"\n"
"Update this hash object\'s state with the provided string.");
#define SHA512TYPE_UPDATE_METHODDEF \
{"update", (PyCFunction)SHA512Type_update, METH_O, SHA512Type_update__doc__},
static PyObject *
SHA512Type_update(SHAobject *self, PyObject *obj)
/*[clinic end generated code: output=6be574cdc3a9c52d input=ded2b46656566283]*/
/*[clinic end generated code: output=1cf333e73995a79e input=ded2b46656566283]*/
{
Py_buffer buf;
@ -636,23 +575,7 @@ SHA512Type_update(SHAobject *self, PyObject *obj)
/*[clinic input]
dump buffer
[clinic start generated code]*/
#ifndef SHA512TYPE_COPY_METHODDEF
#define SHA512TYPE_COPY_METHODDEF
#endif /* !defined(SHA512TYPE_COPY_METHODDEF) */
#ifndef SHA512TYPE_DIGEST_METHODDEF
#define SHA512TYPE_DIGEST_METHODDEF
#endif /* !defined(SHA512TYPE_DIGEST_METHODDEF) */
#ifndef SHA512TYPE_HEXDIGEST_METHODDEF
#define SHA512TYPE_HEXDIGEST_METHODDEF
#endif /* !defined(SHA512TYPE_HEXDIGEST_METHODDEF) */
#ifndef SHA512TYPE_UPDATE_METHODDEF
#define SHA512TYPE_UPDATE_METHODDEF
#endif /* !defined(SHA512TYPE_UPDATE_METHODDEF) */
/*[clinic end generated code: output=de713947d31130e9 input=524ce2e021e4eba6]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/
static PyMethodDef SHA_methods[] = {
SHA512TYPE_COPY_METHODDEF
@ -773,38 +696,9 @@ _sha512.sha512
Return a new SHA-512 hash object; optionally initialized with a string.
[clinic start generated code]*/
PyDoc_STRVAR(_sha512_sha512__doc__,
"sha512($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-512 hash object; optionally initialized with a string.");
#define _SHA512_SHA512_METHODDEF \
{"sha512", (PyCFunction)_sha512_sha512, METH_VARARGS|METH_KEYWORDS, _sha512_sha512__doc__},
static PyObject *
_sha512_sha512_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha512_sha512(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha512", _keywords,
&string))
goto exit;
return_value = _sha512_sha512_impl(module, string);
exit:
return return_value;
}
static PyObject *
_sha512_sha512_impl(PyModuleDef *module, PyObject *string)
/*[clinic end generated code: output=9e39b11115f36878 input=e69bad9ae9b6a308]*/
/*[clinic end generated code: output=da13bc0a94da6de3 input=e69bad9ae9b6a308]*/
{
SHAobject *new;
Py_buffer buf;
@ -842,38 +736,9 @@ _sha512.sha384
Return a new SHA-384 hash object; optionally initialized with a string.
[clinic start generated code]*/
PyDoc_STRVAR(_sha512_sha384__doc__,
"sha384($module, /, string=b\'\')\n"
"--\n"
"\n"
"Return a new SHA-384 hash object; optionally initialized with a string.");
#define _SHA512_SHA384_METHODDEF \
{"sha384", (PyCFunction)_sha512_sha384, METH_VARARGS|METH_KEYWORDS, _sha512_sha384__doc__},
static PyObject *
_sha512_sha384_impl(PyModuleDef *module, PyObject *string);
static PyObject *
_sha512_sha384(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"string", NULL};
PyObject *string = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|O:sha384", _keywords,
&string))
goto exit;
return_value = _sha512_sha384_impl(module, string);
exit:
return return_value;
}
static PyObject *
_sha512_sha384_impl(PyModuleDef *module, PyObject *string)
/*[clinic end generated code: output=397c6fba3525b93a input=c9327788d4ea4545]*/
/*[clinic end generated code: output=ac731aea5509174d input=c9327788d4ea4545]*/
{
SHAobject *new;
Py_buffer buf;
@ -907,15 +772,7 @@ _sha512_sha384_impl(PyModuleDef *module, PyObject *string)
/*[clinic input]
dump buffer
[clinic start generated code]*/
#ifndef _SHA512_SHA512_METHODDEF
#define _SHA512_SHA512_METHODDEF
#endif /* !defined(_SHA512_SHA512_METHODDEF) */
#ifndef _SHA512_SHA384_METHODDEF
#define _SHA512_SHA384_METHODDEF
#endif /* !defined(_SHA512_SHA384_METHODDEF) */
/*[clinic end generated code: output=69d84aa9445b01d8 input=524ce2e021e4eba6]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=524ce2e021e4eba6]*/
/* List of functions exported by this module */

View File

@ -13,10 +13,9 @@
#include "clinic/spwdmodule.c.h"
/*[clinic input]
output preset file
module spwd
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b3464a3667278fae]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=c0b841b90a6a07ce]*/
PyDoc_STRVAR(spwd__doc__,
"This module provides access to the Unix shadow password database.\n\

View File

@ -73,6 +73,8 @@ typedef struct previous_version {
Py_UCS4 (*normalization)(Py_UCS4);
} PreviousDBVersion;
#include "clinic/unicodedata.c.h"
#define get_old_record(self, v) ((((PreviousDBVersion*)self)->getrecord)(v))
static PyMemberDef DB_members[] = {
@ -130,42 +132,9 @@ as integer. If no such value is defined, default is returned, or, if
not given, ValueError is raised.
[clinic start generated code]*/
PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
"decimal($self, unichr, default=None, /)\n"
"--\n"
"\n"
"Converts a Unicode character into its equivalent decimal value.\n"
"\n"
"Returns the decimal value assigned to the Unicode character unichr\n"
"as integer. If no such value is defined, default is returned, or, if\n"
"not given, ValueError is raised.");
#define UNICODEDATA_UCD_DECIMAL_METHODDEF \
{"decimal", (PyCFunction)unicodedata_UCD_decimal, METH_VARARGS, unicodedata_UCD_decimal__doc__},
static PyObject *
unicodedata_UCD_decimal_impl(PreviousDBVersion *self, PyUnicodeObject *unichr, PyObject *default_value);
static PyObject *
unicodedata_UCD_decimal(PreviousDBVersion *self, PyObject *args)
{
PyObject *return_value = NULL;
PyUnicodeObject *unichr;
PyObject *default_value = NULL;
if (!PyArg_ParseTuple(args,
"O!|O:decimal",
&PyUnicode_Type, &unichr, &default_value))
goto exit;
return_value = unicodedata_UCD_decimal_impl(self, unichr, default_value);
exit:
return return_value;
}
static PyObject *
unicodedata_UCD_decimal_impl(PreviousDBVersion *self, PyUnicodeObject *unichr, PyObject *default_value)
/*[clinic end generated code: output=8689669896d293df input=c25c9d2b4de076b1]*/
/*[clinic end generated code: output=d285215533b58b28 input=c25c9d2b4de076b1]*/
{
int have_old = 0;
long rc;

View File

@ -82,12 +82,11 @@ zlib_error(z_stream zst, int err, char *msg)
}
/*[clinic input]
output preset file
module zlib
class zlib.Compress "compobject *" "&Comptype"
class zlib.Decompress "compobject *" "&Decomptype"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=bfd4c340573ba91d]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=093935115c3e3158]*/
static compobject *
newcompobject(PyTypeObject *type)

View File

@ -90,6 +90,8 @@ _canresize(PyByteArrayObject *self)
return 1;
}
#include "clinic/bytearrayobject.c.h"
/* Direct API functions */
PyObject *
@ -1266,27 +1268,9 @@ bytearray.clear
Remove all items from the bytearray.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_clear__doc__,
"clear($self, /)\n"
"--\n"
"\n"
"Remove all items from the bytearray.");
#define BYTEARRAY_CLEAR_METHODDEF \
{"clear", (PyCFunction)bytearray_clear, METH_NOARGS, bytearray_clear__doc__},
static PyObject *
bytearray_clear_impl(PyByteArrayObject *self);
static PyObject *
bytearray_clear(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_clear_impl(self);
}
static PyObject *
bytearray_clear_impl(PyByteArrayObject *self)
/*[clinic end generated code: output=5344093031e2f36c input=e524fd330abcdc18]*/
/*[clinic end generated code: output=85c2fe6aede0956c input=e524fd330abcdc18]*/
{
if (PyByteArray_Resize((PyObject *)self, 0) < 0)
return NULL;
@ -1301,27 +1285,9 @@ bytearray.copy
Return a copy of B.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of B.");
#define BYTEARRAY_COPY_METHODDEF \
{"copy", (PyCFunction)bytearray_copy, METH_NOARGS, bytearray_copy__doc__},
static PyObject *
bytearray_copy_impl(PyByteArrayObject *self);
static PyObject *
bytearray_copy(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_copy_impl(self);
}
static PyObject *
bytearray_copy_impl(PyByteArrayObject *self)
/*[clinic end generated code: output=8788ed299f7f2214 input=6d5d2975aa0f33f3]*/
/*[clinic end generated code: output=68cfbcfed484c132 input=6d5d2975aa0f33f3]*/
{
return PyByteArray_FromStringAndSize(PyByteArray_AS_STRING((PyObject *)self),
PyByteArray_GET_SIZE(self));
@ -1557,53 +1523,9 @@ All characters occurring in the optional argument deletechars are removed.
The remaining characters are mapped through the given translation table.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_translate__doc__,
"translate(table, [deletechars])\n"
"Return a copy with each character mapped by the given translation table.\n"
"\n"
" table\n"
" Translation table, which must be a bytes object of length 256.\n"
"\n"
"All characters occurring in the optional argument deletechars are removed.\n"
"The remaining characters are mapped through the given translation table.");
#define BYTEARRAY_TRANSLATE_METHODDEF \
{"translate", (PyCFunction)bytearray_translate, METH_VARARGS, bytearray_translate__doc__},
static PyObject *
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table, int group_right_1, PyObject *deletechars);
static PyObject *
bytearray_translate(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *table;
int group_right_1 = 0;
PyObject *deletechars = NULL;
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "O:translate", &table))
goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars))
goto exit;
group_right_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "bytearray.translate requires 1 to 2 arguments");
goto exit;
}
return_value = bytearray_translate_impl(self, table, group_right_1, deletechars);
exit:
return return_value;
}
static PyObject *
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table, int group_right_1, PyObject *deletechars)
/*[clinic end generated code: output=a709df81d41db4b7 input=b749ad85f4860824]*/
/*[clinic end generated code: output=fa3ea4f9a8d58bc7 input=b749ad85f4860824]*/
{
char *input, *output;
const char *table_chars;
@ -1708,50 +1630,9 @@ the same position in to.
The bytes objects frm and to must be of the same length.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_maketrans__doc__,
"maketrans(frm, to, /)\n"
"--\n"
"\n"
"Return a translation table useable for the bytes or bytearray translate method.\n"
"\n"
"The returned table will be one where each byte in frm is mapped to the byte at\n"
"the same position in to.\n"
"\n"
"The bytes objects frm and to must be of the same length.");
#define BYTEARRAY_MAKETRANS_METHODDEF \
{"maketrans", (PyCFunction)bytearray_maketrans, METH_VARARGS|METH_STATIC, bytearray_maketrans__doc__},
static PyObject *
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
bytearray_maketrans(void *null, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
Py_buffer to = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*y*:maketrans",
&frm, &to))
goto exit;
return_value = bytearray_maketrans_impl(&frm, &to);
exit:
/* Cleanup for frm */
if (frm.obj)
PyBuffer_Release(&frm);
/* Cleanup for to */
if (to.obj)
PyBuffer_Release(&to);
return return_value;
}
static PyObject *
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to)
/*[clinic end generated code: output=d332622814c26f4b input=5925a81d2fbbf151]*/
/*[clinic end generated code: output=1df267d99f56b15e input=5925a81d2fbbf151]*/
{
return _Py_bytes_maketrans(frm, to);
}
@ -2260,53 +2141,9 @@ If the optional argument count is given, only the first count occurrences are
replaced.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_replace__doc__,
"replace($self, old, new, count=-1, /)\n"
"--\n"
"\n"
"Return a copy with all occurrences of substring old replaced by new.\n"
"\n"
" count\n"
" Maximum number of occurrences to replace.\n"
" -1 (the default value) means replace all occurrences.\n"
"\n"
"If the optional argument count is given, only the first count occurrences are\n"
"replaced.");
#define BYTEARRAY_REPLACE_METHODDEF \
{"replace", (PyCFunction)bytearray_replace, METH_VARARGS, bytearray_replace__doc__},
static PyObject *
bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old, Py_buffer *new, Py_ssize_t count);
static PyObject *
bytearray_replace(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
Py_buffer new = {NULL, NULL};
Py_ssize_t count = -1;
if (!PyArg_ParseTuple(args,
"y*y*|n:replace",
&old, &new, &count))
goto exit;
return_value = bytearray_replace_impl(self, &old, &new, count);
exit:
/* Cleanup for old */
if (old.obj)
PyBuffer_Release(&old);
/* Cleanup for new */
if (new.obj)
PyBuffer_Release(&new);
return return_value;
}
static PyObject *
bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old, Py_buffer *new, Py_ssize_t count)
/*[clinic end generated code: output=9997fbbd5bac4883 input=aa379d988637c7fb]*/
/*[clinic end generated code: output=3fc105c8232d7b3f input=aa379d988637c7fb]*/
{
return (PyObject *)replace((PyByteArrayObject *) self,
old->buf, old->len,
@ -2327,47 +2164,9 @@ bytearray.split
Return a list of the sections in the bytearray, using sep as the delimiter.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_split__doc__,
"split($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytearray, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytearray.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.");
#define BYTEARRAY_SPLIT_METHODDEF \
{"split", (PyCFunction)bytearray_split, METH_VARARGS|METH_KEYWORDS, bytearray_split__doc__},
static PyObject *
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytearray_split(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:split", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytearray_split_impl(self, sep, maxsplit);
exit:
return return_value;
}
static PyObject *
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic end generated code: output=062a3d87d6f918fa input=24f82669f41bf523]*/
/*[clinic end generated code: output=cdccf5a29dbf7eb5 input=24f82669f41bf523]*/
{
Py_ssize_t len = PyByteArray_GET_SIZE(self), n;
const char *s = PyByteArray_AS_STRING(self), *sub;
@ -2409,25 +2208,9 @@ If the separator is not found, returns a 3-tuple containing the original
bytearray object and two empty bytearray objects.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_partition__doc__,
"partition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytearray into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytearray. If the separator is\n"
"found, returns a 3-tuple containing the part before the separator, the\n"
"separator itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing the original\n"
"bytearray object and two empty bytearray objects.");
#define BYTEARRAY_PARTITION_METHODDEF \
{"partition", (PyCFunction)bytearray_partition, METH_O, bytearray_partition__doc__},
static PyObject *
bytearray_partition(PyByteArrayObject *self, PyObject *sep)
/*[clinic end generated code: output=2645138221fe6f4d input=7d7fe37b1696d506]*/
/*[clinic end generated code: output=45d2525ddd35f957 input=7d7fe37b1696d506]*/
{
PyObject *bytesep, *result;
@ -2463,25 +2246,9 @@ If the separator is not found, returns a 3-tuple containing two empty bytearray
objects and the original bytearray object.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_rpartition__doc__,
"rpartition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytes into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytearray, starting and the end.\n"
"If the separator is found, returns a 3-tuple containing the part before the\n"
"separator, the separator itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing two empty bytearray\n"
"objects and the original bytearray object.");
#define BYTEARRAY_RPARTITION_METHODDEF \
{"rpartition", (PyCFunction)bytearray_rpartition, METH_O, bytearray_rpartition__doc__},
static PyObject *
bytearray_rpartition(PyByteArrayObject *self, PyObject *sep)
/*[clinic end generated code: output=ed13e54605d007de input=9b8cd540c1b75853]*/
/*[clinic end generated code: output=440de3c9426115e8 input=9b8cd540c1b75853]*/
{
PyObject *bytesep, *result;
@ -2508,49 +2275,9 @@ Return a list of the sections in the bytearray, using sep as the delimiter.
Splitting is done starting at the end of the bytearray and working to the front.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_rsplit__doc__,
"rsplit($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytearray, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytearray.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.\n"
"\n"
"Splitting is done starting at the end of the bytearray and working to the front.");
#define BYTEARRAY_RSPLIT_METHODDEF \
{"rsplit", (PyCFunction)bytearray_rsplit, METH_VARARGS|METH_KEYWORDS, bytearray_rsplit__doc__},
static PyObject *
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytearray_rsplit(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:rsplit", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytearray_rsplit_impl(self, sep, maxsplit);
exit:
return return_value;
}
static PyObject *
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic end generated code: output=affaf9fc2aae8d41 input=a68286e4dd692ffe]*/
/*[clinic end generated code: output=4d648cf3ac65c9e9 input=a68286e4dd692ffe]*/
{
Py_ssize_t len = PyByteArray_GET_SIZE(self), n;
const char *s = PyByteArray_AS_STRING(self), *sub;
@ -2583,27 +2310,9 @@ bytearray.reverse
Reverse the order of the values in B in place.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_reverse__doc__,
"reverse($self, /)\n"
"--\n"
"\n"
"Reverse the order of the values in B in place.");
#define BYTEARRAY_REVERSE_METHODDEF \
{"reverse", (PyCFunction)bytearray_reverse, METH_NOARGS, bytearray_reverse__doc__},
static PyObject *
bytearray_reverse_impl(PyByteArrayObject *self);
static PyObject *
bytearray_reverse(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_reverse_impl(self);
}
static PyObject *
bytearray_reverse_impl(PyByteArrayObject *self)
/*[clinic end generated code: output=5d5e5f0bfc67f476 input=7933a499b8597bd1]*/
/*[clinic end generated code: output=9f7616f29ab309d3 input=7933a499b8597bd1]*/
{
char swap, *head, *tail;
Py_ssize_t i, j, n = Py_SIZE(self);
@ -2642,43 +2351,9 @@ bytearray.insert
Insert a single item into the bytearray before the given index.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_insert__doc__,
"insert($self, index, item, /)\n"
"--\n"
"\n"
"Insert a single item into the bytearray before the given index.\n"
"\n"
" index\n"
" The index where the value is to be inserted.\n"
" item\n"
" The item to be inserted.");
#define BYTEARRAY_INSERT_METHODDEF \
{"insert", (PyCFunction)bytearray_insert, METH_VARARGS, bytearray_insert__doc__},
static PyObject *
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item);
static PyObject *
bytearray_insert(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_ssize_t index;
int item;
if (!PyArg_ParseTuple(args,
"nO&:insert",
&index, _getbytevalue, &item))
goto exit;
return_value = bytearray_insert_impl(self, index, item);
exit:
return return_value;
}
static PyObject *
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item)
/*[clinic end generated code: output=5ec9340d4ad19080 input=833766836ba30e1e]*/
/*[clinic end generated code: output=76c775a70e7b07b7 input=833766836ba30e1e]*/
{
Py_ssize_t n = Py_SIZE(self);
char *buf;
@ -2716,40 +2391,9 @@ bytearray.append
Append a single item to the end of the bytearray.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_append__doc__,
"append($self, item, /)\n"
"--\n"
"\n"
"Append a single item to the end of the bytearray.\n"
"\n"
" item\n"
" The item to be appended.");
#define BYTEARRAY_APPEND_METHODDEF \
{"append", (PyCFunction)bytearray_append, METH_VARARGS, bytearray_append__doc__},
static PyObject *
bytearray_append_impl(PyByteArrayObject *self, int item);
static PyObject *
bytearray_append(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int item;
if (!PyArg_ParseTuple(args,
"O&:append",
_getbytevalue, &item))
goto exit;
return_value = bytearray_append_impl(self, item);
exit:
return return_value;
}
static PyObject *
bytearray_append_impl(PyByteArrayObject *self, int item)
/*[clinic end generated code: output=b5b3325bb3bbaf85 input=ae56ea87380407cc]*/
/*[clinic end generated code: output=a154e19ed1886cb6 input=ae56ea87380407cc]*/
{
Py_ssize_t n = Py_SIZE(self);
@ -2777,21 +2421,9 @@ bytearray.extend
Append all the items from the iterator or sequence to the end of the bytearray.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_extend__doc__,
"extend($self, iterable_of_ints, /)\n"
"--\n"
"\n"
"Append all the items from the iterator or sequence to the end of the bytearray.\n"
"\n"
" iterable_of_ints\n"
" The iterable of items to append.");
#define BYTEARRAY_EXTEND_METHODDEF \
{"extend", (PyCFunction)bytearray_extend, METH_O, bytearray_extend__doc__},
static PyObject *
bytearray_extend(PyByteArrayObject *self, PyObject *iterable_of_ints)
/*[clinic end generated code: output=13b0c13ad5110dfb input=ce83a5d75b70d850]*/
/*[clinic end generated code: output=98155dbe249170b1 input=ce83a5d75b70d850]*/
{
PyObject *it, *item, *bytearray_obj;
Py_ssize_t buf_size = 0, len = 0;
@ -2877,43 +2509,9 @@ Remove and return a single item from B.
If no index argument is given, will pop the last item.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_pop__doc__,
"pop($self, index=-1, /)\n"
"--\n"
"\n"
"Remove and return a single item from B.\n"
"\n"
" index\n"
" The index from where to remove the item.\n"
" -1 (the default value) means remove the last item.\n"
"\n"
"If no index argument is given, will pop the last item.");
#define BYTEARRAY_POP_METHODDEF \
{"pop", (PyCFunction)bytearray_pop, METH_VARARGS, bytearray_pop__doc__},
static PyObject *
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index);
static PyObject *
bytearray_pop(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_ssize_t index = -1;
if (!PyArg_ParseTuple(args,
"|n:pop",
&index))
goto exit;
return_value = bytearray_pop_impl(self, index);
exit:
return return_value;
}
static PyObject *
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index)
/*[clinic end generated code: output=3b763e548e79af96 input=0797e6c0ca9d5a85]*/
/*[clinic end generated code: output=e0ccd401f8021da8 input=0797e6c0ca9d5a85]*/
{
int value;
Py_ssize_t n = Py_SIZE(self);
@ -2953,40 +2551,9 @@ bytearray.remove
Remove the first occurrence of a value in the bytearray.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_remove__doc__,
"remove($self, value, /)\n"
"--\n"
"\n"
"Remove the first occurrence of a value in the bytearray.\n"
"\n"
" value\n"
" The value to remove.");
#define BYTEARRAY_REMOVE_METHODDEF \
{"remove", (PyCFunction)bytearray_remove, METH_VARARGS, bytearray_remove__doc__},
static PyObject *
bytearray_remove_impl(PyByteArrayObject *self, int value);
static PyObject *
bytearray_remove(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int value;
if (!PyArg_ParseTuple(args,
"O&:remove",
_getbytevalue, &value))
goto exit;
return_value = bytearray_remove_impl(self, value);
exit:
return return_value;
}
static PyObject *
bytearray_remove_impl(PyByteArrayObject *self, int value)
/*[clinic end generated code: output=c71c8bcf4703abfc input=47560b11fd856c24]*/
/*[clinic end generated code: output=d659e37866709c13 input=47560b11fd856c24]*/
{
Py_ssize_t where, n = Py_SIZE(self);
char *buf = PyByteArray_AS_STRING(self);
@ -3042,39 +2609,9 @@ Strip leading and trailing bytes contained in the argument.
If the argument is omitted or None, strip leading and trailing ASCII whitespace.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_strip__doc__,
"strip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading and trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
#define BYTEARRAY_STRIP_METHODDEF \
{"strip", (PyCFunction)bytearray_strip, METH_VARARGS, bytearray_strip__doc__},
static PyObject *
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_strip(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "strip",
0, 1,
&bytes))
goto exit;
return_value = bytearray_strip_impl(self, bytes);
exit:
return return_value;
}
static PyObject *
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes)
/*[clinic end generated code: output=2e3d3358acc4c235 input=ef7bb59b09c21d62]*/
/*[clinic end generated code: output=760412661a34ad5a input=ef7bb59b09c21d62]*/
{
Py_ssize_t left, right, mysize, byteslen;
char *myptr, *bytesptr;
@ -3113,39 +2650,9 @@ Strip leading bytes contained in the argument.
If the argument is omitted or None, strip leading ASCII whitespace.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_lstrip__doc__,
"lstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading ASCII whitespace.");
#define BYTEARRAY_LSTRIP_METHODDEF \
{"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, bytearray_lstrip__doc__},
static PyObject *
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_lstrip(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "lstrip",
0, 1,
&bytes))
goto exit;
return_value = bytearray_lstrip_impl(self, bytes);
exit:
return return_value;
}
static PyObject *
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes)
/*[clinic end generated code: output=2599309808a9ec02 input=80843f975dd7c480]*/
/*[clinic end generated code: output=d005c9d0ab909e66 input=80843f975dd7c480]*/
{
Py_ssize_t left, right, mysize, byteslen;
char *myptr, *bytesptr;
@ -3181,39 +2688,9 @@ Strip trailing bytes contained in the argument.
If the argument is omitted or None, strip trailing ASCII whitespace.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_rstrip__doc__,
"rstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip trailing ASCII whitespace.");
#define BYTEARRAY_RSTRIP_METHODDEF \
{"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, bytearray_rstrip__doc__},
static PyObject *
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_rstrip(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "rstrip",
0, 1,
&bytes))
goto exit;
return_value = bytearray_rstrip_impl(self, bytes);
exit:
return return_value;
}
static PyObject *
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes)
/*[clinic end generated code: output=b5ca6259f4f4f2a3 input=e728b994954cfd91]*/
/*[clinic end generated code: output=030e2fbd2f7276bd input=e728b994954cfd91]*/
{
Py_ssize_t right, mysize, byteslen;
char *myptr, *bytesptr;
@ -3252,48 +2729,9 @@ bytearray.decode
Decode the bytearray using the codec registered for encoding.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_decode__doc__,
"decode($self, /, encoding=\'utf-8\', errors=\'strict\')\n"
"--\n"
"\n"
"Decode the bytearray using the codec registered for encoding.\n"
"\n"
" encoding\n"
" The encoding with which to decode the bytearray.\n"
" errors\n"
" The error handling scheme to use for the handling of decoding errors.\n"
" The default is \'strict\' meaning that decoding errors raise a\n"
" UnicodeDecodeError. Other possible values are \'ignore\' and \'replace\'\n"
" as well as any other name registered with codecs.register_error that\n"
" can handle UnicodeDecodeErrors.");
#define BYTEARRAY_DECODE_METHODDEF \
{"decode", (PyCFunction)bytearray_decode, METH_VARARGS|METH_KEYWORDS, bytearray_decode__doc__},
static PyObject *
bytearray_decode_impl(PyByteArrayObject *self, const char *encoding, const char *errors);
static PyObject *
bytearray_decode(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"encoding", "errors", NULL};
const char *encoding = NULL;
const char *errors = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|ss:decode", _keywords,
&encoding, &errors))
goto exit;
return_value = bytearray_decode_impl(self, encoding, errors);
exit:
return return_value;
}
static PyObject *
bytearray_decode_impl(PyByteArrayObject *self, const char *encoding, const char *errors)
/*[clinic end generated code: output=38b83681f1e38a6c input=f28d8f903020257b]*/
/*[clinic end generated code: output=7e64e2cc91573b26 input=f28d8f903020257b]*/
{
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
@ -3324,22 +2762,9 @@ The bytearray whose method is called is inserted in between each pair.
The result is returned as a new bytearray object.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_join__doc__,
"join($self, iterable_of_bytes, /)\n"
"--\n"
"\n"
"Concatenate any number of bytes/bytearray objects.\n"
"\n"
"The bytearray whose method is called is inserted in between each pair.\n"
"\n"
"The result is returned as a new bytearray object.");
#define BYTEARRAY_JOIN_METHODDEF \
{"join", (PyCFunction)bytearray_join, METH_O, bytearray_join__doc__},
static PyObject *
bytearray_join(PyByteArrayObject *self, PyObject *iterable_of_bytes)
/*[clinic end generated code: output=544e7430032dfdf4 input=aba6b1f9b30fcb8e]*/
/*[clinic end generated code: output=a8516370bf68ae08 input=aba6b1f9b30fcb8e]*/
{
return stringlib_bytes_join((PyObject*)self, iterable_of_bytes);
}
@ -3355,41 +2780,9 @@ Line breaks are not included in the resulting list unless keepends is given and
true.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_splitlines__doc__,
"splitlines($self, /, keepends=False)\n"
"--\n"
"\n"
"Return a list of the lines in the bytearray, breaking at line boundaries.\n"
"\n"
"Line breaks are not included in the resulting list unless keepends is given and\n"
"true.");
#define BYTEARRAY_SPLITLINES_METHODDEF \
{"splitlines", (PyCFunction)bytearray_splitlines, METH_VARARGS|METH_KEYWORDS, bytearray_splitlines__doc__},
static PyObject *
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends);
static PyObject *
bytearray_splitlines(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"keepends", NULL};
int keepends = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|i:splitlines", _keywords,
&keepends))
goto exit;
return_value = bytearray_splitlines_impl(self, keepends);
exit:
return return_value;
}
static PyObject *
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends)
/*[clinic end generated code: output=a837fd0512ad46ff input=36f0b25bc792f6c0]*/
/*[clinic end generated code: output=4223c94b895f6ad9 input=36f0b25bc792f6c0]*/
{
return stringlib_splitlines(
(PyObject*) self, PyByteArray_AS_STRING(self),
@ -3427,40 +2820,9 @@ Spaces between two numbers are accepted.
Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\xb9\\x01\\xef')
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_fromhex__doc__,
"fromhex($type, string, /)\n"
"--\n"
"\n"
"Create a bytearray object from a string of hexadecimal numbers.\n"
"\n"
"Spaces between two numbers are accepted.\n"
"Example: bytearray.fromhex(\'B9 01EF\') -> bytearray(b\'\\\\xb9\\\\x01\\\\xef\')");
#define BYTEARRAY_FROMHEX_METHODDEF \
{"fromhex", (PyCFunction)bytearray_fromhex, METH_VARARGS|METH_CLASS, bytearray_fromhex__doc__},
static PyObject *
bytearray_fromhex_impl(PyObject*cls, PyObject *string);
static PyObject *
bytearray_fromhex(PyTypeObject *cls, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *string;
if (!PyArg_ParseTuple(args,
"U:fromhex",
&string))
goto exit;
return_value = bytearray_fromhex_impl((PyObject*)cls, string);
exit:
return return_value;
}
static PyObject *
bytearray_fromhex_impl(PyObject*cls, PyObject *string)
/*[clinic end generated code: output=adc3c804a74e56d4 input=907bbd2d34d9367a]*/
/*[clinic end generated code: output=df3da60129b3700c input=907bbd2d34d9367a]*/
{
PyObject *newbytes;
char *buf;
@ -3550,27 +2912,9 @@ bytearray.__reduce__ as bytearray_reduce
Return state information for pickling.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_reduce__doc__,
"__reduce__($self, /)\n"
"--\n"
"\n"
"Return state information for pickling.");
#define BYTEARRAY_REDUCE_METHODDEF \
{"__reduce__", (PyCFunction)bytearray_reduce, METH_NOARGS, bytearray_reduce__doc__},
static PyObject *
bytearray_reduce_impl(PyByteArrayObject *self);
static PyObject *
bytearray_reduce(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_reduce_impl(self);
}
static PyObject *
bytearray_reduce_impl(PyByteArrayObject *self)
/*[clinic end generated code: output=b1b56fe87bf30fb0 input=fbb07de4d102a03a]*/
/*[clinic end generated code: output=52bf304086464cab input=fbb07de4d102a03a]*/
{
return _common_reduce(self, 2);
}
@ -3585,37 +2929,9 @@ bytearray.__reduce_ex__ as bytearray_reduce_ex
Return state information for pickling.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_reduce_ex__doc__,
"__reduce_ex__($self, proto=0, /)\n"
"--\n"
"\n"
"Return state information for pickling.");
#define BYTEARRAY_REDUCE_EX_METHODDEF \
{"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_VARARGS, bytearray_reduce_ex__doc__},
static PyObject *
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto);
static PyObject *
bytearray_reduce_ex(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int proto = 0;
if (!PyArg_ParseTuple(args,
"|i:__reduce_ex__",
&proto))
goto exit;
return_value = bytearray_reduce_ex_impl(self, proto);
exit:
return return_value;
}
static PyObject *
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto)
/*[clinic end generated code: output=bbd9afb2f5953dc1 input=0e091a42ca6dbd91]*/
/*[clinic end generated code: output=52eac33377197520 input=0e091a42ca6dbd91]*/
{
return _common_reduce(self, proto);
}
@ -3628,27 +2944,9 @@ bytearray.__sizeof__ as bytearray_sizeof
Returns the size of the bytearray object in memory, in bytes.
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_sizeof__doc__,
"__sizeof__($self, /)\n"
"--\n"
"\n"
"Returns the size of the bytearray object in memory, in bytes.");
#define BYTEARRAY_SIZEOF_METHODDEF \
{"__sizeof__", (PyCFunction)bytearray_sizeof, METH_NOARGS, bytearray_sizeof__doc__},
static PyObject *
bytearray_sizeof_impl(PyByteArrayObject *self);
static PyObject *
bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_sizeof_impl(self);
}
static PyObject *
bytearray_sizeof_impl(PyByteArrayObject *self)
/*[clinic end generated code: output=4a2254b0a85630c6 input=6b23d305362b462b]*/
/*[clinic end generated code: output=738abdd17951c427 input=6b23d305362b462b]*/
{
Py_ssize_t res;

View File

@ -12,6 +12,8 @@ class bytes "PyBytesObject*" "&PyBytes_Type"
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=1a1d9102afc1b00c]*/
#include "clinic/bytesobject.c.h"
#ifdef COUNT_ALLOCS
Py_ssize_t null_strings, one_strings;
#endif
@ -1614,47 +1616,9 @@ bytes.split
Return a list of the sections in the bytes, using sep as the delimiter.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_split__doc__,
"split($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytes, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytes.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.");
#define BYTES_SPLIT_METHODDEF \
{"split", (PyCFunction)bytes_split, METH_VARARGS|METH_KEYWORDS, bytes_split__doc__},
static PyObject *
bytes_split_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytes_split(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:split", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytes_split_impl(self, sep, maxsplit);
exit:
return return_value;
}
static PyObject *
bytes_split_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic end generated code: output=c80a47afdd505975 input=8b809b39074abbfa]*/
/*[clinic end generated code: output=8bde44dacb36ef2e input=8b809b39074abbfa]*/
{
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
const char *s = PyBytes_AS_STRING(self), *sub;
@ -1692,48 +1656,9 @@ If the separator is not found, returns a 3-tuple containing the original bytes
object and two empty bytes objects.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_partition__doc__,
"partition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytes into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytes. If the separator is found,\n"
"returns a 3-tuple containing the part before the separator, the separator\n"
"itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing the original bytes\n"
"object and two empty bytes objects.");
#define BYTES_PARTITION_METHODDEF \
{"partition", (PyCFunction)bytes_partition, METH_VARARGS, bytes_partition__doc__},
static PyObject *
bytes_partition_impl(PyBytesObject *self, Py_buffer *sep);
static PyObject *
bytes_partition(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer sep = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*:partition",
&sep))
goto exit;
return_value = bytes_partition_impl(self, &sep);
exit:
/* Cleanup for sep */
if (sep.obj)
PyBuffer_Release(&sep);
return return_value;
}
static PyObject *
bytes_partition_impl(PyBytesObject *self, Py_buffer *sep)
/*[clinic end generated code: output=3006727cfbf83aa4 input=bc855dc63ca949de]*/
/*[clinic end generated code: output=f532b392a17ff695 input=bc855dc63ca949de]*/
{
return stringlib_partition(
(PyObject*) self,
@ -1759,48 +1684,9 @@ If the separator is not found, returns a 3-tuple containing two empty bytes
objects and the original bytes object.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_rpartition__doc__,
"rpartition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytes into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytes, starting and the end. If\n"
"the separator is found, returns a 3-tuple containing the part before the\n"
"separator, the separator itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing two empty bytes\n"
"objects and the original bytes object.");
#define BYTES_RPARTITION_METHODDEF \
{"rpartition", (PyCFunction)bytes_rpartition, METH_VARARGS, bytes_rpartition__doc__},
static PyObject *
bytes_rpartition_impl(PyBytesObject *self, Py_buffer *sep);
static PyObject *
bytes_rpartition(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer sep = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*:rpartition",
&sep))
goto exit;
return_value = bytes_rpartition_impl(self, &sep);
exit:
/* Cleanup for sep */
if (sep.obj)
PyBuffer_Release(&sep);
return return_value;
}
static PyObject *
bytes_rpartition_impl(PyBytesObject *self, Py_buffer *sep)
/*[clinic end generated code: output=57b169dc47fa90e8 input=6588fff262a9170e]*/
/*[clinic end generated code: output=191b114cbb028e50 input=6588fff262a9170e]*/
{
return stringlib_rpartition(
(PyObject*) self,
@ -1817,49 +1703,9 @@ Return a list of the sections in the bytes, using sep as the delimiter.
Splitting is done starting at the end of the bytes and working to the front.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_rsplit__doc__,
"rsplit($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytes, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytes.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.\n"
"\n"
"Splitting is done starting at the end of the bytes and working to the front.");
#define BYTES_RSPLIT_METHODDEF \
{"rsplit", (PyCFunction)bytes_rsplit, METH_VARARGS|METH_KEYWORDS, bytes_rsplit__doc__},
static PyObject *
bytes_rsplit_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytes_rsplit(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:rsplit", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytes_rsplit_impl(self, sep, maxsplit);
exit:
return return_value;
}
static PyObject *
bytes_rsplit_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit)
/*[clinic end generated code: output=f86feddedbd7b26d input=0f86c9f28f7d7b7b]*/
/*[clinic end generated code: output=0b6570b977911d88 input=0f86c9f28f7d7b7b]*/
{
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
const char *s = PyBytes_AS_STRING(self), *sub;
@ -1896,24 +1742,9 @@ The result is returned as a new bytes object.
Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_join__doc__,
"join($self, iterable_of_bytes, /)\n"
"--\n"
"\n"
"Concatenate any number of bytes objects.\n"
"\n"
"The bytes whose method is called is inserted in between each pair.\n"
"\n"
"The result is returned as a new bytes object.\n"
"\n"
"Example: b\'.\'.join([b\'ab\', b\'pq\', b\'rs\']) -> b\'ab.pq.rs\'.");
#define BYTES_JOIN_METHODDEF \
{"join", (PyCFunction)bytes_join, METH_O, bytes_join__doc__},
static PyObject *
bytes_join(PyBytesObject*self, PyObject *iterable_of_bytes)
/*[clinic end generated code: output=e541a14a8da97908 input=7fe377b95bd549d2]*/
/*[clinic end generated code: output=634aff14764ff997 input=7fe377b95bd549d2]*/
{
return stringlib_bytes_join((PyObject*)self, iterable_of_bytes);
}
@ -2170,39 +2001,9 @@ Strip leading and trailing bytes contained in the argument.
If the argument is omitted or None, strip leading and trailing ASCII whitespace.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_strip__doc__,
"strip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading and trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
#define BYTES_STRIP_METHODDEF \
{"strip", (PyCFunction)bytes_strip, METH_VARARGS, bytes_strip__doc__},
static PyObject *
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_strip(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "strip",
0, 1,
&bytes))
goto exit;
return_value = bytes_strip_impl(self, bytes);
exit:
return return_value;
}
static PyObject *
bytes_strip_impl(PyBytesObject *self, PyObject *bytes)
/*[clinic end generated code: output=c8234a599ba5ec35 input=37daa5fad1395d95]*/
/*[clinic end generated code: output=c7c228d3bd104a1b input=37daa5fad1395d95]*/
{
return do_argstrip(self, BOTHSTRIP, bytes);
}
@ -2219,39 +2020,9 @@ Strip leading bytes contained in the argument.
If the argument is omitted or None, strip leading ASCII whitespace.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_lstrip__doc__,
"lstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading ASCII whitespace.");
#define BYTES_LSTRIP_METHODDEF \
{"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, bytes_lstrip__doc__},
static PyObject *
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_lstrip(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "lstrip",
0, 1,
&bytes))
goto exit;
return_value = bytes_lstrip_impl(self, bytes);
exit:
return return_value;
}
static PyObject *
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes)
/*[clinic end generated code: output=529e8511ab6f1115 input=88811b09dfbc2988]*/
/*[clinic end generated code: output=28602e586f524e82 input=88811b09dfbc2988]*/
{
return do_argstrip(self, LEFTSTRIP, bytes);
}
@ -2268,39 +2039,9 @@ Strip trailing bytes contained in the argument.
If the argument is omitted or None, strip trailing ASCII whitespace.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_rstrip__doc__,
"rstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip trailing ASCII whitespace.");
#define BYTES_RSTRIP_METHODDEF \
{"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, bytes_rstrip__doc__},
static PyObject *
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_rstrip(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "rstrip",
0, 1,
&bytes))
goto exit;
return_value = bytes_rstrip_impl(self, bytes);
exit:
return return_value;
}
static PyObject *
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes)
/*[clinic end generated code: output=e98730bd133e6593 input=8f93c9cd361f0140]*/
/*[clinic end generated code: output=547e3815c95447da input=8f93c9cd361f0140]*/
{
return do_argstrip(self, RIGHTSTRIP, bytes);
}
@ -2371,53 +2112,9 @@ All characters occurring in the optional argument deletechars are removed.
The remaining characters are mapped through the given translation table.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_translate__doc__,
"translate(table, [deletechars])\n"
"Return a copy with each character mapped by the given translation table.\n"
"\n"
" table\n"
" Translation table, which must be a bytes object of length 256.\n"
"\n"
"All characters occurring in the optional argument deletechars are removed.\n"
"The remaining characters are mapped through the given translation table.");
#define BYTES_TRANSLATE_METHODDEF \
{"translate", (PyCFunction)bytes_translate, METH_VARARGS, bytes_translate__doc__},
static PyObject *
bytes_translate_impl(PyBytesObject *self, PyObject *table, int group_right_1, PyObject *deletechars);
static PyObject *
bytes_translate(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *table;
int group_right_1 = 0;
PyObject *deletechars = NULL;
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "O:translate", &table))
goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars))
goto exit;
group_right_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "bytes.translate requires 1 to 2 arguments");
goto exit;
}
return_value = bytes_translate_impl(self, table, group_right_1, deletechars);
exit:
return return_value;
}
static PyObject *
bytes_translate_impl(PyBytesObject *self, PyObject *table, int group_right_1, PyObject *deletechars)
/*[clinic end generated code: output=f0f29a57f41df5d8 input=d8fa5519d7cc4be7]*/
/*[clinic end generated code: output=0ddd2cef4f4918f2 input=d8fa5519d7cc4be7]*/
{
char *input, *output;
Py_buffer table_view = {NULL, NULL};
@ -2547,50 +2244,9 @@ the same position in to.
The bytes objects frm and to must be of the same length.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_maketrans__doc__,
"maketrans(frm, to, /)\n"
"--\n"
"\n"
"Return a translation table useable for the bytes or bytearray translate method.\n"
"\n"
"The returned table will be one where each byte in frm is mapped to the byte at\n"
"the same position in to.\n"
"\n"
"The bytes objects frm and to must be of the same length.");
#define BYTES_MAKETRANS_METHODDEF \
{"maketrans", (PyCFunction)bytes_maketrans, METH_VARARGS|METH_STATIC, bytes_maketrans__doc__},
static PyObject *
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
bytes_maketrans(void *null, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
Py_buffer to = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*y*:maketrans",
&frm, &to))
goto exit;
return_value = bytes_maketrans_impl(&frm, &to);
exit:
/* Cleanup for frm */
if (frm.obj)
PyBuffer_Release(&frm);
/* Cleanup for to */
if (to.obj)
PyBuffer_Release(&to);
return return_value;
}
static PyObject *
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to)
/*[clinic end generated code: output=7df47390c476ac60 input=de7a8fc5632bb8f1]*/
/*[clinic end generated code: output=a36f6399d4b77f6f input=de7a8fc5632bb8f1]*/
{
return _Py_bytes_maketrans(frm, to);
}
@ -3104,53 +2760,9 @@ If the optional argument count is given, only the first count occurrences are
replaced.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_replace__doc__,
"replace($self, old, new, count=-1, /)\n"
"--\n"
"\n"
"Return a copy with all occurrences of substring old replaced by new.\n"
"\n"
" count\n"
" Maximum number of occurrences to replace.\n"
" -1 (the default value) means replace all occurrences.\n"
"\n"
"If the optional argument count is given, only the first count occurrences are\n"
"replaced.");
#define BYTES_REPLACE_METHODDEF \
{"replace", (PyCFunction)bytes_replace, METH_VARARGS, bytes_replace__doc__},
static PyObject *
bytes_replace_impl(PyBytesObject*self, Py_buffer *old, Py_buffer *new, Py_ssize_t count);
static PyObject *
bytes_replace(PyBytesObject*self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
Py_buffer new = {NULL, NULL};
Py_ssize_t count = -1;
if (!PyArg_ParseTuple(args,
"y*y*|n:replace",
&old, &new, &count))
goto exit;
return_value = bytes_replace_impl(self, &old, &new, count);
exit:
/* Cleanup for old */
if (old.obj)
PyBuffer_Release(&old);
/* Cleanup for new */
if (new.obj)
PyBuffer_Release(&new);
return return_value;
}
static PyObject *
bytes_replace_impl(PyBytesObject*self, Py_buffer *old, Py_buffer *new, Py_ssize_t count)
/*[clinic end generated code: output=f07bd9ecf29ee8d8 input=b2fbbf0bf04de8e5]*/
/*[clinic end generated code: output=3fe052c3c60cffc2 input=b2fbbf0bf04de8e5]*/
{
return (PyObject *)replace((PyBytesObject *) self,
(const char *)old->buf, old->len,
@ -3316,48 +2928,9 @@ bytes.decode
Decode the bytes using the codec registered for encoding.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_decode__doc__,
"decode($self, /, encoding=\'utf-8\', errors=\'strict\')\n"
"--\n"
"\n"
"Decode the bytes using the codec registered for encoding.\n"
"\n"
" encoding\n"
" The encoding with which to decode the bytes.\n"
" errors\n"
" The error handling scheme to use for the handling of decoding errors.\n"
" The default is \'strict\' meaning that decoding errors raise a\n"
" UnicodeDecodeError. Other possible values are \'ignore\' and \'replace\'\n"
" as well as any other name registered with codecs.register_error that\n"
" can handle UnicodeDecodeErrors.");
#define BYTES_DECODE_METHODDEF \
{"decode", (PyCFunction)bytes_decode, METH_VARARGS|METH_KEYWORDS, bytes_decode__doc__},
static PyObject *
bytes_decode_impl(PyBytesObject*self, const char *encoding, const char *errors);
static PyObject *
bytes_decode(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"encoding", "errors", NULL};
const char *encoding = NULL;
const char *errors = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|ss:decode", _keywords,
&encoding, &errors))
goto exit;
return_value = bytes_decode_impl(self, encoding, errors);
exit:
return return_value;
}
static PyObject *
bytes_decode_impl(PyBytesObject*self, const char *encoding, const char *errors)
/*[clinic end generated code: output=61a80290bbfce696 input=958174769d2a40ca]*/
/*[clinic end generated code: output=8038751c823b9038 input=958174769d2a40ca]*/
{
return PyUnicode_FromEncodedObject((PyObject*)self, encoding, errors);
}
@ -3374,41 +2947,9 @@ Line breaks are not included in the resulting list unless keepends is given and
true.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_splitlines__doc__,
"splitlines($self, /, keepends=False)\n"
"--\n"
"\n"
"Return a list of the lines in the bytes, breaking at line boundaries.\n"
"\n"
"Line breaks are not included in the resulting list unless keepends is given and\n"
"true.");
#define BYTES_SPLITLINES_METHODDEF \
{"splitlines", (PyCFunction)bytes_splitlines, METH_VARARGS|METH_KEYWORDS, bytes_splitlines__doc__},
static PyObject *
bytes_splitlines_impl(PyBytesObject*self, int keepends);
static PyObject *
bytes_splitlines(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"keepends", NULL};
int keepends = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|i:splitlines", _keywords,
&keepends))
goto exit;
return_value = bytes_splitlines_impl(self, keepends);
exit:
return return_value;
}
static PyObject *
bytes_splitlines_impl(PyBytesObject*self, int keepends)
/*[clinic end generated code: output=79da057d05d126de input=ddb93e3351080c8c]*/
/*[clinic end generated code: output=995c3598f7833cad input=ddb93e3351080c8c]*/
{
return stringlib_splitlines(
(PyObject*) self, PyBytes_AS_STRING(self),
@ -3445,40 +2986,9 @@ Spaces between two numbers are accepted.
Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
[clinic start generated code]*/
PyDoc_STRVAR(bytes_fromhex__doc__,
"fromhex($type, string, /)\n"
"--\n"
"\n"
"Create a bytes object from a string of hexadecimal numbers.\n"
"\n"
"Spaces between two numbers are accepted.\n"
"Example: bytes.fromhex(\'B9 01EF\') -> b\'\\\\xb9\\\\x01\\\\xef\'.");
#define BYTES_FROMHEX_METHODDEF \
{"fromhex", (PyCFunction)bytes_fromhex, METH_VARARGS|METH_CLASS, bytes_fromhex__doc__},
static PyObject *
bytes_fromhex_impl(PyTypeObject *type, PyObject *string);
static PyObject *
bytes_fromhex(PyTypeObject *type, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *string;
if (!PyArg_ParseTuple(args,
"U:fromhex",
&string))
goto exit;
return_value = bytes_fromhex_impl(type, string);
exit:
return return_value;
}
static PyObject *
bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
/*[clinic end generated code: output=09e6cbef56cbbb65 input=bf4d1c361670acd3]*/
/*[clinic end generated code: output=0973acc63661bb2e input=bf4d1c361670acd3]*/
{
PyObject *newstring;
char *buf;

View File

@ -0,0 +1,708 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(bytearray_clear__doc__,
"clear($self, /)\n"
"--\n"
"\n"
"Remove all items from the bytearray.");
#define BYTEARRAY_CLEAR_METHODDEF \
{"clear", (PyCFunction)bytearray_clear, METH_NOARGS, bytearray_clear__doc__},
static PyObject *
bytearray_clear_impl(PyByteArrayObject *self);
static PyObject *
bytearray_clear(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_clear_impl(self);
}
PyDoc_STRVAR(bytearray_copy__doc__,
"copy($self, /)\n"
"--\n"
"\n"
"Return a copy of B.");
#define BYTEARRAY_COPY_METHODDEF \
{"copy", (PyCFunction)bytearray_copy, METH_NOARGS, bytearray_copy__doc__},
static PyObject *
bytearray_copy_impl(PyByteArrayObject *self);
static PyObject *
bytearray_copy(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_copy_impl(self);
}
PyDoc_STRVAR(bytearray_translate__doc__,
"translate(table, [deletechars])\n"
"Return a copy with each character mapped by the given translation table.\n"
"\n"
" table\n"
" Translation table, which must be a bytes object of length 256.\n"
"\n"
"All characters occurring in the optional argument deletechars are removed.\n"
"The remaining characters are mapped through the given translation table.");
#define BYTEARRAY_TRANSLATE_METHODDEF \
{"translate", (PyCFunction)bytearray_translate, METH_VARARGS, bytearray_translate__doc__},
static PyObject *
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table, int group_right_1, PyObject *deletechars);
static PyObject *
bytearray_translate(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *table;
int group_right_1 = 0;
PyObject *deletechars = NULL;
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "O:translate", &table))
goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars))
goto exit;
group_right_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "bytearray.translate requires 1 to 2 arguments");
goto exit;
}
return_value = bytearray_translate_impl(self, table, group_right_1, deletechars);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_maketrans__doc__,
"maketrans(frm, to, /)\n"
"--\n"
"\n"
"Return a translation table useable for the bytes or bytearray translate method.\n"
"\n"
"The returned table will be one where each byte in frm is mapped to the byte at\n"
"the same position in to.\n"
"\n"
"The bytes objects frm and to must be of the same length.");
#define BYTEARRAY_MAKETRANS_METHODDEF \
{"maketrans", (PyCFunction)bytearray_maketrans, METH_VARARGS|METH_STATIC, bytearray_maketrans__doc__},
static PyObject *
bytearray_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
bytearray_maketrans(void *null, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
Py_buffer to = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*y*:maketrans",
&frm, &to))
goto exit;
return_value = bytearray_maketrans_impl(&frm, &to);
exit:
/* Cleanup for frm */
if (frm.obj)
PyBuffer_Release(&frm);
/* Cleanup for to */
if (to.obj)
PyBuffer_Release(&to);
return return_value;
}
PyDoc_STRVAR(bytearray_replace__doc__,
"replace($self, old, new, count=-1, /)\n"
"--\n"
"\n"
"Return a copy with all occurrences of substring old replaced by new.\n"
"\n"
" count\n"
" Maximum number of occurrences to replace.\n"
" -1 (the default value) means replace all occurrences.\n"
"\n"
"If the optional argument count is given, only the first count occurrences are\n"
"replaced.");
#define BYTEARRAY_REPLACE_METHODDEF \
{"replace", (PyCFunction)bytearray_replace, METH_VARARGS, bytearray_replace__doc__},
static PyObject *
bytearray_replace_impl(PyByteArrayObject *self, Py_buffer *old, Py_buffer *new, Py_ssize_t count);
static PyObject *
bytearray_replace(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
Py_buffer new = {NULL, NULL};
Py_ssize_t count = -1;
if (!PyArg_ParseTuple(args,
"y*y*|n:replace",
&old, &new, &count))
goto exit;
return_value = bytearray_replace_impl(self, &old, &new, count);
exit:
/* Cleanup for old */
if (old.obj)
PyBuffer_Release(&old);
/* Cleanup for new */
if (new.obj)
PyBuffer_Release(&new);
return return_value;
}
PyDoc_STRVAR(bytearray_split__doc__,
"split($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytearray, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytearray.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.");
#define BYTEARRAY_SPLIT_METHODDEF \
{"split", (PyCFunction)bytearray_split, METH_VARARGS|METH_KEYWORDS, bytearray_split__doc__},
static PyObject *
bytearray_split_impl(PyByteArrayObject *self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytearray_split(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:split", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytearray_split_impl(self, sep, maxsplit);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_partition__doc__,
"partition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytearray into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytearray. If the separator is\n"
"found, returns a 3-tuple containing the part before the separator, the\n"
"separator itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing the original\n"
"bytearray object and two empty bytearray objects.");
#define BYTEARRAY_PARTITION_METHODDEF \
{"partition", (PyCFunction)bytearray_partition, METH_O, bytearray_partition__doc__},
PyDoc_STRVAR(bytearray_rpartition__doc__,
"rpartition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytes into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytearray, starting and the end.\n"
"If the separator is found, returns a 3-tuple containing the part before the\n"
"separator, the separator itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing two empty bytearray\n"
"objects and the original bytearray object.");
#define BYTEARRAY_RPARTITION_METHODDEF \
{"rpartition", (PyCFunction)bytearray_rpartition, METH_O, bytearray_rpartition__doc__},
PyDoc_STRVAR(bytearray_rsplit__doc__,
"rsplit($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytearray, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytearray.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.\n"
"\n"
"Splitting is done starting at the end of the bytearray and working to the front.");
#define BYTEARRAY_RSPLIT_METHODDEF \
{"rsplit", (PyCFunction)bytearray_rsplit, METH_VARARGS|METH_KEYWORDS, bytearray_rsplit__doc__},
static PyObject *
bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytearray_rsplit(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:rsplit", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytearray_rsplit_impl(self, sep, maxsplit);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_reverse__doc__,
"reverse($self, /)\n"
"--\n"
"\n"
"Reverse the order of the values in B in place.");
#define BYTEARRAY_REVERSE_METHODDEF \
{"reverse", (PyCFunction)bytearray_reverse, METH_NOARGS, bytearray_reverse__doc__},
static PyObject *
bytearray_reverse_impl(PyByteArrayObject *self);
static PyObject *
bytearray_reverse(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_reverse_impl(self);
}
PyDoc_STRVAR(bytearray_insert__doc__,
"insert($self, index, item, /)\n"
"--\n"
"\n"
"Insert a single item into the bytearray before the given index.\n"
"\n"
" index\n"
" The index where the value is to be inserted.\n"
" item\n"
" The item to be inserted.");
#define BYTEARRAY_INSERT_METHODDEF \
{"insert", (PyCFunction)bytearray_insert, METH_VARARGS, bytearray_insert__doc__},
static PyObject *
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item);
static PyObject *
bytearray_insert(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_ssize_t index;
int item;
if (!PyArg_ParseTuple(args,
"nO&:insert",
&index, _getbytevalue, &item))
goto exit;
return_value = bytearray_insert_impl(self, index, item);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_append__doc__,
"append($self, item, /)\n"
"--\n"
"\n"
"Append a single item to the end of the bytearray.\n"
"\n"
" item\n"
" The item to be appended.");
#define BYTEARRAY_APPEND_METHODDEF \
{"append", (PyCFunction)bytearray_append, METH_VARARGS, bytearray_append__doc__},
static PyObject *
bytearray_append_impl(PyByteArrayObject *self, int item);
static PyObject *
bytearray_append(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int item;
if (!PyArg_ParseTuple(args,
"O&:append",
_getbytevalue, &item))
goto exit;
return_value = bytearray_append_impl(self, item);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_extend__doc__,
"extend($self, iterable_of_ints, /)\n"
"--\n"
"\n"
"Append all the items from the iterator or sequence to the end of the bytearray.\n"
"\n"
" iterable_of_ints\n"
" The iterable of items to append.");
#define BYTEARRAY_EXTEND_METHODDEF \
{"extend", (PyCFunction)bytearray_extend, METH_O, bytearray_extend__doc__},
PyDoc_STRVAR(bytearray_pop__doc__,
"pop($self, index=-1, /)\n"
"--\n"
"\n"
"Remove and return a single item from B.\n"
"\n"
" index\n"
" The index from where to remove the item.\n"
" -1 (the default value) means remove the last item.\n"
"\n"
"If no index argument is given, will pop the last item.");
#define BYTEARRAY_POP_METHODDEF \
{"pop", (PyCFunction)bytearray_pop, METH_VARARGS, bytearray_pop__doc__},
static PyObject *
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index);
static PyObject *
bytearray_pop(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_ssize_t index = -1;
if (!PyArg_ParseTuple(args,
"|n:pop",
&index))
goto exit;
return_value = bytearray_pop_impl(self, index);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_remove__doc__,
"remove($self, value, /)\n"
"--\n"
"\n"
"Remove the first occurrence of a value in the bytearray.\n"
"\n"
" value\n"
" The value to remove.");
#define BYTEARRAY_REMOVE_METHODDEF \
{"remove", (PyCFunction)bytearray_remove, METH_VARARGS, bytearray_remove__doc__},
static PyObject *
bytearray_remove_impl(PyByteArrayObject *self, int value);
static PyObject *
bytearray_remove(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int value;
if (!PyArg_ParseTuple(args,
"O&:remove",
_getbytevalue, &value))
goto exit;
return_value = bytearray_remove_impl(self, value);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_strip__doc__,
"strip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading and trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
#define BYTEARRAY_STRIP_METHODDEF \
{"strip", (PyCFunction)bytearray_strip, METH_VARARGS, bytearray_strip__doc__},
static PyObject *
bytearray_strip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_strip(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "strip",
0, 1,
&bytes))
goto exit;
return_value = bytearray_strip_impl(self, bytes);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_lstrip__doc__,
"lstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading ASCII whitespace.");
#define BYTEARRAY_LSTRIP_METHODDEF \
{"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, bytearray_lstrip__doc__},
static PyObject *
bytearray_lstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_lstrip(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "lstrip",
0, 1,
&bytes))
goto exit;
return_value = bytearray_lstrip_impl(self, bytes);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_rstrip__doc__,
"rstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip trailing ASCII whitespace.");
#define BYTEARRAY_RSTRIP_METHODDEF \
{"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, bytearray_rstrip__doc__},
static PyObject *
bytearray_rstrip_impl(PyByteArrayObject *self, PyObject *bytes);
static PyObject *
bytearray_rstrip(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "rstrip",
0, 1,
&bytes))
goto exit;
return_value = bytearray_rstrip_impl(self, bytes);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_decode__doc__,
"decode($self, /, encoding=\'utf-8\', errors=\'strict\')\n"
"--\n"
"\n"
"Decode the bytearray using the codec registered for encoding.\n"
"\n"
" encoding\n"
" The encoding with which to decode the bytearray.\n"
" errors\n"
" The error handling scheme to use for the handling of decoding errors.\n"
" The default is \'strict\' meaning that decoding errors raise a\n"
" UnicodeDecodeError. Other possible values are \'ignore\' and \'replace\'\n"
" as well as any other name registered with codecs.register_error that\n"
" can handle UnicodeDecodeErrors.");
#define BYTEARRAY_DECODE_METHODDEF \
{"decode", (PyCFunction)bytearray_decode, METH_VARARGS|METH_KEYWORDS, bytearray_decode__doc__},
static PyObject *
bytearray_decode_impl(PyByteArrayObject *self, const char *encoding, const char *errors);
static PyObject *
bytearray_decode(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"encoding", "errors", NULL};
const char *encoding = NULL;
const char *errors = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|ss:decode", _keywords,
&encoding, &errors))
goto exit;
return_value = bytearray_decode_impl(self, encoding, errors);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_join__doc__,
"join($self, iterable_of_bytes, /)\n"
"--\n"
"\n"
"Concatenate any number of bytes/bytearray objects.\n"
"\n"
"The bytearray whose method is called is inserted in between each pair.\n"
"\n"
"The result is returned as a new bytearray object.");
#define BYTEARRAY_JOIN_METHODDEF \
{"join", (PyCFunction)bytearray_join, METH_O, bytearray_join__doc__},
PyDoc_STRVAR(bytearray_splitlines__doc__,
"splitlines($self, /, keepends=False)\n"
"--\n"
"\n"
"Return a list of the lines in the bytearray, breaking at line boundaries.\n"
"\n"
"Line breaks are not included in the resulting list unless keepends is given and\n"
"true.");
#define BYTEARRAY_SPLITLINES_METHODDEF \
{"splitlines", (PyCFunction)bytearray_splitlines, METH_VARARGS|METH_KEYWORDS, bytearray_splitlines__doc__},
static PyObject *
bytearray_splitlines_impl(PyByteArrayObject *self, int keepends);
static PyObject *
bytearray_splitlines(PyByteArrayObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"keepends", NULL};
int keepends = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|i:splitlines", _keywords,
&keepends))
goto exit;
return_value = bytearray_splitlines_impl(self, keepends);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_fromhex__doc__,
"fromhex($type, string, /)\n"
"--\n"
"\n"
"Create a bytearray object from a string of hexadecimal numbers.\n"
"\n"
"Spaces between two numbers are accepted.\n"
"Example: bytearray.fromhex(\'B9 01EF\') -> bytearray(b\'\\\\xb9\\\\x01\\\\xef\')");
#define BYTEARRAY_FROMHEX_METHODDEF \
{"fromhex", (PyCFunction)bytearray_fromhex, METH_VARARGS|METH_CLASS, bytearray_fromhex__doc__},
static PyObject *
bytearray_fromhex_impl(PyObject*cls, PyObject *string);
static PyObject *
bytearray_fromhex(PyTypeObject *cls, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *string;
if (!PyArg_ParseTuple(args,
"U:fromhex",
&string))
goto exit;
return_value = bytearray_fromhex_impl((PyObject*)cls, string);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_reduce__doc__,
"__reduce__($self, /)\n"
"--\n"
"\n"
"Return state information for pickling.");
#define BYTEARRAY_REDUCE_METHODDEF \
{"__reduce__", (PyCFunction)bytearray_reduce, METH_NOARGS, bytearray_reduce__doc__},
static PyObject *
bytearray_reduce_impl(PyByteArrayObject *self);
static PyObject *
bytearray_reduce(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_reduce_impl(self);
}
PyDoc_STRVAR(bytearray_reduce_ex__doc__,
"__reduce_ex__($self, proto=0, /)\n"
"--\n"
"\n"
"Return state information for pickling.");
#define BYTEARRAY_REDUCE_EX_METHODDEF \
{"__reduce_ex__", (PyCFunction)bytearray_reduce_ex, METH_VARARGS, bytearray_reduce_ex__doc__},
static PyObject *
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto);
static PyObject *
bytearray_reduce_ex(PyByteArrayObject *self, PyObject *args)
{
PyObject *return_value = NULL;
int proto = 0;
if (!PyArg_ParseTuple(args,
"|i:__reduce_ex__",
&proto))
goto exit;
return_value = bytearray_reduce_ex_impl(self, proto);
exit:
return return_value;
}
PyDoc_STRVAR(bytearray_sizeof__doc__,
"__sizeof__($self, /)\n"
"--\n"
"\n"
"Returns the size of the bytearray object in memory, in bytes.");
#define BYTEARRAY_SIZEOF_METHODDEF \
{"__sizeof__", (PyCFunction)bytearray_sizeof, METH_NOARGS, bytearray_sizeof__doc__},
static PyObject *
bytearray_sizeof_impl(PyByteArrayObject *self);
static PyObject *
bytearray_sizeof(PyByteArrayObject *self, PyObject *Py_UNUSED(ignored))
{
return bytearray_sizeof_impl(self);
}
/*[clinic end generated code: output=70ea384faeca8d16 input=a9049054013a1b77]*/

View File

@ -0,0 +1,496 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(bytes_split__doc__,
"split($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytes, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytes.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.");
#define BYTES_SPLIT_METHODDEF \
{"split", (PyCFunction)bytes_split, METH_VARARGS|METH_KEYWORDS, bytes_split__doc__},
static PyObject *
bytes_split_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytes_split(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:split", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytes_split_impl(self, sep, maxsplit);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_partition__doc__,
"partition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytes into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytes. If the separator is found,\n"
"returns a 3-tuple containing the part before the separator, the separator\n"
"itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing the original bytes\n"
"object and two empty bytes objects.");
#define BYTES_PARTITION_METHODDEF \
{"partition", (PyCFunction)bytes_partition, METH_VARARGS, bytes_partition__doc__},
static PyObject *
bytes_partition_impl(PyBytesObject *self, Py_buffer *sep);
static PyObject *
bytes_partition(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer sep = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*:partition",
&sep))
goto exit;
return_value = bytes_partition_impl(self, &sep);
exit:
/* Cleanup for sep */
if (sep.obj)
PyBuffer_Release(&sep);
return return_value;
}
PyDoc_STRVAR(bytes_rpartition__doc__,
"rpartition($self, sep, /)\n"
"--\n"
"\n"
"Partition the bytes into three parts using the given separator.\n"
"\n"
"This will search for the separator sep in the bytes, starting and the end. If\n"
"the separator is found, returns a 3-tuple containing the part before the\n"
"separator, the separator itself, and the part after it.\n"
"\n"
"If the separator is not found, returns a 3-tuple containing two empty bytes\n"
"objects and the original bytes object.");
#define BYTES_RPARTITION_METHODDEF \
{"rpartition", (PyCFunction)bytes_rpartition, METH_VARARGS, bytes_rpartition__doc__},
static PyObject *
bytes_rpartition_impl(PyBytesObject *self, Py_buffer *sep);
static PyObject *
bytes_rpartition(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer sep = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*:rpartition",
&sep))
goto exit;
return_value = bytes_rpartition_impl(self, &sep);
exit:
/* Cleanup for sep */
if (sep.obj)
PyBuffer_Release(&sep);
return return_value;
}
PyDoc_STRVAR(bytes_rsplit__doc__,
"rsplit($self, /, sep=None, maxsplit=-1)\n"
"--\n"
"\n"
"Return a list of the sections in the bytes, using sep as the delimiter.\n"
"\n"
" sep\n"
" The delimiter according which to split the bytes.\n"
" None (the default value) means split on ASCII whitespace characters\n"
" (space, tab, return, newline, formfeed, vertical tab).\n"
" maxsplit\n"
" Maximum number of splits to do.\n"
" -1 (the default value) means no limit.\n"
"\n"
"Splitting is done starting at the end of the bytes and working to the front.");
#define BYTES_RSPLIT_METHODDEF \
{"rsplit", (PyCFunction)bytes_rsplit, METH_VARARGS|METH_KEYWORDS, bytes_rsplit__doc__},
static PyObject *
bytes_rsplit_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit);
static PyObject *
bytes_rsplit(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"sep", "maxsplit", NULL};
PyObject *sep = Py_None;
Py_ssize_t maxsplit = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|On:rsplit", _keywords,
&sep, &maxsplit))
goto exit;
return_value = bytes_rsplit_impl(self, sep, maxsplit);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_join__doc__,
"join($self, iterable_of_bytes, /)\n"
"--\n"
"\n"
"Concatenate any number of bytes objects.\n"
"\n"
"The bytes whose method is called is inserted in between each pair.\n"
"\n"
"The result is returned as a new bytes object.\n"
"\n"
"Example: b\'.\'.join([b\'ab\', b\'pq\', b\'rs\']) -> b\'ab.pq.rs\'.");
#define BYTES_JOIN_METHODDEF \
{"join", (PyCFunction)bytes_join, METH_O, bytes_join__doc__},
PyDoc_STRVAR(bytes_strip__doc__,
"strip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading and trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading and trailing ASCII whitespace.");
#define BYTES_STRIP_METHODDEF \
{"strip", (PyCFunction)bytes_strip, METH_VARARGS, bytes_strip__doc__},
static PyObject *
bytes_strip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_strip(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "strip",
0, 1,
&bytes))
goto exit;
return_value = bytes_strip_impl(self, bytes);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_lstrip__doc__,
"lstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip leading bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip leading ASCII whitespace.");
#define BYTES_LSTRIP_METHODDEF \
{"lstrip", (PyCFunction)bytes_lstrip, METH_VARARGS, bytes_lstrip__doc__},
static PyObject *
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_lstrip(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "lstrip",
0, 1,
&bytes))
goto exit;
return_value = bytes_lstrip_impl(self, bytes);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_rstrip__doc__,
"rstrip($self, bytes=None, /)\n"
"--\n"
"\n"
"Strip trailing bytes contained in the argument.\n"
"\n"
"If the argument is omitted or None, strip trailing ASCII whitespace.");
#define BYTES_RSTRIP_METHODDEF \
{"rstrip", (PyCFunction)bytes_rstrip, METH_VARARGS, bytes_rstrip__doc__},
static PyObject *
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes);
static PyObject *
bytes_rstrip(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *bytes = Py_None;
if (!PyArg_UnpackTuple(args, "rstrip",
0, 1,
&bytes))
goto exit;
return_value = bytes_rstrip_impl(self, bytes);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_translate__doc__,
"translate(table, [deletechars])\n"
"Return a copy with each character mapped by the given translation table.\n"
"\n"
" table\n"
" Translation table, which must be a bytes object of length 256.\n"
"\n"
"All characters occurring in the optional argument deletechars are removed.\n"
"The remaining characters are mapped through the given translation table.");
#define BYTES_TRANSLATE_METHODDEF \
{"translate", (PyCFunction)bytes_translate, METH_VARARGS, bytes_translate__doc__},
static PyObject *
bytes_translate_impl(PyBytesObject *self, PyObject *table, int group_right_1, PyObject *deletechars);
static PyObject *
bytes_translate(PyBytesObject *self, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *table;
int group_right_1 = 0;
PyObject *deletechars = NULL;
switch (PyTuple_GET_SIZE(args)) {
case 1:
if (!PyArg_ParseTuple(args, "O:translate", &table))
goto exit;
break;
case 2:
if (!PyArg_ParseTuple(args, "OO:translate", &table, &deletechars))
goto exit;
group_right_1 = 1;
break;
default:
PyErr_SetString(PyExc_TypeError, "bytes.translate requires 1 to 2 arguments");
goto exit;
}
return_value = bytes_translate_impl(self, table, group_right_1, deletechars);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_maketrans__doc__,
"maketrans(frm, to, /)\n"
"--\n"
"\n"
"Return a translation table useable for the bytes or bytearray translate method.\n"
"\n"
"The returned table will be one where each byte in frm is mapped to the byte at\n"
"the same position in to.\n"
"\n"
"The bytes objects frm and to must be of the same length.");
#define BYTES_MAKETRANS_METHODDEF \
{"maketrans", (PyCFunction)bytes_maketrans, METH_VARARGS|METH_STATIC, bytes_maketrans__doc__},
static PyObject *
bytes_maketrans_impl(Py_buffer *frm, Py_buffer *to);
static PyObject *
bytes_maketrans(void *null, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer frm = {NULL, NULL};
Py_buffer to = {NULL, NULL};
if (!PyArg_ParseTuple(args,
"y*y*:maketrans",
&frm, &to))
goto exit;
return_value = bytes_maketrans_impl(&frm, &to);
exit:
/* Cleanup for frm */
if (frm.obj)
PyBuffer_Release(&frm);
/* Cleanup for to */
if (to.obj)
PyBuffer_Release(&to);
return return_value;
}
PyDoc_STRVAR(bytes_replace__doc__,
"replace($self, old, new, count=-1, /)\n"
"--\n"
"\n"
"Return a copy with all occurrences of substring old replaced by new.\n"
"\n"
" count\n"
" Maximum number of occurrences to replace.\n"
" -1 (the default value) means replace all occurrences.\n"
"\n"
"If the optional argument count is given, only the first count occurrences are\n"
"replaced.");
#define BYTES_REPLACE_METHODDEF \
{"replace", (PyCFunction)bytes_replace, METH_VARARGS, bytes_replace__doc__},
static PyObject *
bytes_replace_impl(PyBytesObject*self, Py_buffer *old, Py_buffer *new, Py_ssize_t count);
static PyObject *
bytes_replace(PyBytesObject*self, PyObject *args)
{
PyObject *return_value = NULL;
Py_buffer old = {NULL, NULL};
Py_buffer new = {NULL, NULL};
Py_ssize_t count = -1;
if (!PyArg_ParseTuple(args,
"y*y*|n:replace",
&old, &new, &count))
goto exit;
return_value = bytes_replace_impl(self, &old, &new, count);
exit:
/* Cleanup for old */
if (old.obj)
PyBuffer_Release(&old);
/* Cleanup for new */
if (new.obj)
PyBuffer_Release(&new);
return return_value;
}
PyDoc_STRVAR(bytes_decode__doc__,
"decode($self, /, encoding=\'utf-8\', errors=\'strict\')\n"
"--\n"
"\n"
"Decode the bytes using the codec registered for encoding.\n"
"\n"
" encoding\n"
" The encoding with which to decode the bytes.\n"
" errors\n"
" The error handling scheme to use for the handling of decoding errors.\n"
" The default is \'strict\' meaning that decoding errors raise a\n"
" UnicodeDecodeError. Other possible values are \'ignore\' and \'replace\'\n"
" as well as any other name registered with codecs.register_error that\n"
" can handle UnicodeDecodeErrors.");
#define BYTES_DECODE_METHODDEF \
{"decode", (PyCFunction)bytes_decode, METH_VARARGS|METH_KEYWORDS, bytes_decode__doc__},
static PyObject *
bytes_decode_impl(PyBytesObject*self, const char *encoding, const char *errors);
static PyObject *
bytes_decode(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"encoding", "errors", NULL};
const char *encoding = NULL;
const char *errors = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|ss:decode", _keywords,
&encoding, &errors))
goto exit;
return_value = bytes_decode_impl(self, encoding, errors);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_splitlines__doc__,
"splitlines($self, /, keepends=False)\n"
"--\n"
"\n"
"Return a list of the lines in the bytes, breaking at line boundaries.\n"
"\n"
"Line breaks are not included in the resulting list unless keepends is given and\n"
"true.");
#define BYTES_SPLITLINES_METHODDEF \
{"splitlines", (PyCFunction)bytes_splitlines, METH_VARARGS|METH_KEYWORDS, bytes_splitlines__doc__},
static PyObject *
bytes_splitlines_impl(PyBytesObject*self, int keepends);
static PyObject *
bytes_splitlines(PyBytesObject*self, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"keepends", NULL};
int keepends = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"|i:splitlines", _keywords,
&keepends))
goto exit;
return_value = bytes_splitlines_impl(self, keepends);
exit:
return return_value;
}
PyDoc_STRVAR(bytes_fromhex__doc__,
"fromhex($type, string, /)\n"
"--\n"
"\n"
"Create a bytes object from a string of hexadecimal numbers.\n"
"\n"
"Spaces between two numbers are accepted.\n"
"Example: bytes.fromhex(\'B9 01EF\') -> b\'\\\\xb9\\\\x01\\\\xef\'.");
#define BYTES_FROMHEX_METHODDEF \
{"fromhex", (PyCFunction)bytes_fromhex, METH_VARARGS|METH_CLASS, bytes_fromhex__doc__},
static PyObject *
bytes_fromhex_impl(PyTypeObject *type, PyObject *string);
static PyObject *
bytes_fromhex(PyTypeObject *type, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *string;
if (!PyArg_ParseTuple(args,
"U:fromhex",
&string))
goto exit;
return_value = bytes_fromhex_impl(type, string);
exit:
return return_value;
}
/*[clinic end generated code: output=dfe5c9a317b99f49 input=a9049054013a1b77]*/

View File

@ -0,0 +1,42 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(dict_fromkeys__doc__,
"fromkeys($type, iterable, value=None, /)\n"
"--\n"
"\n"
"Returns a new dict with keys from iterable and values equal to value.");
#define DICT_FROMKEYS_METHODDEF \
{"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS|METH_CLASS, dict_fromkeys__doc__},
static PyObject *
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
static PyObject *
dict_fromkeys(PyTypeObject *type, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *iterable;
PyObject *value = Py_None;
if (!PyArg_UnpackTuple(args, "fromkeys",
1, 2,
&iterable, &value))
goto exit;
return_value = dict_fromkeys_impl(type, iterable, value);
exit:
return return_value;
}
PyDoc_STRVAR(dict___contains____doc__,
"__contains__($self, key, /)\n"
"--\n"
"\n"
"True if D has a key k, else False.");
#define DICT___CONTAINS___METHODDEF \
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
/*[clinic end generated code: output=fe74d676332fdba6 input=a9049054013a1b77]*/

View File

@ -0,0 +1,42 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(unicode_maketrans__doc__,
"maketrans(x, y=None, z=None, /)\n"
"--\n"
"\n"
"Return a translation table usable for str.translate().\n"
"\n"
"If there is only one argument, it must be a dictionary mapping Unicode\n"
"ordinals (integers) or characters to Unicode ordinals, strings or None.\n"
"Character keys will be then converted to ordinals.\n"
"If there are two arguments, they must be strings of equal length, and\n"
"in the resulting dictionary, each character in x will be mapped to the\n"
"character at the same position in y. If there is a third argument, it\n"
"must be a string, whose characters will be mapped to None in the result.");
#define UNICODE_MAKETRANS_METHODDEF \
{"maketrans", (PyCFunction)unicode_maketrans, METH_VARARGS|METH_STATIC, unicode_maketrans__doc__},
static PyObject *
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
static PyObject *
unicode_maketrans(void *null, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y = NULL;
PyObject *z = NULL;
if (!PyArg_ParseTuple(args,
"O|UU:maketrans",
&x, &y, &z))
goto exit;
return_value = unicode_maketrans_impl(x, y, z);
exit:
return return_value;
}
/*[clinic end generated code: output=4670413843c53055 input=a9049054013a1b77]*/

View File

@ -233,6 +233,8 @@ static int dictresize(PyDictObject *mp, Py_ssize_t minused);
static PyDictObject *free_list[PyDict_MAXFREELIST];
static int numfree = 0;
#include "clinic/dictobject.c.h"
int
PyDict_ClearFreeList(void)
{
@ -1757,38 +1759,9 @@ dict.fromkeys
Returns a new dict with keys from iterable and values equal to value.
[clinic start generated code]*/
PyDoc_STRVAR(dict_fromkeys__doc__,
"fromkeys($type, iterable, value=None, /)\n"
"--\n"
"\n"
"Returns a new dict with keys from iterable and values equal to value.");
#define DICT_FROMKEYS_METHODDEF \
{"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS|METH_CLASS, dict_fromkeys__doc__},
static PyObject *
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value);
static PyObject *
dict_fromkeys(PyTypeObject *type, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *iterable;
PyObject *value = Py_None;
if (!PyArg_UnpackTuple(args, "fromkeys",
1, 2,
&iterable, &value))
goto exit;
return_value = dict_fromkeys_impl(type, iterable, value);
exit:
return return_value;
}
static PyObject *
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value)
/*[clinic end generated code: output=55f8dc0ffa87406f input=b85a667f9bf4669d]*/
/*[clinic end generated code: output=8fb98e4b10384999 input=b85a667f9bf4669d]*/
{
PyObject *it; /* iter(seq) */
PyObject *key;
@ -2266,18 +2239,9 @@ dict.__contains__
True if D has a key k, else False.
[clinic start generated code]*/
PyDoc_STRVAR(dict___contains____doc__,
"__contains__($self, key, /)\n"
"--\n"
"\n"
"True if D has a key k, else False.");
#define DICT___CONTAINS___METHODDEF \
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
static PyObject *
dict___contains__(PyDictObject *self, PyObject *key)
/*[clinic end generated code: output=3cf3f8aaf2cc5cc3 input=b852b2a19b51ab24]*/
/*[clinic end generated code: output=a3d03db709ed6e6b input=b852b2a19b51ab24]*/
{
register PyDictObject *mp = self;
Py_hash_t hash;

View File

@ -290,6 +290,8 @@ static unsigned char ascii_linebreak[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
#include "clinic/unicodeobject.c.h"
/* The max unicode value is always 0x10FFFF while using the PEP-393 API.
This function is kept for backward compatibility with the old API. */
Py_UNICODE
@ -12955,47 +12957,9 @@ character at the same position in y. If there is a third argument, it
must be a string, whose characters will be mapped to None in the result.
[clinic start generated code]*/
PyDoc_STRVAR(unicode_maketrans__doc__,
"maketrans(x, y=None, z=None, /)\n"
"--\n"
"\n"
"Return a translation table usable for str.translate().\n"
"\n"
"If there is only one argument, it must be a dictionary mapping Unicode\n"
"ordinals (integers) or characters to Unicode ordinals, strings or None.\n"
"Character keys will be then converted to ordinals.\n"
"If there are two arguments, they must be strings of equal length, and\n"
"in the resulting dictionary, each character in x will be mapped to the\n"
"character at the same position in y. If there is a third argument, it\n"
"must be a string, whose characters will be mapped to None in the result.");
#define UNICODE_MAKETRANS_METHODDEF \
{"maketrans", (PyCFunction)unicode_maketrans, METH_VARARGS|METH_STATIC, unicode_maketrans__doc__},
static PyObject *
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z);
static PyObject *
unicode_maketrans(void *null, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y = NULL;
PyObject *z = NULL;
if (!PyArg_ParseTuple(args,
"O|UU:maketrans",
&x, &y, &z))
goto exit;
return_value = unicode_maketrans_impl(x, y, z);
exit:
return return_value;
}
static PyObject *
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z)
/*[clinic end generated code: output=566edf630f77436a input=7bfbf529a293c6c5]*/
/*[clinic end generated code: output=a925c89452bd5881 input=7bfbf529a293c6c5]*/
{
PyObject *new = NULL, *key, *value;
Py_ssize_t i = 0;

View File

@ -46,6 +46,8 @@ _Py_IDENTIFIER(stdin);
_Py_IDENTIFIER(stdout);
_Py_IDENTIFIER(stderr);
#include "clinic/bltinmodule.c.h"
/* AC: cannot convert yet, waiting for *args support */
static PyObject *
builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
@ -239,18 +241,9 @@ abs as builtin_abs
Return the absolute value of the argument.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_abs__doc__,
"abs($module, x, /)\n"
"--\n"
"\n"
"Return the absolute value of the argument.");
#define BUILTIN_ABS_METHODDEF \
{"abs", (PyCFunction)builtin_abs, METH_O, builtin_abs__doc__},
static PyObject *
builtin_abs(PyModuleDef *module, PyObject *x)
/*[clinic end generated code: output=f85095528ce7e2e5 input=aa29cc07869b4732]*/
/*[clinic end generated code: output=6833047c493ecea2 input=aa29cc07869b4732]*/
{
return PyNumber_Absolute(x);
}
@ -266,20 +259,9 @@ Return True if bool(x) is True for all values x in the iterable.
If the iterable is empty, return True.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_all__doc__,
"all($module, iterable, /)\n"
"--\n"
"\n"
"Return True if bool(x) is True for all values x in the iterable.\n"
"\n"
"If the iterable is empty, return True.");
#define BUILTIN_ALL_METHODDEF \
{"all", (PyCFunction)builtin_all, METH_O, builtin_all__doc__},
static PyObject *
builtin_all(PyModuleDef *module, PyObject *iterable)
/*[clinic end generated code: output=d001db739ba83b46 input=dd506dc9998d42bd]*/
/*[clinic end generated code: output=089e6d1b7bde27b1 input=dd506dc9998d42bd]*/
{
PyObject *it, *item;
PyObject *(*iternext)(PyObject *);
@ -326,20 +308,9 @@ Return True if bool(x) is True for any x in the iterable.
If the iterable is empty, return False.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_any__doc__,
"any($module, iterable, /)\n"
"--\n"
"\n"
"Return True if bool(x) is True for any x in the iterable.\n"
"\n"
"If the iterable is empty, return False.");
#define BUILTIN_ANY_METHODDEF \
{"any", (PyCFunction)builtin_any, METH_O, builtin_any__doc__},
static PyObject *
builtin_any(PyModuleDef *module, PyObject *iterable)
/*[clinic end generated code: output=3a4b6dbe6a0d6f61 input=8fe8460f3fbbced8]*/
/*[clinic end generated code: output=1be994b2c2307492 input=8fe8460f3fbbced8]*/
{
PyObject *it, *item;
PyObject *(*iternext)(PyObject *);
@ -389,23 +360,9 @@ repr() using \\x, \\u or \\U escapes. This generates a string similar
to that returned by repr() in Python 2.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_ascii__doc__,
"ascii($module, obj, /)\n"
"--\n"
"\n"
"Return an ASCII-only representation of an object.\n"
"\n"
"As repr(), return a string containing a printable representation of an\n"
"object, but escape the non-ASCII characters in the string returned by\n"
"repr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\n"
"to that returned by repr() in Python 2.");
#define BUILTIN_ASCII_METHODDEF \
{"ascii", (PyCFunction)builtin_ascii, METH_O, builtin_ascii__doc__},
static PyObject *
builtin_ascii(PyModuleDef *module, PyObject *obj)
/*[clinic end generated code: output=f0e6754154c2d30b input=0cbdc1420a306325]*/
/*[clinic end generated code: output=d4e862c48af2a933 input=0cbdc1420a306325]*/
{
return PyObject_ASCII(obj);
}
@ -423,21 +380,9 @@ Return the binary representation of an integer.
'0b1010101010101010101010'
[clinic start generated code]*/
PyDoc_STRVAR(builtin_bin__doc__,
"bin($module, number, /)\n"
"--\n"
"\n"
"Return the binary representation of an integer.\n"
"\n"
" >>> bin(2796202)\n"
" \'0b1010101010101010101010\'");
#define BUILTIN_BIN_METHODDEF \
{"bin", (PyCFunction)builtin_bin, METH_O, builtin_bin__doc__},
static PyObject *
builtin_bin(PyModuleDef *module, PyObject *number)
/*[clinic end generated code: output=18fed0e943650da1 input=2a6362ae9a9c9203]*/
/*[clinic end generated code: output=25ee26c6cf3bbb54 input=2a6362ae9a9c9203]*/
{
return PyNumber_ToBase(number, 2);
}
@ -455,21 +400,9 @@ Note that classes are callable, as are instances of classes with a
__call__() method.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_callable__doc__,
"callable($module, obj, /)\n"
"--\n"
"\n"
"Return whether the object is callable (i.e., some kind of function).\n"
"\n"
"Note that classes are callable, as are instances of classes with a\n"
"__call__() method.");
#define BUILTIN_CALLABLE_METHODDEF \
{"callable", (PyCFunction)builtin_callable, METH_O, builtin_callable__doc__},
static PyObject *
builtin_callable(PyModuleDef *module, PyObject *obj)
/*[clinic end generated code: output=b3a92cbe635f32af input=bb3bb528fffdade4]*/
/*[clinic end generated code: output=f4df2ce92364b656 input=bb3bb528fffdade4]*/
{
return PyBool_FromLong((long)PyCallable_Check(obj));
}
@ -640,40 +573,9 @@ Return value.__format__(format_spec)
format_spec defaults to the empty string
[clinic start generated code]*/
PyDoc_STRVAR(builtin_format__doc__,
"format($module, value, format_spec=\'\', /)\n"
"--\n"
"\n"
"Return value.__format__(format_spec)\n"
"\n"
"format_spec defaults to the empty string");
#define BUILTIN_FORMAT_METHODDEF \
{"format", (PyCFunction)builtin_format, METH_VARARGS, builtin_format__doc__},
static PyObject *
builtin_format_impl(PyModuleDef *module, PyObject *value, PyObject *format_spec);
static PyObject *
builtin_format(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *value;
PyObject *format_spec = NULL;
if (!PyArg_ParseTuple(args,
"O|U:format",
&value, &format_spec))
goto exit;
return_value = builtin_format_impl(module, value, format_spec);
exit:
return return_value;
}
static PyObject *
builtin_format_impl(PyModuleDef *module, PyObject *value, PyObject *format_spec)
/*[clinic end generated code: output=39723a58c72e8871 input=e23f2f11e0098c64]*/
/*[clinic end generated code: output=fae3e927cc715466 input=e23f2f11e0098c64]*/
{
return PyObject_Format(value, format_spec);
}
@ -687,37 +589,9 @@ chr as builtin_chr
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_chr__doc__,
"chr($module, i, /)\n"
"--\n"
"\n"
"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
#define BUILTIN_CHR_METHODDEF \
{"chr", (PyCFunction)builtin_chr, METH_VARARGS, builtin_chr__doc__},
static PyObject *
builtin_chr_impl(PyModuleDef *module, int i);
static PyObject *
builtin_chr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
int i;
if (!PyArg_ParseTuple(args,
"i:chr",
&i))
goto exit;
return_value = builtin_chr_impl(module, i);
exit:
return return_value;
}
static PyObject *
builtin_chr_impl(PyModuleDef *module, int i)
/*[clinic end generated code: output=4d6bbe948f56e2ae input=9b1ced29615adf66]*/
/*[clinic end generated code: output=67fe4d87e690f373 input=9b1ced29615adf66]*/
{
return PyUnicode_FromOrdinal(i);
}
@ -779,55 +653,9 @@ compile; if absent or zero these statements do influence the compilation,
in addition to any features explicitly specified.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_compile__doc__,
"compile($module, /, source, filename, mode, flags=0, dont_inherit=0,\n"
" optimize=-1)\n"
"--\n"
"\n"
"Compile source into a code object that can be executed by exec() or eval().\n"
"\n"
"The source code may represent a Python module, statement or expression.\n"
"The filename will be used for run-time error messages.\n"
"The mode must be \'exec\' to compile a module, \'single\' to compile a\n"
"single (interactive) statement, or \'eval\' to compile an expression.\n"
"The flags argument, if present, controls which future statements influence\n"
"the compilation of the code.\n"
"The dont_inherit argument, if non-zero, stops the compilation inheriting\n"
"the effects of any future statements in effect in the code calling\n"
"compile; if absent or zero these statements do influence the compilation,\n"
"in addition to any features explicitly specified.");
#define BUILTIN_COMPILE_METHODDEF \
{"compile", (PyCFunction)builtin_compile, METH_VARARGS|METH_KEYWORDS, builtin_compile__doc__},
static PyObject *
builtin_compile_impl(PyModuleDef *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, int optimize);
static PyObject *
builtin_compile(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", NULL};
PyObject *source;
PyObject *filename;
const char *mode;
int flags = 0;
int dont_inherit = 0;
int optimize = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"OO&s|iii:compile", _keywords,
&source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize))
goto exit;
return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize);
exit:
return return_value;
}
static PyObject *
builtin_compile_impl(PyModuleDef *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, int optimize)
/*[clinic end generated code: output=c72d197809d178fc input=c6212a9d21472f7e]*/
/*[clinic end generated code: output=4f41a315386bab9f input=c6212a9d21472f7e]*/
{
Py_buffer view = {NULL, NULL};
const char *str;
@ -951,38 +779,9 @@ divmod as builtin_divmod
Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_divmod__doc__,
"divmod($module, x, y, /)\n"
"--\n"
"\n"
"Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.");
#define BUILTIN_DIVMOD_METHODDEF \
{"divmod", (PyCFunction)builtin_divmod, METH_VARARGS, builtin_divmod__doc__},
static PyObject *
builtin_divmod_impl(PyModuleDef *module, PyObject *x, PyObject *y);
static PyObject *
builtin_divmod(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y;
if (!PyArg_UnpackTuple(args, "divmod",
2, 2,
&x, &y))
goto exit;
return_value = builtin_divmod_impl(module, x, y);
exit:
return return_value;
}
static PyObject *
builtin_divmod_impl(PyModuleDef *module, PyObject *x, PyObject *y)
/*[clinic end generated code: output=77e8d408b1338886 input=c9c617b7bb74c615]*/
/*[clinic end generated code: output=9ad0076120ebf9ac input=c9c617b7bb74c615]*/
{
return PyNumber_Divmod(x, y);
}
@ -1005,45 +804,9 @@ defaulting to the current globals and locals.
If only globals is given, locals defaults to it.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_eval__doc__,
"eval($module, source, globals=None, locals=None, /)\n"
"--\n"
"\n"
"Evaluate the given source in the context of globals and locals.\n"
"\n"
"The source may be a string representing a Python expression\n"
"or a code object as returned by compile().\n"
"The globals must be a dictionary and locals can be any mapping,\n"
"defaulting to the current globals and locals.\n"
"If only globals is given, locals defaults to it.");
#define BUILTIN_EVAL_METHODDEF \
{"eval", (PyCFunction)builtin_eval, METH_VARARGS, builtin_eval__doc__},
static PyObject *
builtin_eval_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals);
static PyObject *
builtin_eval(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *source;
PyObject *globals = Py_None;
PyObject *locals = Py_None;
if (!PyArg_UnpackTuple(args, "eval",
1, 3,
&source, &globals, &locals))
goto exit;
return_value = builtin_eval_impl(module, source, globals, locals);
exit:
return return_value;
}
static PyObject *
builtin_eval_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals)
/*[clinic end generated code: output=644fd59012538ce6 input=31e42c1d2125b50b]*/
/*[clinic end generated code: output=90642b79dd8b08d6 input=31e42c1d2125b50b]*/
{
PyObject *result, *tmp = NULL;
Py_buffer view = {NULL, NULL};
@ -1125,45 +888,9 @@ defaulting to the current globals and locals.
If only globals is given, locals defaults to it.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_exec__doc__,
"exec($module, source, globals=None, locals=None, /)\n"
"--\n"
"\n"
"Execute the given source in the context of globals and locals.\n"
"\n"
"The source may be a string representing one or more Python statements\n"
"or a code object as returned by compile().\n"
"The globals must be a dictionary and locals can be any mapping,\n"
"defaulting to the current globals and locals.\n"
"If only globals is given, locals defaults to it.");
#define BUILTIN_EXEC_METHODDEF \
{"exec", (PyCFunction)builtin_exec, METH_VARARGS, builtin_exec__doc__},
static PyObject *
builtin_exec_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals);
static PyObject *
builtin_exec(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *source;
PyObject *globals = Py_None;
PyObject *locals = Py_None;
if (!PyArg_UnpackTuple(args, "exec",
1, 3,
&source, &globals, &locals))
goto exit;
return_value = builtin_exec_impl(module, source, globals, locals);
exit:
return return_value;
}
static PyObject *
builtin_exec_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals)
/*[clinic end generated code: output=0281b48bfa8e3c87 input=536e057b5e00d89e]*/
/*[clinic end generated code: output=e8e0bbcde826a048 input=536e057b5e00d89e]*/
{
PyObject *v;
@ -1275,30 +1002,9 @@ NOTE: Updates to this dictionary *will* affect name lookups in the current
global scope and vice-versa.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_globals__doc__,
"globals($module, /)\n"
"--\n"
"\n"
"Return the dictionary containing the current scope\'s global variables.\n"
"\n"
"NOTE: Updates to this dictionary *will* affect name lookups in the current\n"
"global scope and vice-versa.");
#define BUILTIN_GLOBALS_METHODDEF \
{"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__},
static PyObject *
builtin_globals_impl(PyModuleDef *module);
static PyObject *
builtin_globals(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
return builtin_globals_impl(module);
}
static PyObject *
builtin_globals_impl(PyModuleDef *module)
/*[clinic end generated code: output=048640f58b1f20ad input=9327576f92bb48ba]*/
/*[clinic end generated code: output=4958645e96dd8138 input=9327576f92bb48ba]*/
{
PyObject *d;
@ -1320,40 +1026,9 @@ Return whether the object has an attribute with the given name.
This is done by calling getattr(obj, name) and catching AttributeError.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_hasattr__doc__,
"hasattr($module, obj, name, /)\n"
"--\n"
"\n"
"Return whether the object has an attribute with the given name.\n"
"\n"
"This is done by calling getattr(obj, name) and catching AttributeError.");
#define BUILTIN_HASATTR_METHODDEF \
{"hasattr", (PyCFunction)builtin_hasattr, METH_VARARGS, builtin_hasattr__doc__},
static PyObject *
builtin_hasattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name);
static PyObject *
builtin_hasattr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *name;
if (!PyArg_UnpackTuple(args, "hasattr",
2, 2,
&obj, &name))
goto exit;
return_value = builtin_hasattr_impl(module, obj, name);
exit:
return return_value;
}
static PyObject *
builtin_hasattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name)
/*[clinic end generated code: output=e0bd996ef73d1217 input=b50bad5f739ea10d]*/
/*[clinic end generated code: output=81154fdd63634696 input=b50bad5f739ea10d]*/
{
PyObject *v;
@ -1392,21 +1067,9 @@ This is guaranteed to be unique among simultaneously existing objects.
(CPython uses the object's memory address.)
[clinic start generated code]*/
PyDoc_STRVAR(builtin_id__doc__,
"id($module, obj, /)\n"
"--\n"
"\n"
"Return the identity of an object.\n"
"\n"
"This is guaranteed to be unique among simultaneously existing objects.\n"
"(CPython uses the object\'s memory address.)");
#define BUILTIN_ID_METHODDEF \
{"id", (PyCFunction)builtin_id, METH_O, builtin_id__doc__},
static PyObject *
builtin_id(PyModuleDef *self, PyObject *v)
/*[clinic end generated code: output=f54da09c91992e63 input=a1f988d98357341d]*/
/*[clinic end generated code: output=0aa640785f697f65 input=a1f988d98357341d]*/
{
return PyLong_FromVoidPtr(v);
}
@ -1639,41 +1302,9 @@ Sets the named attribute on the given object to the specified value.
setattr(x, 'y', v) is equivalent to ``x.y = v''
[clinic start generated code]*/
PyDoc_STRVAR(builtin_setattr__doc__,
"setattr($module, obj, name, value, /)\n"
"--\n"
"\n"
"Sets the named attribute on the given object to the specified value.\n"
"\n"
"setattr(x, \'y\', v) is equivalent to ``x.y = v\'\'");
#define BUILTIN_SETATTR_METHODDEF \
{"setattr", (PyCFunction)builtin_setattr, METH_VARARGS, builtin_setattr__doc__},
static PyObject *
builtin_setattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name, PyObject *value);
static PyObject *
builtin_setattr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *name;
PyObject *value;
if (!PyArg_UnpackTuple(args, "setattr",
3, 3,
&obj, &name, &value))
goto exit;
return_value = builtin_setattr_impl(module, obj, name, value);
exit:
return return_value;
}
static PyObject *
builtin_setattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name, PyObject *value)
/*[clinic end generated code: output=4336dcbbf7691d2d input=fbe7e53403116b93]*/
/*[clinic end generated code: output=c5e0a3a3971333ed input=fbe7e53403116b93]*/
{
if (PyObject_SetAttr(obj, name, value) != 0)
return NULL;
@ -1694,40 +1325,9 @@ Deletes the named attribute from the given object.
delattr(x, 'y') is equivalent to ``del x.y''
[clinic start generated code]*/
PyDoc_STRVAR(builtin_delattr__doc__,
"delattr($module, obj, name, /)\n"
"--\n"
"\n"
"Deletes the named attribute from the given object.\n"
"\n"
"delattr(x, \'y\') is equivalent to ``del x.y\'\'");
#define BUILTIN_DELATTR_METHODDEF \
{"delattr", (PyCFunction)builtin_delattr, METH_VARARGS, builtin_delattr__doc__},
static PyObject *
builtin_delattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name);
static PyObject *
builtin_delattr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *name;
if (!PyArg_UnpackTuple(args, "delattr",
2, 2,
&obj, &name))
goto exit;
return_value = builtin_delattr_impl(module, obj, name);
exit:
return return_value;
}
static PyObject *
builtin_delattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name)
/*[clinic end generated code: output=319c2d884aa769cf input=647af2ce9183a823]*/
/*[clinic end generated code: output=ef653e698a0b4187 input=647af2ce9183a823]*/
{
if (PyObject_SetAttr(obj, name, (PyObject *)NULL) != 0)
return NULL;
@ -1748,21 +1348,9 @@ Two objects that compare equal must also have the same hash value, but the
reverse is not necessarily true.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_hash__doc__,
"hash($module, obj, /)\n"
"--\n"
"\n"
"Return the hash value for the given object.\n"
"\n"
"Two objects that compare equal must also have the same hash value, but the\n"
"reverse is not necessarily true.");
#define BUILTIN_HASH_METHODDEF \
{"hash", (PyCFunction)builtin_hash, METH_O, builtin_hash__doc__},
static PyObject *
builtin_hash(PyModuleDef *module, PyObject *obj)
/*[clinic end generated code: output=1ec467611c13468b input=ccc4d2b9a351df4e]*/
/*[clinic end generated code: output=1f32ff154c1f751a input=ccc4d2b9a351df4e]*/
{
Py_hash_t x;
@ -1785,21 +1373,9 @@ Return the hexadecimal representation of an integer.
'0xc0ffee'
[clinic start generated code]*/
PyDoc_STRVAR(builtin_hex__doc__,
"hex($module, number, /)\n"
"--\n"
"\n"
"Return the hexadecimal representation of an integer.\n"
"\n"
" >>> hex(12648430)\n"
" \'0xc0ffee\'");
#define BUILTIN_HEX_METHODDEF \
{"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__},
static PyObject *
builtin_hex(PyModuleDef *module, PyObject *number)
/*[clinic end generated code: output=f18e9439aeaa2c6c input=e816200b0a728ebe]*/
/*[clinic end generated code: output=618489ce3cbc5858 input=e816200b0a728ebe]*/
{
return PyNumber_ToBase(number, 16);
}
@ -1841,18 +1417,9 @@ len as builtin_len
Return the number of items in a container.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_len__doc__,
"len($module, obj, /)\n"
"--\n"
"\n"
"Return the number of items in a container.");
#define BUILTIN_LEN_METHODDEF \
{"len", (PyCFunction)builtin_len, METH_O, builtin_len__doc__},
static PyObject *
builtin_len(PyModuleDef *module, PyObject *obj)
/*[clinic end generated code: output=5a38b0db40761705 input=2e5ff15db9a2de22]*/
/*[clinic end generated code: output=8e5837b6f81d915b input=2e5ff15db9a2de22]*/
{
Py_ssize_t res;
@ -1873,31 +1440,9 @@ the local scope and vice-versa is *implementation dependent* and not
covered by any backwards compatibility guarantees.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_locals__doc__,
"locals($module, /)\n"
"--\n"
"\n"
"Return a dictionary containing the current scope\'s local variables.\n"
"\n"
"NOTE: Whether or not updates to this dictionary will affect name lookups in\n"
"the local scope and vice-versa is *implementation dependent* and not\n"
"covered by any backwards compatibility guarantees.");
#define BUILTIN_LOCALS_METHODDEF \
{"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__},
static PyObject *
builtin_locals_impl(PyModuleDef *module);
static PyObject *
builtin_locals(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
return builtin_locals_impl(module);
}
static PyObject *
builtin_locals_impl(PyModuleDef *module)
/*[clinic end generated code: output=8ac52522924346e2 input=7874018d478d5c4b]*/
/*[clinic end generated code: output=8b5a41f12e19d13a input=7874018d478d5c4b]*/
{
PyObject *d;
@ -2054,21 +1599,9 @@ Return the octal representation of an integer.
'0o1234567'
[clinic start generated code]*/
PyDoc_STRVAR(builtin_oct__doc__,
"oct($module, number, /)\n"
"--\n"
"\n"
"Return the octal representation of an integer.\n"
"\n"
" >>> oct(342391)\n"
" \'0o1234567\'");
#define BUILTIN_OCT_METHODDEF \
{"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__},
static PyObject *
builtin_oct(PyModuleDef *module, PyObject *number)
/*[clinic end generated code: output=b99234d1d70a6673 input=a3a372b521b3dd13]*/
/*[clinic end generated code: output=18f701bc6d8f804a input=a3a372b521b3dd13]*/
{
return PyNumber_ToBase(number, 8);
}
@ -2083,18 +1616,9 @@ ord as builtin_ord
Return the Unicode code point for a one-character string.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_ord__doc__,
"ord($module, c, /)\n"
"--\n"
"\n"
"Return the Unicode code point for a one-character string.");
#define BUILTIN_ORD_METHODDEF \
{"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__},
static PyObject *
builtin_ord(PyModuleDef *module, PyObject *c)
/*[clinic end generated code: output=a8466d23bd76db3f input=762355f87451efa3]*/
/*[clinic end generated code: output=04fd27272d9462f6 input=762355f87451efa3]*/
{
long ord;
Py_ssize_t size;
@ -2152,42 +1676,9 @@ Some types, such as ints, are able to use a more efficient algorithm when
invoked using the three argument form.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_pow__doc__,
"pow($module, x, y, z=None, /)\n"
"--\n"
"\n"
"Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n"
"\n"
"Some types, such as ints, are able to use a more efficient algorithm when\n"
"invoked using the three argument form.");
#define BUILTIN_POW_METHODDEF \
{"pow", (PyCFunction)builtin_pow, METH_VARARGS, builtin_pow__doc__},
static PyObject *
builtin_pow_impl(PyModuleDef *module, PyObject *x, PyObject *y, PyObject *z);
static PyObject *
builtin_pow(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y;
PyObject *z = Py_None;
if (!PyArg_UnpackTuple(args, "pow",
2, 3,
&x, &y, &z))
goto exit;
return_value = builtin_pow_impl(module, x, y, z);
exit:
return return_value;
}
static PyObject *
builtin_pow_impl(PyModuleDef *module, PyObject *x, PyObject *y, PyObject *z)
/*[clinic end generated code: output=d0cdf314311dedba input=561a942d5f5c1899]*/
/*[clinic end generated code: output=1fba268adba9b45f input=561a942d5f5c1899]*/
{
return PyNumber_Power(x, y, z);
}
@ -2304,43 +1795,9 @@ If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.
On *nix systems, readline is used if available.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_input__doc__,
"input($module, prompt=None, /)\n"
"--\n"
"\n"
"Read a string from standard input. The trailing newline is stripped.\n"
"\n"
"The prompt string, if given, is printed to standard output without a\n"
"trailing newline before reading input.\n"
"\n"
"If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\n"
"On *nix systems, readline is used if available.");
#define BUILTIN_INPUT_METHODDEF \
{"input", (PyCFunction)builtin_input, METH_VARARGS, builtin_input__doc__},
static PyObject *
builtin_input_impl(PyModuleDef *module, PyObject *prompt);
static PyObject *
builtin_input(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *prompt = NULL;
if (!PyArg_UnpackTuple(args, "input",
0, 1,
&prompt))
goto exit;
return_value = builtin_input_impl(module, prompt);
exit:
return return_value;
}
static PyObject *
builtin_input_impl(PyModuleDef *module, PyObject *prompt)
/*[clinic end generated code: output=69323bf5695f7c9c input=5e8bb70c2908fe3c]*/
/*[clinic end generated code: output=b77731f59e1515c4 input=5e8bb70c2908fe3c]*/
{
PyObject *fin = _PySys_GetObjectId(&PyId_stdin);
PyObject *fout = _PySys_GetObjectId(&PyId_stdout);
@ -2523,20 +1980,9 @@ Return the canonical string representation of the object.
For many object types, including most builtins, eval(repr(obj)) == obj.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_repr__doc__,
"repr($module, obj, /)\n"
"--\n"
"\n"
"Return the canonical string representation of the object.\n"
"\n"
"For many object types, including most builtins, eval(repr(obj)) == obj.");
#define BUILTIN_REPR_METHODDEF \
{"repr", (PyCFunction)builtin_repr, METH_O, builtin_repr__doc__},
static PyObject *
builtin_repr(PyModuleDef *module, PyObject *obj)
/*[clinic end generated code: output=988980120f39e2fa input=a2bca0f38a5a924d]*/
/*[clinic end generated code: output=dc41784fa4341834 input=a2bca0f38a5a924d]*/
{
return PyObject_Repr(obj);
}
@ -2704,42 +2150,9 @@ This function is intended specifically for use with numeric values and may
reject non-numeric types.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_sum__doc__,
"sum($module, iterable, start=0, /)\n"
"--\n"
"\n"
"Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n"
"\n"
"When the iterable is empty, return the start value.\n"
"This function is intended specifically for use with numeric values and may\n"
"reject non-numeric types.");
#define BUILTIN_SUM_METHODDEF \
{"sum", (PyCFunction)builtin_sum, METH_VARARGS, builtin_sum__doc__},
static PyObject *
builtin_sum_impl(PyModuleDef *module, PyObject *iterable, PyObject *start);
static PyObject *
builtin_sum(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *iterable;
PyObject *start = NULL;
if (!PyArg_UnpackTuple(args, "sum",
1, 2,
&iterable, &start))
goto exit;
return_value = builtin_sum_impl(module, iterable, start);
exit:
return return_value;
}
static PyObject *
builtin_sum_impl(PyModuleDef *module, PyObject *iterable, PyObject *start)
/*[clinic end generated code: output=b42652a0d5f64f6b input=90ae7a242cfcf025]*/
/*[clinic end generated code: output=33655b248b21d581 input=90ae7a242cfcf025]*/
{
PyObject *result = start;
PyObject *temp, *item, *iter;
@ -2914,42 +2327,9 @@ check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)
or ...`` etc.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_isinstance__doc__,
"isinstance($module, obj, class_or_tuple, /)\n"
"--\n"
"\n"
"Return whether an object is an instance of a class or of a subclass thereof.\n"
"\n"
"A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\n"
"check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\n"
"or ...`` etc.");
#define BUILTIN_ISINSTANCE_METHODDEF \
{"isinstance", (PyCFunction)builtin_isinstance, METH_VARARGS, builtin_isinstance__doc__},
static PyObject *
builtin_isinstance_impl(PyModuleDef *module, PyObject *obj, PyObject *class_or_tuple);
static PyObject *
builtin_isinstance(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *class_or_tuple;
if (!PyArg_UnpackTuple(args, "isinstance",
2, 2,
&obj, &class_or_tuple))
goto exit;
return_value = builtin_isinstance_impl(module, obj, class_or_tuple);
exit:
return return_value;
}
static PyObject *
builtin_isinstance_impl(PyModuleDef *module, PyObject *obj, PyObject *class_or_tuple)
/*[clinic end generated code: output=847df57fef8ddea7 input=cf9eb0ad6bb9bad6]*/
/*[clinic end generated code: output=5e234dc3872d75a2 input=cf9eb0ad6bb9bad6]*/
{
int retval;
@ -2974,42 +2354,9 @@ check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)
or ...`` etc.
[clinic start generated code]*/
PyDoc_STRVAR(builtin_issubclass__doc__,
"issubclass($module, cls, class_or_tuple, /)\n"
"--\n"
"\n"
"Return whether \'cls\' is a derived from another class or is the same class.\n"
"\n"
"A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n"
"check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n"
"or ...`` etc.");
#define BUILTIN_ISSUBCLASS_METHODDEF \
{"issubclass", (PyCFunction)builtin_issubclass, METH_VARARGS, builtin_issubclass__doc__},
static PyObject *
builtin_issubclass_impl(PyModuleDef *module, PyObject *cls, PyObject *class_or_tuple);
static PyObject *
builtin_issubclass(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *cls;
PyObject *class_or_tuple;
if (!PyArg_UnpackTuple(args, "issubclass",
2, 2,
&cls, &class_or_tuple))
goto exit;
return_value = builtin_issubclass_impl(module, cls, class_or_tuple);
exit:
return return_value;
}
static PyObject *
builtin_issubclass_impl(PyModuleDef *module, PyObject *cls, PyObject *class_or_tuple)
/*[clinic end generated code: output=a0f8c03692e35474 input=923d03fa41fc352a]*/
/*[clinic end generated code: output=6346a85ba15dbd7d input=923d03fa41fc352a]*/
{
int retval;

View File

@ -0,0 +1,659 @@
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(builtin_abs__doc__,
"abs($module, x, /)\n"
"--\n"
"\n"
"Return the absolute value of the argument.");
#define BUILTIN_ABS_METHODDEF \
{"abs", (PyCFunction)builtin_abs, METH_O, builtin_abs__doc__},
PyDoc_STRVAR(builtin_all__doc__,
"all($module, iterable, /)\n"
"--\n"
"\n"
"Return True if bool(x) is True for all values x in the iterable.\n"
"\n"
"If the iterable is empty, return True.");
#define BUILTIN_ALL_METHODDEF \
{"all", (PyCFunction)builtin_all, METH_O, builtin_all__doc__},
PyDoc_STRVAR(builtin_any__doc__,
"any($module, iterable, /)\n"
"--\n"
"\n"
"Return True if bool(x) is True for any x in the iterable.\n"
"\n"
"If the iterable is empty, return False.");
#define BUILTIN_ANY_METHODDEF \
{"any", (PyCFunction)builtin_any, METH_O, builtin_any__doc__},
PyDoc_STRVAR(builtin_ascii__doc__,
"ascii($module, obj, /)\n"
"--\n"
"\n"
"Return an ASCII-only representation of an object.\n"
"\n"
"As repr(), return a string containing a printable representation of an\n"
"object, but escape the non-ASCII characters in the string returned by\n"
"repr() using \\\\x, \\\\u or \\\\U escapes. This generates a string similar\n"
"to that returned by repr() in Python 2.");
#define BUILTIN_ASCII_METHODDEF \
{"ascii", (PyCFunction)builtin_ascii, METH_O, builtin_ascii__doc__},
PyDoc_STRVAR(builtin_bin__doc__,
"bin($module, number, /)\n"
"--\n"
"\n"
"Return the binary representation of an integer.\n"
"\n"
" >>> bin(2796202)\n"
" \'0b1010101010101010101010\'");
#define BUILTIN_BIN_METHODDEF \
{"bin", (PyCFunction)builtin_bin, METH_O, builtin_bin__doc__},
PyDoc_STRVAR(builtin_callable__doc__,
"callable($module, obj, /)\n"
"--\n"
"\n"
"Return whether the object is callable (i.e., some kind of function).\n"
"\n"
"Note that classes are callable, as are instances of classes with a\n"
"__call__() method.");
#define BUILTIN_CALLABLE_METHODDEF \
{"callable", (PyCFunction)builtin_callable, METH_O, builtin_callable__doc__},
PyDoc_STRVAR(builtin_format__doc__,
"format($module, value, format_spec=\'\', /)\n"
"--\n"
"\n"
"Return value.__format__(format_spec)\n"
"\n"
"format_spec defaults to the empty string");
#define BUILTIN_FORMAT_METHODDEF \
{"format", (PyCFunction)builtin_format, METH_VARARGS, builtin_format__doc__},
static PyObject *
builtin_format_impl(PyModuleDef *module, PyObject *value, PyObject *format_spec);
static PyObject *
builtin_format(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *value;
PyObject *format_spec = NULL;
if (!PyArg_ParseTuple(args,
"O|U:format",
&value, &format_spec))
goto exit;
return_value = builtin_format_impl(module, value, format_spec);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_chr__doc__,
"chr($module, i, /)\n"
"--\n"
"\n"
"Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.");
#define BUILTIN_CHR_METHODDEF \
{"chr", (PyCFunction)builtin_chr, METH_VARARGS, builtin_chr__doc__},
static PyObject *
builtin_chr_impl(PyModuleDef *module, int i);
static PyObject *
builtin_chr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
int i;
if (!PyArg_ParseTuple(args,
"i:chr",
&i))
goto exit;
return_value = builtin_chr_impl(module, i);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_compile__doc__,
"compile($module, /, source, filename, mode, flags=0, dont_inherit=0,\n"
" optimize=-1)\n"
"--\n"
"\n"
"Compile source into a code object that can be executed by exec() or eval().\n"
"\n"
"The source code may represent a Python module, statement or expression.\n"
"The filename will be used for run-time error messages.\n"
"The mode must be \'exec\' to compile a module, \'single\' to compile a\n"
"single (interactive) statement, or \'eval\' to compile an expression.\n"
"The flags argument, if present, controls which future statements influence\n"
"the compilation of the code.\n"
"The dont_inherit argument, if non-zero, stops the compilation inheriting\n"
"the effects of any future statements in effect in the code calling\n"
"compile; if absent or zero these statements do influence the compilation,\n"
"in addition to any features explicitly specified.");
#define BUILTIN_COMPILE_METHODDEF \
{"compile", (PyCFunction)builtin_compile, METH_VARARGS|METH_KEYWORDS, builtin_compile__doc__},
static PyObject *
builtin_compile_impl(PyModuleDef *module, PyObject *source, PyObject *filename, const char *mode, int flags, int dont_inherit, int optimize);
static PyObject *
builtin_compile(PyModuleDef *module, PyObject *args, PyObject *kwargs)
{
PyObject *return_value = NULL;
static char *_keywords[] = {"source", "filename", "mode", "flags", "dont_inherit", "optimize", NULL};
PyObject *source;
PyObject *filename;
const char *mode;
int flags = 0;
int dont_inherit = 0;
int optimize = -1;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"OO&s|iii:compile", _keywords,
&source, PyUnicode_FSDecoder, &filename, &mode, &flags, &dont_inherit, &optimize))
goto exit;
return_value = builtin_compile_impl(module, source, filename, mode, flags, dont_inherit, optimize);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_divmod__doc__,
"divmod($module, x, y, /)\n"
"--\n"
"\n"
"Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x.");
#define BUILTIN_DIVMOD_METHODDEF \
{"divmod", (PyCFunction)builtin_divmod, METH_VARARGS, builtin_divmod__doc__},
static PyObject *
builtin_divmod_impl(PyModuleDef *module, PyObject *x, PyObject *y);
static PyObject *
builtin_divmod(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y;
if (!PyArg_UnpackTuple(args, "divmod",
2, 2,
&x, &y))
goto exit;
return_value = builtin_divmod_impl(module, x, y);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_eval__doc__,
"eval($module, source, globals=None, locals=None, /)\n"
"--\n"
"\n"
"Evaluate the given source in the context of globals and locals.\n"
"\n"
"The source may be a string representing a Python expression\n"
"or a code object as returned by compile().\n"
"The globals must be a dictionary and locals can be any mapping,\n"
"defaulting to the current globals and locals.\n"
"If only globals is given, locals defaults to it.");
#define BUILTIN_EVAL_METHODDEF \
{"eval", (PyCFunction)builtin_eval, METH_VARARGS, builtin_eval__doc__},
static PyObject *
builtin_eval_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals);
static PyObject *
builtin_eval(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *source;
PyObject *globals = Py_None;
PyObject *locals = Py_None;
if (!PyArg_UnpackTuple(args, "eval",
1, 3,
&source, &globals, &locals))
goto exit;
return_value = builtin_eval_impl(module, source, globals, locals);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_exec__doc__,
"exec($module, source, globals=None, locals=None, /)\n"
"--\n"
"\n"
"Execute the given source in the context of globals and locals.\n"
"\n"
"The source may be a string representing one or more Python statements\n"
"or a code object as returned by compile().\n"
"The globals must be a dictionary and locals can be any mapping,\n"
"defaulting to the current globals and locals.\n"
"If only globals is given, locals defaults to it.");
#define BUILTIN_EXEC_METHODDEF \
{"exec", (PyCFunction)builtin_exec, METH_VARARGS, builtin_exec__doc__},
static PyObject *
builtin_exec_impl(PyModuleDef *module, PyObject *source, PyObject *globals, PyObject *locals);
static PyObject *
builtin_exec(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *source;
PyObject *globals = Py_None;
PyObject *locals = Py_None;
if (!PyArg_UnpackTuple(args, "exec",
1, 3,
&source, &globals, &locals))
goto exit;
return_value = builtin_exec_impl(module, source, globals, locals);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_globals__doc__,
"globals($module, /)\n"
"--\n"
"\n"
"Return the dictionary containing the current scope\'s global variables.\n"
"\n"
"NOTE: Updates to this dictionary *will* affect name lookups in the current\n"
"global scope and vice-versa.");
#define BUILTIN_GLOBALS_METHODDEF \
{"globals", (PyCFunction)builtin_globals, METH_NOARGS, builtin_globals__doc__},
static PyObject *
builtin_globals_impl(PyModuleDef *module);
static PyObject *
builtin_globals(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
return builtin_globals_impl(module);
}
PyDoc_STRVAR(builtin_hasattr__doc__,
"hasattr($module, obj, name, /)\n"
"--\n"
"\n"
"Return whether the object has an attribute with the given name.\n"
"\n"
"This is done by calling getattr(obj, name) and catching AttributeError.");
#define BUILTIN_HASATTR_METHODDEF \
{"hasattr", (PyCFunction)builtin_hasattr, METH_VARARGS, builtin_hasattr__doc__},
static PyObject *
builtin_hasattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name);
static PyObject *
builtin_hasattr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *name;
if (!PyArg_UnpackTuple(args, "hasattr",
2, 2,
&obj, &name))
goto exit;
return_value = builtin_hasattr_impl(module, obj, name);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_id__doc__,
"id($module, obj, /)\n"
"--\n"
"\n"
"Return the identity of an object.\n"
"\n"
"This is guaranteed to be unique among simultaneously existing objects.\n"
"(CPython uses the object\'s memory address.)");
#define BUILTIN_ID_METHODDEF \
{"id", (PyCFunction)builtin_id, METH_O, builtin_id__doc__},
PyDoc_STRVAR(builtin_setattr__doc__,
"setattr($module, obj, name, value, /)\n"
"--\n"
"\n"
"Sets the named attribute on the given object to the specified value.\n"
"\n"
"setattr(x, \'y\', v) is equivalent to ``x.y = v\'\'");
#define BUILTIN_SETATTR_METHODDEF \
{"setattr", (PyCFunction)builtin_setattr, METH_VARARGS, builtin_setattr__doc__},
static PyObject *
builtin_setattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name, PyObject *value);
static PyObject *
builtin_setattr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *name;
PyObject *value;
if (!PyArg_UnpackTuple(args, "setattr",
3, 3,
&obj, &name, &value))
goto exit;
return_value = builtin_setattr_impl(module, obj, name, value);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_delattr__doc__,
"delattr($module, obj, name, /)\n"
"--\n"
"\n"
"Deletes the named attribute from the given object.\n"
"\n"
"delattr(x, \'y\') is equivalent to ``del x.y\'\'");
#define BUILTIN_DELATTR_METHODDEF \
{"delattr", (PyCFunction)builtin_delattr, METH_VARARGS, builtin_delattr__doc__},
static PyObject *
builtin_delattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name);
static PyObject *
builtin_delattr(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *name;
if (!PyArg_UnpackTuple(args, "delattr",
2, 2,
&obj, &name))
goto exit;
return_value = builtin_delattr_impl(module, obj, name);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_hash__doc__,
"hash($module, obj, /)\n"
"--\n"
"\n"
"Return the hash value for the given object.\n"
"\n"
"Two objects that compare equal must also have the same hash value, but the\n"
"reverse is not necessarily true.");
#define BUILTIN_HASH_METHODDEF \
{"hash", (PyCFunction)builtin_hash, METH_O, builtin_hash__doc__},
PyDoc_STRVAR(builtin_hex__doc__,
"hex($module, number, /)\n"
"--\n"
"\n"
"Return the hexadecimal representation of an integer.\n"
"\n"
" >>> hex(12648430)\n"
" \'0xc0ffee\'");
#define BUILTIN_HEX_METHODDEF \
{"hex", (PyCFunction)builtin_hex, METH_O, builtin_hex__doc__},
PyDoc_STRVAR(builtin_len__doc__,
"len($module, obj, /)\n"
"--\n"
"\n"
"Return the number of items in a container.");
#define BUILTIN_LEN_METHODDEF \
{"len", (PyCFunction)builtin_len, METH_O, builtin_len__doc__},
PyDoc_STRVAR(builtin_locals__doc__,
"locals($module, /)\n"
"--\n"
"\n"
"Return a dictionary containing the current scope\'s local variables.\n"
"\n"
"NOTE: Whether or not updates to this dictionary will affect name lookups in\n"
"the local scope and vice-versa is *implementation dependent* and not\n"
"covered by any backwards compatibility guarantees.");
#define BUILTIN_LOCALS_METHODDEF \
{"locals", (PyCFunction)builtin_locals, METH_NOARGS, builtin_locals__doc__},
static PyObject *
builtin_locals_impl(PyModuleDef *module);
static PyObject *
builtin_locals(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
{
return builtin_locals_impl(module);
}
PyDoc_STRVAR(builtin_oct__doc__,
"oct($module, number, /)\n"
"--\n"
"\n"
"Return the octal representation of an integer.\n"
"\n"
" >>> oct(342391)\n"
" \'0o1234567\'");
#define BUILTIN_OCT_METHODDEF \
{"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__},
PyDoc_STRVAR(builtin_ord__doc__,
"ord($module, c, /)\n"
"--\n"
"\n"
"Return the Unicode code point for a one-character string.");
#define BUILTIN_ORD_METHODDEF \
{"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__},
PyDoc_STRVAR(builtin_pow__doc__,
"pow($module, x, y, z=None, /)\n"
"--\n"
"\n"
"Equivalent to x**y (with two arguments) or x**y % z (with three arguments)\n"
"\n"
"Some types, such as ints, are able to use a more efficient algorithm when\n"
"invoked using the three argument form.");
#define BUILTIN_POW_METHODDEF \
{"pow", (PyCFunction)builtin_pow, METH_VARARGS, builtin_pow__doc__},
static PyObject *
builtin_pow_impl(PyModuleDef *module, PyObject *x, PyObject *y, PyObject *z);
static PyObject *
builtin_pow(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *x;
PyObject *y;
PyObject *z = Py_None;
if (!PyArg_UnpackTuple(args, "pow",
2, 3,
&x, &y, &z))
goto exit;
return_value = builtin_pow_impl(module, x, y, z);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_input__doc__,
"input($module, prompt=None, /)\n"
"--\n"
"\n"
"Read a string from standard input. The trailing newline is stripped.\n"
"\n"
"The prompt string, if given, is printed to standard output without a\n"
"trailing newline before reading input.\n"
"\n"
"If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.\n"
"On *nix systems, readline is used if available.");
#define BUILTIN_INPUT_METHODDEF \
{"input", (PyCFunction)builtin_input, METH_VARARGS, builtin_input__doc__},
static PyObject *
builtin_input_impl(PyModuleDef *module, PyObject *prompt);
static PyObject *
builtin_input(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *prompt = NULL;
if (!PyArg_UnpackTuple(args, "input",
0, 1,
&prompt))
goto exit;
return_value = builtin_input_impl(module, prompt);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_repr__doc__,
"repr($module, obj, /)\n"
"--\n"
"\n"
"Return the canonical string representation of the object.\n"
"\n"
"For many object types, including most builtins, eval(repr(obj)) == obj.");
#define BUILTIN_REPR_METHODDEF \
{"repr", (PyCFunction)builtin_repr, METH_O, builtin_repr__doc__},
PyDoc_STRVAR(builtin_sum__doc__,
"sum($module, iterable, start=0, /)\n"
"--\n"
"\n"
"Return the sum of a \'start\' value (default: 0) plus an iterable of numbers\n"
"\n"
"When the iterable is empty, return the start value.\n"
"This function is intended specifically for use with numeric values and may\n"
"reject non-numeric types.");
#define BUILTIN_SUM_METHODDEF \
{"sum", (PyCFunction)builtin_sum, METH_VARARGS, builtin_sum__doc__},
static PyObject *
builtin_sum_impl(PyModuleDef *module, PyObject *iterable, PyObject *start);
static PyObject *
builtin_sum(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *iterable;
PyObject *start = NULL;
if (!PyArg_UnpackTuple(args, "sum",
1, 2,
&iterable, &start))
goto exit;
return_value = builtin_sum_impl(module, iterable, start);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_isinstance__doc__,
"isinstance($module, obj, class_or_tuple, /)\n"
"--\n"
"\n"
"Return whether an object is an instance of a class or of a subclass thereof.\n"
"\n"
"A tuple, as in ``isinstance(x, (A, B, ...))``, may be given as the target to\n"
"check against. This is equivalent to ``isinstance(x, A) or isinstance(x, B)\n"
"or ...`` etc.");
#define BUILTIN_ISINSTANCE_METHODDEF \
{"isinstance", (PyCFunction)builtin_isinstance, METH_VARARGS, builtin_isinstance__doc__},
static PyObject *
builtin_isinstance_impl(PyModuleDef *module, PyObject *obj, PyObject *class_or_tuple);
static PyObject *
builtin_isinstance(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *obj;
PyObject *class_or_tuple;
if (!PyArg_UnpackTuple(args, "isinstance",
2, 2,
&obj, &class_or_tuple))
goto exit;
return_value = builtin_isinstance_impl(module, obj, class_or_tuple);
exit:
return return_value;
}
PyDoc_STRVAR(builtin_issubclass__doc__,
"issubclass($module, cls, class_or_tuple, /)\n"
"--\n"
"\n"
"Return whether \'cls\' is a derived from another class or is the same class.\n"
"\n"
"A tuple, as in ``issubclass(x, (A, B, ...))``, may be given as the target to\n"
"check against. This is equivalent to ``issubclass(x, A) or issubclass(x, B)\n"
"or ...`` etc.");
#define BUILTIN_ISSUBCLASS_METHODDEF \
{"issubclass", (PyCFunction)builtin_issubclass, METH_VARARGS, builtin_issubclass__doc__},
static PyObject *
builtin_issubclass_impl(PyModuleDef *module, PyObject *cls, PyObject *class_or_tuple);
static PyObject *
builtin_issubclass(PyModuleDef *module, PyObject *args)
{
PyObject *return_value = NULL;
PyObject *cls;
PyObject *class_or_tuple;
if (!PyArg_UnpackTuple(args, "issubclass",
2, 2,
&cls, &class_or_tuple))
goto exit;
return_value = builtin_issubclass_impl(module, cls, class_or_tuple);
exit:
return return_value;
}
/*[clinic end generated code: output=2da46de189e48d26 input=a9049054013a1b77]*/

View File

@ -32,10 +32,9 @@ struct _inittab *PyImport_Inittab = _PyImport_Inittab;
static PyObject *initstr = NULL;
/*[clinic input]
output preset file
module _imp
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=98c38221164579d5]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=9c332475d8686284]*/
#include "clinic/import.c.h"

View File

@ -1590,15 +1590,15 @@ impl_definition block
d = self.get_destination_buffer
self.destination_buffers = collections.OrderedDict((
('cpp_if', d('suppress')),
('cpp_if', d('file')),
('docstring_prototype', d('suppress')),
('docstring_definition', d('block')),
('methoddef_define', d('block')),
('impl_prototype', d('block')),
('docstring_definition', d('file')),
('methoddef_define', d('file')),
('impl_prototype', d('file')),
('parser_prototype', d('suppress')),
('parser_definition', d('block')),
('cpp_endif', d('suppress')),
('methoddef_ifndef', d('buffer', 1)),
('parser_definition', d('file')),
('cpp_endif', d('file')),
('methoddef_ifndef', d('file', 1)),
('impl_definition', d('block')),
))