mirror of
https://github.com/python/cpython.git
synced 2024-11-23 18:04:37 +08:00
Got rid of redundand "self" parameter declarations.
Argument Clinic is now able to infer all needed information.
This commit is contained in:
parent
312f208568
commit
7a9579c0ce
@ -592,7 +592,6 @@ error:
|
||||
/*[clinic input]
|
||||
_bz2.BZ2Decompressor.decompress
|
||||
|
||||
self: self(type="BZ2Decompressor *")
|
||||
data: Py_buffer
|
||||
max_length: Py_ssize_t=-1
|
||||
|
||||
@ -615,7 +614,7 @@ the unused_data attribute.
|
||||
static PyObject *
|
||||
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
|
||||
Py_ssize_t max_length)
|
||||
/*[clinic end generated code: output=23e41045deb240a3 input=9558b424c8b00516]*/
|
||||
/*[clinic end generated code: output=23e41045deb240a3 input=52e1ffc66a8ea624]*/
|
||||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
|
@ -553,7 +553,6 @@ error:
|
||||
/*[clinic input]
|
||||
_lzma.LZMACompressor.compress
|
||||
|
||||
self: self(type="Compressor *")
|
||||
data: Py_buffer
|
||||
/
|
||||
|
||||
@ -567,7 +566,7 @@ flush() method to finish the compression process.
|
||||
|
||||
static PyObject *
|
||||
_lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data)
|
||||
/*[clinic end generated code: output=31f615136963e00f input=8b60cb13e0ce6420]*/
|
||||
/*[clinic end generated code: output=31f615136963e00f input=64019eac7f2cc8d0]*/
|
||||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
@ -583,8 +582,6 @@ _lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data)
|
||||
/*[clinic input]
|
||||
_lzma.LZMACompressor.flush
|
||||
|
||||
self: self(type="Compressor *")
|
||||
|
||||
Finish the compression process.
|
||||
|
||||
Returns the compressed data left in internal buffers.
|
||||
@ -594,7 +591,7 @@ The compressor object may not be used after this method is called.
|
||||
|
||||
static PyObject *
|
||||
_lzma_LZMACompressor_flush_impl(Compressor *self)
|
||||
/*[clinic end generated code: output=fec21f3e22504f50 input=3060fb26f9b4042c]*/
|
||||
/*[clinic end generated code: output=fec21f3e22504f50 input=6b369303f67ad0a8]*/
|
||||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
@ -698,7 +695,6 @@ Compressor_init_raw(lzma_stream *lzs, PyObject *filterspecs)
|
||||
/*[-clinic input]
|
||||
_lzma.LZMACompressor.__init__
|
||||
|
||||
self: self(type="Compressor *")
|
||||
format: int(c_default="FORMAT_XZ") = FORMAT_XZ
|
||||
The container format to use for the output. This can
|
||||
be FORMAT_XZ (default), FORMAT_ALONE, or FORMAT_RAW.
|
||||
@ -1063,7 +1059,6 @@ error:
|
||||
/*[clinic input]
|
||||
_lzma.LZMADecompressor.decompress
|
||||
|
||||
self: self(type="Decompressor *")
|
||||
data: Py_buffer
|
||||
max_length: Py_ssize_t=-1
|
||||
|
||||
@ -1086,7 +1081,7 @@ the unused_data attribute.
|
||||
static PyObject *
|
||||
_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data,
|
||||
Py_ssize_t max_length)
|
||||
/*[clinic end generated code: output=ef4e20ec7122241d input=f2bb902cc1caf203]*/
|
||||
/*[clinic end generated code: output=ef4e20ec7122241d input=60c1f135820e309d]*/
|
||||
{
|
||||
PyObject *result = NULL;
|
||||
|
||||
@ -1126,7 +1121,6 @@ Decompressor_init_raw(lzma_stream *lzs, PyObject *filterspecs)
|
||||
/*[clinic input]
|
||||
_lzma.LZMADecompressor.__init__
|
||||
|
||||
self: self(type="Decompressor *")
|
||||
format: int(c_default="FORMAT_AUTO") = FORMAT_AUTO
|
||||
Specifies the container format of the input stream. If this is
|
||||
FORMAT_AUTO (the default), the decompressor will automatically detect
|
||||
@ -1152,7 +1146,7 @@ For one-shot decompression, use the decompress() function instead.
|
||||
static int
|
||||
_lzma_LZMADecompressor___init___impl(Decompressor *self, int format,
|
||||
PyObject *memlimit, PyObject *filters)
|
||||
/*[clinic end generated code: output=3e1821f8aa36564c input=458ca6132ef29801]*/
|
||||
/*[clinic end generated code: output=3e1821f8aa36564c input=81fe684a6c2f8a27]*/
|
||||
{
|
||||
const uint32_t decoder_flags = LZMA_TELL_ANY_CHECK | LZMA_TELL_NO_CHECK;
|
||||
uint64_t memlimit_ = UINT64_MAX;
|
||||
|
@ -2485,7 +2485,6 @@ Tkapp_CommandProc(CommandEvent *ev, int flags)
|
||||
/*[clinic input]
|
||||
_tkinter.tkapp.createcommand
|
||||
|
||||
self: self(type="TkappObject *")
|
||||
name: str
|
||||
func: object
|
||||
/
|
||||
@ -2495,7 +2494,7 @@ _tkinter.tkapp.createcommand
|
||||
static PyObject *
|
||||
_tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name,
|
||||
PyObject *func)
|
||||
/*[clinic end generated code: output=2a1c79a4ee2af410 input=2bc2c046a0914234]*/
|
||||
/*[clinic end generated code: output=2a1c79a4ee2af410 input=255785cb70edc6a0]*/
|
||||
{
|
||||
PythonCmd_ClientData *data;
|
||||
int err;
|
||||
@ -2561,7 +2560,6 @@ _tkinter_tkapp_createcommand_impl(TkappObject *self, const char *name,
|
||||
/*[clinic input]
|
||||
_tkinter.tkapp.deletecommand
|
||||
|
||||
self: self(type="TkappObject *")
|
||||
name: str
|
||||
/
|
||||
|
||||
@ -2569,7 +2567,7 @@ _tkinter.tkapp.deletecommand
|
||||
|
||||
static PyObject *
|
||||
_tkinter_tkapp_deletecommand_impl(TkappObject *self, const char *name)
|
||||
/*[clinic end generated code: output=a67e8cb5845e0d2d input=b6306468f10b219c]*/
|
||||
/*[clinic end generated code: output=a67e8cb5845e0d2d input=53e9952eae1f85f5]*/
|
||||
{
|
||||
int err;
|
||||
|
||||
@ -2762,13 +2760,11 @@ typedef struct {
|
||||
/*[clinic input]
|
||||
_tkinter.tktimertoken.deletetimerhandler
|
||||
|
||||
self: self(type="TkttObject *")
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_tkinter_tktimertoken_deletetimerhandler_impl(TkttObject *self)
|
||||
/*[clinic end generated code: output=bd7fe17f328cfa55 input=25ba5dd594e52084]*/
|
||||
/*[clinic end generated code: output=bd7fe17f328cfa55 input=40bd070ff85f5cf3]*/
|
||||
{
|
||||
TkttObject *v = self;
|
||||
PyObject *func = v->func;
|
||||
@ -2894,7 +2890,6 @@ _tkinter_tkapp_createtimerhandler_impl(TkappObject *self, int milliseconds,
|
||||
/*[clinic input]
|
||||
_tkinter.tkapp.mainloop
|
||||
|
||||
self: self(type="TkappObject *")
|
||||
threshold: int = 0
|
||||
/
|
||||
|
||||
@ -2902,7 +2897,7 @@ _tkinter.tkapp.mainloop
|
||||
|
||||
static PyObject *
|
||||
_tkinter_tkapp_mainloop_impl(TkappObject *self, int threshold)
|
||||
/*[clinic end generated code: output=0ba8eabbe57841b0 input=ad57c9c1dd2b9470]*/
|
||||
/*[clinic end generated code: output=0ba8eabbe57841b0 input=036bcdcf03d5eca0]*/
|
||||
{
|
||||
#ifdef WITH_THREAD
|
||||
PyThreadState *tstate = PyThreadState_Get();
|
||||
@ -3072,13 +3067,11 @@ Tkapp_WantObjects(PyObject *self, PyObject *args)
|
||||
/*[clinic input]
|
||||
_tkinter.tkapp.willdispatch
|
||||
|
||||
self: self(type="TkappObject *")
|
||||
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
_tkinter_tkapp_willdispatch_impl(TkappObject *self)
|
||||
/*[clinic end generated code: output=0e3f46d244642155 input=2630699767808970]*/
|
||||
/*[clinic end generated code: output=0e3f46d244642155 input=d88f5970843d6dab]*/
|
||||
{
|
||||
self->dispatching = 1;
|
||||
|
||||
|
@ -1243,14 +1243,12 @@ bytearray_count(PyByteArrayObject *self, PyObject *args)
|
||||
/*[clinic input]
|
||||
bytearray.clear
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
|
||||
Remove all items from the bytearray.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_clear_impl(PyByteArrayObject *self)
|
||||
/*[clinic end generated code: output=85c2fe6aede0956c input=e524fd330abcdc18]*/
|
||||
/*[clinic end generated code: output=85c2fe6aede0956c input=ed6edae9de447ac4]*/
|
||||
{
|
||||
if (PyByteArray_Resize((PyObject *)self, 0) < 0)
|
||||
return NULL;
|
||||
@ -1260,14 +1258,12 @@ bytearray_clear_impl(PyByteArrayObject *self)
|
||||
/*[clinic input]
|
||||
bytearray.copy
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
|
||||
Return a copy of B.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_copy_impl(PyByteArrayObject *self)
|
||||
/*[clinic end generated code: output=68cfbcfed484c132 input=6d5d2975aa0f33f3]*/
|
||||
/*[clinic end generated code: output=68cfbcfed484c132 input=6597b0c01bccaa9e]*/
|
||||
{
|
||||
return PyByteArray_FromStringAndSize(PyByteArray_AS_STRING((PyObject *)self),
|
||||
PyByteArray_GET_SIZE(self));
|
||||
@ -1489,7 +1485,6 @@ bytearray_endswith(PyByteArrayObject *self, PyObject *args)
|
||||
/*[clinic input]
|
||||
bytearray.translate
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
table: object
|
||||
Translation table, which must be a bytes object of length 256.
|
||||
[
|
||||
@ -1506,7 +1501,7 @@ The remaining characters are mapped through the given translation table.
|
||||
static PyObject *
|
||||
bytearray_translate_impl(PyByteArrayObject *self, PyObject *table,
|
||||
int group_right_1, PyObject *deletechars)
|
||||
/*[clinic end generated code: output=2bebc86a9a1ff083 input=b749ad85f4860824]*/
|
||||
/*[clinic end generated code: output=2bebc86a9a1ff083 input=846a01671bccc1c5]*/
|
||||
{
|
||||
char *input, *output;
|
||||
const char *table_chars;
|
||||
@ -2187,7 +2182,6 @@ bytearray_split_impl(PyByteArrayObject *self, PyObject *sep,
|
||||
/*[clinic input]
|
||||
bytearray.partition
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
sep: object
|
||||
/
|
||||
|
||||
@ -2203,7 +2197,7 @@ bytearray object and two empty bytearray objects.
|
||||
|
||||
static PyObject *
|
||||
bytearray_partition(PyByteArrayObject *self, PyObject *sep)
|
||||
/*[clinic end generated code: output=45d2525ddd35f957 input=7d7fe37b1696d506]*/
|
||||
/*[clinic end generated code: output=45d2525ddd35f957 input=86f89223892b70b5]*/
|
||||
{
|
||||
PyObject *bytesep, *result;
|
||||
|
||||
@ -2225,7 +2219,6 @@ bytearray_partition(PyByteArrayObject *self, PyObject *sep)
|
||||
/*[clinic input]
|
||||
bytearray.rpartition
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
sep: object
|
||||
/
|
||||
|
||||
@ -2241,7 +2234,7 @@ objects and the original bytearray object.
|
||||
|
||||
static PyObject *
|
||||
bytearray_rpartition(PyByteArrayObject *self, PyObject *sep)
|
||||
/*[clinic end generated code: output=440de3c9426115e8 input=9b8cd540c1b75853]*/
|
||||
/*[clinic end generated code: output=440de3c9426115e8 input=5f4094f2de87c8f3]*/
|
||||
{
|
||||
PyObject *bytesep, *result;
|
||||
|
||||
@ -2299,14 +2292,12 @@ bytearray_rsplit_impl(PyByteArrayObject *self, PyObject *sep,
|
||||
/*[clinic input]
|
||||
bytearray.reverse
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
|
||||
Reverse the order of the values in B in place.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_reverse_impl(PyByteArrayObject *self)
|
||||
/*[clinic end generated code: output=9f7616f29ab309d3 input=7933a499b8597bd1]*/
|
||||
/*[clinic end generated code: output=9f7616f29ab309d3 input=543356319fc78557]*/
|
||||
{
|
||||
char swap, *head, *tail;
|
||||
Py_ssize_t i, j, n = Py_SIZE(self);
|
||||
@ -2335,7 +2326,6 @@ class bytesvalue_converter(CConverter):
|
||||
/*[clinic input]
|
||||
bytearray.insert
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
index: Py_ssize_t
|
||||
The index where the value is to be inserted.
|
||||
item: bytesvalue
|
||||
@ -2347,7 +2337,7 @@ Insert a single item into the bytearray before the given index.
|
||||
|
||||
static PyObject *
|
||||
bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item)
|
||||
/*[clinic end generated code: output=76c775a70e7b07b7 input=833766836ba30e1e]*/
|
||||
/*[clinic end generated code: output=76c775a70e7b07b7 input=b2b5d07e9de6c070]*/
|
||||
{
|
||||
Py_ssize_t n = Py_SIZE(self);
|
||||
char *buf;
|
||||
@ -2377,7 +2367,6 @@ bytearray_insert_impl(PyByteArrayObject *self, Py_ssize_t index, int item)
|
||||
/*[clinic input]
|
||||
bytearray.append
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
item: bytesvalue
|
||||
The item to be appended.
|
||||
/
|
||||
@ -2387,7 +2376,7 @@ Append a single item to the end of the bytearray.
|
||||
|
||||
static PyObject *
|
||||
bytearray_append_impl(PyByteArrayObject *self, int item)
|
||||
/*[clinic end generated code: output=a154e19ed1886cb6 input=ae56ea87380407cc]*/
|
||||
/*[clinic end generated code: output=a154e19ed1886cb6 input=20d6bec3d1340593]*/
|
||||
{
|
||||
Py_ssize_t n = Py_SIZE(self);
|
||||
|
||||
@ -2407,7 +2396,6 @@ bytearray_append_impl(PyByteArrayObject *self, int item)
|
||||
/*[clinic input]
|
||||
bytearray.extend
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
iterable_of_ints: object
|
||||
The iterable of items to append.
|
||||
/
|
||||
@ -2417,7 +2405,7 @@ Append all the items from the iterator or sequence to the end of the bytearray.
|
||||
|
||||
static PyObject *
|
||||
bytearray_extend(PyByteArrayObject *self, PyObject *iterable_of_ints)
|
||||
/*[clinic end generated code: output=98155dbe249170b1 input=ce83a5d75b70d850]*/
|
||||
/*[clinic end generated code: output=98155dbe249170b1 input=c617b3a93249ba28]*/
|
||||
{
|
||||
PyObject *it, *item, *bytearray_obj;
|
||||
Py_ssize_t buf_size = 0, len = 0;
|
||||
@ -2492,7 +2480,6 @@ bytearray_extend(PyByteArrayObject *self, PyObject *iterable_of_ints)
|
||||
/*[clinic input]
|
||||
bytearray.pop
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
index: Py_ssize_t = -1
|
||||
The index from where to remove the item.
|
||||
-1 (the default value) means remove the last item.
|
||||
@ -2505,7 +2492,7 @@ If no index argument is given, will pop the last item.
|
||||
|
||||
static PyObject *
|
||||
bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index)
|
||||
/*[clinic end generated code: output=e0ccd401f8021da8 input=0797e6c0ca9d5a85]*/
|
||||
/*[clinic end generated code: output=e0ccd401f8021da8 input=3591df2d06c0d237]*/
|
||||
{
|
||||
int value;
|
||||
Py_ssize_t n = Py_SIZE(self);
|
||||
@ -2537,7 +2524,6 @@ bytearray_pop_impl(PyByteArrayObject *self, Py_ssize_t index)
|
||||
/*[clinic input]
|
||||
bytearray.remove
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
value: bytesvalue
|
||||
The value to remove.
|
||||
/
|
||||
@ -2547,7 +2533,7 @@ Remove the first occurrence of a value in the bytearray.
|
||||
|
||||
static PyObject *
|
||||
bytearray_remove_impl(PyByteArrayObject *self, int value)
|
||||
/*[clinic end generated code: output=d659e37866709c13 input=47560b11fd856c24]*/
|
||||
/*[clinic end generated code: output=d659e37866709c13 input=121831240cd51ddf]*/
|
||||
{
|
||||
Py_ssize_t where, n = Py_SIZE(self);
|
||||
char *buf = PyByteArray_AS_STRING(self);
|
||||
@ -2858,14 +2844,12 @@ _common_reduce(PyByteArrayObject *self, int proto)
|
||||
/*[clinic input]
|
||||
bytearray.__reduce__ as bytearray_reduce
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
|
||||
Return state information for pickling.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_reduce_impl(PyByteArrayObject *self)
|
||||
/*[clinic end generated code: output=52bf304086464cab input=fbb07de4d102a03a]*/
|
||||
/*[clinic end generated code: output=52bf304086464cab input=44b5737ada62dd3f]*/
|
||||
{
|
||||
return _common_reduce(self, 2);
|
||||
}
|
||||
@ -2873,7 +2857,6 @@ bytearray_reduce_impl(PyByteArrayObject *self)
|
||||
/*[clinic input]
|
||||
bytearray.__reduce_ex__ as bytearray_reduce_ex
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
proto: int = 0
|
||||
/
|
||||
|
||||
@ -2882,7 +2865,7 @@ Return state information for pickling.
|
||||
|
||||
static PyObject *
|
||||
bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto)
|
||||
/*[clinic end generated code: output=52eac33377197520 input=0e091a42ca6dbd91]*/
|
||||
/*[clinic end generated code: output=52eac33377197520 input=f129bc1a1aa151ee]*/
|
||||
{
|
||||
return _common_reduce(self, proto);
|
||||
}
|
||||
@ -2890,14 +2873,12 @@ bytearray_reduce_ex_impl(PyByteArrayObject *self, int proto)
|
||||
/*[clinic input]
|
||||
bytearray.__sizeof__ as bytearray_sizeof
|
||||
|
||||
self: self(type="PyByteArrayObject *")
|
||||
|
||||
Returns the size of the bytearray object in memory, in bytes.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytearray_sizeof_impl(PyByteArrayObject *self)
|
||||
/*[clinic end generated code: output=738abdd17951c427 input=6b23d305362b462b]*/
|
||||
/*[clinic end generated code: output=738abdd17951c427 input=e27320fd98a4bc5a]*/
|
||||
{
|
||||
Py_ssize_t res;
|
||||
|
||||
|
@ -9,9 +9,9 @@
|
||||
#include <stddef.h>
|
||||
|
||||
/*[clinic input]
|
||||
class bytes "PyBytesObject*" "&PyBytes_Type"
|
||||
class bytes "PyBytesObject *" "&PyBytes_Type"
|
||||
[clinic start generated code]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=1a1d9102afc1b00c]*/
|
||||
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=7a238f965d64892b]*/
|
||||
|
||||
#include "clinic/bytesobject.c.h"
|
||||
|
||||
@ -1752,8 +1752,8 @@ Return a list of the sections in the bytes, using sep as the delimiter.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_split_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=8bde44dacb36ef2e input=8b809b39074abbfa]*/
|
||||
bytes_split_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=52126b5844c1d8ef input=8b809b39074abbfa]*/
|
||||
{
|
||||
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
|
||||
const char *s = PyBytes_AS_STRING(self), *sub;
|
||||
@ -1777,7 +1777,6 @@ bytes_split_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic input]
|
||||
bytes.partition
|
||||
|
||||
self: self(type="PyBytesObject *")
|
||||
sep: Py_buffer
|
||||
/
|
||||
|
||||
@ -1793,7 +1792,7 @@ object and two empty bytes objects.
|
||||
|
||||
static PyObject *
|
||||
bytes_partition_impl(PyBytesObject *self, Py_buffer *sep)
|
||||
/*[clinic end generated code: output=f532b392a17ff695 input=bc855dc63ca949de]*/
|
||||
/*[clinic end generated code: output=f532b392a17ff695 input=61cca95519406099]*/
|
||||
{
|
||||
return stringlib_partition(
|
||||
(PyObject*) self,
|
||||
@ -1805,7 +1804,6 @@ bytes_partition_impl(PyBytesObject *self, Py_buffer *sep)
|
||||
/*[clinic input]
|
||||
bytes.rpartition
|
||||
|
||||
self: self(type="PyBytesObject *")
|
||||
sep: Py_buffer
|
||||
/
|
||||
|
||||
@ -1821,7 +1819,7 @@ objects and the original bytes object.
|
||||
|
||||
static PyObject *
|
||||
bytes_rpartition_impl(PyBytesObject *self, Py_buffer *sep)
|
||||
/*[clinic end generated code: output=191b114cbb028e50 input=6588fff262a9170e]*/
|
||||
/*[clinic end generated code: output=191b114cbb028e50 input=67f689e63a62d478]*/
|
||||
{
|
||||
return stringlib_rpartition(
|
||||
(PyObject*) self,
|
||||
@ -1839,8 +1837,8 @@ Splitting is done starting at the end of the bytes and working to the front.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_rsplit_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=0b6570b977911d88 input=0f86c9f28f7d7b7b]*/
|
||||
bytes_rsplit_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit)
|
||||
/*[clinic end generated code: output=ba698d9ea01e1c8f input=0f86c9f28f7d7b7b]*/
|
||||
{
|
||||
Py_ssize_t len = PyBytes_GET_SIZE(self), n;
|
||||
const char *s = PyBytes_AS_STRING(self), *sub;
|
||||
@ -1878,8 +1876,8 @@ Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_join(PyBytesObject*self, PyObject *iterable_of_bytes)
|
||||
/*[clinic end generated code: output=634aff14764ff997 input=7fe377b95bd549d2]*/
|
||||
bytes_join(PyBytesObject *self, PyObject *iterable_of_bytes)
|
||||
/*[clinic end generated code: output=a046f379f626f6f8 input=7fe377b95bd549d2]*/
|
||||
{
|
||||
return stringlib_bytes_join((PyObject*)self, iterable_of_bytes);
|
||||
}
|
||||
@ -2129,7 +2127,6 @@ do_argstrip(PyBytesObject *self, int striptype, PyObject *bytes)
|
||||
/*[clinic input]
|
||||
bytes.strip
|
||||
|
||||
self: self(type="PyBytesObject *")
|
||||
bytes: object = None
|
||||
/
|
||||
|
||||
@ -2140,7 +2137,7 @@ If the argument is omitted or None, strip leading and trailing ASCII whitespace.
|
||||
|
||||
static PyObject *
|
||||
bytes_strip_impl(PyBytesObject *self, PyObject *bytes)
|
||||
/*[clinic end generated code: output=c7c228d3bd104a1b input=37daa5fad1395d95]*/
|
||||
/*[clinic end generated code: output=c7c228d3bd104a1b input=8a354640e4e0b3ef]*/
|
||||
{
|
||||
return do_argstrip(self, BOTHSTRIP, bytes);
|
||||
}
|
||||
@ -2148,7 +2145,6 @@ bytes_strip_impl(PyBytesObject *self, PyObject *bytes)
|
||||
/*[clinic input]
|
||||
bytes.lstrip
|
||||
|
||||
self: self(type="PyBytesObject *")
|
||||
bytes: object = None
|
||||
/
|
||||
|
||||
@ -2159,7 +2155,7 @@ If the argument is omitted or None, strip leading ASCII whitespace.
|
||||
|
||||
static PyObject *
|
||||
bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes)
|
||||
/*[clinic end generated code: output=28602e586f524e82 input=88811b09dfbc2988]*/
|
||||
/*[clinic end generated code: output=28602e586f524e82 input=9baff4398c3f6857]*/
|
||||
{
|
||||
return do_argstrip(self, LEFTSTRIP, bytes);
|
||||
}
|
||||
@ -2167,7 +2163,6 @@ bytes_lstrip_impl(PyBytesObject *self, PyObject *bytes)
|
||||
/*[clinic input]
|
||||
bytes.rstrip
|
||||
|
||||
self: self(type="PyBytesObject *")
|
||||
bytes: object = None
|
||||
/
|
||||
|
||||
@ -2178,7 +2173,7 @@ If the argument is omitted or None, strip trailing ASCII whitespace.
|
||||
|
||||
static PyObject *
|
||||
bytes_rstrip_impl(PyBytesObject *self, PyObject *bytes)
|
||||
/*[clinic end generated code: output=547e3815c95447da input=8f93c9cd361f0140]*/
|
||||
/*[clinic end generated code: output=547e3815c95447da input=b78af445c727e32b]*/
|
||||
{
|
||||
return do_argstrip(self, RIGHTSTRIP, bytes);
|
||||
}
|
||||
@ -2235,7 +2230,6 @@ bytes_count(PyBytesObject *self, PyObject *args)
|
||||
/*[clinic input]
|
||||
bytes.translate
|
||||
|
||||
self: self(type="PyBytesObject *")
|
||||
table: object
|
||||
Translation table, which must be a bytes object of length 256.
|
||||
[
|
||||
@ -2252,7 +2246,7 @@ The remaining characters are mapped through the given translation table.
|
||||
static PyObject *
|
||||
bytes_translate_impl(PyBytesObject *self, PyObject *table, int group_right_1,
|
||||
PyObject *deletechars)
|
||||
/*[clinic end generated code: output=233df850eb50bf8d input=d8fa5519d7cc4be7]*/
|
||||
/*[clinic end generated code: output=233df850eb50bf8d input=ca20edf39d780d49]*/
|
||||
{
|
||||
char *input, *output;
|
||||
Py_buffer table_view = {NULL, NULL};
|
||||
@ -2909,9 +2903,9 @@ replaced.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_replace_impl(PyBytesObject*self, Py_buffer *old, Py_buffer *new,
|
||||
bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
|
||||
Py_ssize_t count)
|
||||
/*[clinic end generated code: output=403dc9d7a83c5a1d input=b2fbbf0bf04de8e5]*/
|
||||
/*[clinic end generated code: output=994fa588b6b9c104 input=b2fbbf0bf04de8e5]*/
|
||||
{
|
||||
return (PyObject *)replace((PyBytesObject *) self,
|
||||
(const char *)old->buf, old->len,
|
||||
@ -3078,9 +3072,9 @@ Decode the bytes using the codec registered for encoding.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_decode_impl(PyBytesObject*self, const char *encoding,
|
||||
bytes_decode_impl(PyBytesObject *self, const char *encoding,
|
||||
const char *errors)
|
||||
/*[clinic end generated code: output=2d2016ff8e0bb176 input=958174769d2a40ca]*/
|
||||
/*[clinic end generated code: output=5649a53dde27b314 input=958174769d2a40ca]*/
|
||||
{
|
||||
return PyUnicode_FromEncodedObject((PyObject*)self, encoding, errors);
|
||||
}
|
||||
@ -3098,8 +3092,8 @@ true.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
bytes_splitlines_impl(PyBytesObject*self, int keepends)
|
||||
/*[clinic end generated code: output=995c3598f7833cad input=7f4aac67144f9944]*/
|
||||
bytes_splitlines_impl(PyBytesObject *self, int keepends)
|
||||
/*[clinic end generated code: output=3484149a5d880ffb input=7f4aac67144f9944]*/
|
||||
{
|
||||
return stringlib_splitlines(
|
||||
(PyObject*) self, PyBytes_AS_STRING(self),
|
||||
|
@ -20,10 +20,10 @@ PyDoc_STRVAR(bytes_split__doc__,
|
||||
{"split", (PyCFunction)bytes_split, METH_VARARGS|METH_KEYWORDS, bytes_split__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_split_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit);
|
||||
bytes_split_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
|
||||
|
||||
static PyObject *
|
||||
bytes_split(PyBytesObject*self, PyObject *args, PyObject *kwargs)
|
||||
bytes_split(PyBytesObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static char *_keywords[] = {"sep", "maxsplit", NULL};
|
||||
@ -133,10 +133,10 @@ PyDoc_STRVAR(bytes_rsplit__doc__,
|
||||
{"rsplit", (PyCFunction)bytes_rsplit, METH_VARARGS|METH_KEYWORDS, bytes_rsplit__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_rsplit_impl(PyBytesObject*self, PyObject *sep, Py_ssize_t maxsplit);
|
||||
bytes_rsplit_impl(PyBytesObject *self, PyObject *sep, Py_ssize_t maxsplit);
|
||||
|
||||
static PyObject *
|
||||
bytes_rsplit(PyBytesObject*self, PyObject *args, PyObject *kwargs)
|
||||
bytes_rsplit(PyBytesObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static char *_keywords[] = {"sep", "maxsplit", NULL};
|
||||
@ -359,11 +359,11 @@ PyDoc_STRVAR(bytes_replace__doc__,
|
||||
{"replace", (PyCFunction)bytes_replace, METH_VARARGS, bytes_replace__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_replace_impl(PyBytesObject*self, Py_buffer *old, Py_buffer *new,
|
||||
bytes_replace_impl(PyBytesObject *self, Py_buffer *old, Py_buffer *new,
|
||||
Py_ssize_t count);
|
||||
|
||||
static PyObject *
|
||||
bytes_replace(PyBytesObject*self, PyObject *args)
|
||||
bytes_replace(PyBytesObject *self, PyObject *args)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
Py_buffer old = {NULL, NULL};
|
||||
@ -405,11 +405,11 @@ PyDoc_STRVAR(bytes_decode__doc__,
|
||||
{"decode", (PyCFunction)bytes_decode, METH_VARARGS|METH_KEYWORDS, bytes_decode__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_decode_impl(PyBytesObject*self, const char *encoding,
|
||||
bytes_decode_impl(PyBytesObject *self, const char *encoding,
|
||||
const char *errors);
|
||||
|
||||
static PyObject *
|
||||
bytes_decode(PyBytesObject*self, PyObject *args, PyObject *kwargs)
|
||||
bytes_decode(PyBytesObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static char *_keywords[] = {"encoding", "errors", NULL};
|
||||
@ -438,10 +438,10 @@ PyDoc_STRVAR(bytes_splitlines__doc__,
|
||||
{"splitlines", (PyCFunction)bytes_splitlines, METH_VARARGS|METH_KEYWORDS, bytes_splitlines__doc__},
|
||||
|
||||
static PyObject *
|
||||
bytes_splitlines_impl(PyBytesObject*self, int keepends);
|
||||
bytes_splitlines_impl(PyBytesObject *self, int keepends);
|
||||
|
||||
static PyObject *
|
||||
bytes_splitlines(PyBytesObject*self, PyObject *args, PyObject *kwargs)
|
||||
bytes_splitlines(PyBytesObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyObject *return_value = NULL;
|
||||
static char *_keywords[] = {"keepends", NULL};
|
||||
@ -484,4 +484,4 @@ bytes_fromhex(PyTypeObject *type, PyObject *arg)
|
||||
exit:
|
||||
return return_value;
|
||||
}
|
||||
/*[clinic end generated code: output=bd0ce8f25d7e18f4 input=a9049054013a1b77]*/
|
||||
/*[clinic end generated code: output=d0e9f5a1c0682910 input=a9049054013a1b77]*/
|
||||
|
@ -1078,7 +1078,6 @@ builtin_hasattr_impl(PyModuleDef *module, PyObject *obj, PyObject *name)
|
||||
/*[clinic input]
|
||||
id as builtin_id
|
||||
|
||||
self: self(type="PyModuleDef *")
|
||||
obj as v: object
|
||||
/
|
||||
|
||||
@ -1089,8 +1088,8 @@ This is guaranteed to be unique among simultaneously existing objects.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
builtin_id(PyModuleDef *self, PyObject *v)
|
||||
/*[clinic end generated code: output=0aa640785f697f65 input=5a534136419631f4]*/
|
||||
builtin_id(PyModuleDef *module, PyObject *v)
|
||||
/*[clinic end generated code: output=63635e497e09c2f7 input=57fb4a9aaff96384]*/
|
||||
{
|
||||
return PyLong_FromVoidPtr(v);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user