From 581ee3618c756132359d98b6fc149ec7e7ca9ef9 Mon Sep 17 00:00:00 2001 From: Larry Hastings Date: Tue, 28 Jan 2014 05:00:08 -0800 Subject: 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). --- Include/object.h | 6 +- Lib/idlelib/idle_test/test_calltips.py | 4 +- Lib/inspect.py | 21 ++-- Lib/test/test_capi.py | 2 +- Lib/test/test_generators.py | 4 +- Lib/test/test_genexps.py | 4 +- Misc/NEWS | 9 ++ Modules/_bz2module.c | 12 +- Modules/_cryptmodule.c | 6 +- Modules/_cursesmodule.c | 4 +- Modules/_datetimemodule.c | 6 +- Modules/_dbmmodule.c | 10 +- Modules/_lzmamodule.c | 18 +-- Modules/_lzmamodule.clinic.c | 2 +- Modules/_opcode.c | 4 +- Modules/_pickle.c | 34 +++--- Modules/_sre.c | 4 +- Modules/_testcapimodule.c | 8 +- Modules/_weakref.c | 6 +- Modules/audioop.c | 54 ++++----- Modules/binascii.c | 32 +++--- Modules/clinic/_bz2module.c.h | 12 +- Modules/clinic/_lzmamodule.c.h | 16 +-- Modules/clinic/_pickle.c.h | 34 +++--- Modules/clinic/audioop.c.h | 54 ++++----- Modules/clinic/binascii.c.h | 30 ++--- Modules/clinic/zlibmodule.c.h | 26 ++--- Modules/posixmodule.c | 16 +-- Modules/unicodedata.c | 6 +- Modules/zlibmodule.c | 28 ++--- Objects/descrobject.c | 24 +--- Objects/dictobject.c | 10 +- Objects/methodobject.c | 8 +- Objects/typeobject.c | 144 ++++++++++++------------ Objects/unicodeobject.c | 6 +- Python/import.c | 52 ++++----- Tools/clinic/clinic.py | 193 +++++++++++++++++++++++++-------- 37 files changed, 497 insertions(+), 412 deletions(-) diff --git a/Include/object.h b/Include/object.h index 015d216..05bffc9 100644 --- a/Include/object.h +++ b/Include/object.h @@ -493,10 +493,8 @@ PyAPI_FUNC(unsigned int) PyType_ClearCache(void); PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); #ifndef Py_LIMITED_API -PyAPI_FUNC(PyObject *) -_PyType_GetDocFromInternalDoc(const char *, const char *); -PyAPI_FUNC(PyObject *) -_PyType_GetTextSignatureFromInternalDoc(const char *, const char *); +PyAPI_FUNC(PyObject *) _PyType_GetDocFromInternalDoc(const char *); +PyAPI_FUNC(PyObject *) _PyType_GetTextSignatureFromInternalDoc(const char *); #endif /* Generic operations on objects */ diff --git a/Lib/idlelib/idle_test/test_calltips.py b/Lib/idlelib/idle_test/test_calltips.py index ab69bd0..4ee15ae 100644 --- a/Lib/idlelib/idle_test/test_calltips.py +++ b/Lib/idlelib/idle_test/test_calltips.py @@ -54,9 +54,9 @@ class Get_signatureTest(unittest.TestCase): gtest(List, List.__doc__) 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__, - '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" gtest(list.append, append_doc) gtest([].append, append_doc) diff --git a/Lib/inspect.py b/Lib/inspect.py index 2211b8d..5f37a2a 100644 --- a/Lib/inspect.py +++ b/Lib/inspect.py @@ -1998,6 +1998,10 @@ class Signature: else: kind = Parameter.POSITIONAL_OR_KEYWORD + first_parameter_is_self = s.startswith("($") + if first_parameter_is_self: + s = '(' + s[2:] + s = "def foo" + s + ": pass" try: @@ -2102,18 +2106,11 @@ class Signature: kind = Parameter.VAR_KEYWORD p(f.args.kwarg, empty) - if parameters and (hasattr(func, '__self__') or - isinstance(func, _WrapperDescriptor,) or - ismethoddescriptor(func) - ): - name = parameters[0].name - 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') + if first_parameter_is_self: + assert parameters + if getattr(func, '__self__', None): + # strip off self, it's already been bound + parameters.pop(0) else: # for builtins, self parameter is always positional-only! p = parameters[0].replace(kind=Parameter.POSITIONAL_ONLY) diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py index 444feb6..0ec3ca3 100644 --- a/Lib/test/test_capi.py +++ b/Lib/test/test_capi.py @@ -125,7 +125,7 @@ class CAPITest(unittest.TestCase): self.assertEqual(_testcapi.docstring_no_signature.__text_signature__, None) self.assertEqual(_testcapi.docstring_with_invalid_signature.__doc__, - "docstring_with_invalid_signature (module, boo)\n" + "sig= (module, boo)\n" "\n" "This docstring has an invalid signature." ) diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py index 5b7424b..91afe47 100644 --- a/Lib/test/test_generators.py +++ b/Lib/test/test_generators.py @@ -436,8 +436,8 @@ From the Iterators list, about the types of these things. >>> [s for s in dir(i) if not s.startswith('_')] ['close', 'gi_code', 'gi_frame', 'gi_running', 'send', 'throw'] >>> from test.support import HAVE_DOCSTRINGS ->>> print(i.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implements next(self).') -Implements next(self). +>>> print(i.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implement next(self).') +Implement next(self). >>> iter(i) is i True >>> import types diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py index 74957cb..fb531d6 100644 --- a/Lib/test/test_genexps.py +++ b/Lib/test/test_genexps.py @@ -222,8 +222,8 @@ Check that generator attributes are present True >>> from test.support import HAVE_DOCSTRINGS - >>> print(g.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implements next(self).') - Implements next(self). + >>> print(g.__next__.__doc__ if HAVE_DOCSTRINGS else 'Implement next(self).') + Implement next(self). >>> import types >>> isinstance(g, types.GeneratorType) True diff --git a/Misc/NEWS b/Misc/NEWS index d881948..a4aca4d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -203,6 +203,15 @@ Tests 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 "{dirname}/clinic/{basename}.h". diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c index 2a0abe1..e652f4d 100644 --- a/Modules/_bz2module.c +++ b/Modules/_bz2module.c @@ -204,7 +204,7 @@ module _bz2 class _bz2.BZ2Compressor "BZ2Compressor *" "&BZ2Compressor_Type" class _bz2.BZ2Decompressor "BZ2Decompressor *" "&BZ2Decompressor_Type" [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=e3b139924f5e18cc]*/ #include "clinic/_bz2module.c.h" @@ -224,7 +224,7 @@ flush() method to finish the compression process. static PyObject * _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; @@ -249,7 +249,7 @@ The compressor object may not be used after this method is called. static PyObject * _bz2_BZ2Compressor_flush_impl(BZ2Compressor *self) -/*[clinic end generated code: checksum=3ef03fc1b092a701b382b97096c7fd50db87190b]*/ +/*[clinic end generated code: output=3ef03fc1b092a701 input=d64405d3c6f76691]*/ { PyObject *result = NULL; @@ -304,7 +304,7 @@ For one-shot compression, use the compress() function instead. static int _bz2_BZ2Compressor___init___impl(BZ2Compressor *self, int compresslevel) -/*[clinic end generated code: checksum=c4e6adfd02963827075a1cc9309dc6df184b1246]*/ +/*[clinic end generated code: output=c4e6adfd02963827 input=4e1ff7b8394b6e9a]*/ { int bzerror; @@ -484,7 +484,7 @@ is ignored and saved in the unused_data attribute. static PyObject * _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; @@ -515,7 +515,7 @@ For one-shot decompression, use the decompress() function instead. static int _bz2_BZ2Decompressor___init___impl(BZ2Decompressor *self) -/*[clinic end generated code: checksum=e4d2b9bb866ab8f1f4a8bb786ddb5b614ce323c0]*/ +/*[clinic end generated code: output=e4d2b9bb866ab8f1 input=95f6500dcda60088]*/ { int bzerror; diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c index 9154bab..7531c2f 100644 --- a/Modules/_cryptmodule.c +++ b/Modules/_cryptmodule.c @@ -10,7 +10,7 @@ /*[clinic input] module crypt [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=c6252cf4f2f2ae81]*/ /*[clinic input] @@ -30,7 +30,7 @@ results for a given *word*. [clinic start generated code]*/ 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" "\n" "*word* will usually be a user\'s password. *salt* (either a random 2 or 16\n" @@ -63,7 +63,7 @@ exit: static PyObject * 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 salt. Return None in that case. XXX Maybe raise an exception? */ diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c index 534dcff..915a780 100644 --- a/Modules/_cursesmodule.c +++ b/Modules/_cursesmodule.c @@ -138,7 +138,7 @@ typedef chtype attr_t; /* No attr_t type is available */ module curses class curses.window "PyCursesWindowObject *" "&PyCursesWindow_Type" [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=88c860abdbb50e0c]*/ /* Definition of exception curses.error */ @@ -651,7 +651,7 @@ exit: static PyObject * 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; int coordinates_group = group_left_1; diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index b78725e..80fa497 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -20,7 +20,7 @@ module datetime class datetime.datetime "PyDateTime_DateTime *" "&PyDateTime_DateTimeType" [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 * 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]*/ 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" "\n" " tz\n" @@ -4192,7 +4192,7 @@ exit: static PyObject * datetime_datetime_now_impl(PyTypeObject *type, PyObject *tz) -/*[clinic end generated code: checksum=a6d3ad2c0ab6389075289af3467f7b8eb13f5f5c]*/ +/*[clinic end generated code: output=c8a47308483e579a input=80d09869c5267d00]*/ { PyObject *self; diff --git a/Modules/_dbmmodule.c b/Modules/_dbmmodule.c index 88dae16..9f63c8a 100644 --- a/Modules/_dbmmodule.c +++ b/Modules/_dbmmodule.c @@ -32,7 +32,7 @@ static char *which_dbm = "Berkeley DB"; module dbm class dbm.dbm "dbmobject *" "&Dbmtype" [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=92450564684a69a3]*/ typedef struct { PyObject_HEAD @@ -55,7 +55,7 @@ class dbmobject_converter(self_converter): def converter_init(self): self.name = 'dp' [python start generated code]*/ -/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=8a69ac1827811128]*/ static PyObject * newdbmobject(const char *file, int flags, int mode) @@ -319,7 +319,7 @@ exit: static PyObject * 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; @@ -462,7 +462,7 @@ Return a database object. [clinic start generated code]*/ 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" "\n" " filename\n" @@ -499,7 +499,7 @@ exit: static PyObject * 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; diff --git a/Modules/_lzmamodule.c b/Modules/_lzmamodule.c index 56a3942..c43676a 100644 --- a/Modules/_lzmamodule.c +++ b/Modules/_lzmamodule.c @@ -475,7 +475,7 @@ module _lzma class _lzma.LZMACompressor "Compressor *" "&Compressor_type" class _lzma.LZMADecompressor "Decompressor *" "&Decompressor_type" [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f17afc786525d6c2]*/ #include "clinic/_lzmamodule.c.h" @@ -496,7 +496,7 @@ class lzma_filter_converter(CConverter): ' PyMem_Free(%(name)s.options);\n') % {'name': name} [python start generated code]*/ -/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=74fe7631ce377a94]*/ /* LZMACompressor class. */ @@ -560,7 +560,7 @@ flush() method to finish the compression process. static PyObject * _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; @@ -587,7 +587,7 @@ The compressor object may not be used after this method is called. static PyObject * _lzma_LZMACompressor_flush_impl(Compressor *self) -/*[clinic end generated code: checksum=fec21f3e22504f500606ba60e1ba70d79eb22188]*/ +/*[clinic end generated code: output=fec21f3e22504f50 input=3060fb26f9b4042c]*/ { PyObject *result = NULL; @@ -959,7 +959,7 @@ is ignored and saved in the unused_data attribute. static PyObject * _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; @@ -1024,7 +1024,7 @@ For one-shot decompression, use the decompress() function instead. static int _lzma_LZMADecompressor___init___impl(Decompressor *self, int format, PyObject *memlimit, PyObject *filters) -/*[clinic end generated code: checksum=9b119f6f2cc2d7a8e5be41c164a6c080ee82d0c2]*/ +/*[clinic end generated code: output=9b119f6f2cc2d7a8 input=458ca6132ef29801]*/ { const uint32_t decoder_flags = LZMA_TELL_ANY_CHECK | LZMA_TELL_NO_CHECK; uint64_t memlimit_ = UINT64_MAX; @@ -1203,7 +1203,7 @@ Always returns True for CHECK_NONE and CHECK_CRC32. static PyObject * _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)); } @@ -1221,7 +1221,7 @@ The result does not include the filter ID itself, only the options. static PyObject * _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; uint32_t encoded_size; @@ -1261,7 +1261,7 @@ The result does not include the filter ID itself, only the options. static PyObject * _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_ret lzret; diff --git a/Modules/_lzmamodule.clinic.c b/Modules/_lzmamodule.clinic.c index 171354b9..269576c 100644 --- a/Modules/_lzmamodule.clinic.c +++ b/Modules/_lzmamodule.clinic.c @@ -228,4 +228,4 @@ exit: return return_value; } -/*[clinic end generated code: checksum=b4b90dcbd0c9c349c3a94e26a7eecf71aab179a0]*/ +/*[clinic end generated code: output=b4b90dcbd0c9c349 input=a9049054013a1b77]*/ diff --git a/Modules/_opcode.c b/Modules/_opcode.c index a5c546e..1597e3d 100644 --- a/Modules/_opcode.c +++ b/Modules/_opcode.c @@ -4,7 +4,7 @@ /*[clinic input] module _opcode [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=117442e66eb376e6]*/ /*[clinic input] @@ -64,7 +64,7 @@ exit: static int _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; if (HAS_ARG(opcode)) { diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 5486524..7faf96d 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -12,7 +12,7 @@ class _pickle.PicklerMemoProxy "PicklerMemoProxyObject *" "&PicklerMemoProxyType class _pickle.Unpickler "UnpicklerObject *" "&Unpickler_Type" class _pickle.UnpicklerMemoProxy "UnpicklerMemoProxyObject *" "&UnpicklerMemoProxyType" [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. */ enum { @@ -3885,7 +3885,7 @@ re-using picklers. static PyObject * _pickle_Pickler_clear_memo_impl(PicklerObject *self) -/*[clinic end generated code: checksum=8665c8658aaa094ba9b424d3d7fe0add5e8142ab]*/ +/*[clinic end generated code: output=8665c8658aaa094b input=01bdad52f3d93e56]*/ { if (self->memo) PyMemoTable_Clear(self->memo); @@ -3905,7 +3905,7 @@ Write a pickled representation of the given object to the open file. static PyObject * _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). 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 _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(dispatch_table); @@ -4080,7 +4080,7 @@ Remove all items from memo. static PyObject * _pickle_PicklerMemoProxy_clear_impl(PicklerMemoProxyObject *self) -/*[clinic end generated code: checksum=5fb9370d48ae8b055fc72518a2b12d1714338078]*/ +/*[clinic end generated code: output=5fb9370d48ae8b05 input=ccc186dacd0f1405]*/ { if (self->pickler->memo) PyMemoTable_Clear(self->pickler->memo); @@ -4095,7 +4095,7 @@ Copy the memo to a new object. static PyObject * _pickle_PicklerMemoProxy_copy_impl(PicklerMemoProxyObject *self) -/*[clinic end generated code: checksum=bb83a919d29225ef55ba0ecfca002369ea4eb8ea]*/ +/*[clinic end generated code: output=bb83a919d29225ef input=b73043485ac30b36]*/ { Py_ssize_t i; PyMemoTable *memo; @@ -4140,7 +4140,7 @@ Implement pickle support. static PyObject * _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 *contents = _pickle_PicklerMemoProxy_copy_impl(self); @@ -6163,7 +6163,7 @@ specified therein. static PyObject * _pickle_Unpickler_load_impl(UnpicklerObject *self) -/*[clinic end generated code: checksum=fdcc488aad675b1458b5644180d092b99e6e4fe4]*/ +/*[clinic end generated code: output=fdcc488aad675b14 input=acbb91a42fa9b7b9]*/ { UnpicklerObject *unpickler = (UnpicklerObject*)self; @@ -6206,7 +6206,7 @@ needed. Both arguments passed are str objects. static PyObject * _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 *modules_dict; @@ -6389,7 +6389,7 @@ string instances as bytes objects. static int _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); @@ -6453,7 +6453,7 @@ Remove all items from memo. static PyObject * _pickle_UnpicklerMemoProxy_clear_impl(UnpicklerMemoProxyObject *self) -/*[clinic end generated code: checksum=d20cd43f4ba1fb1f1ba1677fae3ff69b8cc41582]*/ +/*[clinic end generated code: output=d20cd43f4ba1fb1f input=b1df7c52e7afd9bd]*/ { _Unpickler_MemoCleanup(self->unpickler); self->unpickler->memo = _Unpickler_NewMemo(self->unpickler->memo_size); @@ -6470,7 +6470,7 @@ Copy the memo to a new object. static PyObject * _pickle_UnpicklerMemoProxy_copy_impl(UnpicklerMemoProxyObject *self) -/*[clinic end generated code: checksum=e12af7e9bc1e4c77df97c1e657d6b8e026a022b7]*/ +/*[clinic end generated code: output=e12af7e9bc1e4c77 input=97769247ce032c1d]*/ { Py_ssize_t i; PyObject *new_memo = PyDict_New(); @@ -6508,7 +6508,7 @@ Implement pickling support. static PyObject * _pickle_UnpicklerMemoProxy___reduce___impl(UnpicklerMemoProxyObject *self) -/*[clinic end generated code: checksum=6da34ac048d94cca7604faa72d45992e730882f1]*/ +/*[clinic end generated code: output=6da34ac048d94cca input=6920862413407199]*/ { PyObject *reduce_value; PyObject *constructor_args; @@ -6818,7 +6818,7 @@ to map the new Python 3 names to the old module names used in Python static PyObject * _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(); @@ -6871,7 +6871,7 @@ Python 2, so that the pickle data stream is readable with Python 2. static PyObject * _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; PicklerObject *pickler = _Pickler_New(); @@ -6931,7 +6931,7 @@ string instances as bytes objects. static PyObject * _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; UnpicklerObject *unpickler = _Unpickler_New(); @@ -6984,7 +6984,7 @@ string instances as bytes objects. static PyObject * _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; UnpicklerObject *unpickler = _Unpickler_New(); diff --git a/Modules/_sre.c b/Modules/_sre.c index 41dca7d..4dcaec1 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -540,7 +540,7 @@ Matches zero or more characters at the beginning of the string. [clinic start generated code]*/ 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."); #define PATTERN_MATCH_METHODDEF \ @@ -570,7 +570,7 @@ exit: static PyObject * 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; Py_ssize_t status; diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 35eb21d..260e53d 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -2851,18 +2851,18 @@ PyDoc_STRVAR(docstring_no_signature, ); PyDoc_STRVAR(docstring_with_invalid_signature, -"docstring_with_invalid_signature (module, boo)\n" +"sig= (module, boo)\n" "\n" "This docstring has an invalid signature." ); PyDoc_STRVAR(docstring_with_signature, -"docstring_with_signature(module, sig)\n" +"sig=(module, sig)\n" "This docstring has a valid signature." ); PyDoc_STRVAR(docstring_with_signature_and_extra_newlines, -"docstring_with_signature_and_extra_newlines(module, parameter)\n" +"sig=(module, parameter)\n" "\n" "\n" "\n" @@ -2870,7 +2870,7 @@ PyDoc_STRVAR(docstring_with_signature_and_extra_newlines, ); 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" diff --git a/Modules/_weakref.c b/Modules/_weakref.c index 1cc6246..6451dba 100644 --- a/Modules/_weakref.c +++ b/Modules/_weakref.c @@ -7,7 +7,7 @@ /*[clinic input] module _weakref [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ffec73b85846596d]*/ /*[clinic input] @@ -20,7 +20,7 @@ Return the number of weak references to 'object'. [clinic start generated code]*/ PyDoc_STRVAR(_weakref_getweakrefcount__doc__, -"getweakrefcount(module, object)\n" +"sig=($module, object)\n" "Return the number of weak references to \'object\'."); #define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \ @@ -46,7 +46,7 @@ exit: static Py_ssize_t _weakref_getweakrefcount_impl(PyModuleDef *module, PyObject *object) -/*[clinic end generated code: checksum=dd8ba0730babf263d3db78d260ea7eacf6eb3735]*/ +/*[clinic end generated code: output=ef51baac56180816 input=cedb69711b6a2507]*/ { PyWeakReference **list; diff --git a/Modules/audioop.c b/Modules/audioop.c index 159b2fb..2d287f2 100644 --- a/Modules/audioop.c +++ b/Modules/audioop.c @@ -394,7 +394,7 @@ audioop_check_parameters(Py_ssize_t len, int size) output preset file module audioop [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=5619f935f269199a]*/ /*[clinic input] audioop.getsample @@ -409,7 +409,7 @@ Return the value of sample index from the fragment. static PyObject * 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; @@ -435,7 +435,7 @@ Return the maximum of the absolute value of all samples in a fragment. static PyObject * 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; unsigned int absval, max = 0; @@ -463,7 +463,7 @@ Return the minimum and maximum values of all samples in the sound fragment. static PyObject * 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; /* -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 * 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; int avg; @@ -521,7 +521,7 @@ Return the root-mean-square of the fragment, i.e. sqrt(sum(S_i^2)/n). static PyObject * 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; unsigned int res; @@ -595,7 +595,7 @@ Try to match reference as well as possible to a portion of fragment. static PyObject * 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; 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 * 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; Py_ssize_t len; @@ -704,7 +704,7 @@ Search fragment for a slice of specified number of samples with maximum energy. static PyObject * 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; Py_ssize_t len1; @@ -757,7 +757,7 @@ Return the average peak-peak value over all samples in the fragment. static PyObject * 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; int prevval, prevextremevalid = 0, prevextreme = 0; @@ -814,7 +814,7 @@ Return the maximum peak-peak value in the sound fragment. static PyObject * 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; 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 * 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; int prevval; @@ -898,7 +898,7 @@ Return a fragment that has all samples in the original fragment multiplied by th static PyObject * 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; Py_ssize_t i; @@ -939,7 +939,7 @@ Convert a stereo fragment to a mono fragment. static PyObject * 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; Py_ssize_t len, i; @@ -987,7 +987,7 @@ Generate a stereo fragment from a mono fragment. static PyObject * 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; Py_ssize_t i; @@ -1034,7 +1034,7 @@ Return a fragment which is the addition of the two samples passed as parameters. static PyObject * 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; 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 * 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; Py_ssize_t i; @@ -1151,7 +1151,7 @@ Reverse the samples in a fragment and returns the modified fragment. static PyObject * 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; Py_ssize_t i; @@ -1184,7 +1184,7 @@ Convert big-endian samples to little-endian and vice versa. static PyObject * 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; Py_ssize_t i; @@ -1219,7 +1219,7 @@ Convert samples between 1-, 2-, 3- and 4-byte formats. static PyObject * 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; Py_ssize_t i, j; @@ -1276,7 +1276,7 @@ Convert the frame rate of the input fragment. static PyObject * 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; Py_ssize_t len; @@ -1455,7 +1455,7 @@ Convert samples in the audio fragment to u-LAW encoding. static PyObject * 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; Py_ssize_t i; @@ -1488,7 +1488,7 @@ Convert sound fragments in u-LAW encoding to linearly encoded sound fragments. static PyObject * 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; signed char *ncp; @@ -1528,7 +1528,7 @@ Convert samples in the audio fragment to a-LAW encoding. static PyObject * 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; Py_ssize_t i; @@ -1561,7 +1561,7 @@ Convert sound fragments in a-LAW encoding to linearly encoded sound fragments. static PyObject * 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; signed char *ncp; @@ -1603,7 +1603,7 @@ Convert samples to 4 bit Intel/DVI ADPCM encoding. static PyObject * 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; Py_ssize_t i; @@ -1725,7 +1725,7 @@ Decode an Intel/DVI ADPCM coded fragment to a linear fragment. static PyObject * 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 *ncp; diff --git a/Modules/binascii.c b/Modules/binascii.c index d38182e..42d08de 100644 --- a/Modules/binascii.c +++ b/Modules/binascii.c @@ -187,7 +187,7 @@ static unsigned short crctab_hqx[256] = { output preset file module binascii [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=44c6f840ce708f0c]*/ /*[python input] @@ -202,7 +202,7 @@ class ascii_buffer_converter(CConverter): return "".join(["if (", name, ".obj)\n PyBuffer_Release(&", name, ");\n"]) [python start generated code]*/ -/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=3eb7b63610da92cd]*/ static int ascii_buffer_converter(PyObject *arg, Py_buffer *buf) @@ -254,7 +254,7 @@ Decode a line of uuencoded data. static PyObject * 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; int leftbits = 0; @@ -340,7 +340,7 @@ Uuencode line of data. static PyObject * 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; int leftbits = 0; @@ -427,7 +427,7 @@ Decode a line of base64 data. static PyObject * 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; int leftbits = 0; @@ -535,7 +535,7 @@ Base64-code line of data. static PyObject * 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; int leftbits = 0; @@ -602,7 +602,7 @@ Decode .hqx coding. static PyObject * 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; int leftbits = 0; @@ -685,7 +685,7 @@ Binhex RLE-code binary data. static PyObject * 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; PyObject *rv; @@ -749,7 +749,7 @@ Encode .hqx data. static PyObject * 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; int leftbits = 0; @@ -806,7 +806,7 @@ Decode hexbin RLE-coded string. static PyObject * 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_byte, in_repeat; @@ -920,7 +920,7 @@ Compute hqx CRC incrementally. static int 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 int ucrc = (unsigned int)crc; @@ -1068,7 +1068,7 @@ Compute CRC-32 incrementally. static unsigned int 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 /* This was taken from zlibmodule.c PyZlib_crc32 (but is PY_SSIZE_T_CLEAN) */ @@ -1116,7 +1116,7 @@ available as "hexlify()". static PyObject * 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; Py_ssize_t arglen; @@ -1177,7 +1177,7 @@ This function is also available as "unhexlify()". static PyObject * 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; Py_ssize_t arglen; @@ -1248,7 +1248,7 @@ Decode a string of qp-encoded data. static PyObject * 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; char ch; @@ -1354,7 +1354,7 @@ are both encoded. When quotetabs is set, space and tabs are encoded. static PyObject * 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; unsigned char *databuf, *odata; diff --git a/Modules/clinic/_bz2module.c.h b/Modules/clinic/_bz2module.c.h index 1611002..98f9a1b 100644 --- a/Modules/clinic/_bz2module.c.h +++ b/Modules/clinic/_bz2module.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(_bz2_BZ2Compressor_compress__doc__, -"compress(self, data)\n" +"sig=($self, data)\n" "Provide data to the compressor object.\n" "\n" "Returns a chunk of compressed data if possible, or b\'\' otherwise.\n" @@ -38,7 +38,7 @@ exit: } PyDoc_STRVAR(_bz2_BZ2Compressor_flush__doc__, -"flush(self)\n" +"sig=($self)\n" "Finish the compression process.\n" "\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__, -"BZ2Compressor(compresslevel=9)\n" +"sig=(compresslevel=9)\n" "Create a compressor object for compressing data incrementally.\n" "\n" " compresslevel\n" @@ -89,7 +89,7 @@ exit: } PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__, -"decompress(self, data)\n" +"sig=($self, data)\n" "Provide data to the decompressor object.\n" "\n" "Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n" @@ -125,7 +125,7 @@ exit: } PyDoc_STRVAR(_bz2_BZ2Decompressor___init____doc__, -"BZ2Decompressor()\n" +"sig=()\n" "Create a decompressor object for decompressing data incrementally.\n" "\n" "For one-shot decompression, use the decompress() function instead."); @@ -149,4 +149,4 @@ _bz2_BZ2Decompressor___init__(PyObject *self, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: checksum=4ade1dba3921a8bd8a614e5417f7654d8fb10be5]*/ +/*[clinic end generated code: output=aca4f6329c1c773a input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_lzmamodule.c.h b/Modules/clinic/_lzmamodule.c.h index 171354b9..1848891 100644 --- a/Modules/clinic/_lzmamodule.c.h +++ b/Modules/clinic/_lzmamodule.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(_lzma_LZMACompressor_compress__doc__, -"compress(self, data)\n" +"sig=($self, data)\n" "Provide data to the compressor object.\n" "\n" "Returns a chunk of compressed data if possible, or b\'\' otherwise.\n" @@ -38,7 +38,7 @@ exit: } PyDoc_STRVAR(_lzma_LZMACompressor_flush__doc__, -"flush(self)\n" +"sig=($self)\n" "Finish the compression process.\n" "\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__, -"decompress(self, data)\n" +"sig=($self, data)\n" "Provide data to the decompressor object.\n" "\n" "Returns a chunk of decompressed data if possible, or b\'\' otherwise.\n" @@ -94,7 +94,7 @@ exit: } 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" "\n" " format\n" @@ -137,7 +137,7 @@ exit: } 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" "\n" "Always returns True for CHECK_NONE and CHECK_CRC32."); @@ -165,7 +165,7 @@ exit: } 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" "\n" "The result does not include the filter ID itself, only the options."); @@ -197,7 +197,7 @@ exit: } 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" "\n" "The result does not include the filter ID itself, only the options."); @@ -228,4 +228,4 @@ exit: return return_value; } -/*[clinic end generated code: checksum=b4b90dcbd0c9c349c3a94e26a7eecf71aab179a0]*/ +/*[clinic end generated code: output=fe63bc798a5c5c55 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/_pickle.c.h b/Modules/clinic/_pickle.c.h index 12dc2ed..9ef469d 100644 --- a/Modules/clinic/_pickle.c.h +++ b/Modules/clinic/_pickle.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(_pickle_Pickler_clear_memo__doc__, -"clear_memo(self)\n" +"sig=($self)\n" "Clears the pickler\'s \"memo\".\n" "\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__, -"dump(self, obj)\n" +"sig=($self, obj)\n" "Write a pickled representation of the given object to the open file."); #define _PICKLE_PICKLER_DUMP_METHODDEF \ {"dump", (PyCFunction)_pickle_Pickler_dump, METH_O, _pickle_Pickler_dump__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" "\n" "The optional *protocol* argument tells the pickler to use the given\n" @@ -74,7 +74,7 @@ exit: } PyDoc_STRVAR(_pickle_PicklerMemoProxy_clear__doc__, -"clear(self)\n" +"sig=($self)\n" "Remove all items from memo."); #define _PICKLE_PICKLERMEMOPROXY_CLEAR_METHODDEF \ @@ -90,7 +90,7 @@ _pickle_PicklerMemoProxy_clear(PicklerMemoProxyObject *self, PyObject *Py_UNUSED } PyDoc_STRVAR(_pickle_PicklerMemoProxy_copy__doc__, -"copy(self)\n" +"sig=($self)\n" "Copy the memo to a new object."); #define _PICKLE_PICKLERMEMOPROXY_COPY_METHODDEF \ @@ -106,7 +106,7 @@ _pickle_PicklerMemoProxy_copy(PicklerMemoProxyObject *self, PyObject *Py_UNUSED( } PyDoc_STRVAR(_pickle_PicklerMemoProxy___reduce____doc__, -"__reduce__(self)\n" +"sig=($self)\n" "Implement pickle support."); #define _PICKLE_PICKLERMEMOPROXY___REDUCE___METHODDEF \ @@ -122,7 +122,7 @@ _pickle_PicklerMemoProxy___reduce__(PicklerMemoProxyObject *self, PyObject *Py_U } PyDoc_STRVAR(_pickle_Unpickler_load__doc__, -"load(self)\n" +"sig=($self)\n" "Load a pickle.\n" "\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__, -"find_class(self, module_name, global_name)\n" +"sig=($self, module_name, global_name)\n" "Return an object from a specified module.\n" "\n" "If necessary, the module will be imported. Subclasses may override\n" @@ -176,7 +176,7 @@ exit: } 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" "\n" "The protocol version of the pickle is detected automatically, so no\n" @@ -222,7 +222,7 @@ exit: } PyDoc_STRVAR(_pickle_UnpicklerMemoProxy_clear__doc__, -"clear(self)\n" +"sig=($self)\n" "Remove all items from memo."); #define _PICKLE_UNPICKLERMEMOPROXY_CLEAR_METHODDEF \ @@ -238,7 +238,7 @@ _pickle_UnpicklerMemoProxy_clear(UnpicklerMemoProxyObject *self, PyObject *Py_UN } PyDoc_STRVAR(_pickle_UnpicklerMemoProxy_copy__doc__, -"copy(self)\n" +"sig=($self)\n" "Copy the memo to a new object."); #define _PICKLE_UNPICKLERMEMOPROXY_COPY_METHODDEF \ @@ -254,7 +254,7 @@ _pickle_UnpicklerMemoProxy_copy(UnpicklerMemoProxyObject *self, PyObject *Py_UNU } PyDoc_STRVAR(_pickle_UnpicklerMemoProxy___reduce____doc__, -"__reduce__(self)\n" +"sig=($self)\n" "Implement pickling support."); #define _PICKLE_UNPICKLERMEMOPROXY___REDUCE___METHODDEF \ @@ -270,7 +270,7 @@ _pickle_UnpicklerMemoProxy___reduce__(UnpicklerMemoProxyObject *self, PyObject * } 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" "\n" "This is equivalent to ``Pickler(file, protocol).dump(obj)``, but may\n" @@ -320,7 +320,7 @@ exit: } 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" "\n" "The optional *protocol* argument tells the pickler to use the given\n" @@ -361,7 +361,7 @@ exit: } 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" "\n" "This is equivalent to ``Unpickler(file).load()``, but may be more\n" @@ -413,7 +413,7 @@ exit: } 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" "\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: return return_value; } -/*[clinic end generated code: checksum=b7a2e1df72bdbc87da3cd0e43a3caa1a879892bb]*/ +/*[clinic end generated code: output=c59d4dafc2646f11 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/audioop.c.h b/Modules/clinic/audioop.c.h index 974fdb1..92d13b0 100644 --- a/Modules/clinic/audioop.c.h +++ b/Modules/clinic/audioop.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ 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."); #define AUDIOOP_GETSAMPLE_METHODDEF \ @@ -35,7 +35,7 @@ exit: } 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."); #define AUDIOOP_MAX_METHODDEF \ @@ -66,7 +66,7 @@ exit: } 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."); #define AUDIOOP_MINMAX_METHODDEF \ @@ -97,7 +97,7 @@ exit: } PyDoc_STRVAR(audioop_avg__doc__, -"avg(module, fragment, width)\n" +"sig=($module, fragment, width)\n" "Return the average over all samples in the fragment."); #define AUDIOOP_AVG_METHODDEF \ @@ -128,7 +128,7 @@ exit: } 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)."); #define AUDIOOP_RMS_METHODDEF \ @@ -159,7 +159,7 @@ exit: } 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."); #define AUDIOOP_FINDFIT_METHODDEF \ @@ -193,7 +193,7 @@ exit: } 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."); #define AUDIOOP_FINDFACTOR_METHODDEF \ @@ -227,7 +227,7 @@ exit: } 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."); #define AUDIOOP_FINDMAX_METHODDEF \ @@ -258,7 +258,7 @@ exit: } 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."); #define AUDIOOP_AVGPP_METHODDEF \ @@ -289,7 +289,7 @@ exit: } 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."); #define AUDIOOP_MAXPP_METHODDEF \ @@ -320,7 +320,7 @@ exit: } 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."); #define AUDIOOP_CROSS_METHODDEF \ @@ -351,7 +351,7 @@ exit: } 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."); #define AUDIOOP_MUL_METHODDEF \ @@ -383,7 +383,7 @@ exit: } 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."); #define AUDIOOP_TOMONO_METHODDEF \ @@ -416,7 +416,7 @@ exit: } 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."); #define AUDIOOP_TOSTEREO_METHODDEF \ @@ -449,7 +449,7 @@ exit: } 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."); #define AUDIOOP_ADD_METHODDEF \ @@ -484,7 +484,7 @@ exit: } 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."); #define AUDIOOP_BIAS_METHODDEF \ @@ -516,7 +516,7 @@ exit: } 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."); #define AUDIOOP_REVERSE_METHODDEF \ @@ -547,7 +547,7 @@ exit: } 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."); #define AUDIOOP_BYTESWAP_METHODDEF \ @@ -578,7 +578,7 @@ exit: } 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."); #define AUDIOOP_LIN2LIN_METHODDEF \ @@ -610,7 +610,7 @@ exit: } 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."); #define AUDIOOP_RATECV_METHODDEF \ @@ -647,7 +647,7 @@ exit: } 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."); #define AUDIOOP_LIN2ULAW_METHODDEF \ @@ -678,7 +678,7 @@ exit: } 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."); #define AUDIOOP_ULAW2LIN_METHODDEF \ @@ -709,7 +709,7 @@ exit: } 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."); #define AUDIOOP_LIN2ALAW_METHODDEF \ @@ -740,7 +740,7 @@ exit: } 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."); #define AUDIOOP_ALAW2LIN_METHODDEF \ @@ -771,7 +771,7 @@ exit: } 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."); #define AUDIOOP_LIN2ADPCM_METHODDEF \ @@ -803,7 +803,7 @@ exit: } 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."); #define AUDIOOP_ADPCM2LIN_METHODDEF \ @@ -833,4 +833,4 @@ exit: return return_value; } -/*[clinic end generated code: checksum=0d9fa2c5719e996b169f808350016cd622799562]*/ +/*[clinic end generated code: output=ee7e58cfd3d0d5a6 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/binascii.c.h b/Modules/clinic/binascii.c.h index cbafc68..e4ef36c 100644 --- a/Modules/clinic/binascii.c.h +++ b/Modules/clinic/binascii.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(binascii_a2b_uu__doc__, -"a2b_uu(module, data)\n" +"sig=($module, data)\n" "Decode a line of uuencoded data."); #define BINASCII_A2B_UU_METHODDEF \ @@ -33,7 +33,7 @@ exit: } PyDoc_STRVAR(binascii_b2a_uu__doc__, -"b2a_uu(module, data)\n" +"sig=($module, data)\n" "Uuencode line of data."); #define BINASCII_B2A_UU_METHODDEF \ @@ -63,7 +63,7 @@ exit: } PyDoc_STRVAR(binascii_a2b_base64__doc__, -"a2b_base64(module, data)\n" +"sig=($module, data)\n" "Decode a line of base64 data."); #define BINASCII_A2B_BASE64_METHODDEF \ @@ -93,7 +93,7 @@ exit: } PyDoc_STRVAR(binascii_b2a_base64__doc__, -"b2a_base64(module, data)\n" +"sig=($module, data)\n" "Base64-code line of data."); #define BINASCII_B2A_BASE64_METHODDEF \ @@ -123,7 +123,7 @@ exit: } PyDoc_STRVAR(binascii_a2b_hqx__doc__, -"a2b_hqx(module, data)\n" +"sig=($module, data)\n" "Decode .hqx coding."); #define BINASCII_A2B_HQX_METHODDEF \ @@ -153,7 +153,7 @@ exit: } PyDoc_STRVAR(binascii_rlecode_hqx__doc__, -"rlecode_hqx(module, data)\n" +"sig=($module, data)\n" "Binhex RLE-code binary data."); #define BINASCII_RLECODE_HQX_METHODDEF \ @@ -183,7 +183,7 @@ exit: } PyDoc_STRVAR(binascii_b2a_hqx__doc__, -"b2a_hqx(module, data)\n" +"sig=($module, data)\n" "Encode .hqx data."); #define BINASCII_B2A_HQX_METHODDEF \ @@ -213,7 +213,7 @@ exit: } PyDoc_STRVAR(binascii_rledecode_hqx__doc__, -"rledecode_hqx(module, data)\n" +"sig=($module, data)\n" "Decode hexbin RLE-coded string."); #define BINASCII_RLEDECODE_HQX_METHODDEF \ @@ -243,7 +243,7 @@ exit: } PyDoc_STRVAR(binascii_crc_hqx__doc__, -"crc_hqx(module, data, crc)\n" +"sig=($module, data, crc)\n" "Compute hqx CRC incrementally."); #define BINASCII_CRC_HQX_METHODDEF \ @@ -278,7 +278,7 @@ exit: } PyDoc_STRVAR(binascii_crc32__doc__, -"crc32(module, data, crc=0)\n" +"sig=($module, data, crc=0)\n" "Compute CRC-32 incrementally."); #define BINASCII_CRC32_METHODDEF \ @@ -313,7 +313,7 @@ exit: } PyDoc_STRVAR(binascii_b2a_hex__doc__, -"b2a_hex(module, data)\n" +"sig=($module, data)\n" "Hexadecimal representation of binary data.\n" "\n" "The return value is a bytes object. This function is also\n" @@ -346,7 +346,7 @@ exit: } PyDoc_STRVAR(binascii_a2b_hex__doc__, -"a2b_hex(module, hexstr)\n" +"sig=($module, hexstr)\n" "Binary data of hexadecimal representation.\n" "\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__, -"a2b_qp(module, data, header=False)\n" +"sig=($module, data, header=False)\n" "Decode a string of qp-encoded data."); #define BINASCII_A2B_QP_METHODDEF \ @@ -411,7 +411,7 @@ exit: } 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" "\n" "On encoding, when istext is set, newlines are not encoded, and white\n" @@ -447,4 +447,4 @@ exit: return return_value; } -/*[clinic end generated code: checksum=8180e5be47a110ae8c89263a7c12a91d80754f60]*/ +/*[clinic end generated code: output=831a8ccc9f984001 input=a9049054013a1b77]*/ diff --git a/Modules/clinic/zlibmodule.c.h b/Modules/clinic/zlibmodule.c.h index 0adeb01..86fd796 100644 --- a/Modules/clinic/zlibmodule.c.h +++ b/Modules/clinic/zlibmodule.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ 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" "\n" " bytes\n" @@ -39,7 +39,7 @@ exit: } 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" "\n" " data\n" @@ -78,7 +78,7 @@ exit: } 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" "\n" " level\n" @@ -132,7 +132,7 @@ exit: } 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" "\n" " wbits\n" @@ -166,7 +166,7 @@ exit: } PyDoc_STRVAR(zlib_Compress_compress__doc__, -"compress(self, data)\n" +"sig=($self, data)\n" "Returns a bytes object containing compressed data.\n" "\n" " data\n" @@ -203,7 +203,7 @@ exit: } 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" "\n" " data\n" @@ -245,7 +245,7 @@ exit: } 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" "\n" " mode\n" @@ -277,7 +277,7 @@ exit: } PyDoc_STRVAR(zlib_Compress_copy__doc__, -"copy(self)\n" +"sig=($self)\n" "Return a copy of the compression object."); #define ZLIB_COMPRESS_COPY_METHODDEF \ @@ -293,7 +293,7 @@ zlib_Compress_copy(compobject *self, PyObject *Py_UNUSED(ignored)) } PyDoc_STRVAR(zlib_Decompress_copy__doc__, -"copy(self)\n" +"sig=($self)\n" "Return a copy of the decompression object."); #define ZLIB_DECOMPRESS_COPY_METHODDEF \ @@ -309,7 +309,7 @@ zlib_Decompress_copy(compobject *self, PyObject *Py_UNUSED(ignored)) } 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" "\n" " length\n" @@ -338,7 +338,7 @@ exit: } 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" "\n" " value\n" @@ -374,7 +374,7 @@ exit: } 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" "\n" " value\n" @@ -408,4 +408,4 @@ exit: return return_value; } -/*[clinic end generated code: checksum=04f94bbaf2652717753e237e4021bf6c92ddffdd]*/ +/*[clinic end generated code: output=ad23316b49faf7e6 input=a9049054013a1b77]*/ diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 9889789..fca852d 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -184,7 +184,7 @@ corresponding Unix manual entries for more information on calls."); /*[clinic input] module os [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=8cff096d1133288f]*/ #ifndef _MSC_VER @@ -2397,7 +2397,7 @@ class dir_fd_converter(CConverter): [python start generated code]*/ -/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=d702d58a8469cc7d]*/ /*[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]*/ 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" "\n" " path\n" @@ -2481,7 +2481,7 @@ exit: static PyObject * 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); } @@ -2562,7 +2562,7 @@ Note that most operations will use the effective uid/gid, therefore this [clinic start generated code]*/ 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" "\n" " path\n" @@ -2622,7 +2622,7 @@ exit: static PyObject * 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; @@ -2718,7 +2718,7 @@ Return the name of the terminal device connected to 'fd'. [clinic start generated code]*/ PyDoc_STRVAR(os_ttyname__doc__, -"ttyname(module, fd)\n" +"sig=($module, fd)\n" "Return the name of the terminal device connected to \'fd\'.\n" "\n" " fd\n" @@ -2752,7 +2752,7 @@ exit: static char * os_ttyname_impl(PyModuleDef *module, int fd) -/*[clinic end generated code: checksum=11bbb8b7969155f54bb8a1ec35ac1ebdfd4b0fec]*/ +/*[clinic end generated code: output=c3083e665d4d11b9 input=5f72ca83e76b3b45]*/ { char *ret; diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c index ca1620f..c6c4ba2 100644 --- a/Modules/unicodedata.c +++ b/Modules/unicodedata.c @@ -21,7 +21,7 @@ module unicodedata class unicodedata.UCD 'PreviousDBVersion *' '&UCD_Type' [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=6dac153082d150bc]*/ /* character properties */ @@ -129,7 +129,7 @@ not given, ValueError is raised. [clinic start generated code]*/ 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" "\n" "Returns the decimal value assigned to the Unicode character unichr\n" @@ -161,7 +161,7 @@ exit: static PyObject * 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; long rc; diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c index a6b72bd..cde16f7 100644 --- a/Modules/zlibmodule.c +++ b/Modules/zlibmodule.c @@ -86,7 +86,7 @@ module zlib class zlib.Compress "compobject *" "&Comptype" class zlib.Decompress "compobject *" "&Decomptype" [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=bfd4c340573ba91d]*/ static compobject * newcompobject(PyTypeObject *type) @@ -148,7 +148,7 @@ Returns a bytes object containing compressed data. static PyObject * 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; Byte *input, *output = NULL; @@ -232,7 +232,7 @@ class uint_converter(CConverter): c_ignored_default = "0" [python start generated code]*/ -/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=22263855f7a3ebfd]*/ static int uint_converter(PyObject *obj, void *ptr) @@ -281,7 +281,7 @@ Returns a bytes object containing the uncompressed data. static PyObject * 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; Byte *input; @@ -411,7 +411,7 @@ Return a compressor object. static PyObject * 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; int err; @@ -483,7 +483,7 @@ Return a decompressor object. static PyObject * 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; compobject *self; @@ -571,7 +571,7 @@ Call the flush() method to clear these buffers. static PyObject * 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; unsigned int inplen; @@ -705,7 +705,7 @@ Call the flush() method to clear these buffers. static PyObject * 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; unsigned int old_length, length = DEF_BUF_SIZE; @@ -840,7 +840,7 @@ Return a bytes object containing any remaining compressed data. static PyObject * zlib_Compress_flush_impl(compobject *self, int mode) -/*[clinic end generated code: checksum=a203f4cefc9de727aa1d2ea39d11c0a16c32041a]*/ +/*[clinic end generated code: output=a203f4cefc9de727 input=6982996afe0772d8]*/ { int err; unsigned int length = DEF_BUF_SIZE, new_length; @@ -933,7 +933,7 @@ Return a copy of the compression object. static PyObject * zlib_Compress_copy_impl(compobject *self) -/*[clinic end generated code: checksum=5144aa153c21e805afa5c19e5b48cf8e6480b5da]*/ +/*[clinic end generated code: output=5144aa153c21e805 input=c656351f94b82718]*/ { compobject *retval = NULL; int err; @@ -991,7 +991,7 @@ Return a copy of the decompression object. static PyObject * zlib_Decompress_copy_impl(compobject *self) -/*[clinic end generated code: checksum=02a883a2a510c8ccfeef3f89e317a275bfe8c094]*/ +/*[clinic end generated code: output=02a883a2a510c8cc input=ba6c3e96712a596b]*/ { compobject *retval = NULL; int err; @@ -1055,7 +1055,7 @@ Return a bytes object containing any remaining decompressed data. static PyObject * 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; unsigned int new_length; @@ -1183,7 +1183,7 @@ The returned checksum is an integer. static PyObject * 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 and may lower performance */ @@ -1222,7 +1222,7 @@ The returned checksum is an integer. static PyObject * 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; diff --git a/Objects/descrobject.c b/Objects/descrobject.c index ce1c71b..181cc51 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -353,17 +353,13 @@ wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) static PyObject * method_get_doc(PyMethodDescrObject *descr, void *closure) { - const char *name = descr->d_method->ml_name; - const char *doc = descr->d_method->ml_doc; - return _PyType_GetDocFromInternalDoc(name, doc); + return _PyType_GetDocFromInternalDoc(descr->d_method->ml_doc); } static PyObject * method_get_text_signature(PyMethodDescrObject *descr, void *closure) { - const char *name = descr->d_method->ml_name; - const char *doc = descr->d_method->ml_doc; - return _PyType_GetTextSignatureFromInternalDoc(name, doc); + return _PyType_GetTextSignatureFromInternalDoc(descr->d_method->ml_doc); } static PyObject * @@ -470,17 +466,13 @@ static PyGetSetDef getset_getset[] = { static PyObject * wrapperdescr_get_doc(PyWrapperDescrObject *descr, void *closure) { - const char *name = descr->d_base->name; - const char *doc = descr->d_base->doc; - return _PyType_GetDocFromInternalDoc(name, doc); + return _PyType_GetDocFromInternalDoc(descr->d_base->doc); } static PyObject * wrapperdescr_get_text_signature(PyWrapperDescrObject *descr, void *closure) { - const char *name = descr->d_base->name; - const char *doc = descr->d_base->doc; - return _PyType_GetTextSignatureFromInternalDoc(name, doc); + return _PyType_GetTextSignatureFromInternalDoc(descr->d_base->doc); } static PyGetSetDef wrapperdescr_getset[] = { @@ -1159,17 +1151,13 @@ wrapper_name(wrapperobject *wp) static PyObject * wrapper_doc(wrapperobject *wp, void *closure) { - const char *name = wp->descr->d_base->name; - const char *doc = wp->descr->d_base->doc; - return _PyType_GetDocFromInternalDoc(name, doc); + return _PyType_GetDocFromInternalDoc(wp->descr->d_base->doc); } static PyObject * wrapper_text_signature(wrapperobject *wp, void *closure) { - const char *name = wp->descr->d_base->name; - const char *doc = wp->descr->d_base->doc; - return _PyType_GetTextSignatureFromInternalDoc(name, doc); + return _PyType_GetTextSignatureFromInternalDoc(wp->descr->d_base->doc); } static PyObject * diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 2332e3f..2673817 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -72,7 +72,7 @@ to the combined-table form. /*[clinic input] class dict "PyDictObject *" "&PyDict_Type" [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=f157a5a0ce9589d6]*/ typedef struct { /* 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]*/ 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."); #define DICT_FROMKEYS_METHODDEF \ @@ -1730,7 +1730,7 @@ exit: static PyObject * 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 *key; @@ -2209,7 +2209,7 @@ True if D has a key k, else False. [clinic start generated code]*/ PyDoc_STRVAR(dict___contains____doc__, -"__contains__(self, key)\n" +"sig=($self, key)\n" "True if D has a key k, else False."); #define DICT___CONTAINS___METHODDEF \ @@ -2217,7 +2217,7 @@ PyDoc_STRVAR(dict___contains____doc__, static PyObject * dict___contains__(PyDictObject *self, PyObject *key) -/*[clinic end generated code: checksum=744ca54369dda9815a596304087f1b37fafa5960]*/ +/*[clinic end generated code: output=c654684a6d880281 input=b852b2a19b51ab24]*/ { register PyDictObject *mp = self; Py_hash_t hash; diff --git a/Objects/methodobject.c b/Objects/methodobject.c index 227ad57..ead7443 100644 --- a/Objects/methodobject.c +++ b/Objects/methodobject.c @@ -182,17 +182,13 @@ static PyMethodDef meth_methods[] = { static PyObject * meth_get__text_signature__(PyCFunctionObject *m, void *closure) { - const char *name = m->m_ml->ml_name; - const char *doc = m->m_ml->ml_doc; - return _PyType_GetTextSignatureFromInternalDoc(name, doc); + return _PyType_GetTextSignatureFromInternalDoc(m->m_ml->ml_doc); } static PyObject * meth_get__doc__(PyCFunctionObject *m, void *closure) { - const char *name = m->m_ml->ml_name; - const char *doc = m->m_ml->ml_doc; - return _PyType_GetDocFromInternalDoc(name, doc); + return _PyType_GetDocFromInternalDoc(m->m_ml->ml_doc); } static PyObject * diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 08da4de..cbbb58a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -60,18 +60,11 @@ slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds); * otherwise returns NULL. */ static const char * -find_signature(const char *name, const char *doc) +find_signature(const char *doc) { - size_t length; - if (!doc || !name) - return NULL; - length = strlen(name); - if (strncmp(doc, name, length)) - return NULL; - doc += length; - if (*doc != '(') - return NULL; - return doc; + if (doc && !strncmp(doc, "sig=(", 5)) + return doc + 4; + return NULL; } /* @@ -94,9 +87,9 @@ skip_eols(const char *trace) } 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) return skip_eols(skip_signature(signature)); @@ -104,9 +97,9 @@ _PyType_DocWithoutSignature(const char *name, const char *internal_doc) } 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) { Py_INCREF(Py_None); @@ -117,9 +110,9 @@ _PyType_GetDocFromInternalDoc(const char *name, const char *internal_doc) } 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; if (!signature) { @@ -706,9 +699,7 @@ type_get_doc(PyTypeObject *type, void *context) { PyObject *result; if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) { - const char *name = type->tp_name; - const char *doc = type->tp_doc; - return _PyType_GetDocFromInternalDoc(name, doc); + return _PyType_GetDocFromInternalDoc(type->tp_doc); } result = _PyDict_GetItemId(type->tp_dict, &PyId___doc__); if (result == NULL) { @@ -728,9 +719,7 @@ type_get_doc(PyTypeObject *type, void *context) static PyObject * type_get_text_signature(PyTypeObject *type, void *context) { - const char *name = type->tp_name; - const char *doc = type->tp_doc; - return _PyType_GetTextSignatureFromInternalDoc(name, doc); + return _PyType_GetTextSignatureFromInternalDoc(type->tp_doc); } static int @@ -2608,7 +2597,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases) /* need to make a copy of the docstring slot, which usually points to a static string literal */ 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; char *tp_doc = PyObject_MALLOC(len); if (tp_doc == NULL) { @@ -3000,7 +2989,7 @@ static PyMethodDef type_methods[] = { PyDoc_STRVAR(type_doc, /* 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(name, bases, dict) -> a new type"); @@ -4196,7 +4185,7 @@ PyTypeObject PyBaseObject_Type = { PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ 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_clear */ object_richcompare, /* tp_richcompare */ @@ -4663,7 +4652,7 @@ PyType_Ready(PyTypeObject *type) */ if (_PyDict_GetItemId(type->tp_dict, &PyId___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); if (doc == NULL) goto error; @@ -5325,8 +5314,9 @@ tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds) static struct PyMethodDef tp_new_methoddef[] = { {"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS, - PyDoc_STR("T.__new__(S, ...) -> " - "a new object with type S, a subtype of T")}, + PyDoc_STR("sig=($type, *args, **kwargs)\n" + "Create and return a new object. " + "See help(type) for accurate signature.")}, {0} }; @@ -6098,22 +6088,22 @@ typedef struct wrapperbase slotdef; ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, DOC) #define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \ - NAME "(self)\n" DOC) + "sig=($self)\n" DOC) #define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ 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) \ 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) \ 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) \ 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) \ ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \ - NAME "(self, value)\n" DOC) + "sig=($self, value)\n" DOC) static slotdef slotdefs[] = { TPSLOT("__getattribute__", tp_getattr, NULL, NULL, ""), @@ -6121,52 +6111,52 @@ static slotdef slotdefs[] = { TPSLOT("__setattr__", tp_setattr, NULL, NULL, ""), TPSLOT("__delattr__", tp_setattr, NULL, NULL, ""), 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, - "__hash__(self)\nReturns hash(self)."), + "sig=($self)\nReturn hash(self)."), 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), 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, 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("__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, - "__delattr__(self, name)\nImplements delattr(self, name)."), + "sig=($self, name)\nImplement delattr(self, name)."), TPSLOT("__lt__", tp_richcompare, slot_tp_richcompare, richcmp_lt, - "__lt__(self, value)\nReturns selfvalue."), + "sig=($self, value)\nReturn self>value."), 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, - "__iter__(self)\nImplements iter(self)."), + "sig=($self)\nImplement iter(self)."), 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, - "__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, - "__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, 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, - "__init__(self, *args, **kwargs)\n" - "Initializes self. See help(type(self)) for accurate signature.", + "sig=($self, *args, **kwargs)\n" + "Initialize self. See help(type(self)) for accurate signature.", PyWrapperFlag_KEYWORDS), TPSLOT("__new__", tp_new, slot_tp_new, NULL, - "__new__(cls, *args, **kwargs)\n" - "Creates new object. See help(cls) for accurate signature."), + "sig=(type, *args, **kwargs)\n" + "Create and return new object. See help(type) for accurate signature."), TPSLOT("__del__", tp_finalize, slot_tp_finalize, (wrapperfunc)wrap_del, ""), BINSLOT("__add__", nb_add, slot_nb_add, @@ -6186,13 +6176,13 @@ static slotdef slotdefs[] = { RBINSLOT("__rmod__", nb_remainder, slot_nb_remainder, "%"), 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, - "__rdivmod__(self, value)\nReturns divmod(value, self)."), + "Return divmod(value, self)."), 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, - "__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("__pos__", nb_positive, slot_nb_positive, wrap_unaryfunc, "+self"), UNSLOT("__abs__", nb_absolute, slot_nb_absolute, wrap_unaryfunc, @@ -6243,48 +6233,48 @@ static slotdef slotdefs[] = { IBSLOT("__itruediv__", nb_inplace_true_divide, slot_nb_inplace_true_divide, wrap_binaryfunc, "/"), NBSLOT("__index__", nb_index, slot_nb_index, wrap_unaryfunc, - "__index__(self)\n" - "Returns self converted to an integer, if self is suitable" + "sig=($self)\n" + "Return self converted to an integer, if self is suitable" "for use as an index into a list."), 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, wrap_binaryfunc, - "__getitem__(self, key)\nReturns self[key]."), + "sig=($self, key)\nReturn self[key]."), MPSLOT("__setitem__", mp_ass_subscript, slot_mp_ass_subscript, 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, wrap_delitem, - "__delitem__(key)\nDeletes self[key]."), + "sig=(key)\nDelete self[key]."), 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. 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 user-defined methods has unexpected side-effects, as shown by test_descr.notimplemented() */ 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, - "__mul__(self, value)\nReturns self*value.n"), + "sig=($self, value)\nReturn self*value.n"), 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, - "__getitem__(self, key)\nReturns self[key]."), + "sig=($self, key)\nReturn self[key]."), 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, - "__delitem__(self, key)\nDeletes self[key]."), + "sig=($self, key)\nDelete self[key]."), 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, wrap_binaryfunc, - "__iadd__(self, value)\nImplements self+=value."), + "sig=($self, value)\nImplement self+=value."), SQSLOT("__imul__", sq_inplace_repeat, NULL, wrap_indexargfunc, - "__imul__(self, value)\nImplements self*=value."), + "sig=($self, value)\nImplement self*=value."), {NULL} }; diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 919b733..02359e5 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -50,7 +50,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. /*[clinic input] class str "PyUnicodeObject *" "&PyUnicode_Type" [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=604e916854800fa8]*/ /* --- Globals ------------------------------------------------------------ @@ -12885,7 +12885,7 @@ must be a string, whose characters will be mapped to None in the result. [clinic start generated code]*/ PyDoc_STRVAR(unicode_maketrans__doc__, -"maketrans(x, y=None, z=None)\n" +"sig=(x, y=None, z=None)\n" "Return a translation table usable for str.translate().\n" "\n" "If there is only one argument, it must be a dictionary mapping Unicode\n" @@ -12922,7 +12922,7 @@ exit: static PyObject * 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; Py_ssize_t i = 0; diff --git a/Python/import.c b/Python/import.c index ae8ff5e..2fd9b44 100644 --- a/Python/import.c +++ b/Python/import.c @@ -34,7 +34,7 @@ static PyObject *initstr = NULL; /*[clinic input] module _imp [clinic start generated code]*/ -/*[clinic end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[clinic end generated code: output=da39a3ee5e6b4b0d input=9c332475d8686284]*/ /*[python input] class fs_unicode_converter(CConverter): @@ -42,7 +42,7 @@ class fs_unicode_converter(CConverter): converter = 'PyUnicode_FSDecoder' [python start generated code]*/ -/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/ +/*[python end generated code: output=da39a3ee5e6b4b0d input=9d6786230166006e]*/ /* Initialize things */ @@ -232,7 +232,7 @@ On platforms without threads, return False. [clinic start generated code]*/ 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" "\n" "On platforms without threads, return False."); @@ -251,7 +251,7 @@ _imp_lock_held(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) static PyObject * _imp_lock_held_impl(PyModuleDef *module) -/*[clinic end generated code: checksum=17172a9917d389dd1564e2108fec34d23aecb6c2]*/ +/*[clinic end generated code: output=5ce46d12a8e4c469 input=9b088f9b217d9bdf]*/ { #ifdef WITH_THREAD return PyBool_FromLong(import_lock_thread != -1); @@ -270,7 +270,7 @@ modules. On platforms without threads, this function does nothing. [clinic start generated code]*/ PyDoc_STRVAR(_imp_acquire_lock__doc__, -"acquire_lock(module)\n" +"sig=($module)\n" "Acquires the interpreter\'s import lock for the current thread.\n" "\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 * _imp_acquire_lock_impl(PyModuleDef *module) -/*[clinic end generated code: checksum=20db30e18f6b8758386fe06907edb3f8e43080d7]*/ +/*[clinic end generated code: output=b0dd6a132ad25961 input=4a2d4381866d5fdc]*/ { #ifdef WITH_THREAD _PyImport_AcquireLock(); @@ -308,7 +308,7 @@ On platforms without threads, this function does nothing. [clinic start generated code]*/ PyDoc_STRVAR(_imp_release_lock__doc__, -"release_lock(module)\n" +"sig=($module)\n" "Release the interpreter\'s import lock.\n" "\n" "On platforms without threads, this function does nothing."); @@ -327,7 +327,7 @@ _imp_release_lock(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) static PyObject * _imp_release_lock_impl(PyModuleDef *module) -/*[clinic end generated code: checksum=17749fd7752d2c392447a1f83c5d371f54d7ebd3]*/ +/*[clinic end generated code: output=b1e6e9d723cf5f89 input=934fb11516dd778b]*/ { #ifdef WITH_THREAD if (_PyImport_ReleaseLock() < 0) { @@ -927,7 +927,7 @@ Changes code.co_filename to specify the passed-in file path. [clinic start generated code]*/ 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" "\n" " code\n" @@ -960,7 +960,7 @@ exit: static PyObject * _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); @@ -1823,7 +1823,7 @@ Returns the list of file suffixes used to identify extension modules. [clinic start generated code]*/ PyDoc_STRVAR(_imp_extension_suffixes__doc__, -"extension_suffixes(module)\n" +"sig=($module)\n" "Returns the list of file suffixes used to identify extension modules."); #define _IMP_EXTENSION_SUFFIXES_METHODDEF \ @@ -1840,7 +1840,7 @@ _imp_extension_suffixes(PyModuleDef *module, PyObject *Py_UNUSED(ignored)) static PyObject * _imp_extension_suffixes_impl(PyModuleDef *module) -/*[clinic end generated code: checksum=625c8f11a5bbd4b85373f0a54f7f3ef19c55beb4]*/ +/*[clinic end generated code: output=c1bcfbddabefa00a input=ecdeeecfcb6f839e]*/ { PyObject *list; const char *suffix; @@ -1878,7 +1878,7 @@ Initializes a built-in module. [clinic start generated code]*/ PyDoc_STRVAR(_imp_init_builtin__doc__, -"init_builtin(module, name)\n" +"sig=($module, name)\n" "Initializes a built-in module."); #define _IMP_INIT_BUILTIN_METHODDEF \ @@ -1905,7 +1905,7 @@ exit: static PyObject * _imp_init_builtin_impl(PyModuleDef *module, PyObject *name) -/*[clinic end generated code: checksum=a4e4805a523757cd3ddfeec6e5b16740678fed6a]*/ +/*[clinic end generated code: output=02437efd4668f53e input=f934d2231ec52a2e]*/ { int ret; PyObject *m; @@ -1932,7 +1932,7 @@ Initializes a frozen module. [clinic start generated code]*/ PyDoc_STRVAR(_imp_init_frozen__doc__, -"init_frozen(module, name)\n" +"sig=($module, name)\n" "Initializes a frozen module."); #define _IMP_INIT_FROZEN_METHODDEF \ @@ -1959,7 +1959,7 @@ exit: static PyObject * _imp_init_frozen_impl(PyModuleDef *module, PyObject *name) -/*[clinic end generated code: checksum=2a58c119dd3e121cf5a9924f936cfd7b40253c12]*/ +/*[clinic end generated code: output=20cea421af513afe input=13019adfc04f3fb3]*/ { int ret; PyObject *m; @@ -1986,7 +1986,7 @@ Create a code object for a frozen module. [clinic start generated code]*/ 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."); #define _IMP_GET_FROZEN_OBJECT_METHODDEF \ @@ -2013,7 +2013,7 @@ exit: static PyObject * _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); } @@ -2028,7 +2028,7 @@ Returns True if the module name is of a frozen package. [clinic start generated code]*/ 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."); #define _IMP_IS_FROZEN_PACKAGE_METHODDEF \ @@ -2055,7 +2055,7 @@ exit: static PyObject * _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); } @@ -2070,7 +2070,7 @@ Returns True if the module name corresponds to a built-in module. [clinic start generated code]*/ 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."); #define _IMP_IS_BUILTIN_METHODDEF \ @@ -2097,7 +2097,7 @@ exit: static PyObject * _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)); } @@ -2112,7 +2112,7 @@ Returns True if the module name corresponds to a frozen module. [clinic start generated code]*/ 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."); #define _IMP_IS_FROZEN_METHODDEF \ @@ -2139,7 +2139,7 @@ exit: static PyObject * _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; @@ -2161,7 +2161,7 @@ Loads an extension module. [clinic start generated code]*/ 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."); #define _IMP_LOAD_DYNAMIC_METHODDEF \ @@ -2190,7 +2190,7 @@ exit: static PyObject * _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; FILE *fp; diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index f3fe3c1..a68551f 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -19,6 +19,7 @@ import os import pprint import re import shlex +import string import sys import tempfile import textwrap @@ -98,7 +99,7 @@ def warn_or_fail(fail=False, *args, filename=None, line_number=None): if clinic: if filename is None: 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 if filename is not None: add(' in file "' + filename + '"') @@ -335,6 +336,22 @@ class CRenderData: 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): start_line = "" @@ -347,18 +364,59 @@ class Language(metaclass=abc.ABCMeta): pass def validate(self): - def assert_only_one(field, token='dsl_name'): - line = getattr(self, field) - token = '{' + token + '}' - if len(line.split(token)) != 2: - fail(self.__class__.__name__ + " " + field + " must contain " + token + " exactly once!") + def assert_only_one(attr, *additional_fields): + """ + Ensures that the string found at getattr(self, attr) + contains exactly one formatter replacement string for + 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('stop_line') - assert_only_one('checksum_line') - assert_only_one('checksum_line', 'checksum') - if len(self.body_prefix.split('{dsl_name}')) >= 3: - fail(self.__class__.__name__ + " body_prefix may contain " + token + " once at most!") + field = "arguments" if "{arguments}" in self.checksum_line else "checksum" + assert_only_one('checksum_line', field) @@ -368,7 +426,7 @@ class PythonLanguage(Language): start_line = "#/*[{dsl_name} input]" body_prefix = "#" 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): @@ -438,7 +496,7 @@ class CLanguage(Language): start_line = "/*[{dsl_name} input]" body_prefix = "" 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): function = None @@ -1103,10 +1161,12 @@ def OverrideStdioWith(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.""" - pattern = r'^{}(\w+){}$' - return re.compile(pattern.format(re.escape(before), re.escape(after))) + group_re = "\w+" if word else ".+" + pattern = r'^{}({}){}$' + pattern = pattern.format(re.escape(before), group_re, re.escape(after)) + return re.compile(pattern) class Block: @@ -1164,6 +1224,16 @@ class Block: self.indent = indent 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(( + "")) + class BlockParser: """ @@ -1264,29 +1334,43 @@ class BlockParser: if self.last_dsl_name == dsl_name: checksum_re = self.last_checksum_re else: - before, _, after = self.language.checksum_line.format(dsl_name=dsl_name, checksum='{checksum}').partition('{checksum}') - assert _ == '{checksum}' - checksum_re = create_regex(before, after) + before, _, after = self.language.checksum_line.format(dsl_name=dsl_name, arguments='{arguments}').partition('{arguments}') + assert _ == '{arguments}' + checksum_re = create_regex(before, after, word=False) self.last_dsl_name = dsl_name self.last_checksum_re = checksum_re # scan forward for checksum line output_add, output_output = text_accumulator() - checksum = None + arguments = None while self.input: line = self._line() match = checksum_re.match(line.lstrip()) - checksum = match.group(1) if match else None - if checksum: + arguments = match.group(1) if match else None + if arguments: break output_add(line) if self.is_start_line(line): break 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: - 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: fail("Checksum mismatch!\nExpected: {}\nComputed: {}\n" "Suggested fix: remove all generated code including " @@ -1336,13 +1420,15 @@ class BlockPrinter: write(self.language.stop_line.format(dsl_name=dsl_name)) write("\n") + input = ''.join(block.input) output = ''.join(block.output) if output: if not output.endswith('\n'): output += '\n' 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") 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. # (instantiated from the "parsers" global.) self.parsers = {} @@ -1477,6 +1563,7 @@ impl_definition block fail("Custom printers are broken right now") self.printer = printer or BlockPrinter(language) self.verify = verify + self.force = force self.filename = filename self.modules = collections.OrderedDict() self.classes = collections.OrderedDict() @@ -1594,11 +1681,12 @@ impl_definition block fail("Can't write to destination {}, " "can't make directory {}!".format( destination.filename, dirname)) - with open(destination.filename, "rt") as f: - parser_2 = BlockParser(f.read(), language=self.language) - blocks = list(parser_2) - if (len(blocks) != 1) or (blocks[0].input != 'preserve\n'): - fail("Modified destination file " + repr(destination.filename) + ", not overwriting!") + if self.verify: + with open(destination.filename, "rt") as f: + parser_2 = BlockParser(f.read(), language=self.language) + blocks = list(parser_2) + if (len(blocks) != 1) or (blocks[0].input != 'preserve\n'): + fail("Modified destination file " + repr(destination.filename) + ", not overwriting!") except FileNotFoundError: pass @@ -1658,7 +1746,7 @@ impl_definition block 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:] if not extension: 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: 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: raw = f.read() cooked = clinic.parse(raw) - if cooked == raw: + if (cooked == raw) and not force: return 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) -def compute_checksum(input): +def compute_checksum(input, length=None): 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, full_name=None, 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.return_annotation = return_annotation self.name = name @@ -1840,6 +1932,7 @@ class Function: self.kind = kind self.coexist = coexist self.self_converter = None + self.suppress_signature = suppress_signature @property def methoddef_flags(self): @@ -3520,6 +3613,7 @@ class DSLParser: else: fail("Function " + self.function.name + " has an unsupported group configuration. (Unexpected state " + str(self.parameter_state) + ".b)") self.group += 1 + self.function.suppress_signature = True elif symbol == ']': if not self.group: fail("Function " + self.function.name + " has a ] without a matching [.") @@ -3615,11 +3709,14 @@ class DSLParser: ## docstring first line ## - if new_or_init: - assert f.cls - add(f.cls.name) + if not f.suppress_signature: + add('sig=') else: - add(f.name) + if new_or_init: + assert f.cls + add(f.cls.name) + else: + add(f.name) add('(') # populate "right_bracket_count" field for every parameter @@ -3673,7 +3770,17 @@ class DSLParser: add_comma = True 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(): a.append('=') value = p.converter.py_default @@ -3915,7 +4022,7 @@ def main(argv): path = os.path.join(root, filename) if ns.verbose: print(path) - parse_file(path, verify=not ns.force) + parse_file(path, force=ns.force, verify=not ns.force) return if not ns.filename: @@ -3931,7 +4038,7 @@ def main(argv): for filename in ns.filename: if ns.verbose: 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__": -- cgit v0.12