Issue #20326: Argument Clinic now uses a simple, unique signature to

annotate text signatures in docstrings, resulting in fewer false
positives.  "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.

Issue #20326: Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
This commit is contained in:
Larry Hastings 2014-01-28 05:00:08 -08:00
parent eecbbad89b
commit 581ee3618c
37 changed files with 497 additions and 412 deletions

View File

@ -493,10 +493,8 @@ PyAPI_FUNC(unsigned int) PyType_ClearCache(void);
PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); PyAPI_FUNC(void) PyType_Modified(PyTypeObject *);
#ifndef Py_LIMITED_API #ifndef Py_LIMITED_API
PyAPI_FUNC(PyObject *) PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *);
_PyType_GetDocFromInternalDoc(const char *, const char *); PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *);
PyAPI_FUNC(PyObject *)
_PyType_GetTextSignatureFromInternalDoc(const char *, const char *);
#endif #endif
/* Generic operations on objects */ /* Generic operations on objects */

View File

@ -54,9 +54,9 @@ class Get_signatureTest(unittest.TestCase):
gtest(List, List.__doc__) gtest(List, List.__doc__)
gtest(list.__new__, gtest(list.__new__,
'T.__new__(S, ...) -> a new object with type S, a subtype of T') 'Create and return a new object. See help(type) for accurate signature.')
gtest(list.__init__, gtest(list.__init__,
'x.__init__(...) initializes x; see help(type(x)) for signature') 'Initialize self. See help(type(self)) for accurate signature.')
append_doc = "L.append(object) -> None -- append object to end" append_doc = "L.append(object) -> None -- append object to end"
gtest(list.append, append_doc) gtest(list.append, append_doc)
gtest([].append, append_doc) gtest([].append, append_doc)

View File

@ -1998,6 +1998,10 @@ class Signature:
else: else:
kind = Parameter.POSITIONAL_OR_KEYWORD kind = Parameter.POSITIONAL_OR_KEYWORD
first_parameter_is_self = s.startswith("($")
if first_parameter_is_self:
s = '(' + s[2:]
s = "def foo" + s + ": pass" s = "def foo" + s + ": pass"
try: try:
@ -2102,18 +2106,11 @@ class Signature:
kind = Parameter.VAR_KEYWORD kind = Parameter.VAR_KEYWORD
p(f.args.kwarg, empty) p(f.args.kwarg, empty)
if parameters and (hasattr(func, '__self__') or if first_parameter_is_self:
isinstance(func, _WrapperDescriptor,) or assert parameters
ismethoddescriptor(func) if getattr(func, '__self__', None):
): # strip off self, it's already been bound
name = parameters[0].name parameters.pop(0)
if name not in ('self', 'module', 'type'):
pass
elif getattr(func, '__self__', None):
# strip off self (it's already been bound)
p = parameters.pop(0)
if not p.name in ('self', 'module', 'type'):
raise ValueError('Unexpected name ' + repr(p.name) + ', expected self/module/cls/type')
else: else:
# for builtins, self parameter is always positional-only! # for builtins, self parameter is always positional-only!
p = parameters[0].replace(kind=Parameter.POSITIONAL_ONLY) p = parameters[0].replace(kind=Parameter.POSITIONAL_ONLY)

View File

@ -125,7 +125,7 @@ class CAPITest(unittest.TestCase):
self.assertEqual(_testcapi.docstring_no_signature.__text_signature__, None) self.assertEqual(_testcapi.docstring_no_signature.__text_signature__, None)
self.assertEqual(_testcapi.docstring_with_invalid_signature.__doc__, self.assertEqual(_testcapi.docstring_with_invalid_signature.__doc__,
"docstring_with_invalid_signature (module, boo)\n" "sig= (module, boo)\n"
"\n" "\n"
"This docstring has an invalid signature." "This docstring has an invalid signature."
) )

View File

@ -436,8 +436,8 @@ From the Iterators list, about the types of these things.
>>> [s for s in dir(i) if not s.startswith('_')] >>> [s for s in dir(i) if not s.startswith('_')]
['close', 'gi_code', 'gi_frame', 'gi_running', 'send', 'throw'] ['close', 'gi_code', 'gi_frame', 'gi_running', 'send', 'throw']
>>> from test.support import HAVE_DOCSTRINGS >>> from test.support import HAVE_DOCSTRINGS
>>> print(i.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implements next(self).') >>> print(i.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implement next(self).')
Implements next(self). Implement next(self).
>>> iter(i) is i >>> iter(i) is i
True True
>>> import types >>> import types

View File

@ -222,8 +222,8 @@ Check that generator attributes are present
True True
>>> from test.support import HAVE_DOCSTRINGS >>> from test.support import HAVE_DOCSTRINGS
>>> print(g.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implements next(self).') >>> print(g.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implement next(self).')
Implements next(self). Implement next(self).
>>> import types >>> import types
>>> isinstance(g, types.GeneratorType) >>> isinstance(g, types.GeneratorType)
True True

View File

@ -203,6 +203,15 @@ Tests
Tools/Demos Tools/Demos
----------- -----------
- Issue #20326: Argument Clinic now uses a simple, unique signature to
annotate text signatures in docstrings, resulting in fewer false
positives. "self" parameters are also explicitly marked, allowing
inspect.Signature() to authoritatively detect (and skip) said parameters.
- Issue #20326: Argument Clinic now generates separate checksums for the
input and output sections of the block, allowing external tools to verify
that the input has not changed (and thus the output is not out-of-date).
- Issue #20390: Argument Clinic's "file" output preset now defaults to - Issue #20390: Argument Clinic's "file" output preset now defaults to
"{dirname}/clinic/{basename}.h". "{dirname}/clinic/{basename}.h".

View File

@ -204,7 +204,7 @@ module _bz2
class _bz2.BZ2Compressor "BZ2Compressor *" "&BZ2Compressor_Type" class _bz2.BZ2Compressor "BZ2Compressor *" "&BZ2Compressor_Type"
class _bz2.BZ2Decompressor "BZ2Decompressor *" "&BZ2Decompressor_Type" class _bz2.BZ2Decompressor "BZ2Decompressor *" "&BZ2Decompressor_Type"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=e3b139924f5e18cc]*/
#include "clinic/_bz2module.c.h" #include "clinic/_bz2module.c.h"
@ -224,7 +224,7 @@ flush() method to finish the compression process.
static PyObject * static PyObject *
_bz2_BZ2Compressor_compress_impl(BZ2Compressor *self, Py_buffer *data) _bz2_BZ2Compressor_compress_impl(BZ2Compressor *self, Py_buffer *data)
/*[clinic end generated code: checksum=59365426e941fbcc4c7a4d0eef85ca7e19196eaa]*/ /*[clinic end generated code: output=59365426e941fbcc input=85c963218070fc4c]*/
{ {
PyObject *result = NULL; PyObject *result = NULL;
@ -249,7 +249,7 @@ The compressor object may not be used after this method is called.
static PyObject * static PyObject *
_bz2_BZ2Compressor_flush_impl(BZ2Compressor *self) _bz2_BZ2Compressor_flush_impl(BZ2Compressor *self)
/*[clinic end generated code: checksum=3ef03fc1b092a701b382b97096c7fd50db87190b]*/ /*[clinic end generated code: output=3ef03fc1b092a701 input=d64405d3c6f76691]*/
{ {
PyObject *result = NULL; PyObject *result = NULL;
@ -304,7 +304,7 @@ For one-shot compression, use the compress() function instead.
static int static int
_bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel) _bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel)
/*[clinic end generated code: checksum=c4e6adfd02963827075a1cc9309dc6df184b1246]*/ /*[clinic end generated code: output=c4e6adfd02963827 input=4e1ff7b8394b6e9a]*/
{ {
int bzerror; int bzerror;
@ -484,7 +484,7 @@ is ignored and saved in the unused_data attribute.
static PyObject * static PyObject *
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data) _bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data)
/*[clinic end generated code: checksum=086e4b99e60cb3f67c0481959591eae0735320bc]*/ /*[clinic end generated code: output=086e4b99e60cb3f6 input=616c2a6db5269961]*/
{ {
PyObject *result = NULL; PyObject *result = NULL;
@ -515,7 +515,7 @@ For one-shot decompression, use the decompress() function instead.
static int static int
_bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self) _bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self)
/*[clinic end generated code: checksum=e4d2b9bb866ab8f1f4a8bb786ddb5b614ce323c0]*/ /*[clinic end generated code: output=e4d2b9bb866ab8f1 input=95f6500dcda60088]*/
{ {
int bzerror; int bzerror;

View File

@ -10,7 +10,7 @@
/*[clinic input] /*[clinic input]
module crypt module crypt
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=c6252cf4f2f2ae81]*/
/*[clinic input] /*[clinic input]
@ -30,7 +30,7 @@ results for a given *word*.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(crypt_crypt__doc__, PyDoc_STRVAR(crypt_crypt__doc__,
"crypt(module, word, salt)\n" "sig=($module, word, salt)\n"
"Hash a *word* with the given *salt* and return the hashed password.\n" "Hash a *word* with the given *salt* and return the hashed password.\n"
"\n" "\n"
"*word* will usually be a user\'s password. *salt* (either a random 2 or 16\n" "*word* will usually be a user\'s password. *salt* (either a random 2 or 16\n"
@ -63,7 +63,7 @@ exit:
static PyObject * static PyObject *
crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt) crypt_crypt_impl(PyModuleDef *module, const char *word, const char *salt)
/*[clinic end generated code: checksum=dbfe26a21eb335abefe6a0bbd0a682ea22b9adc0]*/ /*[clinic end generated code: output=c7443257e03fca92 input=4d93b6d0f41fbf58]*/
{ {
/* On some platforms (AtheOS) crypt returns NULL for an invalid /* On some platforms (AtheOS) crypt returns NULL for an invalid
salt. Return None in that case. XXX Maybe raise an exception? */ salt. Return None in that case. XXX Maybe raise an exception? */

View File

@ -138,7 +138,7 @@ typedef chtype attr_t; /* No attr_t type is available */
module curses module curses
class curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type" class curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=88c860abdbb50e0c]*/
/* Definition of exception curses.error */ /* Definition of exception curses.error */
@ -651,7 +651,7 @@ exit:
static PyObject * static PyObject *
curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int x, int y, PyObject *ch, int group_right_1, long attr) curses_window_addch_impl(PyCursesWindowObject *self, int group_left_1, int x, int y, PyObject *ch, int group_right_1, long attr)
/*[clinic end generated code: checksum=e1cdbd4f4e42fc6b36fd4755d7e4bd5b58751ea1]*/ /*[clinic end generated code: output=e1cdbd4f4e42fc6b input=fe7e3711d5bbf1f6]*/
{ {
PyCursesWindowObject *cwself = (PyCursesWindowObject *)self; PyCursesWindowObject *cwself = (PyCursesWindowObject *)self;
int coordinates_group = group_left_1; int coordinates_group = group_left_1;

View File

@ -20,7 +20,7 @@
module datetime module datetime
class datetime.datetime "PyDateTime_DateTime *" "&PyDateTime_DateTimeType" class datetime.datetime "PyDateTime_DateTime *" "&PyDateTime_DateTimeType"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=78142cb64b9e98bc]*/
/* We require that C int be at least 32 bits, and use int virtually /* 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 * everywhere. In just a few cases we use a temp long, where a Python
@ -4159,7 +4159,7 @@ If no tz is specified, uses local timezone.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(datetime_datetime_now__doc__, PyDoc_STRVAR(datetime_datetime_now__doc__,
"now(type, tz=None)\n" "sig=($type, tz=None)\n"
"Returns new datetime object representing current time local to tz.\n" "Returns new datetime object representing current time local to tz.\n"
"\n" "\n"
" tz\n" " tz\n"
@ -4192,7 +4192,7 @@ exit:
static PyObject * static PyObject *
datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz) datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz)
/*[clinic end generated code: checksum=a6d3ad2c0ab6389075289af3467f7b8eb13f5f5c]*/ /*[clinic end generated code: output=c8a47308483e579a input=80d09869c5267d00]*/
{ {
PyObject *self; PyObject *self;

View File

@ -32,7 +32,7 @@ static char *which_dbm = "Berkeley DB";
module dbm module dbm
class dbm.dbm "dbmobject *" "&Dbmtype" class dbm.dbm "dbmobject *" "&Dbmtype"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=92450564684a69a3]*/
typedef struct { typedef struct {
PyObject_HEAD PyObject_HEAD
@ -55,7 +55,7 @@ class dbmobject_converter(self_converter):
def converter_init(self): def converter_init(self):
self.name = 'dp' self.name = 'dp'
[python start generated code]*/ [python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[python end generated code: output=da39a3ee5e6b4b0d input=8a69ac1827811128]*/
static PyObject * static PyObject *
newdbmobject(const char *file, int flags, int mode) newdbmobject(const char *file, int flags, int mode)
@ -319,7 +319,7 @@ exit:
static PyObject * static PyObject *
dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, int group_right_1, PyObject *default_value) dbm_dbm_get_impl(dbmobject *dp, const char *key, Py_ssize_clean_t key_length, int group_right_1, PyObject *default_value)
/*[clinic end generated code: checksum=31d5180d6b36f1eafea78ec4391adf3559916379]*/ /*[clinic end generated code: output=31d5180d6b36f1ea input=43a561dc2bd1db3b]*/
{ {
datum dbm_key, val; datum dbm_key, val;
@ -462,7 +462,7 @@ Return a database object.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(dbmopen__doc__, PyDoc_STRVAR(dbmopen__doc__,
"open(module, filename, flags=\'r\', mode=0o666)\n" "sig=($module, filename, flags=\'r\', mode=0o666)\n"
"Return a database object.\n" "Return a database object.\n"
"\n" "\n"
" filename\n" " filename\n"
@ -499,7 +499,7 @@ exit:
static PyObject * static PyObject *
dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode) dbmopen_impl(PyModuleDef *module, const char *filename, const char *flags, int mode)
/*[clinic end generated code: checksum=9efae7d3c3b67a365011bf4e463e918901ba6c79]*/ /*[clinic end generated code: output=a1da6a481d9d332b input=6499ab0fab1333ac]*/
{ {
int iflags; int iflags;

View File

@ -475,7 +475,7 @@ module _lzma
class _lzma.LZMACompressor "Compressor *" "&Compressor_type" class _lzma.LZMACompressor "Compressor *" "&Compressor_type"
class _lzma.LZMADecompressor "Decompressor *" "&Decompressor_type" class _lzma.LZMADecompressor "Decompressor *" "&Decompressor_type"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=f17afc786525d6c2]*/
#include "clinic/_lzmamodule.c.h" #include "clinic/_lzmamodule.c.h"
@ -496,7 +496,7 @@ class lzma_filter_converter(CConverter):
' PyMem_Free(%(name)s.options);\n') % {'name': name} ' PyMem_Free(%(name)s.options);\n') % {'name': name}
[python start generated code]*/ [python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[python end generated code: output=da39a3ee5e6b4b0d input=74fe7631ce377a94]*/
/* LZMACompressor class. */ /* LZMACompressor class. */
@ -560,7 +560,7 @@ flush() method to finish the compression process.
static PyObject * static PyObject *
_lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data) _lzma_LZMACompressor_compress_impl(Compressor *self, Py_buffer *data)
/*[clinic end generated code: checksum=31f615136963e00f26f8be33440ec1e3604565ba]*/ /*[clinic end generated code: output=31f615136963e00f input=8b60cb13e0ce6420]*/
{ {
PyObject *result = NULL; PyObject *result = NULL;
@ -587,7 +587,7 @@ The compressor object may not be used after this method is called.
static PyObject * static PyObject *
_lzma_LZMACompressor_flush_impl(Compressor *self) _lzma_LZMACompressor_flush_impl(Compressor *self)
/*[clinic end generated code: checksum=fec21f3e22504f500606ba60e1ba70d79eb22188]*/ /*[clinic end generated code: output=fec21f3e22504f50 input=3060fb26f9b4042c]*/
{ {
PyObject *result = NULL; PyObject *result = NULL;
@ -959,7 +959,7 @@ is ignored and saved in the unused_data attribute.
static PyObject * static PyObject *
_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data) _lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data)
/*[clinic end generated code: checksum=d86e78da7ff0ff219d511275b16b79476da8922e]*/ /*[clinic end generated code: output=d86e78da7ff0ff21 input=50c4768b821bf0ef]*/
{ {
PyObject *result = NULL; PyObject *result = NULL;
@ -1024,7 +1024,7 @@ For one-shot decompression, use the decompress() function instead.
static int static int
_lzma_LZMADecompressor___init___impl(Decompressor *self, int format, PyObject *memlimit, PyObject *filters) _lzma_LZMADecompressor___init___impl(Decompressor *self, int format, PyObject *memlimit, PyObject *filters)
/*[clinic end generated code: checksum=9b119f6f2cc2d7a8e5be41c164a6c080ee82d0c2]*/ /*[clinic end generated code: output=9b119f6f2cc2d7a8 input=458ca6132ef29801]*/
{ {
const uint32_t decoder_flags = LZMA_TELL_ANY_CHECK | LZMA_TELL_NO_CHECK; const uint32_t decoder_flags = LZMA_TELL_ANY_CHECK | LZMA_TELL_NO_CHECK;
uint64_t memlimit_ = UINT64_MAX; uint64_t memlimit_ = UINT64_MAX;
@ -1203,7 +1203,7 @@ Always returns True for CHECK_NONE and CHECK_CRC32.
static PyObject * static PyObject *
_lzma_is_check_supported_impl(PyModuleDef *module, int check_id) _lzma_is_check_supported_impl(PyModuleDef *module, int check_id)
/*[clinic end generated code: checksum=bb828e90e00ad96ed61f66719c2fca7fde637418]*/ /*[clinic end generated code: output=bb828e90e00ad96e input=5518297b97b2318f]*/
{ {
return PyBool_FromLong(lzma_check_is_supported(check_id)); return PyBool_FromLong(lzma_check_is_supported(check_id));
} }
@ -1221,7 +1221,7 @@ The result does not include the filter ID itself, only the options.
static PyObject * static PyObject *
_lzma__encode_filter_properties_impl(PyModuleDef *module, lzma_filter filter) _lzma__encode_filter_properties_impl(PyModuleDef *module, lzma_filter filter)
/*[clinic end generated code: checksum=b5fe690acd6b61d1abfc32f522ada5bdcf9b13da]*/ /*[clinic end generated code: output=b5fe690acd6b61d1 input=d4c64f1b557c77d4]*/
{ {
lzma_ret lzret; lzma_ret lzret;
uint32_t encoded_size; uint32_t encoded_size;
@ -1261,7 +1261,7 @@ The result does not include the filter ID itself, only the options.
static PyObject * static PyObject *
_lzma__decode_filter_properties_impl(PyModuleDef *module, lzma_vli filter_id, Py_buffer *encoded_props) _lzma__decode_filter_properties_impl(PyModuleDef *module, lzma_vli filter_id, Py_buffer *encoded_props)
/*[clinic end generated code: checksum=235f7f5345d48744dcd21f781dafbbf05a717538]*/ /*[clinic end generated code: output=235f7f5345d48744 input=246410800782160c]*/
{ {
lzma_filter filter; lzma_filter filter;
lzma_ret lzret; lzma_ret lzret;

View File

@ -228,4 +228,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: checksum=b4b90dcbd0c9c349c3a94e26a7eecf71aab179a0]*/ /*[clinic end generated code: output=b4b90dcbd0c9c349 input=a9049054013a1b77]*/

View File

@ -4,7 +4,7 @@
/*[clinic input] /*[clinic input]
module _opcode module _opcode
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=117442e66eb376e6]*/
/*[clinic input] /*[clinic input]
@ -64,7 +64,7 @@ exit:
static int static int
_opcode_stack_effect_impl(PyModuleDef *module, int opcode, int group_right_1, int oparg) _opcode_stack_effect_impl(PyModuleDef *module, int opcode, int group_right_1, int oparg)
/*[clinic end generated code: checksum=4689140ffda2494a123ea2593fb63445fb039774]*/ /*[clinic end generated code: output=4689140ffda2494a input=056816407c3d4284]*/
{ {
int effect; int effect;
if (HAS_ARG(opcode)) { if (HAS_ARG(opcode)) {

View File

@ -12,7 +12,7 @@ class _pickle.PicklerMemoProxy "PicklerMemoProxyObject *" "&PicklerMemoProxyType
class _pickle.Unpickler "UnpicklerObject *" "&Unpickler_Type" class _pickle.Unpickler "UnpicklerObject *" "&Unpickler_Type"
class _pickle.UnpicklerMemoProxy "UnpicklerMemoProxyObject *" "&UnpicklerMemoProxyType" class _pickle.UnpicklerMemoProxy "UnpicklerMemoProxyObject *" "&UnpicklerMemoProxyType"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=11c45248a41dd3fc]*/
/* Bump this when new opcodes are added to the pickle protocol. */ /* Bump this when new opcodes are added to the pickle protocol. */
enum { enum {
@ -3885,7 +3885,7 @@ re-using picklers.
static PyObject * static PyObject *
_pickle_Pickler_clear_memo_impl(PicklerObject *self) _pickle_Pickler_clear_memo_impl(PicklerObject *self)
/*[clinic end generated code: checksum=8665c8658aaa094ba9b424d3d7fe0add5e8142ab]*/ /*[clinic end generated code: output=8665c8658aaa094b input=01bdad52f3d93e56]*/
{ {
if (self->memo) if (self->memo)
PyMemoTable_Clear(self->memo); PyMemoTable_Clear(self->memo);
@ -3905,7 +3905,7 @@ Write a pickled representation of the given object to the open file.
static PyObject * static PyObject *
_pickle_Pickler_dump(PicklerObject *self, PyObject *obj) _pickle_Pickler_dump(PicklerObject *self, PyObject *obj)
/*[clinic end generated code: checksum=87ecad1261e02ac7ad0b051467b61bb058ae55b3]*/ /*[clinic end generated code: output=87ecad1261e02ac7 input=552eb1c0f52260d9]*/
{ {
/* Check whether the Pickler was initialized correctly (issue3664). /* Check whether the Pickler was initialized correctly (issue3664).
Developers often forget to call __init__() in their subclasses, which Developers often forget to call __init__() in their subclasses, which
@ -4010,7 +4010,7 @@ to map the new Python 3 names to the old module names used in Python
static int static int
_pickle_Pickler___init___impl(PicklerObject *self, PyObject *file, PyObject *protocol, int fix_imports) _pickle_Pickler___init___impl(PicklerObject *self, PyObject *file, PyObject *protocol, int fix_imports)
/*[clinic end generated code: checksum=56e229f3b1f4332fbfe28a33e43dae836a8dab43]*/ /*[clinic end generated code: output=56e229f3b1f4332f input=b8cdeb7e3f5ee674]*/
{ {
_Py_IDENTIFIER(persistent_id); _Py_IDENTIFIER(persistent_id);
_Py_IDENTIFIER(dispatch_table); _Py_IDENTIFIER(dispatch_table);
@ -4080,7 +4080,7 @@ Remove all items from memo.
static PyObject * static PyObject *
_pickle_PicklerMemoProxy_clear_impl(PicklerMemoProxyObject *self) _pickle_PicklerMemoProxy_clear_impl(PicklerMemoProxyObject *self)
/*[clinic end generated code: checksum=5fb9370d48ae8b055fc72518a2b12d1714338078]*/ /*[clinic end generated code: output=5fb9370d48ae8b05 input=ccc186dacd0f1405]*/
{ {
if (self->pickler->memo) if (self->pickler->memo)
PyMemoTable_Clear(self->pickler->memo); PyMemoTable_Clear(self->pickler->memo);
@ -4095,7 +4095,7 @@ Copy the memo to a new object.
static PyObject * static PyObject *
_pickle_PicklerMemoProxy_copy_impl(PicklerMemoProxyObject *self) _pickle_PicklerMemoProxy_copy_impl(PicklerMemoProxyObject *self)
/*[clinic end generated code: checksum=bb83a919d29225ef55ba0ecfca002369ea4eb8ea]*/ /*[clinic end generated code: output=bb83a919d29225ef input=b73043485ac30b36]*/
{ {
Py_ssize_t i; Py_ssize_t i;
PyMemoTable *memo; PyMemoTable *memo;
@ -4140,7 +4140,7 @@ Implement pickle support.
static PyObject * static PyObject *
_pickle_PicklerMemoProxy___reduce___impl(PicklerMemoProxyObject *self) _pickle_PicklerMemoProxy___reduce___impl(PicklerMemoProxyObject *self)
/*[clinic end generated code: checksum=bebba1168863ab1d6560ad707d0f4ab41deb722d]*/ /*[clinic end generated code: output=bebba1168863ab1d input=2f7c540e24b7aae4]*/
{ {
PyObject *reduce_value, *dict_args; PyObject *reduce_value, *dict_args;
PyObject *contents = _pickle_PicklerMemoProxy_copy_impl(self); PyObject *contents = _pickle_PicklerMemoProxy_copy_impl(self);
@ -6163,7 +6163,7 @@ specified therein.
static PyObject * static PyObject *
_pickle_Unpickler_load_impl(UnpicklerObject *self) _pickle_Unpickler_load_impl(UnpicklerObject *self)
/*[clinic end generated code: checksum=fdcc488aad675b1458b5644180d092b99e6e4fe4]*/ /*[clinic end generated code: output=fdcc488aad675b14 input=acbb91a42fa9b7b9]*/
{ {
UnpicklerObject *unpickler = (UnpicklerObject*)self; UnpicklerObject *unpickler = (UnpicklerObject*)self;
@ -6206,7 +6206,7 @@ needed. Both arguments passed are str objects.
static PyObject * static PyObject *
_pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyObject *module_name, PyObject *global_name) _pickle_Unpickler_find_class_impl(UnpicklerObject *self, PyObject *module_name, PyObject *global_name)
/*[clinic end generated code: checksum=64c77437e088e188fa0b022a0402d5b2964da8c9]*/ /*[clinic end generated code: output=64c77437e088e188 input=e2e6a865de093ef4]*/
{ {
PyObject *global; PyObject *global;
PyObject *modules_dict; PyObject *modules_dict;
@ -6389,7 +6389,7 @@ string instances as bytes objects.
static int static int
_pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file, int fix_imports, const char *encoding, const char *errors) _pickle_Unpickler___init___impl(UnpicklerObject *self, PyObject *file, int fix_imports, const char *encoding, const char *errors)
/*[clinic end generated code: checksum=b9ed1d84d315f3b57f91b878cdd88024ccc2ae89]*/ /*[clinic end generated code: output=b9ed1d84d315f3b5 input=30b4dc9e976b890c]*/
{ {
_Py_IDENTIFIER(persistent_load); _Py_IDENTIFIER(persistent_load);
@ -6453,7 +6453,7 @@ Remove all items from memo.
static PyObject * static PyObject *
_pickle_UnpicklerMemoProxy_clear_impl(UnpicklerMemoProxyObject *self) _pickle_UnpicklerMemoProxy_clear_impl(UnpicklerMemoProxyObject *self)
/*[clinic end generated code: checksum=d20cd43f4ba1fb1f1ba1677fae3ff69b8cc41582]*/ /*[clinic end generated code: output=d20cd43f4ba1fb1f input=b1df7c52e7afd9bd]*/
{ {
_Unpickler_MemoCleanup(self->unpickler); _Unpickler_MemoCleanup(self->unpickler);
self->unpickler->memo = _Unpickler_NewMemo(self->unpickler->memo_size); self->unpickler->memo = _Unpickler_NewMemo(self->unpickler->memo_size);
@ -6470,7 +6470,7 @@ Copy the memo to a new object.
static PyObject * static PyObject *
_pickle_UnpicklerMemoProxy_copy_impl(UnpicklerMemoProxyObject *self) _pickle_UnpicklerMemoProxy_copy_impl(UnpicklerMemoProxyObject *self)
/*[clinic end generated code: checksum=e12af7e9bc1e4c77df97c1e657d6b8e026a022b7]*/ /*[clinic end generated code: output=e12af7e9bc1e4c77 input=97769247ce032c1d]*/
{ {
Py_ssize_t i; Py_ssize_t i;
PyObject *new_memo = PyDict_New(); PyObject *new_memo = PyDict_New();
@ -6508,7 +6508,7 @@ Implement pickling support.
static PyObject * static PyObject *
_pickle_UnpicklerMemoProxy___reduce___impl(UnpicklerMemoProxyObject *self) _pickle_UnpicklerMemoProxy___reduce___impl(UnpicklerMemoProxyObject *self)
/*[clinic end generated code: checksum=6da34ac048d94cca7604faa72d45992e730882f1]*/ /*[clinic end generated code: output=6da34ac048d94cca input=6920862413407199]*/
{ {
PyObject *reduce_value; PyObject *reduce_value;
PyObject *constructor_args; PyObject *constructor_args;
@ -6818,7 +6818,7 @@ to map the new Python 3 names to the old module names used in Python
static PyObject * static PyObject *
_pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file, PyObject *protocol, int fix_imports) _pickle_dump_impl(PyModuleDef *module, PyObject *obj, PyObject *file, PyObject *protocol, int fix_imports)
/*[clinic end generated code: checksum=a606e626d553850d96c286e909a139552d5d4096]*/ /*[clinic end generated code: output=a606e626d553850d input=e9e5fdd48de92eae]*/
{ {
PicklerObject *pickler = _Pickler_New(); PicklerObject *pickler = _Pickler_New();
@ -6871,7 +6871,7 @@ Python 2, so that the pickle data stream is readable with Python 2.
static PyObject * static PyObject *
_pickle_dumps_impl(PyModuleDef *module, PyObject *obj, PyObject *protocol, int fix_imports) _pickle_dumps_impl(PyModuleDef *module, PyObject *obj, PyObject *protocol, int fix_imports)
/*[clinic end generated code: checksum=777f0deefe5b88ee324d43ab31b2579da7bbf22a]*/ /*[clinic end generated code: output=777f0deefe5b88ee input=293dbeda181580b7]*/
{ {
PyObject *result; PyObject *result;
PicklerObject *pickler = _Pickler_New(); PicklerObject *pickler = _Pickler_New();
@ -6931,7 +6931,7 @@ string instances as bytes objects.
static PyObject * static PyObject *
_pickle_load_impl(PyModuleDef *module, PyObject *file, int fix_imports, const char *encoding, const char *errors) _pickle_load_impl(PyModuleDef *module, PyObject *file, int fix_imports, const char *encoding, const char *errors)
/*[clinic end generated code: checksum=568c61356c172654a23cf4edb4afffa1dc2a55d9]*/ /*[clinic end generated code: output=568c61356c172654 input=da97372e38e510a6]*/
{ {
PyObject *result; PyObject *result;
UnpicklerObject *unpickler = _Unpickler_New(); UnpicklerObject *unpickler = _Unpickler_New();
@ -6984,7 +6984,7 @@ string instances as bytes objects.
static PyObject * static PyObject *
_pickle_loads_impl(PyModuleDef *module, PyObject *data, int fix_imports, const char *encoding, const char *errors) _pickle_loads_impl(PyModuleDef *module, PyObject *data, int fix_imports, const char *encoding, const char *errors)
/*[clinic end generated code: checksum=0b3845ad110b25220ab613e9a1e573194271a337]*/ /*[clinic end generated code: output=0b3845ad110b2522 input=f57f0fdaa2b4cb8b]*/
{ {
PyObject *result; PyObject *result;
UnpicklerObject *unpickler = _Unpickler_New(); UnpicklerObject *unpickler = _Unpickler_New();

View File

@ -540,7 +540,7 @@ Matches zero or more characters at the beginning of the string.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(pattern_match__doc__, PyDoc_STRVAR(pattern_match__doc__,
"match(self, pattern, pos=0, endpos=sys.maxsize)\n" "sig=($self, pattern, pos=0, endpos=sys.maxsize)\n"
"Matches zero or more characters at the beginning of the string."); "Matches zero or more characters at the beginning of the string.");
#define PATTERN_MATCH_METHODDEF \ #define PATTERN_MATCH_METHODDEF \
@ -570,7 +570,7 @@ exit:
static PyObject * static PyObject *
pattern_match_impl(PatternObject *self, PyObject *pattern, Py_ssize_t pos, Py_ssize_t endpos) pattern_match_impl(PatternObject *self, PyObject *pattern, Py_ssize_t pos, Py_ssize_t endpos)
/*[clinic end generated code: checksum=4a3865d13638cb7c13dcae1fe58c1a9c35071998]*/ /*[clinic end generated code: output=9f5b785661677848 input=26f9fd31befe46b9]*/
{ {
SRE_STATE state; SRE_STATE state;
Py_ssize_t status; Py_ssize_t status;

View File

@ -2851,18 +2851,18 @@ PyDoc_STRVAR(docstring_no_signature,
); );
PyDoc_STRVAR(docstring_with_invalid_signature, PyDoc_STRVAR(docstring_with_invalid_signature,
"docstring_with_invalid_signature (module, boo)\n" "sig= (module, boo)\n"
"\n" "\n"
"This docstring has an invalid signature." "This docstring has an invalid signature."
); );
PyDoc_STRVAR(docstring_with_signature, PyDoc_STRVAR(docstring_with_signature,
"docstring_with_signature(module, sig)\n" "sig=(module, sig)\n"
"This docstring has a valid signature." "This docstring has a valid signature."
); );
PyDoc_STRVAR(docstring_with_signature_and_extra_newlines, PyDoc_STRVAR(docstring_with_signature_and_extra_newlines,
"docstring_with_signature_and_extra_newlines(module, parameter)\n" "sig=(module, parameter)\n"
"\n" "\n"
"\n" "\n"
"\n" "\n"
@ -2870,7 +2870,7 @@ PyDoc_STRVAR(docstring_with_signature_and_extra_newlines,
); );
PyDoc_STRVAR(docstring_with_signature_with_defaults, PyDoc_STRVAR(docstring_with_signature_with_defaults,
"docstring_with_signature_with_defaults(module, s='avocado', b=b'bytes', d=3.14, i=35, n=None, t=True, f=False, local=the_number_three, sys=sys.maxsize, exp=sys.maxsize - 1)\n" "sig=(module, s='avocado', b=b'bytes', d=3.14, i=35, n=None, t=True, f=False, local=the_number_three, sys=sys.maxsize, exp=sys.maxsize - 1)\n"
"\n" "\n"
"\n" "\n"
"\n" "\n"

View File

@ -7,7 +7,7 @@
/*[clinic input] /*[clinic input]
module _weakref module _weakref
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=ffec73b85846596d]*/
/*[clinic input] /*[clinic input]
@ -20,7 +20,7 @@ Return the number of weak references to 'object'.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_weakref_getweakrefcount__doc__, PyDoc_STRVAR(_weakref_getweakrefcount__doc__,
"getweakrefcount(module, object)\n" "sig=($module, object)\n"
"Return the number of weak references to \'object\'."); "Return the number of weak references to \'object\'.");
#define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \ #define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \
@ -46,7 +46,7 @@ exit:
static Py_ssize_t static Py_ssize_t
_weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object) _weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object)
/*[clinic end generated code: checksum=dd8ba0730babf263d3db78d260ea7eacf6eb3735]*/ /*[clinic end generated code: output=ef51baac56180816 input=cedb69711b6a2507]*/
{ {
PyWeakReference **list; PyWeakReference **list;

View File

@ -394,7 +394,7 @@ audioop_check_parameters(Py_ssize_t len, int size)
output preset file output preset file
module audioop module audioop
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=5619f935f269199a]*/
/*[clinic input] /*[clinic input]
audioop.getsample audioop.getsample
@ -409,7 +409,7 @@ Return the value of sample index from the fragment.
static PyObject * static PyObject *
audioop_getsample_impl(PyModuleDef *module, Py_buffer *fragment, int width, Py_ssize_t index) audioop_getsample_impl(PyModuleDef *module, Py_buffer *fragment, int width, Py_ssize_t index)
/*[clinic end generated code: checksum=f4482497e6f6e78fe88451c19a288837099d6eef]*/ /*[clinic end generated code: output=f4482497e6f6e78f input=88edbe2871393549]*/
{ {
int val; int val;
@ -435,7 +435,7 @@ Return the maximum of the absolute value of all samples in a fragment.
static PyObject * static PyObject *
audioop_max_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_max_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=85047ee1001f230518386b16148955ba9be4874f]*/ /*[clinic end generated code: output=85047ee1001f2305 input=32bea5ea0ac8c223]*/
{ {
Py_ssize_t i; Py_ssize_t i;
unsigned int absval, max = 0; unsigned int absval, max = 0;
@ -463,7 +463,7 @@ Return the minimum and maximum values of all samples in the sound fragment.
static PyObject * static PyObject *
audioop_minmax_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_minmax_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=ae8f5513c64fd569849adbbcc5fcd4d8f399da1b]*/ /*[clinic end generated code: output=ae8f5513c64fd569 input=89848e9b927a0696]*/
{ {
Py_ssize_t i; Py_ssize_t i;
/* -1 trick below is needed on Windows to support -0x80000000 without /* -1 trick below is needed on Windows to support -0x80000000 without
@ -492,7 +492,7 @@ Return the average over all samples in the fragment.
static PyObject * static PyObject *
audioop_avg_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_avg_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=7fccd645c95f4860899f6b3aaab269e3e58806e1]*/ /*[clinic end generated code: output=7fccd645c95f4860 input=1114493c7611334d]*/
{ {
Py_ssize_t i; Py_ssize_t i;
int avg; int avg;
@ -521,7 +521,7 @@ Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n).
static PyObject * static PyObject *
audioop_rms_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_rms_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=7b398702c81b709d87aba3f0635eeb3fc1b0a1a4]*/ /*[clinic end generated code: output=7b398702c81b709d input=4cc57c6c94219d78]*/
{ {
Py_ssize_t i; Py_ssize_t i;
unsigned int res; unsigned int res;
@ -595,7 +595,7 @@ Try to match reference as well as possible to a portion of fragment.
static PyObject * static PyObject *
audioop_findfit_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference) audioop_findfit_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference)
/*[clinic end generated code: checksum=505fd04d4244db31044abb5c114a5e8f9c45b171]*/ /*[clinic end generated code: output=505fd04d4244db31 input=62c305605e183c9a]*/
{ {
const short *cp1, *cp2; const short *cp1, *cp2;
Py_ssize_t len1, len2; Py_ssize_t len1, len2;
@ -663,7 +663,7 @@ Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal.
static PyObject * static PyObject *
audioop_findfactor_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference) audioop_findfactor_impl(PyModuleDef *module, Py_buffer *fragment, Py_buffer *reference)
/*[clinic end generated code: checksum=ddf35a1e57575ce4acbc000104810d9fdde8eba5]*/ /*[clinic end generated code: output=ddf35a1e57575ce4 input=816680301d012b21]*/
{ {
const short *cp1, *cp2; const short *cp1, *cp2;
Py_ssize_t len; Py_ssize_t len;
@ -704,7 +704,7 @@ Search fragment for a slice of specified number of samples with maximum energy.
static PyObject * static PyObject *
audioop_findmax_impl(PyModuleDef *module, Py_buffer *fragment, Py_ssize_t length) audioop_findmax_impl(PyModuleDef *module, Py_buffer *fragment, Py_ssize_t length)
/*[clinic end generated code: checksum=21d0c2a1e5655134f7460b7fd49ee4ba1e5fdb13]*/ /*[clinic end generated code: output=21d0c2a1e5655134 input=2f304801ed42383c]*/
{ {
const short *cp1; const short *cp1;
Py_ssize_t len1; Py_ssize_t len1;
@ -757,7 +757,7 @@ Return the average peak-peak value over all samples in the fragment.
static PyObject * static PyObject *
audioop_avgpp_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_avgpp_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=06c8380fd6e34207f4b58d6c3d4b5ebc7afe138d]*/ /*[clinic end generated code: output=06c8380fd6e34207 input=0b3cceeae420a7d9]*/
{ {
Py_ssize_t i; Py_ssize_t i;
int prevval, prevextremevalid = 0, prevextreme = 0; int prevval, prevextremevalid = 0, prevextreme = 0;
@ -814,7 +814,7 @@ Return the maximum peak-peak value in the sound fragment.
static PyObject * static PyObject *
audioop_maxpp_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_maxpp_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=c300c0bd7e8535c07e128bbaac211c69744f750b]*/ /*[clinic end generated code: output=c300c0bd7e8535c0 input=671a13e1518f80a1]*/
{ {
Py_ssize_t i; Py_ssize_t i;
int prevval, prevextremevalid = 0, prevextreme = 0; int prevval, prevextremevalid = 0, prevextreme = 0;
@ -867,7 +867,7 @@ Return the number of zero crossings in the fragment passed as an argument.
static PyObject * static PyObject *
audioop_cross_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_cross_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=99e6572d7d7cdbf1b5372090308201c62d518a43]*/ /*[clinic end generated code: output=99e6572d7d7cdbf1 input=b1b3f15b83f6b41a]*/
{ {
Py_ssize_t i; Py_ssize_t i;
int prevval; int prevval;
@ -898,7 +898,7 @@ Return a fragment that has all samples in the original fragment multiplied by th
static PyObject * static PyObject *
audioop_mul_impl(PyModuleDef *module, Py_buffer *fragment, int width, double factor) audioop_mul_impl(PyModuleDef *module, Py_buffer *fragment, int width, double factor)
/*[clinic end generated code: checksum=a697ebbd5852d38f941d52127a5b38e4f8cd5540]*/ /*[clinic end generated code: output=a697ebbd5852d38f input=c726667baa157d3c]*/
{ {
signed char *ncp; signed char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -939,7 +939,7 @@ Convert a stereo fragment to a mono fragment.
static PyObject * static PyObject *
audioop_tomono_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor) audioop_tomono_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor)
/*[clinic end generated code: checksum=436e7710521661dd541ec177ee53e6b0ee340182]*/ /*[clinic end generated code: output=436e7710521661dd input=c4ec949b3f4dddfa]*/
{ {
signed char *cp, *ncp; signed char *cp, *ncp;
Py_ssize_t len, i; Py_ssize_t len, i;
@ -987,7 +987,7 @@ Generate a stereo fragment from a mono fragment.
static PyObject * static PyObject *
audioop_tostereo_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor) audioop_tostereo_impl(PyModuleDef *module, Py_buffer *fragment, int width, double lfactor, double rfactor)
/*[clinic end generated code: checksum=6ff50681c87f4c1cbe4c394c4186ae8ae91b5c0d]*/ /*[clinic end generated code: output=6ff50681c87f4c1c input=27b6395ebfdff37a]*/
{ {
signed char *ncp; signed char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1034,7 +1034,7 @@ Return a fragment which is the addition of the two samples passed as parameters.
static PyObject * static PyObject *
audioop_add_impl(PyModuleDef *module, Py_buffer *fragment1, Py_buffer *fragment2, int width) audioop_add_impl(PyModuleDef *module, Py_buffer *fragment1, Py_buffer *fragment2, int width)
/*[clinic end generated code: checksum=f9218bf9ea75c3f1e4b2ed5ffdfd631354e8fdfe]*/ /*[clinic end generated code: output=f9218bf9ea75c3f1 input=4a8d4bae4c1605c7]*/
{ {
signed char *ncp; signed char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1092,7 +1092,7 @@ Return a fragment that is the original fragment with a bias added to each sample
static PyObject * static PyObject *
audioop_bias_impl(PyModuleDef *module, Py_buffer *fragment, int width, int bias) audioop_bias_impl(PyModuleDef *module, Py_buffer *fragment, int width, int bias)
/*[clinic end generated code: checksum=8ec80b3f5d510a51a85e89e8c0a73070697f2ab4]*/ /*[clinic end generated code: output=8ec80b3f5d510a51 input=2b5cce5c3bb4838c]*/
{ {
signed char *ncp; signed char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1151,7 +1151,7 @@ Reverse the samples in a fragment and returns the modified fragment.
static PyObject * static PyObject *
audioop_reverse_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_reverse_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=6ec3c91337f5925eaf17a7b8b907120102b6fb72]*/ /*[clinic end generated code: output=6ec3c91337f5925e input=668f890cf9f9d225]*/
{ {
unsigned char *ncp; unsigned char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1184,7 +1184,7 @@ Convert big-endian samples to little-endian and vice versa.
static PyObject * static PyObject *
audioop_byteswap_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_byteswap_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=bfe4aa584b7a3f5bd818cf79f83fa73e612cc9b8]*/ /*[clinic end generated code: output=bfe4aa584b7a3f5b input=fae7611ceffa5c82]*/
{ {
unsigned char *ncp; unsigned char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1219,7 +1219,7 @@ Convert samples between 1-, 2-, 3- and 4-byte formats.
static PyObject * static PyObject *
audioop_lin2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, int newwidth) audioop_lin2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, int newwidth)
/*[clinic end generated code: checksum=3f9468a74472a93e2054a9da0ea1bbc39fe23e84]*/ /*[clinic end generated code: output=3f9468a74472a93e input=5ce08c8aa2f24d96]*/
{ {
unsigned char *ncp; unsigned char *ncp;
Py_ssize_t i, j; Py_ssize_t i, j;
@ -1276,7 +1276,7 @@ Convert the frame rate of the input fragment.
static PyObject * static PyObject *
audioop_ratecv_impl(PyModuleDef *module, Py_buffer *fragment, int width, int nchannels, int inrate, int outrate, PyObject *state, int weightA, int weightB) audioop_ratecv_impl(PyModuleDef *module, Py_buffer *fragment, int width, int nchannels, int inrate, int outrate, PyObject *state, int weightA, int weightB)
/*[clinic end generated code: checksum=5585dddc4b5ff2363877076f4c6616df8d3e6f14]*/ /*[clinic end generated code: output=5585dddc4b5ff236 input=aff3acdc94476191]*/
{ {
char *cp, *ncp; char *cp, *ncp;
Py_ssize_t len; Py_ssize_t len;
@ -1455,7 +1455,7 @@ Convert samples in the audio fragment to u-LAW encoding.
static PyObject * static PyObject *
audioop_lin2ulaw_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_lin2ulaw_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=26263cc877c5e1bc84fede972fb59499a82d949c]*/ /*[clinic end generated code: output=26263cc877c5e1bc input=2450d1b870b6bac2]*/
{ {
unsigned char *ncp; unsigned char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1488,7 +1488,7 @@ Convert sound fragments in u-LAW encoding to linearly encoded sound fragments.
static PyObject * static PyObject *
audioop_ulaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_ulaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=9864cb34e3a1d87689f830d4c95cdcaae9a44561]*/ /*[clinic end generated code: output=9864cb34e3a1d876 input=45d53ddce5be7d06]*/
{ {
unsigned char *cp; unsigned char *cp;
signed char *ncp; signed char *ncp;
@ -1528,7 +1528,7 @@ Convert samples in the audio fragment to a-LAW encoding.
static PyObject * static PyObject *
audioop_lin2alaw_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_lin2alaw_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=d5bf14bd0fe6fdcd4b0d604ccdf257097eb2419e]*/ /*[clinic end generated code: output=d5bf14bd0fe6fdcd input=ffb1ef8bb39da945]*/
{ {
unsigned char *ncp; unsigned char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1561,7 +1561,7 @@ Convert sound fragments in a-LAW encoding to linearly encoded sound fragments.
static PyObject * static PyObject *
audioop_alaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width) audioop_alaw2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width)
/*[clinic end generated code: checksum=d2b604ddd036e1cd4bb95b5553626b44302db48a]*/ /*[clinic end generated code: output=d2b604ddd036e1cd input=4140626046cd1772]*/
{ {
unsigned char *cp; unsigned char *cp;
signed char *ncp; signed char *ncp;
@ -1603,7 +1603,7 @@ Convert samples to 4 bit Intel/DVI ADPCM encoding.
static PyObject * static PyObject *
audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state) audioop_lin2adpcm_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state)
/*[clinic end generated code: checksum=4654c29d2731fafe35e7aa1e3d261361dbbbcc3b]*/ /*[clinic end generated code: output=4654c29d2731fafe input=12919d549b90c90a]*/
{ {
signed char *ncp; signed char *ncp;
Py_ssize_t i; Py_ssize_t i;
@ -1725,7 +1725,7 @@ Decode an Intel/DVI ADPCM coded fragment to a linear fragment.
static PyObject * static PyObject *
audioop_adpcm2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state) audioop_adpcm2lin_impl(PyModuleDef *module, Py_buffer *fragment, int width, PyObject *state)
/*[clinic end generated code: checksum=371965cdcc0aa69ba970e8bc5662b30d45bcc38d]*/ /*[clinic end generated code: output=371965cdcc0aa69b input=f5221144f5ca9ef0]*/
{ {
signed char *cp; signed char *cp;
signed char *ncp; signed char *ncp;

View File

@ -187,7 +187,7 @@ static unsigned short crctab_hqx[256] = {
output preset file output preset file
module binascii module binascii
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=44c6f840ce708f0c]*/
/*[python input] /*[python input]
@ -202,7 +202,7 @@ class ascii_buffer_converter(CConverter):
return "".join(["if (", name, ".obj)\n PyBuffer_Release(&", name, ");\n"]) return "".join(["if (", name, ".obj)\n PyBuffer_Release(&", name, ");\n"])
[python start generated code]*/ [python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[python end generated code: output=da39a3ee5e6b4b0d input=3eb7b63610da92cd]*/
static int static int
ascii_buffer_converter(PyObject *arg, Py_buffer *buf) ascii_buffer_converter(PyObject *arg, Py_buffer *buf)
@ -254,7 +254,7 @@ Decode a line of uuencoded data.
static PyObject * static PyObject *
binascii_a2b_uu_impl(PyModuleDef *module, Py_buffer *data) binascii_a2b_uu_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=5779f39b0b48459ff0f7a365d7e69b57422e2a4a]*/ /*[clinic end generated code: output=5779f39b0b48459f input=7cafeaf73df63d1c]*/
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -340,7 +340,7 @@ Uuencode line of data.
static PyObject * static PyObject *
binascii_b2a_uu_impl(PyModuleDef *module, Py_buffer *data) binascii_b2a_uu_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=181021b69bb9a4149fffa98aa3ed57b59ffa38cb]*/ /*[clinic end generated code: output=181021b69bb9a414 input=00fdf458ce8b465b]*/
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -427,7 +427,7 @@ Decode a line of base64 data.
static PyObject * static PyObject *
binascii_a2b_base64_impl(PyModuleDef *module, Py_buffer *data) binascii_a2b_base64_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=3e351b702bed56d249caa4aa0f1bb3fae7546025]*/ /*[clinic end generated code: output=3e351b702bed56d2 input=5872acf6e1cac243]*/
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -535,7 +535,7 @@ Base64-code line of data.
static PyObject * static PyObject *
binascii_b2a_base64_impl(PyModuleDef *module, Py_buffer *data) binascii_b2a_base64_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=3cd61fbee2913285e253bc5415c9d052b0c5dd96]*/ /*[clinic end generated code: output=3cd61fbee2913285 input=14ec4e47371174a9]*/
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -602,7 +602,7 @@ Decode .hqx coding.
static PyObject * static PyObject *
binascii_a2b_hqx_impl(PyModuleDef *module, Py_buffer *data) binascii_a2b_hqx_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=60bcdbbd28b105cd7091d98e70a6e458f8039e9e]*/ /*[clinic end generated code: output=60bcdbbd28b105cd input=0d914c680e0eed55]*/
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -685,7 +685,7 @@ Binhex RLE-code binary data.
static PyObject * static PyObject *
binascii_rlecode_hqx_impl(PyModuleDef *module, Py_buffer *data) binascii_rlecode_hqx_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=0905da344dbf064855925c3a0fb83ec11ca33e8b]*/ /*[clinic end generated code: output=0905da344dbf0648 input=e1f1712447a82b09]*/
{ {
unsigned char *in_data, *out_data; unsigned char *in_data, *out_data;
PyObject *rv; PyObject *rv;
@ -749,7 +749,7 @@ Encode .hqx data.
static PyObject * static PyObject *
binascii_b2a_hqx_impl(PyModuleDef *module, Py_buffer *data) binascii_b2a_hqx_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=5a987810d5e3cdbb0eb415eba8907c022342fe15]*/ /*[clinic end generated code: output=5a987810d5e3cdbb input=9596ebe019fe12ba]*/
{ {
unsigned char *ascii_data, *bin_data; unsigned char *ascii_data, *bin_data;
int leftbits = 0; int leftbits = 0;
@ -806,7 +806,7 @@ Decode hexbin RLE-coded string.
static PyObject * static PyObject *
binascii_rledecode_hqx_impl(PyModuleDef *module, Py_buffer *data) binascii_rledecode_hqx_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=f7afd89b789946ab50e31d595c695d5cad7e27e3]*/ /*[clinic end generated code: output=f7afd89b789946ab input=54cdd49fc014402c]*/
{ {
unsigned char *in_data, *out_data; unsigned char *in_data, *out_data;
unsigned char in_byte, in_repeat; unsigned char in_byte, in_repeat;
@ -920,7 +920,7 @@ Compute hqx CRC incrementally.
static int static int
binascii_crc_hqx_impl(PyModuleDef *module, Py_buffer *data, int crc) binascii_crc_hqx_impl(PyModuleDef *module, Py_buffer *data, int crc)
/*[clinic end generated code: checksum=634dac18dfa863d738833b5a0886eca93c034c0c]*/ /*[clinic end generated code: output=634dac18dfa863d7 input=68060931b2f51c8a]*/
{ {
unsigned char *bin_data; unsigned char *bin_data;
unsigned int ucrc = (unsigned int)crc; unsigned int ucrc = (unsigned int)crc;
@ -1068,7 +1068,7 @@ Compute CRC-32 incrementally.
static unsigned int static unsigned int
binascii_crc32_impl(PyModuleDef *module, Py_buffer *data, unsigned int crc) binascii_crc32_impl(PyModuleDef *module, Py_buffer *data, unsigned int crc)
/*[clinic end generated code: checksum=620a961643393c4f2a1fb273fda2acb43970c3f5]*/ /*[clinic end generated code: output=620a961643393c4f input=bbe340bc99d25aa8]*/
#ifdef USE_ZLIB_CRC32 #ifdef USE_ZLIB_CRC32
/* This was taken from zlibmodule.c PyZlib_crc32 (but is PY_SSIZE_T_CLEAN) */ /* This was taken from zlibmodule.c PyZlib_crc32 (but is PY_SSIZE_T_CLEAN) */
@ -1116,7 +1116,7 @@ available as "hexlify()".
static PyObject * static PyObject *
binascii_b2a_hex_impl(PyModuleDef *module, Py_buffer *data) binascii_b2a_hex_impl(PyModuleDef *module, Py_buffer *data)
/*[clinic end generated code: checksum=179318922c2f8fdaee0d4d3283758aec8e8741a5]*/ /*[clinic end generated code: output=179318922c2f8fda input=96423cfa299ff3b1]*/
{ {
char* argbuf; char* argbuf;
Py_ssize_t arglen; Py_ssize_t arglen;
@ -1177,7 +1177,7 @@ This function is also available as "unhexlify()".
static PyObject * static PyObject *
binascii_a2b_hex_impl(PyModuleDef *module, Py_buffer *hexstr) binascii_a2b_hex_impl(PyModuleDef *module, Py_buffer *hexstr)
/*[clinic end generated code: checksum=d61da452b5c6d2903c32c3e90e6a97221b25989b]*/ /*[clinic end generated code: output=d61da452b5c6d290 input=9e1e7f2f94db24fd]*/
{ {
char* argbuf; char* argbuf;
Py_ssize_t arglen; Py_ssize_t arglen;
@ -1248,7 +1248,7 @@ Decode a string of qp-encoded data.
static PyObject * static PyObject *
binascii_a2b_qp_impl(PyModuleDef *module, Py_buffer *data, int header) binascii_a2b_qp_impl(PyModuleDef *module, Py_buffer *data, int header)
/*[clinic end generated code: checksum=a44ef8827035211431d0906a76dbfe97e59a5079]*/ /*[clinic end generated code: output=a44ef88270352114 input=5187a0d3d8e54f3b]*/
{ {
Py_ssize_t in, out; Py_ssize_t in, out;
char ch; char ch;
@ -1354,7 +1354,7 @@ are both encoded. When quotetabs is set, space and tabs are encoded.
static PyObject * static PyObject *
binascii_b2a_qp_impl(PyModuleDef *module, Py_buffer *data, int quotetabs, int istext, int header) binascii_b2a_qp_impl(PyModuleDef *module, Py_buffer *data, int quotetabs, int istext, int header)
/*[clinic end generated code: checksum=ff2991ba640fff3e67ac63205801c7173a0366cd]*/ /*[clinic end generated code: output=ff2991ba640fff3e input=7f2a9aaa008e92b2]*/
{ {
Py_ssize_t in, out; Py_ssize_t in, out;
unsigned char *databuf, *odata; unsigned char *databuf, *odata;

View File

@ -3,7 +3,7 @@ preserve
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_bz2_BZ2Compressor_compress__doc__, PyDoc_STRVAR(_bz2_BZ2Compressor_compress__doc__,
"compress(self, data)\n" "sig=($self, data)\n"
"Provide data to the compressor object.\n" "Provide data to the compressor object.\n"
"\n" "\n"
"Returns a chunk of compressed data if possible, or b\'\' otherwise.\n" "Returns a chunk of compressed data if possible, or b\'\' otherwise.\n"
@ -38,7 +38,7 @@ exit:
} }
PyDoc_STRVAR(_bz2_BZ2Compressor_flush__doc__, PyDoc_STRVAR(_bz2_BZ2Compressor_flush__doc__,
"flush(self)\n" "sig=($self)\n"
"Finish the compression process.\n" "Finish the compression process.\n"
"\n" "\n"
"Returns the compressed data left in internal buffers.\n" "Returns the compressed data left in internal buffers.\n"
@ -58,7 +58,7 @@ _bz2_BZ2Compressor_flush(BZ2Compressor *self, PyObject *Py_UNUSED(ignored))
} }
PyDoc_STRVAR(_bz2_BZ2Compressor___init____doc__, PyDoc_STRVAR(_bz2_BZ2Compressor___init____doc__,
"BZ2Compressor(compresslevel=9)\n" "sig=(compresslevel=9)\n"
"Create a compressor object for compressing data incrementally.\n" "Create a compressor object for compressing data incrementally.\n"
"\n" "\n"
" compresslevel\n" " compresslevel\n"
@ -89,7 +89,7 @@ exit:
} }
PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__, PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__,
"decompress(self, data)\n" "sig=($self, data)\n"
"Provide data to the decompressor object.\n" "Provide data to the decompressor object.\n"
"\n" "\n"
"Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n" "Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n"
@ -125,7 +125,7 @@ exit:
} }
PyDoc_STRVAR(_bz2_BZ2Decompressor___init____doc__, PyDoc_STRVAR(_bz2_BZ2Decompressor___init____doc__,
"BZ2Decompressor()\n" "sig=()\n"
"Create a decompressor object for decompressing data incrementally.\n" "Create a decompressor object for decompressing data incrementally.\n"
"\n" "\n"
"For one-shot decompression, use the decompress() function instead."); "For one-shot decompression, use the decompress() function instead.");
@ -149,4 +149,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: checksum=4ade1dba3921a8bd8a614e5417f7654d8fb10be5]*/ /*[clinic end generated code: output=aca4f6329c1c773a input=a9049054013a1b77]*/

View File

@ -3,7 +3,7 @@ preserve
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_lzma_LZMACompressor_compress__doc__, PyDoc_STRVAR(_lzma_LZMACompressor_compress__doc__,
"compress(self, data)\n" "sig=($self, data)\n"
"Provide data to the compressor object.\n" "Provide data to the compressor object.\n"
"\n" "\n"
"Returns a chunk of compressed data if possible, or b\'\' otherwise.\n" "Returns a chunk of compressed data if possible, or b\'\' otherwise.\n"
@ -38,7 +38,7 @@ exit:
} }
PyDoc_STRVAR(_lzma_LZMACompressor_flush__doc__, PyDoc_STRVAR(_lzma_LZMACompressor_flush__doc__,
"flush(self)\n" "sig=($self)\n"
"Finish the compression process.\n" "Finish the compression process.\n"
"\n" "\n"
"Returns the compressed data left in internal buffers.\n" "Returns the compressed data left in internal buffers.\n"
@ -58,7 +58,7 @@ _lzma_LZMACompressor_flush(Compressor *self, PyObject *Py_UNUSED(ignored))
} }
PyDoc_STRVAR(_lzma_LZMADecompressor_decompress__doc__, PyDoc_STRVAR(_lzma_LZMADecompressor_decompress__doc__,
"decompress(self, data)\n" "sig=($self, data)\n"
"Provide data to the decompressor object.\n" "Provide data to the decompressor object.\n"
"\n" "\n"
"Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n" "Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n"
@ -94,7 +94,7 @@ exit:
} }
PyDoc_STRVAR(_lzma_LZMADecompressor___init____doc__, PyDoc_STRVAR(_lzma_LZMADecompressor___init____doc__,
"LZMADecompressor(format=FORMAT_AUTO, memlimit=None, filters=None)\n" "sig=(format=FORMAT_AUTO, memlimit=None, filters=None)\n"
"Create a decompressor object for decompressing data incrementally.\n" "Create a decompressor object for decompressing data incrementally.\n"
"\n" "\n"
" format\n" " format\n"
@ -137,7 +137,7 @@ exit:
} }
PyDoc_STRVAR(_lzma_is_check_supported__doc__, PyDoc_STRVAR(_lzma_is_check_supported__doc__,
"is_check_supported(module, check_id)\n" "sig=($module, check_id)\n"
"Test whether the given integrity check is supported.\n" "Test whether the given integrity check is supported.\n"
"\n" "\n"
"Always returns True for CHECK_NONE and CHECK_CRC32."); "Always returns True for CHECK_NONE and CHECK_CRC32.");
@ -165,7 +165,7 @@ exit:
} }
PyDoc_STRVAR(_lzma__encode_filter_properties__doc__, PyDoc_STRVAR(_lzma__encode_filter_properties__doc__,
"_encode_filter_properties(module, filter)\n" "sig=($module, filter)\n"
"Return a bytes object encoding the options (properties) of the filter specified by *filter* (a dict).\n" "Return a bytes object encoding the options (properties) of the filter specified by *filter* (a dict).\n"
"\n" "\n"
"The result does not include the filter ID itself, only the options."); "The result does not include the filter ID itself, only the options.");
@ -197,7 +197,7 @@ exit:
} }
PyDoc_STRVAR(_lzma__decode_filter_properties__doc__, PyDoc_STRVAR(_lzma__decode_filter_properties__doc__,
"_decode_filter_properties(module, filter_id, encoded_props)\n" "sig=($module, filter_id, encoded_props)\n"
"Return a bytes object encoding the options (properties) of the filter specified by *filter* (a dict).\n" "Return a bytes object encoding the options (properties) of the filter specified by *filter* (a dict).\n"
"\n" "\n"
"The result does not include the filter ID itself, only the options."); "The result does not include the filter ID itself, only the options.");
@ -228,4 +228,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: checksum=b4b90dcbd0c9c349c3a94e26a7eecf71aab179a0]*/ /*[clinic end generated code: output=fe63bc798a5c5c55 input=a9049054013a1b77]*/

View File

@ -3,7 +3,7 @@ preserve
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_pickle_Pickler_clear_memo__doc__, PyDoc_STRVAR(_pickle_Pickler_clear_memo__doc__,
"clear_memo(self)\n" "sig=($self)\n"
"Clears the pickler\'s \"memo\".\n" "Clears the pickler\'s \"memo\".\n"
"\n" "\n"
"The memo is the data structure that remembers which objects the\n" "The memo is the data structure that remembers which objects the\n"
@ -24,14 +24,14 @@ _pickle_Pickler_clear_memo(PicklerObject *self, PyObject *Py_UNUSED(ignored))
} }
PyDoc_STRVAR(_pickle_Pickler_dump__doc__, PyDoc_STRVAR(_pickle_Pickler_dump__doc__,
"dump(self, obj)\n" "sig=($self, obj)\n"
"Write a pickled representation of the given object to the open file."); "Write a pickled representation of the given object to the open file.");
#define _PICKLE_PICKLER_DUMP_METHODDEF \ #define _PICKLE_PICKLER_DUMP_METHODDEF \
{"dump", (PyCFunction)_pickle_Pickler_dump, METH_O, _pickle_Pickler_dump__doc__}, {"dump", (PyCFunction)_pickle_Pickler_dump, METH_O, _pickle_Pickler_dump__doc__},
PyDoc_STRVAR(_pickle_Pickler___init____doc__, PyDoc_STRVAR(_pickle_Pickler___init____doc__,
"Pickler(file, protocol=None, fix_imports=True)\n" "sig=(file, protocol=None, fix_imports=True)\n"
"This takes a binary file for writing a pickle data stream.\n" "This takes a binary file for writing a pickle data stream.\n"
"\n" "\n"
"The optional *protocol* argument tells the pickler to use the given\n" "The optional *protocol* argument tells the pickler to use the given\n"
@ -74,7 +74,7 @@ exit:
} }
PyDoc_STRVAR(_pickle_PicklerMemoProxy_clear__doc__, PyDoc_STRVAR(_pickle_PicklerMemoProxy_clear__doc__,
"clear(self)\n" "sig=($self)\n"
"Remove all items from memo."); "Remove all items from memo.");
#define _PICKLE_PICKLERMEMOPROXY_CLEAR_METHODDEF \ #define _PICKLE_PICKLERMEMOPROXY_CLEAR_METHODDEF \
@ -90,7 +90,7 @@ _pickle_PicklerMemoProxy_clear(PicklerMemoProxyObject *self, PyObject *Py_UNUSED
} }
PyDoc_STRVAR(_pickle_PicklerMemoProxy_copy__doc__, PyDoc_STRVAR(_pickle_PicklerMemoProxy_copy__doc__,
"copy(self)\n" "sig=($self)\n"
"Copy the memo to a new object."); "Copy the memo to a new object.");
#define _PICKLE_PICKLERMEMOPROXY_COPY_METHODDEF \ #define _PICKLE_PICKLERMEMOPROXY_COPY_METHODDEF \
@ -106,7 +106,7 @@ _pickle_PicklerMemoProxy_copy(PicklerMemoProxyObject *self, PyObject *Py_UNUSED(
} }
PyDoc_STRVAR(_pickle_PicklerMemoProxy___reduce____doc__, PyDoc_STRVAR(_pickle_PicklerMemoProxy___reduce____doc__,
"__reduce__(self)\n" "sig=($self)\n"
"Implement pickle support."); "Implement pickle support.");
#define _PICKLE_PICKLERMEMOPROXY___REDUCE___METHODDEF \ #define _PICKLE_PICKLERMEMOPROXY___REDUCE___METHODDEF \
@ -122,7 +122,7 @@ _pickle_PicklerMemoProxy___reduce__(PicklerMemoProxyObject *self, PyObject *Py_U
} }
PyDoc_STRVAR(_pickle_Unpickler_load__doc__, PyDoc_STRVAR(_pickle_Unpickler_load__doc__,
"load(self)\n" "sig=($self)\n"
"Load a pickle.\n" "Load a pickle.\n"
"\n" "\n"
"Read a pickled object representation from the open file object given\n" "Read a pickled object representation from the open file object given\n"
@ -142,7 +142,7 @@ _pickle_Unpickler_load(UnpicklerObject *self, PyObject *Py_UNUSED(ignored))
} }
PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__, PyDoc_STRVAR(_pickle_Unpickler_find_class__doc__,
"find_class(self, module_name, global_name)\n" "sig=($self, module_name, global_name)\n"
"Return an object from a specified module.\n" "Return an object from a specified module.\n"
"\n" "\n"
"If necessary, the module will be imported. Subclasses may override\n" "If necessary, the module will be imported. Subclasses may override\n"
@ -176,7 +176,7 @@ exit:
} }
PyDoc_STRVAR(_pickle_Unpickler___init____doc__, PyDoc_STRVAR(_pickle_Unpickler___init____doc__,
"Unpickler(file, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n" "sig=(file, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n"
"This takes a binary file for reading a pickle data stream.\n" "This takes a binary file for reading a pickle data stream.\n"
"\n" "\n"
"The protocol version of the pickle is detected automatically, so no\n" "The protocol version of the pickle is detected automatically, so no\n"
@ -222,7 +222,7 @@ exit:
} }
PyDoc_STRVAR(_pickle_UnpicklerMemoProxy_clear__doc__, PyDoc_STRVAR(_pickle_UnpicklerMemoProxy_clear__doc__,
"clear(self)\n" "sig=($self)\n"
"Remove all items from memo."); "Remove all items from memo.");
#define _PICKLE_UNPICKLERMEMOPROXY_CLEAR_METHODDEF \ #define _PICKLE_UNPICKLERMEMOPROXY_CLEAR_METHODDEF \
@ -238,7 +238,7 @@ _pickle_UnpicklerMemoProxy_clear(UnpicklerMemoProxyObject *self, PyObject *Py_UN
} }
PyDoc_STRVAR(_pickle_UnpicklerMemoProxy_copy__doc__, PyDoc_STRVAR(_pickle_UnpicklerMemoProxy_copy__doc__,
"copy(self)\n" "sig=($self)\n"
"Copy the memo to a new object."); "Copy the memo to a new object.");
#define _PICKLE_UNPICKLERMEMOPROXY_COPY_METHODDEF \ #define _PICKLE_UNPICKLERMEMOPROXY_COPY_METHODDEF \
@ -254,7 +254,7 @@ _pickle_UnpicklerMemoProxy_copy(UnpicklerMemoProxyObject *self, PyObject *Py_UNU
} }
PyDoc_STRVAR(_pickle_UnpicklerMemoProxy___reduce____doc__, PyDoc_STRVAR(_pickle_UnpicklerMemoProxy___reduce____doc__,
"__reduce__(self)\n" "sig=($self)\n"
"Implement pickling support."); "Implement pickling support.");
#define _PICKLE_UNPICKLERMEMOPROXY___REDUCE___METHODDEF \ #define _PICKLE_UNPICKLERMEMOPROXY___REDUCE___METHODDEF \
@ -270,7 +270,7 @@ _pickle_UnpicklerMemoProxy___reduce__(UnpicklerMemoProxyObject *self, PyObject *
} }
PyDoc_STRVAR(_pickle_dump__doc__, PyDoc_STRVAR(_pickle_dump__doc__,
"dump(module, obj, file, protocol=None, *, fix_imports=True)\n" "sig=($module, obj, file, protocol=None, *, fix_imports=True)\n"
"Write a pickled representation of obj to the open file object file.\n" "Write a pickled representation of obj to the open file object file.\n"
"\n" "\n"
"This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may\n" "This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may\n"
@ -320,7 +320,7 @@ exit:
} }
PyDoc_STRVAR(_pickle_dumps__doc__, PyDoc_STRVAR(_pickle_dumps__doc__,
"dumps(module, obj, protocol=None, *, fix_imports=True)\n" "sig=($module, obj, protocol=None, *, fix_imports=True)\n"
"Return the pickled representation of the object as a bytes object.\n" "Return the pickled representation of the object as a bytes object.\n"
"\n" "\n"
"The optional *protocol* argument tells the pickler to use the given\n" "The optional *protocol* argument tells the pickler to use the given\n"
@ -361,7 +361,7 @@ exit:
} }
PyDoc_STRVAR(_pickle_load__doc__, PyDoc_STRVAR(_pickle_load__doc__,
"load(module, file, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n" "sig=($module, file, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n"
"Read and return an object from the pickle data stored in a file.\n" "Read and return an object from the pickle data stored in a file.\n"
"\n" "\n"
"This is equivalent to ``Unpickler(file).load()``, but may be more\n" "This is equivalent to ``Unpickler(file).load()``, but may be more\n"
@ -413,7 +413,7 @@ exit:
} }
PyDoc_STRVAR(_pickle_loads__doc__, PyDoc_STRVAR(_pickle_loads__doc__,
"loads(module, data, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n" "sig=($module, data, *, fix_imports=True, encoding=\'ASCII\', errors=\'strict\')\n"
"Read and return an object from the given pickle data.\n" "Read and return an object from the given pickle data.\n"
"\n" "\n"
"The protocol version of the pickle is detected automatically, so no\n" "The protocol version of the pickle is detected automatically, so no\n"
@ -454,4 +454,4 @@ _pickle_loads(PyModuleDef *module, PyObject *args, PyObject *kwargs)
exit: exit:
return return_value; return return_value;
} }
/*[clinic end generated code: checksum=b7a2e1df72bdbc87da3cd0e43a3caa1a879892bb]*/ /*[clinic end generated code: output=c59d4dafc2646f11 input=a9049054013a1b77]*/

View File

@ -3,7 +3,7 @@ preserve
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(audioop_getsample__doc__, PyDoc_STRVAR(audioop_getsample__doc__,
"getsample(module, fragment, width, index)\n" "sig=($module, fragment, width, index)\n"
"Return the value of sample index from the fragment."); "Return the value of sample index from the fragment.");
#define AUDIOOP_GETSAMPLE_METHODDEF \ #define AUDIOOP_GETSAMPLE_METHODDEF \
@ -35,7 +35,7 @@ exit:
} }
PyDoc_STRVAR(audioop_max__doc__, PyDoc_STRVAR(audioop_max__doc__,
"max(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Return the maximum of the absolute value of all samples in a fragment."); "Return the maximum of the absolute value of all samples in a fragment.");
#define AUDIOOP_MAX_METHODDEF \ #define AUDIOOP_MAX_METHODDEF \
@ -66,7 +66,7 @@ exit:
} }
PyDoc_STRVAR(audioop_minmax__doc__, PyDoc_STRVAR(audioop_minmax__doc__,
"minmax(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Return the minimum and maximum values of all samples in the sound fragment."); "Return the minimum and maximum values of all samples in the sound fragment.");
#define AUDIOOP_MINMAX_METHODDEF \ #define AUDIOOP_MINMAX_METHODDEF \
@ -97,7 +97,7 @@ exit:
} }
PyDoc_STRVAR(audioop_avg__doc__, PyDoc_STRVAR(audioop_avg__doc__,
"avg(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Return the average over all samples in the fragment."); "Return the average over all samples in the fragment.");
#define AUDIOOP_AVG_METHODDEF \ #define AUDIOOP_AVG_METHODDEF \
@ -128,7 +128,7 @@ exit:
} }
PyDoc_STRVAR(audioop_rms__doc__, PyDoc_STRVAR(audioop_rms__doc__,
"rms(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n)."); "Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n).");
#define AUDIOOP_RMS_METHODDEF \ #define AUDIOOP_RMS_METHODDEF \
@ -159,7 +159,7 @@ exit:
} }
PyDoc_STRVAR(audioop_findfit__doc__, PyDoc_STRVAR(audioop_findfit__doc__,
"findfit(module, fragment, reference)\n" "sig=($module, fragment, reference)\n"
"Try to match reference as well as possible to a portion of fragment."); "Try to match reference as well as possible to a portion of fragment.");
#define AUDIOOP_FINDFIT_METHODDEF \ #define AUDIOOP_FINDFIT_METHODDEF \
@ -193,7 +193,7 @@ exit:
} }
PyDoc_STRVAR(audioop_findfactor__doc__, PyDoc_STRVAR(audioop_findfactor__doc__,
"findfactor(module, fragment, reference)\n" "sig=($module, fragment, reference)\n"
"Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal."); "Return a factor F such that rms(add(fragment, mul(reference, -F))) is minimal.");
#define AUDIOOP_FINDFACTOR_METHODDEF \ #define AUDIOOP_FINDFACTOR_METHODDEF \
@ -227,7 +227,7 @@ exit:
} }
PyDoc_STRVAR(audioop_findmax__doc__, PyDoc_STRVAR(audioop_findmax__doc__,
"findmax(module, fragment, length)\n" "sig=($module, fragment, length)\n"
"Search fragment for a slice of specified number of samples with maximum energy."); "Search fragment for a slice of specified number of samples with maximum energy.");
#define AUDIOOP_FINDMAX_METHODDEF \ #define AUDIOOP_FINDMAX_METHODDEF \
@ -258,7 +258,7 @@ exit:
} }
PyDoc_STRVAR(audioop_avgpp__doc__, PyDoc_STRVAR(audioop_avgpp__doc__,
"avgpp(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Return the average peak-peak value over all samples in the fragment."); "Return the average peak-peak value over all samples in the fragment.");
#define AUDIOOP_AVGPP_METHODDEF \ #define AUDIOOP_AVGPP_METHODDEF \
@ -289,7 +289,7 @@ exit:
} }
PyDoc_STRVAR(audioop_maxpp__doc__, PyDoc_STRVAR(audioop_maxpp__doc__,
"maxpp(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Return the maximum peak-peak value in the sound fragment."); "Return the maximum peak-peak value in the sound fragment.");
#define AUDIOOP_MAXPP_METHODDEF \ #define AUDIOOP_MAXPP_METHODDEF \
@ -320,7 +320,7 @@ exit:
} }
PyDoc_STRVAR(audioop_cross__doc__, PyDoc_STRVAR(audioop_cross__doc__,
"cross(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Return the number of zero crossings in the fragment passed as an argument."); "Return the number of zero crossings in the fragment passed as an argument.");
#define AUDIOOP_CROSS_METHODDEF \ #define AUDIOOP_CROSS_METHODDEF \
@ -351,7 +351,7 @@ exit:
} }
PyDoc_STRVAR(audioop_mul__doc__, PyDoc_STRVAR(audioop_mul__doc__,
"mul(module, fragment, width, factor)\n" "sig=($module, fragment, width, factor)\n"
"Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor."); "Return a fragment that has all samples in the original fragment multiplied by the floating-point value factor.");
#define AUDIOOP_MUL_METHODDEF \ #define AUDIOOP_MUL_METHODDEF \
@ -383,7 +383,7 @@ exit:
} }
PyDoc_STRVAR(audioop_tomono__doc__, PyDoc_STRVAR(audioop_tomono__doc__,
"tomono(module, fragment, width, lfactor, rfactor)\n" "sig=($module, fragment, width, lfactor, rfactor)\n"
"Convert a stereo fragment to a mono fragment."); "Convert a stereo fragment to a mono fragment.");
#define AUDIOOP_TOMONO_METHODDEF \ #define AUDIOOP_TOMONO_METHODDEF \
@ -416,7 +416,7 @@ exit:
} }
PyDoc_STRVAR(audioop_tostereo__doc__, PyDoc_STRVAR(audioop_tostereo__doc__,
"tostereo(module, fragment, width, lfactor, rfactor)\n" "sig=($module, fragment, width, lfactor, rfactor)\n"
"Generate a stereo fragment from a mono fragment."); "Generate a stereo fragment from a mono fragment.");
#define AUDIOOP_TOSTEREO_METHODDEF \ #define AUDIOOP_TOSTEREO_METHODDEF \
@ -449,7 +449,7 @@ exit:
} }
PyDoc_STRVAR(audioop_add__doc__, PyDoc_STRVAR(audioop_add__doc__,
"add(module, fragment1, fragment2, width)\n" "sig=($module, fragment1, fragment2, width)\n"
"Return a fragment which is the addition of the two samples passed as parameters."); "Return a fragment which is the addition of the two samples passed as parameters.");
#define AUDIOOP_ADD_METHODDEF \ #define AUDIOOP_ADD_METHODDEF \
@ -484,7 +484,7 @@ exit:
} }
PyDoc_STRVAR(audioop_bias__doc__, PyDoc_STRVAR(audioop_bias__doc__,
"bias(module, fragment, width, bias)\n" "sig=($module, fragment, width, bias)\n"
"Return a fragment that is the original fragment with a bias added to each sample."); "Return a fragment that is the original fragment with a bias added to each sample.");
#define AUDIOOP_BIAS_METHODDEF \ #define AUDIOOP_BIAS_METHODDEF \
@ -516,7 +516,7 @@ exit:
} }
PyDoc_STRVAR(audioop_reverse__doc__, PyDoc_STRVAR(audioop_reverse__doc__,
"reverse(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Reverse the samples in a fragment and returns the modified fragment."); "Reverse the samples in a fragment and returns the modified fragment.");
#define AUDIOOP_REVERSE_METHODDEF \ #define AUDIOOP_REVERSE_METHODDEF \
@ -547,7 +547,7 @@ exit:
} }
PyDoc_STRVAR(audioop_byteswap__doc__, PyDoc_STRVAR(audioop_byteswap__doc__,
"byteswap(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Convert big-endian samples to little-endian and vice versa."); "Convert big-endian samples to little-endian and vice versa.");
#define AUDIOOP_BYTESWAP_METHODDEF \ #define AUDIOOP_BYTESWAP_METHODDEF \
@ -578,7 +578,7 @@ exit:
} }
PyDoc_STRVAR(audioop_lin2lin__doc__, PyDoc_STRVAR(audioop_lin2lin__doc__,
"lin2lin(module, fragment, width, newwidth)\n" "sig=($module, fragment, width, newwidth)\n"
"Convert samples between 1-, 2-, 3- and 4-byte formats."); "Convert samples between 1-, 2-, 3- and 4-byte formats.");
#define AUDIOOP_LIN2LIN_METHODDEF \ #define AUDIOOP_LIN2LIN_METHODDEF \
@ -610,7 +610,7 @@ exit:
} }
PyDoc_STRVAR(audioop_ratecv__doc__, PyDoc_STRVAR(audioop_ratecv__doc__,
"ratecv(module, fragment, width, nchannels, inrate, outrate, state, weightA=1, weightB=0)\n" "sig=($module, fragment, width, nchannels, inrate, outrate, state, weightA=1, weightB=0)\n"
"Convert the frame rate of the input fragment."); "Convert the frame rate of the input fragment.");
#define AUDIOOP_RATECV_METHODDEF \ #define AUDIOOP_RATECV_METHODDEF \
@ -647,7 +647,7 @@ exit:
} }
PyDoc_STRVAR(audioop_lin2ulaw__doc__, PyDoc_STRVAR(audioop_lin2ulaw__doc__,
"lin2ulaw(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Convert samples in the audio fragment to u-LAW encoding."); "Convert samples in the audio fragment to u-LAW encoding.");
#define AUDIOOP_LIN2ULAW_METHODDEF \ #define AUDIOOP_LIN2ULAW_METHODDEF \
@ -678,7 +678,7 @@ exit:
} }
PyDoc_STRVAR(audioop_ulaw2lin__doc__, PyDoc_STRVAR(audioop_ulaw2lin__doc__,
"ulaw2lin(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Convert sound fragments in u-LAW encoding to linearly encoded sound fragments."); "Convert sound fragments in u-LAW encoding to linearly encoded sound fragments.");
#define AUDIOOP_ULAW2LIN_METHODDEF \ #define AUDIOOP_ULAW2LIN_METHODDEF \
@ -709,7 +709,7 @@ exit:
} }
PyDoc_STRVAR(audioop_lin2alaw__doc__, PyDoc_STRVAR(audioop_lin2alaw__doc__,
"lin2alaw(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Convert samples in the audio fragment to a-LAW encoding."); "Convert samples in the audio fragment to a-LAW encoding.");
#define AUDIOOP_LIN2ALAW_METHODDEF \ #define AUDIOOP_LIN2ALAW_METHODDEF \
@ -740,7 +740,7 @@ exit:
} }
PyDoc_STRVAR(audioop_alaw2lin__doc__, PyDoc_STRVAR(audioop_alaw2lin__doc__,
"alaw2lin(module, fragment, width)\n" "sig=($module, fragment, width)\n"
"Convert sound fragments in a-LAW encoding to linearly encoded sound fragments."); "Convert sound fragments in a-LAW encoding to linearly encoded sound fragments.");
#define AUDIOOP_ALAW2LIN_METHODDEF \ #define AUDIOOP_ALAW2LIN_METHODDEF \
@ -771,7 +771,7 @@ exit:
} }
PyDoc_STRVAR(audioop_lin2adpcm__doc__, PyDoc_STRVAR(audioop_lin2adpcm__doc__,
"lin2adpcm(module, fragment, width, state)\n" "sig=($module, fragment, width, state)\n"
"Convert samples to 4 bit Intel/DVI ADPCM encoding."); "Convert samples to 4 bit Intel/DVI ADPCM encoding.");
#define AUDIOOP_LIN2ADPCM_METHODDEF \ #define AUDIOOP_LIN2ADPCM_METHODDEF \
@ -803,7 +803,7 @@ exit:
} }
PyDoc_STRVAR(audioop_adpcm2lin__doc__, PyDoc_STRVAR(audioop_adpcm2lin__doc__,
"adpcm2lin(module, fragment, width, state)\n" "sig=($module, fragment, width, state)\n"
"Decode an Intel/DVI ADPCM coded fragment to a linear fragment."); "Decode an Intel/DVI ADPCM coded fragment to a linear fragment.");
#define AUDIOOP_ADPCM2LIN_METHODDEF \ #define AUDIOOP_ADPCM2LIN_METHODDEF \
@ -833,4 +833,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: checksum=0d9fa2c5719e996b169f808350016cd622799562]*/ /*[clinic end generated code: output=ee7e58cfd3d0d5a6 input=a9049054013a1b77]*/

View File

@ -3,7 +3,7 @@ preserve
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(binascii_a2b_uu__doc__, PyDoc_STRVAR(binascii_a2b_uu__doc__,
"a2b_uu(module, data)\n" "sig=($module, data)\n"
"Decode a line of uuencoded data."); "Decode a line of uuencoded data.");
#define BINASCII_A2B_UU_METHODDEF \ #define BINASCII_A2B_UU_METHODDEF \
@ -33,7 +33,7 @@ exit:
} }
PyDoc_STRVAR(binascii_b2a_uu__doc__, PyDoc_STRVAR(binascii_b2a_uu__doc__,
"b2a_uu(module, data)\n" "sig=($module, data)\n"
"Uuencode line of data."); "Uuencode line of data.");
#define BINASCII_B2A_UU_METHODDEF \ #define BINASCII_B2A_UU_METHODDEF \
@ -63,7 +63,7 @@ exit:
} }
PyDoc_STRVAR(binascii_a2b_base64__doc__, PyDoc_STRVAR(binascii_a2b_base64__doc__,
"a2b_base64(module, data)\n" "sig=($module, data)\n"
"Decode a line of base64 data."); "Decode a line of base64 data.");
#define BINASCII_A2B_BASE64_METHODDEF \ #define BINASCII_A2B_BASE64_METHODDEF \
@ -93,7 +93,7 @@ exit:
} }
PyDoc_STRVAR(binascii_b2a_base64__doc__, PyDoc_STRVAR(binascii_b2a_base64__doc__,
"b2a_base64(module, data)\n" "sig=($module, data)\n"
"Base64-code line of data."); "Base64-code line of data.");
#define BINASCII_B2A_BASE64_METHODDEF \ #define BINASCII_B2A_BASE64_METHODDEF \
@ -123,7 +123,7 @@ exit:
} }
PyDoc_STRVAR(binascii_a2b_hqx__doc__, PyDoc_STRVAR(binascii_a2b_hqx__doc__,
"a2b_hqx(module, data)\n" "sig=($module, data)\n"
"Decode .hqx coding."); "Decode .hqx coding.");
#define BINASCII_A2B_HQX_METHODDEF \ #define BINASCII_A2B_HQX_METHODDEF \
@ -153,7 +153,7 @@ exit:
} }
PyDoc_STRVAR(binascii_rlecode_hqx__doc__, PyDoc_STRVAR(binascii_rlecode_hqx__doc__,
"rlecode_hqx(module, data)\n" "sig=($module, data)\n"
"Binhex RLE-code binary data."); "Binhex RLE-code binary data.");
#define BINASCII_RLECODE_HQX_METHODDEF \ #define BINASCII_RLECODE_HQX_METHODDEF \
@ -183,7 +183,7 @@ exit:
} }
PyDoc_STRVAR(binascii_b2a_hqx__doc__, PyDoc_STRVAR(binascii_b2a_hqx__doc__,
"b2a_hqx(module, data)\n" "sig=($module, data)\n"
"Encode .hqx data."); "Encode .hqx data.");
#define BINASCII_B2A_HQX_METHODDEF \ #define BINASCII_B2A_HQX_METHODDEF \
@ -213,7 +213,7 @@ exit:
} }
PyDoc_STRVAR(binascii_rledecode_hqx__doc__, PyDoc_STRVAR(binascii_rledecode_hqx__doc__,
"rledecode_hqx(module, data)\n" "sig=($module, data)\n"
"Decode hexbin RLE-coded string."); "Decode hexbin RLE-coded string.");
#define BINASCII_RLEDECODE_HQX_METHODDEF \ #define BINASCII_RLEDECODE_HQX_METHODDEF \
@ -243,7 +243,7 @@ exit:
} }
PyDoc_STRVAR(binascii_crc_hqx__doc__, PyDoc_STRVAR(binascii_crc_hqx__doc__,
"crc_hqx(module, data, crc)\n" "sig=($module, data, crc)\n"
"Compute hqx CRC incrementally."); "Compute hqx CRC incrementally.");
#define BINASCII_CRC_HQX_METHODDEF \ #define BINASCII_CRC_HQX_METHODDEF \
@ -278,7 +278,7 @@ exit:
} }
PyDoc_STRVAR(binascii_crc32__doc__, PyDoc_STRVAR(binascii_crc32__doc__,
"crc32(module, data, crc=0)\n" "sig=($module, data, crc=0)\n"
"Compute CRC-32 incrementally."); "Compute CRC-32 incrementally.");
#define BINASCII_CRC32_METHODDEF \ #define BINASCII_CRC32_METHODDEF \
@ -313,7 +313,7 @@ exit:
} }
PyDoc_STRVAR(binascii_b2a_hex__doc__, PyDoc_STRVAR(binascii_b2a_hex__doc__,
"b2a_hex(module, data)\n" "sig=($module, data)\n"
"Hexadecimal representation of binary data.\n" "Hexadecimal representation of binary data.\n"
"\n" "\n"
"The return value is a bytes object. This function is also\n" "The return value is a bytes object. This function is also\n"
@ -346,7 +346,7 @@ exit:
} }
PyDoc_STRVAR(binascii_a2b_hex__doc__, PyDoc_STRVAR(binascii_a2b_hex__doc__,
"a2b_hex(module, hexstr)\n" "sig=($module, hexstr)\n"
"Binary data of hexadecimal representation.\n" "Binary data of hexadecimal representation.\n"
"\n" "\n"
"hexstr must contain an even number of hex digits (upper or lower case).\n" "hexstr must contain an even number of hex digits (upper or lower case).\n"
@ -379,7 +379,7 @@ exit:
} }
PyDoc_STRVAR(binascii_a2b_qp__doc__, PyDoc_STRVAR(binascii_a2b_qp__doc__,
"a2b_qp(module, data, header=False)\n" "sig=($module, data, header=False)\n"
"Decode a string of qp-encoded data."); "Decode a string of qp-encoded data.");
#define BINASCII_A2B_QP_METHODDEF \ #define BINASCII_A2B_QP_METHODDEF \
@ -411,7 +411,7 @@ exit:
} }
PyDoc_STRVAR(binascii_b2a_qp__doc__, PyDoc_STRVAR(binascii_b2a_qp__doc__,
"b2a_qp(module, data, quotetabs=False, istext=True, header=False)\n" "sig=($module, data, quotetabs=False, istext=True, header=False)\n"
"Encode a string using quoted-printable encoding.\n" "Encode a string using quoted-printable encoding.\n"
"\n" "\n"
"On encoding, when istext is set, newlines are not encoded, and white\n" "On encoding, when istext is set, newlines are not encoded, and white\n"
@ -447,4 +447,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: checksum=8180e5be47a110ae8c89263a7c12a91d80754f60]*/ /*[clinic end generated code: output=831a8ccc9f984001 input=a9049054013a1b77]*/

View File

@ -3,7 +3,7 @@ preserve
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(zlib_compress__doc__, PyDoc_STRVAR(zlib_compress__doc__,
"compress(module, bytes, level=Z_DEFAULT_COMPRESSION)\n" "sig=($module, bytes, level=Z_DEFAULT_COMPRESSION)\n"
"Returns a bytes object containing compressed data.\n" "Returns a bytes object containing compressed data.\n"
"\n" "\n"
" bytes\n" " bytes\n"
@ -39,7 +39,7 @@ exit:
} }
PyDoc_STRVAR(zlib_decompress__doc__, PyDoc_STRVAR(zlib_decompress__doc__,
"decompress(module, data, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)\n" "sig=($module, data, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)\n"
"Returns a bytes object containing the uncompressed data.\n" "Returns a bytes object containing the uncompressed data.\n"
"\n" "\n"
" data\n" " data\n"
@ -78,7 +78,7 @@ exit:
} }
PyDoc_STRVAR(zlib_compressobj__doc__, PyDoc_STRVAR(zlib_compressobj__doc__,
"compressobj(module, level=Z_DEFAULT_COMPRESSION, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY, zdict=None)\n" "sig=($module, level=Z_DEFAULT_COMPRESSION, method=DEFLATED, wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=Z_DEFAULT_STRATEGY, zdict=None)\n"
"Return a compressor object.\n" "Return a compressor object.\n"
"\n" "\n"
" level\n" " level\n"
@ -132,7 +132,7 @@ exit:
} }
PyDoc_STRVAR(zlib_decompressobj__doc__, PyDoc_STRVAR(zlib_decompressobj__doc__,
"decompressobj(module, wbits=MAX_WBITS, zdict=b\'\')\n" "sig=($module, wbits=MAX_WBITS, zdict=b\'\')\n"
"Return a decompressor object.\n" "Return a decompressor object.\n"
"\n" "\n"
" wbits\n" " wbits\n"
@ -166,7 +166,7 @@ exit:
} }
PyDoc_STRVAR(zlib_Compress_compress__doc__, PyDoc_STRVAR(zlib_Compress_compress__doc__,
"compress(self, data)\n" "sig=($self, data)\n"
"Returns a bytes object containing compressed data.\n" "Returns a bytes object containing compressed data.\n"
"\n" "\n"
" data\n" " data\n"
@ -203,7 +203,7 @@ exit:
} }
PyDoc_STRVAR(zlib_Decompress_decompress__doc__, PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
"decompress(self, data, max_length=0)\n" "sig=($self, data, max_length=0)\n"
"Return a bytes object containing the decompressed version of the data.\n" "Return a bytes object containing the decompressed version of the data.\n"
"\n" "\n"
" data\n" " data\n"
@ -245,7 +245,7 @@ exit:
} }
PyDoc_STRVAR(zlib_Compress_flush__doc__, PyDoc_STRVAR(zlib_Compress_flush__doc__,
"flush(self, mode=Z_FINISH)\n" "sig=($self, mode=Z_FINISH)\n"
"Return a bytes object containing any remaining compressed data.\n" "Return a bytes object containing any remaining compressed data.\n"
"\n" "\n"
" mode\n" " mode\n"
@ -277,7 +277,7 @@ exit:
} }
PyDoc_STRVAR(zlib_Compress_copy__doc__, PyDoc_STRVAR(zlib_Compress_copy__doc__,
"copy(self)\n" "sig=($self)\n"
"Return a copy of the compression object."); "Return a copy of the compression object.");
#define ZLIB_COMPRESS_COPY_METHODDEF \ #define ZLIB_COMPRESS_COPY_METHODDEF \
@ -293,7 +293,7 @@ zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
} }
PyDoc_STRVAR(zlib_Decompress_copy__doc__, PyDoc_STRVAR(zlib_Decompress_copy__doc__,
"copy(self)\n" "sig=($self)\n"
"Return a copy of the decompression object."); "Return a copy of the decompression object.");
#define ZLIB_DECOMPRESS_COPY_METHODDEF \ #define ZLIB_DECOMPRESS_COPY_METHODDEF \
@ -309,7 +309,7 @@ zlib_Decompress_copy(compobject *self, PyObject *Py_UNUSED(ignored))
} }
PyDoc_STRVAR(zlib_Decompress_flush__doc__, PyDoc_STRVAR(zlib_Decompress_flush__doc__,
"flush(self, length=DEF_BUF_SIZE)\n" "sig=($self, length=DEF_BUF_SIZE)\n"
"Return a bytes object containing any remaining decompressed data.\n" "Return a bytes object containing any remaining decompressed data.\n"
"\n" "\n"
" length\n" " length\n"
@ -338,7 +338,7 @@ exit:
} }
PyDoc_STRVAR(zlib_adler32__doc__, PyDoc_STRVAR(zlib_adler32__doc__,
"adler32(module, data, value=1)\n" "sig=($module, data, value=1)\n"
"Compute an Adler-32 checksum of data.\n" "Compute an Adler-32 checksum of data.\n"
"\n" "\n"
" value\n" " value\n"
@ -374,7 +374,7 @@ exit:
} }
PyDoc_STRVAR(zlib_crc32__doc__, PyDoc_STRVAR(zlib_crc32__doc__,
"crc32(module, data, value=0)\n" "sig=($module, data, value=0)\n"
"Compute a CRC-32 checksum of data.\n" "Compute a CRC-32 checksum of data.\n"
"\n" "\n"
" value\n" " value\n"
@ -408,4 +408,4 @@ exit:
return return_value; return return_value;
} }
/*[clinic end generated code: checksum=04f94bbaf2652717753e237e4021bf6c92ddffdd]*/ /*[clinic end generated code: output=ad23316b49faf7e6 input=a9049054013a1b77]*/

View File

@ -184,7 +184,7 @@ corresponding Unix manual entries for more information on calls.");
/*[clinic input] /*[clinic input]
module os module os
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=8cff096d1133288f]*/
#ifndef _MSC_VER #ifndef _MSC_VER
@ -2397,7 +2397,7 @@ class dir_fd_converter(CConverter):
[python start generated code]*/ [python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[python end generated code: output=da39a3ee5e6b4b0d input=d702d58a8469cc7d]*/
/*[clinic input] /*[clinic input]
@ -2430,7 +2430,7 @@ It's an error to use dir_fd or follow_symlinks when specifying path as
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(os_stat__doc__, PyDoc_STRVAR(os_stat__doc__,
"stat(module, path, *, dir_fd=None, follow_symlinks=True)\n" "sig=($module, path, *, dir_fd=None, follow_symlinks=True)\n"
"Perform a stat system call on the given path.\n" "Perform a stat system call on the given path.\n"
"\n" "\n"
" path\n" " path\n"
@ -2481,7 +2481,7 @@ exit:
static PyObject * static PyObject *
os_stat_impl(PyModuleDef *module, path_t *path, int dir_fd, int follow_symlinks) os_stat_impl(PyModuleDef *module, path_t *path, int dir_fd, int follow_symlinks)
/*[clinic end generated code: checksum=09cc91b4947f9e3b9335c8be998bb7c56f7f8b40]*/ /*[clinic end generated code: output=33b6ee92cd1b98de input=5ae155bd475fd20a]*/
{ {
return posix_do_stat("stat", path, dir_fd, follow_symlinks); return posix_do_stat("stat", path, dir_fd, follow_symlinks);
} }
@ -2562,7 +2562,7 @@ Note that most operations will use the effective uid/gid, therefore this
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(os_access__doc__, PyDoc_STRVAR(os_access__doc__,
"access(module, path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)\n" "sig=($module, path, mode, *, dir_fd=None, effective_ids=False, follow_symlinks=True)\n"
"Use the real uid/gid to test for access to a path.\n" "Use the real uid/gid to test for access to a path.\n"
"\n" "\n"
" path\n" " path\n"
@ -2622,7 +2622,7 @@ exit:
static PyObject * static PyObject *
os_access_impl(PyModuleDef *module, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks) os_access_impl(PyModuleDef *module, path_t *path, int mode, int dir_fd, int effective_ids, int follow_symlinks)
/*[clinic end generated code: checksum=6483a51e1fee83da4f8e41cbc8054a701cfed1c5]*/ /*[clinic end generated code: output=33b3fafc61e778e1 input=2e2e7594371f5b7e]*/
{ {
PyObject *return_value = NULL; PyObject *return_value = NULL;
@ -2718,7 +2718,7 @@ Return the name of the terminal device connected to 'fd'.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(os_ttyname__doc__, PyDoc_STRVAR(os_ttyname__doc__,
"ttyname(module, fd)\n" "sig=($module, fd)\n"
"Return the name of the terminal device connected to \'fd\'.\n" "Return the name of the terminal device connected to \'fd\'.\n"
"\n" "\n"
" fd\n" " fd\n"
@ -2752,7 +2752,7 @@ exit:
static char * static char *
os_ttyname_impl(PyModuleDef *module, int fd) os_ttyname_impl(PyModuleDef *module, int fd)
/*[clinic end generated code: checksum=11bbb8b7969155f54bb8a1ec35ac1ebdfd4b0fec]*/ /*[clinic end generated code: output=c3083e665d4d11b9 input=5f72ca83e76b3b45]*/
{ {
char *ret; char *ret;

View File

@ -21,7 +21,7 @@
module unicodedata module unicodedata
class unicodedata.UCD 'PreviousDBVersion *' '&UCD_Type' class unicodedata.UCD 'PreviousDBVersion *' '&UCD_Type'
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=6dac153082d150bc]*/
/* character properties */ /* character properties */
@ -129,7 +129,7 @@ not given, ValueError is raised.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(unicodedata_UCD_decimal__doc__, PyDoc_STRVAR(unicodedata_UCD_decimal__doc__,
"decimal(self, unichr, default=None)\n" "sig=($self, unichr, default=None)\n"
"Converts a Unicode character into its equivalent decimal value.\n" "Converts a Unicode character into its equivalent decimal value.\n"
"\n" "\n"
"Returns the decimal value assigned to the Unicode character unichr\n" "Returns the decimal value assigned to the Unicode character unichr\n"
@ -161,7 +161,7 @@ exit:
static PyObject * static PyObject *
unicodedata_UCD_decimal_impl(PreviousDBVersion *self, PyUnicodeObject *unichr, PyObject *default_value) unicodedata_UCD_decimal_impl(PreviousDBVersion *self, PyUnicodeObject *unichr, PyObject *default_value)
/*[clinic end generated code: checksum=e1371a1a016e19fdd3cd2c1af1d1832df095f50b]*/ /*[clinic end generated code: output=a3ad5de9393acb2f input=c25c9d2b4de076b1]*/
{ {
int have_old = 0; int have_old = 0;
long rc; long rc;

View File

@ -86,7 +86,7 @@ module zlib
class zlib.Compress "compobject *" "&Comptype" class zlib.Compress "compobject *" "&Comptype"
class zlib.Decompress "compobject *" "&Decomptype" class zlib.Decompress "compobject *" "&Decomptype"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=bfd4c340573ba91d]*/
static compobject * static compobject *
newcompobject(PyTypeObject *type) newcompobject(PyTypeObject *type)
@ -148,7 +148,7 @@ Returns a bytes object containing compressed data.
static PyObject * static PyObject *
zlib_compress_impl(PyModuleDef *module, Py_buffer *bytes, int level) zlib_compress_impl(PyModuleDef *module, Py_buffer *bytes, int level)
/*[clinic end generated code: checksum=5d7dd4588788efd3516e5f4225050d6413632601]*/ /*[clinic end generated code: output=5d7dd4588788efd3 input=be3abe9934bda4b3]*/
{ {
PyObject *ReturnVal = NULL; PyObject *ReturnVal = NULL;
Byte *input, *output = NULL; Byte *input, *output = NULL;
@ -232,7 +232,7 @@ class uint_converter(CConverter):
c_ignored_default = "0" c_ignored_default = "0"
[python start generated code]*/ [python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[python end generated code: output=da39a3ee5e6b4b0d input=22263855f7a3ebfd]*/
static int static int
uint_converter(PyObject *obj, void *ptr) uint_converter(PyObject *obj, void *ptr)
@ -281,7 +281,7 @@ Returns a bytes object containing the uncompressed data.
static PyObject * static PyObject *
zlib_decompress_impl(PyModuleDef *module, Py_buffer *data, int wbits, unsigned int bufsize) zlib_decompress_impl(PyModuleDef *module, Py_buffer *data, int wbits, unsigned int bufsize)
/*[clinic end generated code: checksum=9e5464e72df9cb5fee73df662dbcaed867e01d32]*/ /*[clinic end generated code: output=9e5464e72df9cb5f input=0f4b9abb7103f50e]*/
{ {
PyObject *result_str = NULL; PyObject *result_str = NULL;
Byte *input; Byte *input;
@ -411,7 +411,7 @@ Return a compressor object.
static PyObject * static PyObject *
zlib_compressobj_impl(PyModuleDef *module, int level, int method, int wbits, int memLevel, int strategy, Py_buffer *zdict) zlib_compressobj_impl(PyModuleDef *module, int level, int method, int wbits, int memLevel, int strategy, Py_buffer *zdict)
/*[clinic end generated code: checksum=89e5a6c1449caa9ed76f1baad066600e985151a9]*/ /*[clinic end generated code: output=89e5a6c1449caa9e input=b034847f8821f6af]*/
{ {
compobject *self = NULL; compobject *self = NULL;
int err; int err;
@ -483,7 +483,7 @@ Return a decompressor object.
static PyObject * static PyObject *
zlib_decompressobj_impl(PyModuleDef *module, int wbits, PyObject *zdict) zlib_decompressobj_impl(PyModuleDef *module, int wbits, PyObject *zdict)
/*[clinic end generated code: checksum=8ccd583fbd631798566d415933cd44440c8a74b5]*/ /*[clinic end generated code: output=8ccd583fbd631798 input=67f05145a6920127]*/
{ {
int err; int err;
compobject *self; compobject *self;
@ -571,7 +571,7 @@ Call the flush() method to clear these buffers.
static PyObject * static PyObject *
zlib_Compress_compress_impl(compobject *self, Py_buffer *data) zlib_Compress_compress_impl(compobject *self, Py_buffer *data)
/*[clinic end generated code: checksum=5d5cd791cbc6a7f4b6de4ec12c085c88d4d3e31c]*/ /*[clinic end generated code: output=5d5cd791cbc6a7f4 input=0d95908d6e64fab8]*/
{ {
int err; int err;
unsigned int inplen; unsigned int inplen;
@ -705,7 +705,7 @@ Call the flush() method to clear these buffers.
static PyObject * static PyObject *
zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data, unsigned int max_length) zlib_Decompress_decompress_impl(compobject *self, Py_buffer *data, unsigned int max_length)
/*[clinic end generated code: checksum=755cccc9087bfe55486b7e15fa7e2ab60b4c86d6]*/ /*[clinic end generated code: output=755cccc9087bfe55 input=02cfc047377cec86]*/
{ {
int err; int err;
unsigned int old_length, length = DEF_BUF_SIZE; unsigned int old_length, length = DEF_BUF_SIZE;
@ -840,7 +840,7 @@ Return a bytes object containing any remaining compressed data.
static PyObject * static PyObject *
zlib_Compress_flush_impl(compobject *self, int mode) zlib_Compress_flush_impl(compobject *self, int mode)
/*[clinic end generated code: checksum=a203f4cefc9de727aa1d2ea39d11c0a16c32041a]*/ /*[clinic end generated code: output=a203f4cefc9de727 input=6982996afe0772d8]*/
{ {
int err; int err;
unsigned int length = DEF_BUF_SIZE, new_length; unsigned int length = DEF_BUF_SIZE, new_length;
@ -933,7 +933,7 @@ Return a copy of the compression object.
static PyObject * static PyObject *
zlib_Compress_copy_impl(compobject *self) zlib_Compress_copy_impl(compobject *self)
/*[clinic end generated code: checksum=5144aa153c21e805afa5c19e5b48cf8e6480b5da]*/ /*[clinic end generated code: output=5144aa153c21e805 input=c656351f94b82718]*/
{ {
compobject *retval = NULL; compobject *retval = NULL;
int err; int err;
@ -991,7 +991,7 @@ Return a copy of the decompression object.
static PyObject * static PyObject *
zlib_Decompress_copy_impl(compobject *self) zlib_Decompress_copy_impl(compobject *self)
/*[clinic end generated code: checksum=02a883a2a510c8ccfeef3f89e317a275bfe8c094]*/ /*[clinic end generated code: output=02a883a2a510c8cc input=ba6c3e96712a596b]*/
{ {
compobject *retval = NULL; compobject *retval = NULL;
int err; int err;
@ -1055,7 +1055,7 @@ Return a bytes object containing any remaining decompressed data.
static PyObject * static PyObject *
zlib_Decompress_flush_impl(compobject *self, unsigned int length) zlib_Decompress_flush_impl(compobject *self, unsigned int length)
/*[clinic end generated code: checksum=db6fb753ab698e22afe3957c9da9e5e77f4bfc08]*/ /*[clinic end generated code: output=db6fb753ab698e22 input=fe7954136712c353]*/
{ {
int err; int err;
unsigned int new_length; unsigned int new_length;
@ -1183,7 +1183,7 @@ The returned checksum is an integer.
static PyObject * static PyObject *
zlib_adler32_impl(PyModuleDef *module, Py_buffer *data, unsigned int value) zlib_adler32_impl(PyModuleDef *module, Py_buffer *data, unsigned int value)
/*[clinic end generated code: checksum=51d6d75ee655c78af8c968fdb4c11d97e62c67d5]*/ /*[clinic end generated code: output=51d6d75ee655c78a input=6ff4557872160e88]*/
{ {
/* Releasing the GIL for very small buffers is inefficient /* Releasing the GIL for very small buffers is inefficient
and may lower performance */ and may lower performance */
@ -1222,7 +1222,7 @@ The returned checksum is an integer.
static PyObject * static PyObject *
zlib_crc32_impl(PyModuleDef *module, Py_buffer *data, unsigned int value) zlib_crc32_impl(PyModuleDef *module, Py_buffer *data, unsigned int value)
/*[clinic end generated code: checksum=c1e986e74fe7b62369998a71a81ebeb9b73e8d4c]*/ /*[clinic end generated code: output=c1e986e74fe7b623 input=26c3ed430fa00b4c]*/
{ {
int signed_val; int signed_val;

View File

@ -353,17 +353,13 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds)
static PyObject * static PyObject *
method_get_doc(PyMethodDescrObject *descr, void *closure) method_get_doc(PyMethodDescrObject *descr, void *closure)
{ {
const char *name = descr->d_method->ml_name; return _PyType_GetDocFromInternalDoc(descr->d_method->ml_doc);
const char *doc = descr->d_method->ml_doc;
return _PyType_GetDocFromInternalDoc(name, doc);
} }
static PyObject * static PyObject *
method_get_text_signature(PyMethodDescrObject *descr, void *closure) method_get_text_signature(PyMethodDescrObject *descr, void *closure)
{ {
const char *name = descr->d_method->ml_name; return _PyType_GetTextSignatureFromInternalDoc(descr->d_method->ml_doc);
const char *doc = descr->d_method->ml_doc;
return _PyType_GetTextSignatureFromInternalDoc(name, doc);
} }
static PyObject * static PyObject *
@ -470,17 +466,13 @@ static PyGetSetDef getset_getset[] = {
static PyObject * static PyObject *
wrapperdescr_get_doc(PyWrapperDescrObject *descr, void *closure) wrapperdescr_get_doc(PyWrapperDescrObject *descr, void *closure)
{ {
const char *name = descr->d_base->name; return _PyType_GetDocFromInternalDoc(descr->d_base->doc);
const char *doc = descr->d_base->doc;
return _PyType_GetDocFromInternalDoc(name, doc);
} }
static PyObject * static PyObject *
wrapperdescr_get_text_signature(PyWrapperDescrObject *descr, void *closure) wrapperdescr_get_text_signature(PyWrapperDescrObject *descr, void *closure)
{ {
const char *name = descr->d_base->name; return _PyType_GetTextSignatureFromInternalDoc(descr->d_base->doc);
const char *doc = descr->d_base->doc;
return _PyType_GetTextSignatureFromInternalDoc(name, doc);
} }
static PyGetSetDef wrapperdescr_getset[] = { static PyGetSetDef wrapperdescr_getset[] = {
@ -1159,17 +1151,13 @@ wrapper_name(wrapperobject *wp)
static PyObject * static PyObject *
wrapper_doc(wrapperobject *wp, void *closure) wrapper_doc(wrapperobject *wp, void *closure)
{ {
const char *name = wp->descr->d_base->name; return _PyType_GetDocFromInternalDoc(wp->descr->d_base->doc);
const char *doc = wp->descr->d_base->doc;
return _PyType_GetDocFromInternalDoc(name, doc);
} }
static PyObject * static PyObject *
wrapper_text_signature(wrapperobject *wp, void *closure) wrapper_text_signature(wrapperobject *wp, void *closure)
{ {
const char *name = wp->descr->d_base->name; return _PyType_GetTextSignatureFromInternalDoc(wp->descr->d_base->doc);
const char *doc = wp->descr->d_base->doc;
return _PyType_GetTextSignatureFromInternalDoc(name, doc);
} }
static PyObject * static PyObject *

View File

@ -72,7 +72,7 @@ to the combined-table form.
/*[clinic input] /*[clinic input]
class dict "PyDictObject *" "&PyDict_Type" class dict "PyDictObject *" "&PyDict_Type"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=f157a5a0ce9589d6]*/
typedef struct { typedef struct {
/* Cached hash code of me_key. */ /* Cached hash code of me_key. */
@ -1702,7 +1702,7 @@ Returns a new dict with keys from iterable and values equal to value.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(dict_fromkeys__doc__, PyDoc_STRVAR(dict_fromkeys__doc__,
"fromkeys(type, iterable, value=None)\n" "sig=($type, iterable, value=None)\n"
"Returns a new dict with keys from iterable and values equal to value."); "Returns a new dict with keys from iterable and values equal to value.");
#define DICT_FROMKEYS_METHODDEF \ #define DICT_FROMKEYS_METHODDEF \
@ -1730,7 +1730,7 @@ exit:
static PyObject * static PyObject *
dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value) dict_fromkeys_impl(PyTypeObject *type, PyObject *iterable, PyObject *value)
/*[clinic end generated code: checksum=008269e1774a379b356841548c04061fd78a9542]*/ /*[clinic end generated code: output=aff6e583703dbeba input=b85a667f9bf4669d]*/
{ {
PyObject *it; /* iter(seq) */ PyObject *it; /* iter(seq) */
PyObject *key; PyObject *key;
@ -2209,7 +2209,7 @@ True if D has a key k, else False.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(dict___contains____doc__, PyDoc_STRVAR(dict___contains____doc__,
"__contains__(self, key)\n" "sig=($self, key)\n"
"True if D has a key k, else False."); "True if D has a key k, else False.");
#define DICT___CONTAINS___METHODDEF \ #define DICT___CONTAINS___METHODDEF \
@ -2217,7 +2217,7 @@ PyDoc_STRVAR(dict___contains____doc__,
static PyObject * static PyObject *
dict___contains__(PyDictObject *self, PyObject *key) dict___contains__(PyDictObject *self, PyObject *key)
/*[clinic end generated code: checksum=744ca54369dda9815a596304087f1b37fafa5960]*/ /*[clinic end generated code: output=c654684a6d880281 input=b852b2a19b51ab24]*/
{ {
register PyDictObject *mp = self; register PyDictObject *mp = self;
Py_hash_t hash; Py_hash_t hash;

View File

@ -182,17 +182,13 @@ static PyMethodDef meth_methods[] = {
static PyObject * static PyObject *
meth_get__text_signature__(PyCFunctionObject *m, void *closure) meth_get__text_signature__(PyCFunctionObject *m, void *closure)
{ {
const char *name = m->m_ml->ml_name; return _PyType_GetTextSignatureFromInternalDoc(m->m_ml->ml_doc);
const char *doc = m->m_ml->ml_doc;
return _PyType_GetTextSignatureFromInternalDoc(name, doc);
} }
static PyObject * static PyObject *
meth_get__doc__(PyCFunctionObject *m, void *closure) meth_get__doc__(PyCFunctionObject *m, void *closure)
{ {
const char *name = m->m_ml->ml_name; return _PyType_GetDocFromInternalDoc(m->m_ml->ml_doc);
const char *doc = m->m_ml->ml_doc;
return _PyType_GetDocFromInternalDoc(name, doc);
} }
static PyObject * static PyObject *

View File

@ -60,18 +60,11 @@ slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
* otherwise returns NULL. * otherwise returns NULL.
*/ */
static const char * static const char *
find_signature(const char *name, const char *doc) find_signature(const char *doc)
{ {
size_t length; if (doc && !strncmp(doc, "sig=(", 5))
if (!doc || !name) return doc + 4;
return NULL; return NULL;
length = strlen(name);
if (strncmp(doc, name, length))
return NULL;
doc += length;
if (*doc != '(')
return NULL;
return doc;
} }
/* /*
@ -94,9 +87,9 @@ skip_eols(const char *trace)
} }
static const char * static const char *
_PyType_DocWithoutSignature(const char *name, const char *internal_doc) _PyType_DocWithoutSignature(const char *internal_doc)
{ {
const char *signature = find_signature(name, internal_doc); const char *signature = find_signature(internal_doc);
if (signature) if (signature)
return skip_eols(skip_signature(signature)); return skip_eols(skip_signature(signature));
@ -104,9 +97,9 @@ _PyType_DocWithoutSignature(const char *name, const char *internal_doc)
} }
PyObject * PyObject *
_PyType_GetDocFromInternalDoc(const char *name, const char *internal_doc) _PyType_GetDocFromInternalDoc(const char *internal_doc)
{ {
const char *doc = _PyType_DocWithoutSignature(name, internal_doc); const char *doc = _PyType_DocWithoutSignature(internal_doc);
if (!doc) { if (!doc) {
Py_INCREF(Py_None); Py_INCREF(Py_None);
@ -117,9 +110,9 @@ _PyType_GetDocFromInternalDoc(const char *name, const char *internal_doc)
} }
PyObject * PyObject *
_PyType_GetTextSignatureFromInternalDoc(const char *name, const char *internal_doc) _PyType_GetTextSignatureFromInternalDoc(const char *internal_doc)
{ {
const char *signature = find_signature(name, internal_doc); const char *signature = find_signature(internal_doc);
const char *doc; const char *doc;
if (!signature) { if (!signature) {
@ -706,9 +699,7 @@ type_get_doc(PyTypeObject *type, void *context)
{ {
PyObject *result; PyObject *result;
if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) { if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) {
const char *name = type->tp_name; return _PyType_GetDocFromInternalDoc(type->tp_doc);
const char *doc = type->tp_doc;
return _PyType_GetDocFromInternalDoc(name, doc);
} }
result = _PyDict_GetItemId(type->tp_dict, &PyId___doc__); result = _PyDict_GetItemId(type->tp_dict, &PyId___doc__);
if (result == NULL) { if (result == NULL) {
@ -728,9 +719,7 @@ type_get_doc(PyTypeObject *type, void *context)
static PyObject * static PyObject *
type_get_text_signature(PyTypeObject *type, void *context) type_get_text_signature(PyTypeObject *type, void *context)
{ {
const char *name = type->tp_name; return _PyType_GetTextSignatureFromInternalDoc(type->tp_doc);
const char *doc = type->tp_doc;
return _PyType_GetTextSignatureFromInternalDoc(name, doc);
} }
static int static int
@ -2608,7 +2597,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
/* need to make a copy of the docstring slot, which usually /* need to make a copy of the docstring slot, which usually
points to a static string literal */ points to a static string literal */
if (slot->slot == Py_tp_doc) { if (slot->slot == Py_tp_doc) {
const char *old_doc = _PyType_DocWithoutSignature(spec->name, slot->pfunc); const char *old_doc = _PyType_DocWithoutSignature(slot->pfunc);
size_t len = strlen(old_doc)+1; size_t len = strlen(old_doc)+1;
char *tp_doc = PyObject_MALLOC(len); char *tp_doc = PyObject_MALLOC(len);
if (tp_doc == NULL) { if (tp_doc == NULL) {
@ -3000,7 +2989,7 @@ static PyMethodDef type_methods[] = {
PyDoc_STRVAR(type_doc, PyDoc_STRVAR(type_doc,
/* this text signature cannot be accurate yet. will fix. --larry */ /* this text signature cannot be accurate yet. will fix. --larry */
"type(object_or_name, bases, dict)\n" "sig=(object_or_name, bases, dict)\n"
"type(object) -> the object's type\n" "type(object) -> the object's type\n"
"type(name, bases, dict) -> a new type"); "type(name, bases, dict) -> a new type");
@ -4196,7 +4185,7 @@ PyTypeObject PyBaseObject_Type = {
PyObject_GenericSetAttr, /* tp_setattro */ PyObject_GenericSetAttr, /* tp_setattro */
0, /* tp_as_buffer */ 0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
PyDoc_STR("object()\nThe most base type"), /* tp_doc */ PyDoc_STR("sig=()\nThe most base type"), /* tp_doc */
0, /* tp_traverse */ 0, /* tp_traverse */
0, /* tp_clear */ 0, /* tp_clear */
object_richcompare, /* tp_richcompare */ object_richcompare, /* tp_richcompare */
@ -4663,7 +4652,7 @@ PyType_Ready(PyTypeObject *type)
*/ */
if (_PyDict_GetItemId(type->tp_dict, &PyId___doc__) == NULL) { if (_PyDict_GetItemId(type->tp_dict, &PyId___doc__) == NULL) {
if (type->tp_doc != NULL) { if (type->tp_doc != NULL) {
const char *old_doc = _PyType_DocWithoutSignature(type->tp_name, type->tp_doc); const char *old_doc = _PyType_DocWithoutSignature(type->tp_doc);
PyObject *doc = PyUnicode_FromString(old_doc); PyObject *doc = PyUnicode_FromString(old_doc);
if (doc == NULL) if (doc == NULL)
goto error; goto error;
@ -5325,8 +5314,9 @@ tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds)
static struct PyMethodDef tp_new_methoddef[] = { static struct PyMethodDef tp_new_methoddef[] = {
{"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS, {"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS,
PyDoc_STR("T.__new__(S, ...) -> " PyDoc_STR("sig=($type, *args, **kwargs)\n"
"a new object with type S, a subtype of T")}, "Create and return a new object. "
"See help(type) for accurate signature.")},
{0} {0}
}; };
@ -6098,22 +6088,22 @@ typedef struct wrapperbase slotdef;
ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, DOC) ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, DOC)
#define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ #define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \ ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
NAME "(self)\n" DOC) "sig=($self)\n" DOC)
#define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ #define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \
ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \ ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \
NAME "(self, value)\nReturns self" DOC "value.") "sig=($self, value)\nReturn self" DOC "value.")
#define BINSLOT(NAME, SLOT, FUNCTION, DOC) \ #define BINSLOT(NAME, SLOT, FUNCTION, DOC) \
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \ ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
NAME "(self, value)\nReturns self" DOC "value.") "sig=($self, value)\nReturn self" DOC "value.")
#define RBINSLOT(NAME, SLOT, FUNCTION, DOC) \ #define RBINSLOT(NAME, SLOT, FUNCTION, DOC) \
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \ ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
NAME "(self, value)\nReturns value" DOC "self.") "sig=($self, value)\nReturn value" DOC "self.")
#define BINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \ #define BINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \ ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \
NAME "(self, value)\n" DOC) "sig=($self, value)\n" DOC)
#define RBINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \ #define RBINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \
ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \ ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \
NAME "(self, value)\n" DOC) "sig=($self, value)\n" DOC)
static slotdef slotdefs[] = { static slotdef slotdefs[] = {
TPSLOT("__getattribute__", tp_getattr, NULL, NULL, ""), TPSLOT("__getattribute__", tp_getattr, NULL, NULL, ""),
@ -6121,52 +6111,52 @@ static slotdef slotdefs[] = {
TPSLOT("__setattr__", tp_setattr, NULL, NULL, ""), TPSLOT("__setattr__", tp_setattr, NULL, NULL, ""),
TPSLOT("__delattr__", tp_setattr, NULL, NULL, ""), TPSLOT("__delattr__", tp_setattr, NULL, NULL, ""),
TPSLOT("__repr__", tp_repr, slot_tp_repr, wrap_unaryfunc, TPSLOT("__repr__", tp_repr, slot_tp_repr, wrap_unaryfunc,
"__repr__(self)\nReturns repr(self)."), "sig=($self)\nReturn repr(self)."),
TPSLOT("__hash__", tp_hash, slot_tp_hash, wrap_hashfunc, TPSLOT("__hash__", tp_hash, slot_tp_hash, wrap_hashfunc,
"__hash__(self)\nReturns hash(self)."), "sig=($self)\nReturn hash(self)."),
FLSLOT("__call__", tp_call, slot_tp_call, (wrapperfunc)wrap_call, FLSLOT("__call__", tp_call, slot_tp_call, (wrapperfunc)wrap_call,
"__call__(self, *args, **kwargs)\nCalls self as a function.", "sig=($self, *args, **kwargs)\nCall self as a function.",
PyWrapperFlag_KEYWORDS), PyWrapperFlag_KEYWORDS),
TPSLOT("__str__", tp_str, slot_tp_str, wrap_unaryfunc, TPSLOT("__str__", tp_str, slot_tp_str, wrap_unaryfunc,
"__str__(self)\nReturns str(self)."), "sig=($self)\nReturn str(self)."),
TPSLOT("__getattribute__", tp_getattro, slot_tp_getattr_hook, TPSLOT("__getattribute__", tp_getattro, slot_tp_getattr_hook,
wrap_binaryfunc, wrap_binaryfunc,
"__getattribute__(self, name)\nReturns getattr(self, name)."), "sig=($self, name)\nReturn getattr(self, name)."),
TPSLOT("__getattr__", tp_getattro, slot_tp_getattr_hook, NULL, ""), TPSLOT("__getattr__", tp_getattro, slot_tp_getattr_hook, NULL, ""),
TPSLOT("__setattr__", tp_setattro, slot_tp_setattro, wrap_setattr, TPSLOT("__setattr__", tp_setattro, slot_tp_setattro, wrap_setattr,
"__setattr__(self, name, value)\nImplements setattr(self, name, value)."), "sig=($self, name, value)\nImplement setattr(self, name, value)."),
TPSLOT("__delattr__", tp_setattro, slot_tp_setattro, wrap_delattr, TPSLOT("__delattr__", tp_setattro, slot_tp_setattro, wrap_delattr,
"__delattr__(self, name)\nImplements delattr(self, name)."), "sig=($self, name)\nImplement delattr(self, name)."),
TPSLOT("__lt__", tp_richcompare, slot_tp_richcompare, richcmp_lt, TPSLOT("__lt__", tp_richcompare, slot_tp_richcompare, richcmp_lt,
"__lt__(self, value)\nReturns self<value."), "sig=($self, value)\nReturn self<value."),
TPSLOT("__le__", tp_richcompare, slot_tp_richcompare, richcmp_le, TPSLOT("__le__", tp_richcompare, slot_tp_richcompare, richcmp_le,
"__le__(self, value)\nReturns self<=value."), "sig=($self, value)\nReturn self<=value."),
TPSLOT("__eq__", tp_richcompare, slot_tp_richcompare, richcmp_eq, TPSLOT("__eq__", tp_richcompare, slot_tp_richcompare, richcmp_eq,
"__eq__(self, value)\nReturns self==value."), "sig=($self, value)\nReturn self==value."),
TPSLOT("__ne__", tp_richcompare, slot_tp_richcompare, richcmp_ne, TPSLOT("__ne__", tp_richcompare, slot_tp_richcompare, richcmp_ne,
"__ne__(self, value)\nReturns self!=value."), "sig=($self, value)\nReturn self!=value."),
TPSLOT("__gt__", tp_richcompare, slot_tp_richcompare, richcmp_gt, TPSLOT("__gt__", tp_richcompare, slot_tp_richcompare, richcmp_gt,
"__gt__(self, value)\nReturns self>value."), "sig=($self, value)\nReturn self>value."),
TPSLOT("__ge__", tp_richcompare, slot_tp_richcompare, richcmp_ge, TPSLOT("__ge__", tp_richcompare, slot_tp_richcompare, richcmp_ge,
"__ge__(self, value)\nReturns self>=value."), "sig=($self, value)\nReturn self>=value."),
TPSLOT("__iter__", tp_iter, slot_tp_iter, wrap_unaryfunc, TPSLOT("__iter__", tp_iter, slot_tp_iter, wrap_unaryfunc,
"__iter__(self)\nImplements iter(self)."), "sig=($self)\nImplement iter(self)."),
TPSLOT("__next__", tp_iternext, slot_tp_iternext, wrap_next, TPSLOT("__next__", tp_iternext, slot_tp_iternext, wrap_next,
"__next__(self)\nImplements next(self)."), "sig=($self)\nImplement next(self)."),
TPSLOT("__get__", tp_descr_get, slot_tp_descr_get, wrap_descr_get, TPSLOT("__get__", tp_descr_get, slot_tp_descr_get, wrap_descr_get,
"__get__(self, instance, owner)\nCalled to get an attribute of instance, which is of type owner."), "sig=($self, instance, owner)\nReturn an attribute of instance, which is of type owner."),
TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set, TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set,
"__set__(self, instance, value)\nSets an attribute of instance to value."), "sig=($self, instance, value)\nSet an attribute of instance to value."),
TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set, TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set,
wrap_descr_delete, wrap_descr_delete,
"__delete__(instance)\nDeletes an attribute of instance."), "sig=(instance)\nDelete an attribute of instance."),
FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init, FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init,
"__init__(self, *args, **kwargs)\n" "sig=($self, *args, **kwargs)\n"
"Initializes self. See help(type(self)) for accurate signature.", "Initialize self. See help(type(self)) for accurate signature.",
PyWrapperFlag_KEYWORDS), PyWrapperFlag_KEYWORDS),
TPSLOT("__new__", tp_new, slot_tp_new, NULL, TPSLOT("__new__", tp_new, slot_tp_new, NULL,
"__new__(cls, *args, **kwargs)\n" "sig=(type, *args, **kwargs)\n"
"Creates new object. See help(cls) for accurate signature."), "Create and return new object. See help(type) for accurate signature."),
TPSLOT("__del__", tp_finalize, slot_tp_finalize, (wrapperfunc)wrap_del, ""), TPSLOT("__del__", tp_finalize, slot_tp_finalize, (wrapperfunc)wrap_del, ""),
BINSLOT("__add__", nb_add, slot_nb_add, BINSLOT("__add__", nb_add, slot_nb_add,
@ -6186,13 +6176,13 @@ static slotdef slotdefs[] = {
RBINSLOT("__rmod__", nb_remainder, slot_nb_remainder, RBINSLOT("__rmod__", nb_remainder, slot_nb_remainder,
"%"), "%"),
BINSLOTNOTINFIX("__divmod__", nb_divmod, slot_nb_divmod, BINSLOTNOTINFIX("__divmod__", nb_divmod, slot_nb_divmod,
"__divmod__(self, value)\nReturns divmod(self, value)."), "Return divmod(self, value)."),
RBINSLOTNOTINFIX("__rdivmod__", nb_divmod, slot_nb_divmod, RBINSLOTNOTINFIX("__rdivmod__", nb_divmod, slot_nb_divmod,
"__rdivmod__(self, value)\nReturns divmod(value, self)."), "Return divmod(value, self)."),
NBSLOT("__pow__", nb_power, slot_nb_power, wrap_ternaryfunc, NBSLOT("__pow__", nb_power, slot_nb_power, wrap_ternaryfunc,
"__pow__(self, value, mod=None)\nReturns pow(self, value, mod)."), "sig=($self, value, mod=None)\nReturn pow(self, value, mod)."),
NBSLOT("__rpow__", nb_power, slot_nb_power, wrap_ternaryfunc_r, NBSLOT("__rpow__", nb_power, slot_nb_power, wrap_ternaryfunc_r,
"__rpow__(self, value, mod=None)\nReturns pow(value, self, mod)."), "sig=($self, value, mod=None)\nReturn pow(value, self, mod)."),
UNSLOT("__neg__", nb_negative, slot_nb_negative, wrap_unaryfunc, "-self"), UNSLOT("__neg__", nb_negative, slot_nb_negative, wrap_unaryfunc, "-self"),
UNSLOT("__pos__", nb_positive, slot_nb_positive, wrap_unaryfunc, "+self"), UNSLOT("__pos__", nb_positive, slot_nb_positive, wrap_unaryfunc, "+self"),
UNSLOT("__abs__", nb_absolute, slot_nb_absolute, wrap_unaryfunc, UNSLOT("__abs__", nb_absolute, slot_nb_absolute, wrap_unaryfunc,
@ -6243,48 +6233,48 @@ static slotdef slotdefs[] = {
IBSLOT("__itruediv__", nb_inplace_true_divide, IBSLOT("__itruediv__", nb_inplace_true_divide,
slot_nb_inplace_true_divide, wrap_binaryfunc, "/"), slot_nb_inplace_true_divide, wrap_binaryfunc, "/"),
NBSLOT("__index__", nb_index, slot_nb_index, wrap_unaryfunc, NBSLOT("__index__", nb_index, slot_nb_index, wrap_unaryfunc,
"__index__(self)\n" "sig=($self)\n"
"Returns self converted to an integer, if self is suitable" "Return self converted to an integer, if self is suitable"
"for use as an index into a list."), "for use as an index into a list."),
MPSLOT("__len__", mp_length, slot_mp_length, wrap_lenfunc, MPSLOT("__len__", mp_length, slot_mp_length, wrap_lenfunc,
"__len__(self)\nReturns len(self)."), "sig=($self)\nReturn len(self)."),
MPSLOT("__getitem__", mp_subscript, slot_mp_subscript, MPSLOT("__getitem__", mp_subscript, slot_mp_subscript,
wrap_binaryfunc, wrap_binaryfunc,
"__getitem__(self, key)\nReturns self[key]."), "sig=($self, key)\nReturn self[key]."),
MPSLOT("__setitem__", mp_ass_subscript, slot_mp_ass_subscript, MPSLOT("__setitem__", mp_ass_subscript, slot_mp_ass_subscript,
wrap_objobjargproc, wrap_objobjargproc,
"__setitem__(self, key, value)\nSets self[key] to value."), "sig=($self, key, value)\nSet self[key] to value."),
MPSLOT("__delitem__", mp_ass_subscript, slot_mp_ass_subscript, MPSLOT("__delitem__", mp_ass_subscript, slot_mp_ass_subscript,
wrap_delitem, wrap_delitem,
"__delitem__(key)\nDeletes self[key]."), "sig=(key)\nDelete self[key]."),
SQSLOT("__len__", sq_length, slot_sq_length, wrap_lenfunc, SQSLOT("__len__", sq_length, slot_sq_length, wrap_lenfunc,
"__len__(self)\nReturns len(self)."), "sig=($self)\nReturn len(self)."),
/* Heap types defining __add__/__mul__ have sq_concat/sq_repeat == NULL. /* Heap types defining __add__/__mul__ have sq_concat/sq_repeat == NULL.
The logic in abstract.c always falls back to nb_add/nb_multiply in The logic in abstract.c always falls back to nb_add/nb_multiply in
this case. Defining both the nb_* and the sq_* slots to call the this case. Defining both the nb_* and the sq_* slots to call the
user-defined methods has unexpected side-effects, as shown by user-defined methods has unexpected side-effects, as shown by
test_descr.notimplemented() */ test_descr.notimplemented() */
SQSLOT("__add__", sq_concat, NULL, wrap_binaryfunc, SQSLOT("__add__", sq_concat, NULL, wrap_binaryfunc,
"__add__(self, value)\nReturns self+value."), "sig=($self, value)\nReturn self+value."),
SQSLOT("__mul__", sq_repeat, NULL, wrap_indexargfunc, SQSLOT("__mul__", sq_repeat, NULL, wrap_indexargfunc,
"__mul__(self, value)\nReturns self*value.n"), "sig=($self, value)\nReturn self*value.n"),
SQSLOT("__rmul__", sq_repeat, NULL, wrap_indexargfunc, SQSLOT("__rmul__", sq_repeat, NULL, wrap_indexargfunc,
"__rmul__(self, value)\nReturns self*value."), "sig=($self, value)\nReturn self*value."),
SQSLOT("__getitem__", sq_item, slot_sq_item, wrap_sq_item, SQSLOT("__getitem__", sq_item, slot_sq_item, wrap_sq_item,
"__getitem__(self, key)\nReturns self[key]."), "sig=($self, key)\nReturn self[key]."),
SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem,
"__setitem__(self, key, value)\nSets self[key] to value."), "sig=($self, key, value)\nSet self[key] to value."),
SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem, SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem,
"__delitem__(self, key)\nDeletes self[key]."), "sig=($self, key)\nDelete self[key]."),
SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc, SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc,
"__contains__(self, key)\nReturns key in self."), "sig=($self, key)\nReturn key in self."),
SQSLOT("__iadd__", sq_inplace_concat, NULL, SQSLOT("__iadd__", sq_inplace_concat, NULL,
wrap_binaryfunc, wrap_binaryfunc,
"__iadd__(self, value)\nImplements self+=value."), "sig=($self, value)\nImplement self+=value."),
SQSLOT("__imul__", sq_inplace_repeat, NULL, SQSLOT("__imul__", sq_inplace_repeat, NULL,
wrap_indexargfunc, wrap_indexargfunc,
"__imul__(self, value)\nImplements self*=value."), "sig=($self, value)\nImplement self*=value."),
{NULL} {NULL}
}; };

View File

@ -50,7 +50,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/*[clinic input] /*[clinic input]
class str "PyUnicodeObject *" "&PyUnicode_Type" class str "PyUnicodeObject *" "&PyUnicode_Type"
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=604e916854800fa8]*/
/* --- Globals ------------------------------------------------------------ /* --- Globals ------------------------------------------------------------
@ -12885,7 +12885,7 @@ must be a string, whose characters will be mapped to None in the result.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(unicode_maketrans__doc__, PyDoc_STRVAR(unicode_maketrans__doc__,
"maketrans(x, y=None, z=None)\n" "sig=(x, y=None, z=None)\n"
"Return a translation table usable for str.translate().\n" "Return a translation table usable for str.translate().\n"
"\n" "\n"
"If there is only one argument, it must be a dictionary mapping Unicode\n" "If there is only one argument, it must be a dictionary mapping Unicode\n"
@ -12922,7 +12922,7 @@ exit:
static PyObject * static PyObject *
unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z) unicode_maketrans_impl(PyObject *x, PyObject *y, PyObject *z)
/*[clinic end generated code: checksum=90a3de8c494b304687e1e0d7e5fa8ba78eac6533]*/ /*[clinic end generated code: output=ca001ac83ed32269 input=7bfbf529a293c6c5]*/
{ {
PyObject *new = NULL, *key, *value; PyObject *new = NULL, *key, *value;
Py_ssize_t i = 0; Py_ssize_t i = 0;

View File

@ -34,7 +34,7 @@ static PyObject *initstr = NULL;
/*[clinic input] /*[clinic input]
module _imp module _imp
[clinic start generated code]*/ [clinic start generated code]*/
/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=9c332475d8686284]*/
/*[python input] /*[python input]
class fs_unicode_converter(CConverter): class fs_unicode_converter(CConverter):
@ -42,7 +42,7 @@ class fs_unicode_converter(CConverter):
converter = 'PyUnicode_FSDecoder' converter = 'PyUnicode_FSDecoder'
[python start generated code]*/ [python start generated code]*/
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ /*[python end generated code: output=da39a3ee5e6b4b0d input=9d6786230166006e]*/
/* Initialize things */ /* Initialize things */
@ -232,7 +232,7 @@ On platforms without threads, return False.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_lock_held__doc__, PyDoc_STRVAR(_imp_lock_held__doc__,
"lock_held(module)\n" "sig=($module)\n"
"Return True if the import lock is currently held, else False.\n" "Return True if the import lock is currently held, else False.\n"
"\n" "\n"
"On platforms without threads, return False."); "On platforms without threads, return False.");
@ -251,7 +251,7 @@ _imp_lock_held(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
static PyObject * static PyObject *
_imp_lock_held_impl(PyModuleDef *module) _imp_lock_held_impl(PyModuleDef *module)
/*[clinic end generated code: checksum=17172a9917d389dd1564e2108fec34d23aecb6c2]*/ /*[clinic end generated code: output=5ce46d12a8e4c469 input=9b088f9b217d9bdf]*/
{ {
#ifdef WITH_THREAD #ifdef WITH_THREAD
return PyBool_FromLong(import_lock_thread != -1); return PyBool_FromLong(import_lock_thread != -1);
@ -270,7 +270,7 @@ modules. On platforms without threads, this function does nothing.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_acquire_lock__doc__, PyDoc_STRVAR(_imp_acquire_lock__doc__,
"acquire_lock(module)\n" "sig=($module)\n"
"Acquires the interpreter\'s import lock for the current thread.\n" "Acquires the interpreter\'s import lock for the current thread.\n"
"\n" "\n"
"This lock should be used by import hooks to ensure thread-safety when importing\n" "This lock should be used by import hooks to ensure thread-safety when importing\n"
@ -290,7 +290,7 @@ _imp_acquire_lock(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
static PyObject * static PyObject *
_imp_acquire_lock_impl(PyModuleDef *module) _imp_acquire_lock_impl(PyModuleDef *module)
/*[clinic end generated code: checksum=20db30e18f6b8758386fe06907edb3f8e43080d7]*/ /*[clinic end generated code: output=b0dd6a132ad25961 input=4a2d4381866d5fdc]*/
{ {
#ifdef WITH_THREAD #ifdef WITH_THREAD
_PyImport_AcquireLock(); _PyImport_AcquireLock();
@ -308,7 +308,7 @@ On platforms without threads, this function does nothing.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_release_lock__doc__, PyDoc_STRVAR(_imp_release_lock__doc__,
"release_lock(module)\n" "sig=($module)\n"
"Release the interpreter\'s import lock.\n" "Release the interpreter\'s import lock.\n"
"\n" "\n"
"On platforms without threads, this function does nothing."); "On platforms without threads, this function does nothing.");
@ -327,7 +327,7 @@ _imp_release_lock(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
static PyObject * static PyObject *
_imp_release_lock_impl(PyModuleDef *module) _imp_release_lock_impl(PyModuleDef *module)
/*[clinic end generated code: checksum=17749fd7752d2c392447a1f83c5d371f54d7ebd3]*/ /*[clinic end generated code: output=b1e6e9d723cf5f89 input=934fb11516dd778b]*/
{ {
#ifdef WITH_THREAD #ifdef WITH_THREAD
if (_PyImport_ReleaseLock() < 0) { if (_PyImport_ReleaseLock() < 0) {
@ -927,7 +927,7 @@ Changes code.co_filename to specify the passed-in file path.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp__fix_co_filename__doc__, PyDoc_STRVAR(_imp__fix_co_filename__doc__,
"_fix_co_filename(module, code, path)\n" "sig=($module, code, path)\n"
"Changes code.co_filename to specify the passed-in file path.\n" "Changes code.co_filename to specify the passed-in file path.\n"
"\n" "\n"
" code\n" " code\n"
@ -960,7 +960,7 @@ exit:
static PyObject * static PyObject *
_imp__fix_co_filename_impl(PyModuleDef *module, PyCodeObject *code, PyObject *path) _imp__fix_co_filename_impl(PyModuleDef *module, PyCodeObject *code, PyObject *path)
/*[clinic end generated code: checksum=d32cf2b2e0480c714f909921cc9e55d763b39dd5]*/ /*[clinic end generated code: output=3fe5b5a1b0d497df input=895ba50e78b82f05]*/
{ {
update_compiled_module(code, path); update_compiled_module(code, path);
@ -1823,7 +1823,7 @@ Returns the list of file suffixes used to identify extension modules.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_extension_suffixes__doc__, PyDoc_STRVAR(_imp_extension_suffixes__doc__,
"extension_suffixes(module)\n" "sig=($module)\n"
"Returns the list of file suffixes used to identify extension modules."); "Returns the list of file suffixes used to identify extension modules.");
#define _IMP_EXTENSION_SUFFIXES_METHODDEF \ #define _IMP_EXTENSION_SUFFIXES_METHODDEF \
@ -1840,7 +1840,7 @@ _imp_extension_suffixes(PyModuleDef *module, PyObject *Py_UNUSED(ignored))
static PyObject * static PyObject *
_imp_extension_suffixes_impl(PyModuleDef *module) _imp_extension_suffixes_impl(PyModuleDef *module)
/*[clinic end generated code: checksum=625c8f11a5bbd4b85373f0a54f7f3ef19c55beb4]*/ /*[clinic end generated code: output=c1bcfbddabefa00a input=ecdeeecfcb6f839e]*/
{ {
PyObject *list; PyObject *list;
const char *suffix; const char *suffix;
@ -1878,7 +1878,7 @@ Initializes a built-in module.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_init_builtin__doc__, PyDoc_STRVAR(_imp_init_builtin__doc__,
"init_builtin(module, name)\n" "sig=($module, name)\n"
"Initializes a built-in module."); "Initializes a built-in module.");
#define _IMP_INIT_BUILTIN_METHODDEF \ #define _IMP_INIT_BUILTIN_METHODDEF \
@ -1905,7 +1905,7 @@ exit:
static PyObject * static PyObject *
_imp_init_builtin_impl(PyModuleDef *module, PyObject *name) _imp_init_builtin_impl(PyModuleDef *module, PyObject *name)
/*[clinic end generated code: checksum=a4e4805a523757cd3ddfeec6e5b16740678fed6a]*/ /*[clinic end generated code: output=02437efd4668f53e input=f934d2231ec52a2e]*/
{ {
int ret; int ret;
PyObject *m; PyObject *m;
@ -1932,7 +1932,7 @@ Initializes a frozen module.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_init_frozen__doc__, PyDoc_STRVAR(_imp_init_frozen__doc__,
"init_frozen(module, name)\n" "sig=($module, name)\n"
"Initializes a frozen module."); "Initializes a frozen module.");
#define _IMP_INIT_FROZEN_METHODDEF \ #define _IMP_INIT_FROZEN_METHODDEF \
@ -1959,7 +1959,7 @@ exit:
static PyObject * static PyObject *
_imp_init_frozen_impl(PyModuleDef *module, PyObject *name) _imp_init_frozen_impl(PyModuleDef *module, PyObject *name)
/*[clinic end generated code: checksum=2a58c119dd3e121cf5a9924f936cfd7b40253c12]*/ /*[clinic end generated code: output=20cea421af513afe input=13019adfc04f3fb3]*/
{ {
int ret; int ret;
PyObject *m; PyObject *m;
@ -1986,7 +1986,7 @@ Create a code object for a frozen module.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_get_frozen_object__doc__, PyDoc_STRVAR(_imp_get_frozen_object__doc__,
"get_frozen_object(module, name)\n" "sig=($module, name)\n"
"Create a code object for a frozen module."); "Create a code object for a frozen module.");
#define _IMP_GET_FROZEN_OBJECT_METHODDEF \ #define _IMP_GET_FROZEN_OBJECT_METHODDEF \
@ -2013,7 +2013,7 @@ exit:
static PyObject * static PyObject *
_imp_get_frozen_object_impl(PyModuleDef *module, PyObject *name) _imp_get_frozen_object_impl(PyModuleDef *module, PyObject *name)
/*[clinic end generated code: checksum=94c9108b58dda80d187fef21275a009bd0f91e96]*/ /*[clinic end generated code: output=f00d01ae30ec842f input=ed689bc05358fdbd]*/
{ {
return get_frozen_object(name); return get_frozen_object(name);
} }
@ -2028,7 +2028,7 @@ Returns True if the module name is of a frozen package.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_is_frozen_package__doc__, PyDoc_STRVAR(_imp_is_frozen_package__doc__,
"is_frozen_package(module, name)\n" "sig=($module, name)\n"
"Returns True if the module name is of a frozen package."); "Returns True if the module name is of a frozen package.");
#define _IMP_IS_FROZEN_PACKAGE_METHODDEF \ #define _IMP_IS_FROZEN_PACKAGE_METHODDEF \
@ -2055,7 +2055,7 @@ exit:
static PyObject * static PyObject *
_imp_is_frozen_package_impl(PyModuleDef *module, PyObject *name) _imp_is_frozen_package_impl(PyModuleDef *module, PyObject *name)
/*[clinic end generated code: checksum=17a342b94dbe859cdfc361bc8a6bc1b3cb163364]*/ /*[clinic end generated code: output=35c78f2448c6fcff input=81b6cdecd080fbb8]*/
{ {
return is_frozen_package(name); return is_frozen_package(name);
} }
@ -2070,7 +2070,7 @@ Returns True if the module name corresponds to a built-in module.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_is_builtin__doc__, PyDoc_STRVAR(_imp_is_builtin__doc__,
"is_builtin(module, name)\n" "sig=($module, name)\n"
"Returns True if the module name corresponds to a built-in module."); "Returns True if the module name corresponds to a built-in module.");
#define _IMP_IS_BUILTIN_METHODDEF \ #define _IMP_IS_BUILTIN_METHODDEF \
@ -2097,7 +2097,7 @@ exit:
static PyObject * static PyObject *
_imp_is_builtin_impl(PyModuleDef *module, PyObject *name) _imp_is_builtin_impl(PyModuleDef *module, PyObject *name)
/*[clinic end generated code: checksum=51c6139dcfd9bee1f40980ea68b7797f8489d69a]*/ /*[clinic end generated code: output=641689f833347f66 input=86befdac021dd1c7]*/
{ {
return PyLong_FromLong(is_builtin(name)); return PyLong_FromLong(is_builtin(name));
} }
@ -2112,7 +2112,7 @@ Returns True if the module name corresponds to a frozen module.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_is_frozen__doc__, PyDoc_STRVAR(_imp_is_frozen__doc__,
"is_frozen(module, name)\n" "sig=($module, name)\n"
"Returns True if the module name corresponds to a frozen module."); "Returns True if the module name corresponds to a frozen module.");
#define _IMP_IS_FROZEN_METHODDEF \ #define _IMP_IS_FROZEN_METHODDEF \
@ -2139,7 +2139,7 @@ exit:
static PyObject * static PyObject *
_imp_is_frozen_impl(PyModuleDef *module, PyObject *name) _imp_is_frozen_impl(PyModuleDef *module, PyObject *name)
/*[clinic end generated code: checksum=4b079fb45a495835056ea5604735d552d222be5c]*/ /*[clinic end generated code: output=0f80c7a3f283a686 input=7301dbca1897d66b]*/
{ {
const struct _frozen *p; const struct _frozen *p;
@ -2161,7 +2161,7 @@ Loads an extension module.
[clinic start generated code]*/ [clinic start generated code]*/
PyDoc_STRVAR(_imp_load_dynamic__doc__, PyDoc_STRVAR(_imp_load_dynamic__doc__,
"load_dynamic(module, name, path, file=None)\n" "sig=($module, name, path, file=None)\n"
"Loads an extension module."); "Loads an extension module.");
#define _IMP_LOAD_DYNAMIC_METHODDEF \ #define _IMP_LOAD_DYNAMIC_METHODDEF \
@ -2190,7 +2190,7 @@ exit:
static PyObject * static PyObject *
_imp_load_dynamic_impl(PyModuleDef *module, PyObject *name, PyObject *path, PyObject *file) _imp_load_dynamic_impl(PyModuleDef *module, PyObject *name, PyObject *path, PyObject *file)
/*[clinic end generated code: checksum=63e051fd0d0350c785bf185be41b0892f9920622]*/ /*[clinic end generated code: output=8f33f48dc6252948 input=af64f06e4bad3526]*/
{ {
PyObject *mod; PyObject *mod;
FILE *fp; FILE *fp;

View File

@ -19,6 +19,7 @@ import os
import pprint import pprint
import re import re
import shlex import shlex
import string
import sys import sys
import tempfile import tempfile
import textwrap import textwrap
@ -98,7 +99,7 @@ def warn_or_fail(fail=False, *args, filename=None, line_number=None):
if clinic: if clinic:
if filename is None: if filename is None:
filename = clinic.filename filename = clinic.filename
if clinic.block_parser and (line_number is None): if getattr(clinic, 'block_parser', None) and (line_number is None):
line_number = clinic.block_parser.line_number line_number = clinic.block_parser.line_number
if filename is not None: if filename is not None:
add(' in file "' + filename + '"') add(' in file "' + filename + '"')
@ -335,6 +336,22 @@ class CRenderData:
self.cleanup = [] self.cleanup = []
class FormatCounterFormatter(string.Formatter):
"""
This counts how many instances of each formatter
"replacement string" appear in the format string.
e.g. after evaluating "string {a}, {b}, {c}, {a}"
the counts dict would now look like
{'a': 2, 'b': 1, 'c': 1}
"""
def __init__(self):
self.counts = collections.Counter()
def get_value(self, key, args, kwargs):
self.counts[key] += 1
return ''
class Language(metaclass=abc.ABCMeta): class Language(metaclass=abc.ABCMeta):
start_line = "" start_line = ""
@ -347,18 +364,59 @@ class Language(metaclass=abc.ABCMeta):
pass pass
def validate(self): def validate(self):
def assert_only_one(field, token='dsl_name'): def assert_only_one(attr, *additional_fields):
line = getattr(self, field) """
token = '{' + token + '}' Ensures that the string found at getattr(self, attr)
if len(line.split(token)) != 2: contains exactly one formatter replacement string for
fail(self.__class__.__name__ + " " + field + " must contain " + token + " exactly once!") each valid field. The list of valid fields is
['dsl_name'] extended by additional_fields.
e.g.
self.fmt = "{dsl_name} {a} {b}"
# this passes
self.assert_only_one('fmt', 'a', 'b')
# this fails, the format string has a {b} in it
self.assert_only_one('fmt', 'a')
# this fails, the format string doesn't have a {c} in it
self.assert_only_one('fmt', 'a', 'b', 'c')
# this fails, the format string has two {a}s in it,
# it must contain exactly one
self.fmt2 = '{dsl_name} {a} {a}'
self.assert_only_one('fmt2', 'a')
"""
fields = ['dsl_name']
fields.extend(additional_fields)
line = getattr(self, attr)
fcf = FormatCounterFormatter()
fcf.format(line)
def local_fail(should_be_there_but_isnt):
if should_be_there_but_isnt:
fail("{} {} must contain {{{}}} exactly once!".format(
self.__class__.__name__, attr, name))
else:
fail("{} {} must not contain {{{}}}!".format(
self.__class__.__name__, attr, name))
for name, count in fcf.counts.items():
if name in fields:
if count > 1:
local_fail(True)
else:
local_fail(False)
for name in fields:
if fcf.counts.get(name) != 1:
local_fail(True)
assert_only_one('start_line') assert_only_one('start_line')
assert_only_one('stop_line') assert_only_one('stop_line')
assert_only_one('checksum_line')
assert_only_one('checksum_line', 'checksum')
if len(self.body_prefix.split('{dsl_name}')) >= 3: field = "arguments" if "{arguments}" in self.checksum_line else "checksum"
fail(self.__class__.__name__ + " body_prefix may contain " + token + " once at most!") assert_only_one('checksum_line', field)
@ -368,7 +426,7 @@ class PythonLanguage(Language):
start_line = "#/*[{dsl_name} input]" start_line = "#/*[{dsl_name} input]"
body_prefix = "#" body_prefix = "#"
stop_line = "#[{dsl_name} start generated code]*/" stop_line = "#[{dsl_name} start generated code]*/"
checksum_line = "#/*[{dsl_name} end generated code: checksum={checksum}]*/" checksum_line = "#/*[{dsl_name} end generated code: {arguments}]*/"
def permute_left_option_groups(l): def permute_left_option_groups(l):
@ -438,7 +496,7 @@ class CLanguage(Language):
start_line = "/*[{dsl_name} input]" start_line = "/*[{dsl_name} input]"
body_prefix = "" body_prefix = ""
stop_line = "[{dsl_name} start generated code]*/" stop_line = "[{dsl_name} start generated code]*/"
checksum_line = "/*[{dsl_name} end generated code: checksum={checksum}]*/" checksum_line = "/*[{dsl_name} end generated code: {arguments}]*/"
def render(self, clinic, signatures): def render(self, clinic, signatures):
function = None function = None
@ -1103,10 +1161,12 @@ def OverrideStdioWith(stdout):
sys.stdout = saved_stdout sys.stdout = saved_stdout
def create_regex(before, after): def create_regex(before, after, word=True):
"""Create an re object for matching marker lines.""" """Create an re object for matching marker lines."""
pattern = r'^{}(\w+){}$' group_re = "\w+" if word else ".+"
return re.compile(pattern.format(re.escape(before), re.escape(after))) pattern = r'^{}({}){}$'
pattern = pattern.format(re.escape(before), group_re, re.escape(after))
return re.compile(pattern)
class Block: class Block:
@ -1164,6 +1224,16 @@ class Block:
self.indent = indent self.indent = indent
self.preindent = preindent self.preindent = preindent
def __repr__(self):
dsl_name = self.dsl_name or "text"
def summarize(s):
s = repr(s)
if len(s) > 30:
return s[:26] + "..." + s[0]
return s
return "".join((
"<Block ", dsl_name, " input=", summarize(self.input), " output=", summarize(self.output), ">"))
class BlockParser: class BlockParser:
""" """
@ -1264,29 +1334,43 @@ class BlockParser:
if self.last_dsl_name == dsl_name: if self.last_dsl_name == dsl_name:
checksum_re = self.last_checksum_re checksum_re = self.last_checksum_re
else: else:
before, _, after = self.language.checksum_line.format(dsl_name=dsl_name, checksum='{checksum}').partition('{checksum}') before, _, after = self.language.checksum_line.format(dsl_name=dsl_name, arguments='{arguments}').partition('{arguments}')
assert _ == '{checksum}' assert _ == '{arguments}'
checksum_re = create_regex(before, after) checksum_re = create_regex(before, after, word=False)
self.last_dsl_name = dsl_name self.last_dsl_name = dsl_name
self.last_checksum_re = checksum_re self.last_checksum_re = checksum_re
# scan forward for checksum line # scan forward for checksum line
output_add, output_output = text_accumulator() output_add, output_output = text_accumulator()
checksum = None arguments = None
while self.input: while self.input:
line = self._line() line = self._line()
match = checksum_re.match(line.lstrip()) match = checksum_re.match(line.lstrip())
checksum = match.group(1) if match else None arguments = match.group(1) if match else None
if checksum: if arguments:
break break
output_add(line) output_add(line)
if self.is_start_line(line): if self.is_start_line(line):
break break
output = output_output() output = output_output()
if checksum: if arguments:
d = {}
for field in shlex.split(arguments):
name, equals, value = field.partition('=')
if not equals:
fail("Mangled Argument Clinic marker line: {!r}".format(line))
d[name.strip()] = value.strip()
if self.verify: if self.verify:
computed = compute_checksum(output) if 'input' in d:
checksum = d['output']
input_checksum = d['input']
else:
checksum = d['checksum']
input_checksum = None
computed = compute_checksum(output, len(checksum))
if checksum != computed: if checksum != computed:
fail("Checksum mismatch!\nExpected: {}\nComputed: {}\n" fail("Checksum mismatch!\nExpected: {}\nComputed: {}\n"
"Suggested fix: remove all generated code including " "Suggested fix: remove all generated code including "
@ -1336,13 +1420,15 @@ class BlockPrinter:
write(self.language.stop_line.format(dsl_name=dsl_name)) write(self.language.stop_line.format(dsl_name=dsl_name))
write("\n") write("\n")
input = ''.join(block.input)
output = ''.join(block.output) output = ''.join(block.output)
if output: if output:
if not output.endswith('\n'): if not output.endswith('\n'):
output += '\n' output += '\n'
write(output) write(output)
write(self.language.checksum_line.format(dsl_name=dsl_name, checksum=compute_checksum(output))) arguments="output={} input={}".format(compute_checksum(output, 16), compute_checksum(input, 16))
write(self.language.checksum_line.format(dsl_name=dsl_name, arguments=arguments))
write("\n") write("\n")
def write(self, text): def write(self, text):
@ -1468,7 +1554,7 @@ impl_definition block
""" """
def __init__(self, language, printer=None, *, verify=True, filename=None): def __init__(self, language, printer=None, *, force=False, verify=True, filename=None):
# maps strings to Parser objects. # maps strings to Parser objects.
# (instantiated from the "parsers" global.) # (instantiated from the "parsers" global.)
self.parsers = {} self.parsers = {}
@ -1477,6 +1563,7 @@ impl_definition block
fail("Custom printers are broken right now") fail("Custom printers are broken right now")
self.printer = printer or BlockPrinter(language) self.printer = printer or BlockPrinter(language)
self.verify = verify self.verify = verify
self.force = force
self.filename = filename self.filename = filename
self.modules = collections.OrderedDict() self.modules = collections.OrderedDict()
self.classes = collections.OrderedDict() self.classes = collections.OrderedDict()
@ -1594,6 +1681,7 @@ impl_definition block
fail("Can't write to destination {}, " fail("Can't write to destination {}, "
"can't make directory {}!".format( "can't make directory {}!".format(
destination.filename, dirname)) destination.filename, dirname))
if self.verify:
with open(destination.filename, "rt") as f: with open(destination.filename, "rt") as f:
parser_2 = BlockParser(f.read(), language=self.language) parser_2 = BlockParser(f.read(), language=self.language)
blocks = list(parser_2) blocks = list(parser_2)
@ -1658,7 +1746,7 @@ impl_definition block
return module, cls return module, cls
def parse_file(filename, *, verify=True, output=None, encoding='utf-8'): def parse_file(filename, *, force=False, verify=True, output=None, encoding='utf-8'):
extension = os.path.splitext(filename)[1][1:] extension = os.path.splitext(filename)[1][1:]
if not extension: if not extension:
fail("Can't extract file type for file " + repr(filename)) fail("Can't extract file type for file " + repr(filename))
@ -1668,13 +1756,13 @@ def parse_file(filename, *, verify=True, output=None, encoding='utf-8'):
except KeyError: except KeyError:
fail("Can't identify file type for file " + repr(filename)) fail("Can't identify file type for file " + repr(filename))
clinic = Clinic(language, verify=verify, filename=filename) clinic = Clinic(language, force=force, verify=verify, filename=filename)
with open(filename, 'r', encoding=encoding) as f: with open(filename, 'r', encoding=encoding) as f:
raw = f.read() raw = f.read()
cooked = clinic.parse(raw) cooked = clinic.parse(raw)
if cooked == raw: if (cooked == raw) and not force:
return return
directory = os.path.dirname(filename) or '.' directory = os.path.dirname(filename) or '.'
@ -1687,9 +1775,12 @@ def parse_file(filename, *, verify=True, output=None, encoding='utf-8'):
os.replace(tmpfilename, output or filename) os.replace(tmpfilename, output or filename)
def compute_checksum(input): def compute_checksum(input, length=None):
input = input or '' input = input or ''
return hashlib.sha1(input.encode('utf-8')).hexdigest() s = hashlib.sha1(input.encode('utf-8')).hexdigest()
if length:
s = s[:length]
return s
@ -1826,7 +1917,8 @@ class Function:
module, cls=None, c_basename=None, module, cls=None, c_basename=None,
full_name=None, full_name=None,
return_converter, return_annotation=_empty, return_converter, return_annotation=_empty,
docstring=None, kind=CALLABLE, coexist=False): docstring=None, kind=CALLABLE, coexist=False,
suppress_signature=False):
self.parameters = parameters or collections.OrderedDict() self.parameters = parameters or collections.OrderedDict()
self.return_annotation = return_annotation self.return_annotation = return_annotation
self.name = name self.name = name
@ -1840,6 +1932,7 @@ class Function:
self.kind = kind self.kind = kind
self.coexist = coexist self.coexist = coexist
self.self_converter = None self.self_converter = None
self.suppress_signature = suppress_signature
@property @property
def methoddef_flags(self): def methoddef_flags(self):
@ -3520,6 +3613,7 @@ class DSLParser:
else: else:
fail("Function " + self.function.name + " has an unsupported group configuration. (Unexpected state " + str(self.parameter_state) + ".b)") fail("Function " + self.function.name + " has an unsupported group configuration. (Unexpected state " + str(self.parameter_state) + ".b)")
self.group += 1 self.group += 1
self.function.suppress_signature = True
elif symbol == ']': elif symbol == ']':
if not self.group: if not self.group:
fail("Function " + self.function.name + " has a ] without a matching [.") fail("Function " + self.function.name + " has a ] without a matching [.")
@ -3615,6 +3709,9 @@ class DSLParser:
## docstring first line ## docstring first line
## ##
if not f.suppress_signature:
add('sig=')
else:
if new_or_init: if new_or_init:
assert f.cls assert f.cls
add(f.cls.name) add(f.cls.name)
@ -3673,7 +3770,17 @@ class DSLParser:
add_comma = True add_comma = True
name = p.converter.signature_name or p.name name = p.converter.signature_name or p.name
a = [name]
a = []
if isinstance(p.converter, self_converter) and not f.suppress_signature:
# annotate first parameter as being a "self".
#
# if inspect.Signature gets this function, and it's already bound,
# the self parameter will be stripped off.
#
# if it's not bound, it should be marked as positional-only.
a.append('$')
a.append(name)
if p.converter.is_optional(): if p.converter.is_optional():
a.append('=') a.append('=')
value = p.converter.py_default value = p.converter.py_default
@ -3915,7 +4022,7 @@ def main(argv):
path = os.path.join(root, filename) path = os.path.join(root, filename)
if ns.verbose: if ns.verbose:
print(path) print(path)
parse_file(path, verify=not ns.force) parse_file(path, force=ns.force, verify=not ns.force)
return return
if not ns.filename: if not ns.filename:
@ -3931,7 +4038,7 @@ def main(argv):
for filename in ns.filename: for filename in ns.filename:
if ns.verbose: if ns.verbose:
print(filename) print(filename)
parse_file(filename, output=ns.output, verify=not ns.force) parse_file(filename, output=ns.output, force=ns.force, verify=not ns.force)
if __name__ == "__main__": if __name__ == "__main__":