summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/tools/python3/Modules')
-rw-r--r--contrib/tools/python3/Modules/_abc.c8
-rw-r--r--contrib/tools/python3/Modules/_asynciomodule.c31
-rw-r--r--contrib/tools/python3/Modules/_bisectmodule.c12
-rw-r--r--contrib/tools/python3/Modules/_bz2module.c42
-rw-r--r--contrib/tools/python3/Modules/_codecsmodule.c42
-rw-r--r--contrib/tools/python3/Modules/_collectionsmodule.c10
-rw-r--r--contrib/tools/python3/Modules/_csv.c6
-rw-r--r--contrib/tools/python3/Modules/_ctypes/_ctypes.c2
-rw-r--r--contrib/tools/python3/Modules/_datetimemodule.c6
-rw-r--r--contrib/tools/python3/Modules/_elementtree.c57
-rw-r--r--contrib/tools/python3/Modules/_functoolsmodule.c3
-rw-r--r--contrib/tools/python3/Modules/_hashopenssl.c12
-rw-r--r--contrib/tools/python3/Modules/_interpchannelsmodule.c4
-rw-r--r--contrib/tools/python3/Modules/_interpqueuesmodule.c1
-rw-r--r--contrib/tools/python3/Modules/_io/_iomodule.c88
-rw-r--r--contrib/tools/python3/Modules/_io/bytesio.c12
-rw-r--r--contrib/tools/python3/Modules/_io/clinic/_iomodule.c.h86
-rw-r--r--contrib/tools/python3/Modules/_io/clinic/bytesio.c.h10
-rw-r--r--contrib/tools/python3/Modules/_io/clinic/fileio.c.h53
-rw-r--r--contrib/tools/python3/Modules/_io/clinic/iobase.c.h16
-rw-r--r--contrib/tools/python3/Modules/_io/clinic/stringio.c.h5
-rw-r--r--contrib/tools/python3/Modules/_io/clinic/textio.c.h15
-rw-r--r--contrib/tools/python3/Modules/_io/clinic/winconsoleio.c.h8
-rw-r--r--contrib/tools/python3/Modules/_io/fileio.c63
-rw-r--r--contrib/tools/python3/Modules/_io/iobase.c18
-rw-r--r--contrib/tools/python3/Modules/_io/stringio.c5
-rw-r--r--contrib/tools/python3/Modules/_io/textio.c20
-rw-r--r--contrib/tools/python3/Modules/_io/winconsoleio.c11
-rw-r--r--contrib/tools/python3/Modules/_json.c32
-rw-r--r--contrib/tools/python3/Modules/_lzmamodule.c24
-rw-r--r--contrib/tools/python3/Modules/_multiprocessing/clinic/posixshmem.c.h8
-rw-r--r--contrib/tools/python3/Modules/_multiprocessing/posixshmem.c8
-rw-r--r--contrib/tools/python3/Modules/_opcode.c3
-rw-r--r--contrib/tools/python3/Modules/_posixsubprocess.c16
-rw-r--r--contrib/tools/python3/Modules/_queuemodule.c20
-rw-r--r--contrib/tools/python3/Modules/_sqlite/blob.c39
-rw-r--r--contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h19
-rw-r--r--contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h41
-rw-r--r--contrib/tools/python3/Modules/_sqlite/connection.c96
-rw-r--r--contrib/tools/python3/Modules/_sqlite/ya.make4
-rw-r--r--contrib/tools/python3/Modules/_sre/sre.c4
-rw-r--r--contrib/tools/python3/Modules/_ssl.c79
-rw-r--r--contrib/tools/python3/Modules/_struct.c25
-rw-r--r--contrib/tools/python3/Modules/_testlimitedcapi/clinic/long.c.h6
-rw-r--r--contrib/tools/python3/Modules/_testlimitedcapi/long.c6
-rw-r--r--contrib/tools/python3/Modules/_testlimitedcapi/parts.h1
-rw-r--r--contrib/tools/python3/Modules/_testlimitedcapi/weakref.c78
-rw-r--r--contrib/tools/python3/Modules/_winapi.c5
-rw-r--r--contrib/tools/python3/Modules/arraymodule.c42
-rw-r--r--contrib/tools/python3/Modules/binascii.c8
-rw-r--r--contrib/tools/python3/Modules/cjkcodecs/clinic/multibytecodec.c.h18
-rw-r--r--contrib/tools/python3/Modules/cjkcodecs/multibytecodec.c20
-rw-r--r--contrib/tools/python3/Modules/clinic/_abc.c.h8
-rw-r--r--contrib/tools/python3/Modules/clinic/_asynciomodule.c.h19
-rw-r--r--contrib/tools/python3/Modules/clinic/_bisectmodule.c.h10
-rw-r--r--contrib/tools/python3/Modules/clinic/_bz2module.c.h23
-rw-r--r--contrib/tools/python3/Modules/clinic/_codecsmodule.c.h34
-rw-r--r--contrib/tools/python3/Modules/clinic/_curses_panel.c.h8
-rw-r--r--contrib/tools/python3/Modules/clinic/_cursesmodule.c.h282
-rw-r--r--contrib/tools/python3/Modules/clinic/_datetimemodule.c.h6
-rw-r--r--contrib/tools/python3/Modules/clinic/_dbmmodule.c.h5
-rw-r--r--contrib/tools/python3/Modules/clinic/_gdbmmodule.c.h18
-rw-r--r--contrib/tools/python3/Modules/clinic/_hashopenssl.c.h10
-rw-r--r--contrib/tools/python3/Modules/clinic/_lzmamodule.c.h23
-rw-r--r--contrib/tools/python3/Modules/clinic/_posixsubprocess.c.h16
-rw-r--r--contrib/tools/python3/Modules/clinic/_queuemodule.c.h16
-rw-r--r--contrib/tools/python3/Modules/clinic/_ssl.c.h49
-rw-r--r--contrib/tools/python3/Modules/clinic/_testmultiphase.c.h6
-rw-r--r--contrib/tools/python3/Modules/clinic/_tkinter.c.h5
-rw-r--r--contrib/tools/python3/Modules/clinic/arraymodule.c.h23
-rw-r--r--contrib/tools/python3/Modules/clinic/cmathmodule.c.h14
-rw-r--r--contrib/tools/python3/Modules/clinic/gcmodule.c.h13
-rw-r--r--contrib/tools/python3/Modules/clinic/itertoolsmodule.c.h6
-rw-r--r--contrib/tools/python3/Modules/clinic/mathmodule.c.h11
-rw-r--r--contrib/tools/python3/Modules/clinic/overlapped.c.h7
-rw-r--r--contrib/tools/python3/Modules/clinic/pyexpat.c.h177
-rw-r--r--contrib/tools/python3/Modules/clinic/selectmodule.c.h35
-rw-r--r--contrib/tools/python3/Modules/clinic/signalmodule.c.h17
-rw-r--r--contrib/tools/python3/Modules/clinic/termios.c.h5
-rw-r--r--contrib/tools/python3/Modules/clinic/zlibmodule.c.h27
-rw-r--r--contrib/tools/python3/Modules/cmathmodule.c16
-rw-r--r--contrib/tools/python3/Modules/faulthandler.c15
-rw-r--r--contrib/tools/python3/Modules/gcmodule.c15
-rw-r--r--contrib/tools/python3/Modules/itertoolsmodule.c12
-rw-r--r--contrib/tools/python3/Modules/main.c1
-rw-r--r--contrib/tools/python3/Modules/mathmodule.c13
-rw-r--r--contrib/tools/python3/Modules/overlapped.c12
-rw-r--r--contrib/tools/python3/Modules/posixmodule.c2
-rw-r--r--contrib/tools/python3/Modules/pyexpat.c134
-rw-r--r--contrib/tools/python3/Modules/selectmodule.c45
-rw-r--r--contrib/tools/python3/Modules/signalmodule.c21
-rw-r--r--contrib/tools/python3/Modules/socketmodule.c3
-rw-r--r--contrib/tools/python3/Modules/termios.c5
-rw-r--r--contrib/tools/python3/Modules/unicodedata.c175
-rw-r--r--contrib/tools/python3/Modules/zlibmodule.c30
95 files changed, 1626 insertions, 994 deletions
diff --git a/contrib/tools/python3/Modules/_abc.c b/contrib/tools/python3/Modules/_abc.c
index 4f4b24b035d..baffb80ffe6 100644
--- a/contrib/tools/python3/Modules/_abc.c
+++ b/contrib/tools/python3/Modules/_abc.c
@@ -907,14 +907,14 @@ _abc.get_cache_token
Returns the current ABC cache token.
-The token is an opaque object (supporting equality testing) identifying the
-current version of the ABC cache for virtual subclasses. The token changes
-with every call to register() on any ABC.
+The token is an opaque object (supporting equality testing) identifying
+the current version of the ABC cache for virtual subclasses. The token
+changes with every call to register() on any ABC.
[clinic start generated code]*/
static PyObject *
_abc_get_cache_token_impl(PyObject *module)
-/*[clinic end generated code: output=c7d87841e033dacc input=70413d1c423ad9f9]*/
+/*[clinic end generated code: output=c7d87841e033dacc input=d87acc04492f6bf3]*/
{
_abcmodule_state *state = get_abc_state(module);
return PyLong_FromUnsignedLongLong(get_invalidation_counter(state));
diff --git a/contrib/tools/python3/Modules/_asynciomodule.c b/contrib/tools/python3/Modules/_asynciomodule.c
index 0ed899f5a7c..857cb06d013 100644
--- a/contrib/tools/python3/Modules/_asynciomodule.c
+++ b/contrib/tools/python3/Modules/_asynciomodule.c
@@ -781,12 +781,13 @@ Return the result this future represents.
If the future has been cancelled, raises CancelledError. If the
future's result isn't yet available, raises InvalidStateError. If
-the future is done and has an exception set, this exception is raised.
+the future is done and has an exception set, this exception is
+raised.
[clinic start generated code]*/
static PyObject *
_asyncio_Future_result_impl(FutureObj *self)
-/*[clinic end generated code: output=f35f940936a4b1e5 input=49ecf9cf5ec50dc5]*/
+/*[clinic end generated code: output=f35f940936a4b1e5 input=c7361d75834bb8cd]*/
{
asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
PyObject *result;
@@ -917,15 +918,15 @@ _asyncio.Future.add_done_callback
Add a callback to be run when the future becomes done.
-The callback is called with a single argument - the future object. If
-the future is already done when this is called, the callback is
+The callback is called with a single argument - the future object.
+If the future is already done when this is called, the callback is
scheduled with call_soon.
[clinic start generated code]*/
static PyObject *
_asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls,
PyObject *fn, PyObject *context)
-/*[clinic end generated code: output=922e9a4cbd601167 input=599261c521458cc2]*/
+/*[clinic end generated code: output=922e9a4cbd601167 input=1b96105434e0a562]*/
{
asyncio_state *state = get_asyncio_state_by_cls(cls);
if (context == NULL) {
@@ -1072,15 +1073,15 @@ _asyncio.Future.cancel
Cancel the future and schedule callbacks.
-If the future is already done or cancelled, return False. Otherwise,
-change the future's state to cancelled, schedule the callbacks and
-return True.
+If the future is already done or cancelled, return False.
+Otherwise, change the future's state to cancelled, schedule the
+callbacks and return True.
[clinic start generated code]*/
static PyObject *
_asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls,
PyObject *msg)
-/*[clinic end generated code: output=074956f35904b034 input=bba8f8b786941a94]*/
+/*[clinic end generated code: output=074956f35904b034 input=4aefb2a5726ba0f5]*/
{
asyncio_state *state = get_asyncio_state_by_cls(cls);
ENSURE_FUTURE_ALIVE(state, self)
@@ -1110,13 +1111,13 @@ _asyncio.Future.done
Return True if the future is done.
-Done means either that a result / exception are available, or that the
-future was cancelled.
+Done means either that a result / exception are available, or that
+the future was cancelled.
[clinic start generated code]*/
static PyObject *
_asyncio_Future_done_impl(FutureObj *self)
-/*[clinic end generated code: output=244c5ac351145096 input=28d7b23fdb65d2ac]*/
+/*[clinic end generated code: output=244c5ac351145096 input=afad8c9d2283428d]*/
{
if (!future_is_alive(self) || self->fut_state == STATE_PENDING) {
Py_RETURN_FALSE;
@@ -1439,7 +1440,8 @@ static PyMethodDef FutureType_methods[] = {
_ASYNCIO_FUTURE_DONE_METHODDEF
_ASYNCIO_FUTURE_GET_LOOP_METHODDEF
_ASYNCIO_FUTURE__MAKE_CANCELLED_ERROR_METHODDEF
- {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
+ PyDoc_STR("Futures are generic over the type of their results")},
{NULL, NULL} /* Sentinel */
};
@@ -2611,7 +2613,8 @@ static PyMethodDef TaskType_methods[] = {
_ASYNCIO_TASK_SET_NAME_METHODDEF
_ASYNCIO_TASK_GET_CORO_METHODDEF
_ASYNCIO_TASK_GET_CONTEXT_METHODDEF
- {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
+ PyDoc_STR("Tasks are generic over the return type of their wrapped coroutines")},
{NULL, NULL} /* Sentinel */
};
diff --git a/contrib/tools/python3/Modules/_bisectmodule.c b/contrib/tools/python3/Modules/_bisectmodule.c
index 9b146265445..16fc5b6a919 100644
--- a/contrib/tools/python3/Modules/_bisectmodule.c
+++ b/contrib/tools/python3/Modules/_bisectmodule.c
@@ -161,8 +161,8 @@ _bisect.bisect_right -> Py_ssize_t
Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e <= x, and all e in
-a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will
-insert just after the rightmost x already there.
+a[i:] have e > x. So if x already appears in the list, a.insert(i, x)
+will insert just after the rightmost x already there.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
@@ -173,7 +173,7 @@ A custom key function can be supplied to customize the sort order.
static Py_ssize_t
_bisect_bisect_right_impl(PyObject *module, PyObject *a, PyObject *x,
Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
-/*[clinic end generated code: output=3a4bc09cc7c8a73d input=43071869772dd53a]*/
+/*[clinic end generated code: output=3a4bc09cc7c8a73d input=b8951a7bb11516e1]*/
{
return internal_bisect_right(a, x, lo, hi, key);
}
@@ -346,8 +346,8 @@ _bisect.bisect_left -> Py_ssize_t
Return the index where to insert item x in list a, assuming a is sorted.
The return value i is such that all e in a[:i] have e < x, and all e in
-a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will
-insert just before the leftmost x already there.
+a[i:] have e >= x. So if x already appears in the list, a.insert(i, x)
+will insert just before the leftmost x already there.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
@@ -358,7 +358,7 @@ A custom key function can be supplied to customize the sort order.
static Py_ssize_t
_bisect_bisect_left_impl(PyObject *module, PyObject *a, PyObject *x,
Py_ssize_t lo, Py_ssize_t hi, PyObject *key)
-/*[clinic end generated code: output=70749d6e5cae9284 input=f29c4fe7f9b797c7]*/
+/*[clinic end generated code: output=70749d6e5cae9284 input=d24dc2b6439000f7]*/
{
return internal_bisect_left(a, x, lo, hi, key);
}
diff --git a/contrib/tools/python3/Modules/_bz2module.c b/contrib/tools/python3/Modules/_bz2module.c
index 661847ad267..dc536835acd 100644
--- a/contrib/tools/python3/Modules/_bz2module.c
+++ b/contrib/tools/python3/Modules/_bz2module.c
@@ -116,6 +116,7 @@ typedef struct {
typedef struct {
PyObject_HEAD
bz_stream bzs;
+ int bzerror;
char eof; /* Py_T_BOOL expects a char */
PyObject *unused_data;
char needs_input;
@@ -455,8 +456,11 @@ decompress_buf(BZ2Decompressor *d, Py_ssize_t max_length)
d->bzs_avail_in_real += bzs->avail_in;
- if (catch_bz2_error(bzret))
+ if (catch_bz2_error(bzret)) {
+ d->bzerror = bzret;
+ d->needs_input = 0;
goto error;
+ }
if (bzret == BZ_STREAM_END) {
d->eof = 1;
break;
@@ -589,6 +593,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len, Py_ssize_t max_length)
return result;
error:
+ bzs->next_in = NULL;
Py_XDECREF(result);
return NULL;
}
@@ -601,32 +606,40 @@ _bz2.BZ2Decompressor.decompress
Decompress *data*, returning uncompressed data as bytes.
-If *max_length* is nonnegative, returns at most *max_length* bytes of
-decompressed data. If this limit is reached and further output can be
-produced, *self.needs_input* will be set to ``False``. In this case, the next
-call to *decompress()* may provide *data* as b'' to obtain more of the output.
+If *max_length* is nonnegative, returns at most *max_length* bytes
+of decompressed data. If this limit is reached and further output
+can be produced, *self.needs_input* will be set to ``False``. In
+this case, the next call to *decompress()* may provide *data* as b''
+to obtain more of the output.
-If all of the input data was decompressed and returned (either because this
-was less than *max_length* bytes, or because *max_length* was negative),
-*self.needs_input* will be set to True.
+If all of the input data was decompressed and returned (either
+because this was less than *max_length* bytes, or because
+*max_length* was negative), *self.needs_input* will be set to True.
-Attempting to decompress data after the end of stream is reached raises an
-EOFError. Any data found after the end of the stream is ignored and saved in
-the unused_data attribute.
+Attempting to decompress data after the end of stream is reached
+raises an EOFError. Any data found after the end of the stream is
+ignored and saved in the unused_data attribute.
[clinic start generated code]*/
static PyObject *
_bz2_BZ2Decompressor_decompress_impl(BZ2Decompressor *self, Py_buffer *data,
Py_ssize_t max_length)
-/*[clinic end generated code: output=23e41045deb240a3 input=52e1ffc66a8ea624]*/
+/*[clinic end generated code: output=23e41045deb240a3 input=7f68faa9ff7a1b51]*/
{
PyObject *result = NULL;
ACQUIRE_LOCK(self);
- if (self->eof)
+ if (self->eof) {
PyErr_SetString(PyExc_EOFError, "End of stream already reached");
- else
+ }
+ else if (self->bzerror) {
+ // Re-entering BZ2_bzDecompress() after an error can write out of bounds.
+ PyErr_SetString(PyExc_ValueError,
+ "Decompressor is unusable after a previous error");
+ }
+ else {
result = decompress(self, data->buf, data->len, max_length);
+ }
RELEASE_LOCK(self);
return result;
}
@@ -660,6 +673,7 @@ _bz2_BZ2Decompressor_impl(PyTypeObject *type)
return NULL;
}
+ self->bzerror = 0;
self->needs_input = 1;
self->bzs_avail_in_real = 0;
self->input_buffer = NULL;
diff --git a/contrib/tools/python3/Modules/_codecsmodule.c b/contrib/tools/python3/Modules/_codecsmodule.c
index 32373f0799b..4caf2260178 100644
--- a/contrib/tools/python3/Modules/_codecsmodule.c
+++ b/contrib/tools/python3/Modules/_codecsmodule.c
@@ -54,14 +54,15 @@ _codecs.register
Register a codec search function.
-Search functions are expected to take one argument, the encoding name in
-all lower case letters, and either return None, or a tuple of functions
-(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).
+Search functions are expected to take one argument, the encoding
+name in all lower case letters, and either return None, or a tuple
+of functions (encoder, decoder, stream_reader, stream_writer) (or
+a CodecInfo object).
[clinic start generated code]*/
static PyObject *
_codecs_register(PyObject *module, PyObject *search_function)
-/*[clinic end generated code: output=d1bf21e99db7d6d3 input=369578467955cae4]*/
+/*[clinic end generated code: output=d1bf21e99db7d6d3 input=2321d8c8c0420dfc]*/
{
if (PyCodec_Register(search_function))
return NULL;
@@ -114,16 +115,16 @@ _codecs.encode
Encodes obj using the codec registered for encoding.
The default encoding is 'utf-8'. errors may be given to set a
-different error handling scheme. Default is 'strict' meaning that encoding
-errors raise a ValueError. Other possible values are 'ignore', 'replace'
-and 'backslashreplace' as well as any other name registered with
-codecs.register_error that can handle ValueErrors.
+different error handling scheme. Default is 'strict' meaning that
+encoding errors raise a ValueError. Other possible values are 'ignore',
+'replace' and 'backslashreplace' as well as any other name registered
+with codecs.register_error that can handle ValueErrors.
[clinic start generated code]*/
static PyObject *
_codecs_encode_impl(PyObject *module, PyObject *obj, const char *encoding,
const char *errors)
-/*[clinic end generated code: output=385148eb9a067c86 input=cd5b685040ff61f0]*/
+/*[clinic end generated code: output=385148eb9a067c86 input=e5271d443e391d7f]*/
{
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
@@ -141,16 +142,16 @@ _codecs.decode
Decodes obj using the codec registered for encoding.
Default encoding is 'utf-8'. errors may be given to set a
-different error handling scheme. Default is 'strict' meaning that encoding
-errors raise a ValueError. Other possible values are 'ignore', 'replace'
-and 'backslashreplace' as well as any other name registered with
-codecs.register_error that can handle ValueErrors.
+different error handling scheme. Default is 'strict' meaning that
+encoding errors raise a ValueError. Other possible values are 'ignore',
+'replace' and 'backslashreplace' as well as any other name registered
+with codecs.register_error that can handle ValueErrors.
[clinic start generated code]*/
static PyObject *
_codecs_decode_impl(PyObject *module, PyObject *obj, const char *encoding,
const char *errors)
-/*[clinic end generated code: output=679882417dc3a0bd input=7702c0cc2fa1add6]*/
+/*[clinic end generated code: output=679882417dc3a0bd input=3e6254628f9ca538]*/
{
if (encoding == NULL)
encoding = PyUnicode_GetDefaultEncoding();
@@ -965,14 +966,15 @@ _codecs.register_error
Register the specified error handler under the name errors.
handler must be a callable object, that will be called with an exception
-instance containing information about the location of the encoding/decoding
-error and must return a (replacement, new position) tuple.
+instance containing information about the location of the
+encoding/decoding error and must return a (replacement, new position)
+tuple.
[clinic start generated code]*/
static PyObject *
_codecs_register_error_impl(PyObject *module, const char *errors,
PyObject *handler)
-/*[clinic end generated code: output=fa2f7d1879b3067d input=5e6709203c2e33fe]*/
+/*[clinic end generated code: output=fa2f7d1879b3067d input=5bea01dfe835d9d8]*/
{
if (PyCodec_RegisterError(errors, handler))
return NULL;
@@ -986,13 +988,13 @@ _codecs.lookup_error
lookup_error(errors) -> handler
-Return the error handler for the specified error handling name or raise a
-LookupError, if no handler exists under this name.
+Return the error handler for the specified error handling name or raise
+a LookupError, if no handler exists under this name.
[clinic start generated code]*/
static PyObject *
_codecs_lookup_error_impl(PyObject *module, const char *name)
-/*[clinic end generated code: output=087f05dc0c9a98cc input=4775dd65e6235aba]*/
+/*[clinic end generated code: output=087f05dc0c9a98cc input=86cfb6a7a9c67113]*/
{
return PyCodec_LookupError(name);
}
diff --git a/contrib/tools/python3/Modules/_collectionsmodule.c b/contrib/tools/python3/Modules/_collectionsmodule.c
index b2c3d0e42be..daf62c940b3 100644
--- a/contrib/tools/python3/Modules/_collectionsmodule.c
+++ b/contrib/tools/python3/Modules/_collectionsmodule.c
@@ -1824,7 +1824,7 @@ static PyMethodDef deque_methods[] = {
DEQUE_ROTATE_METHODDEF
DEQUE___SIZEOF___METHODDEF
{"__class_getitem__", Py_GenericAlias,
- METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ METH_O|METH_CLASS, PyDoc_STR("deques are generic over the type of their contents")},
{NULL, NULL} /* sentinel */
};
@@ -2284,6 +2284,12 @@ defdict_reduce(defdictobject *dd, PyObject *Py_UNUSED(ignored))
return result;
}
+
+PyDoc_STRVAR(defdict_class_getitem_doc,
+"defaultdicts are generic over two types, signifying (respectively) the types \
+of the dictionary's keys and values");
+
+
static PyMethodDef defdict_methods[] = {
{"__missing__", (PyCFunction)defdict_missing, METH_O,
defdict_missing_doc},
@@ -2294,7 +2300,7 @@ static PyMethodDef defdict_methods[] = {
{"__reduce__", (PyCFunction)defdict_reduce, METH_NOARGS,
reduce_doc},
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
- PyDoc_STR("See PEP 585")},
+ defdict_class_getitem_doc},
{NULL}
};
diff --git a/contrib/tools/python3/Modules/_csv.c b/contrib/tools/python3/Modules/_csv.c
index 0b7ff2575fc..755d005f4d8 100644
--- a/contrib/tools/python3/Modules/_csv.c
+++ b/contrib/tools/python3/Modules/_csv.c
@@ -957,6 +957,12 @@ Reader_iternext(ReaderObj *self)
Py_DECREF(lineobj);
return NULL;
}
+ if (self->fields == NULL) {
+ PyErr_SetString(module_state->error_obj,
+ "iterator has already advanced the reader");
+ Py_DECREF(lineobj);
+ return NULL;
+ }
++self->line_num;
kind = PyUnicode_KIND(lineobj);
data = PyUnicode_DATA(lineobj);
diff --git a/contrib/tools/python3/Modules/_ctypes/_ctypes.c b/contrib/tools/python3/Modules/_ctypes/_ctypes.c
index aac812813d9..c66d157be75 100644
--- a/contrib/tools/python3/Modules/_ctypes/_ctypes.c
+++ b/contrib/tools/python3/Modules/_ctypes/_ctypes.c
@@ -4935,7 +4935,7 @@ Array_length(PyObject *myself)
static PyMethodDef Array_methods[] = {
{"__class_getitem__", Py_GenericAlias,
- METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ METH_O|METH_CLASS, PyDoc_STR("Arrays are generic over the type of their elements")},
{ NULL, NULL }
};
diff --git a/contrib/tools/python3/Modules/_datetimemodule.c b/contrib/tools/python3/Modules/_datetimemodule.c
index 8cfa04f676d..8df5913dfae 100644
--- a/contrib/tools/python3/Modules/_datetimemodule.c
+++ b/contrib/tools/python3/Modules/_datetimemodule.c
@@ -3208,13 +3208,13 @@ datetime.date.fromtimestamp
Create a date from a POSIX timestamp.
-The timestamp is a number, e.g. created via time.time(), that is interpreted
-as local time.
+The timestamp is a number, e.g. created via time.time(), that is
+interpreted as local time.
[clinic start generated code]*/
static PyObject *
datetime_date_fromtimestamp(PyTypeObject *type, PyObject *timestamp)
-/*[clinic end generated code: output=fd045fda58168869 input=eabb3fe7f40491fe]*/
+/*[clinic end generated code: output=fd045fda58168869 input=15720eef43b169a1]*/
{
return date_fromtimestamp((PyObject *) type, timestamp);
}
diff --git a/contrib/tools/python3/Modules/_elementtree.c b/contrib/tools/python3/Modules/_elementtree.c
index dfa03663c38..f2e2f1237f1 100644
--- a/contrib/tools/python3/Modules/_elementtree.c
+++ b/contrib/tools/python3/Modules/_elementtree.c
@@ -16,6 +16,7 @@
#endif
#include "Python.h"
+#include "pycore_ceval.h" // _Py_EnterRecursiveCall()
#include "pycore_import.h" // _PyImport_GetModuleAttrString()
#include "pycore_pyhash.h" // _Py_HashSecret
#include "pycore_weakref.h" // FT_CLEAR_WEAKREFS()
@@ -563,7 +564,7 @@ element_get_attrib(ElementObject* self)
LOCAL(PyObject*)
element_get_text(ElementObject* self)
{
- /* return borrowed reference to text attribute */
+ /* return new reference to text attribute */
PyObject *res = self->text;
@@ -578,13 +579,13 @@ element_get_text(ElementObject* self)
}
}
- return res;
+ return Py_NewRef(res);
}
LOCAL(PyObject*)
element_get_tail(ElementObject* self)
{
- /* return borrowed reference to text attribute */
+ /* return new reference to tail attribute */
PyObject *res = self->tail;
@@ -599,7 +600,7 @@ element_get_tail(ElementObject* self)
}
}
- return res;
+ return Py_NewRef(res);
}
static PyObject*
@@ -801,26 +802,31 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
/*[clinic end generated code: output=eefc3df50465b642 input=a2d40348c0aade10]*/
{
Py_ssize_t i;
- ElementObject* element;
+ ElementObject* element = NULL;
PyObject* tag;
PyObject* attrib;
PyObject* text;
PyObject* tail;
PyObject* id;
+ if (_Py_EnterRecursiveCall(" in Element.__deepcopy__")) {
+ return NULL;
+ }
+
PyTypeObject *tp = Py_TYPE(self);
elementtreestate *st = get_elementtree_state_by_type(tp);
// The deepcopy() helper takes care of incrementing the refcount
// of the object to copy so to avoid use-after-frees.
tag = deepcopy(st, self->tag, memo);
- if (!tag)
- return NULL;
+ if (!tag) {
+ goto error;
+ }
if (self->extra && self->extra->attrib) {
attrib = deepcopy(st, self->extra->attrib, memo);
if (!attrib) {
Py_DECREF(tag);
- return NULL;
+ goto error;
}
} else {
attrib = NULL;
@@ -831,8 +837,9 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
Py_DECREF(tag);
Py_XDECREF(attrib);
- if (!element)
- return NULL;
+ if (!element) {
+ goto error;
+ }
text = deepcopy(st, JOIN_OBJ(self->text), memo);
if (!text)
@@ -894,10 +901,12 @@ _elementtree_Element___deepcopy___impl(ElementObject *self, PyObject *memo)
if (i < 0)
goto error;
+ _Py_LeaveRecursiveCall();
return (PyObject*) element;
error:
- Py_DECREF(element);
+ _Py_LeaveRecursiveCall();
+ Py_XDECREF(element);
return NULL;
}
@@ -1340,9 +1349,9 @@ _elementtree_Element_findtext_impl(ElementObject *self, PyTypeObject *cls,
PyObject *text = element_get_text((ElementObject *)item);
Py_DECREF(item);
if (text == Py_None) {
+ Py_DECREF(text);
return Py_GetConstant(Py_CONSTANT_EMPTY_STR);
}
- Py_XINCREF(text);
return text;
}
Py_DECREF(item);
@@ -2042,15 +2051,13 @@ element_tag_getter(ElementObject *self, void *closure)
static PyObject*
element_text_getter(ElementObject *self, void *closure)
{
- PyObject *res = element_get_text(self);
- return Py_XNewRef(res);
+ return element_get_text(self);
}
static PyObject*
element_tail_getter(ElementObject *self, void *closure)
{
- PyObject *res = element_get_tail(self);
- return Py_XNewRef(res);
+ return element_get_tail(self);
}
static PyObject*
@@ -2266,6 +2273,10 @@ elementiter_next(ElementIterObject *it)
return NULL;
}
if (it->gettext) {
+ if (elem->tag != Py_None && !PyUnicode_Check(elem->tag)) {
+ Py_DECREF(elem);
+ continue;
+ }
text = element_get_text(elem);
goto gettext;
}
@@ -2283,16 +2294,14 @@ elementiter_next(ElementIterObject *it)
continue;
gettext:
+ Py_DECREF(elem);
if (!text) {
- Py_DECREF(elem);
return NULL;
}
if (text == Py_None) {
- Py_DECREF(elem);
+ Py_DECREF(text);
}
else {
- Py_INCREF(text);
- Py_DECREF(elem);
rc = PyObject_IsTrue(text);
if (rc > 0)
return text;
@@ -3687,8 +3696,12 @@ _elementtree_XMLParser___init___impl(XMLParserObject *self, PyObject *target,
PyErr_NoMemory();
return -1;
}
- /* expat < 2.1.0 has no XML_SetHashSalt() */
- if (EXPAT(st, SetHashSalt) != NULL) {
+ // Prefer 16-byte entropy, only expat >= 2.8.0. See gh-149018
+ if (EXPAT(st, SetHashSalt16Bytes) != NULL) {
+ EXPAT(st, SetHashSalt16Bytes)(self->parser,
+ _Py_HashSecret.expat.hashsalt16);
+ }
+ else if (EXPAT(st, SetHashSalt) != NULL) {
EXPAT(st, SetHashSalt)(self->parser,
(unsigned long)_Py_HashSecret.expat.hashsalt);
}
diff --git a/contrib/tools/python3/Modules/_functoolsmodule.c b/contrib/tools/python3/Modules/_functoolsmodule.c
index a1682ec4c0e..08acd2c5ab9 100644
--- a/contrib/tools/python3/Modules/_functoolsmodule.c
+++ b/contrib/tools/python3/Modules/_functoolsmodule.c
@@ -522,7 +522,8 @@ static PyMethodDef partial_methods[] = {
{"__reduce__", (PyCFunction)partial_reduce, METH_NOARGS},
{"__setstate__", (PyCFunction)partial_setstate, METH_O},
{"__class_getitem__", Py_GenericAlias,
- METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ METH_O|METH_CLASS,
+ PyDoc_STR("partial is generic over the wrapped function's return type")},
{NULL, NULL} /* sentinel */
};
diff --git a/contrib/tools/python3/Modules/_hashopenssl.c b/contrib/tools/python3/Modules/_hashopenssl.c
index bf3894e4ffb..8a4fe473684 100644
--- a/contrib/tools/python3/Modules/_hashopenssl.c
+++ b/contrib/tools/python3/Modules/_hashopenssl.c
@@ -1870,13 +1870,13 @@ _hashlib.HMAC.hexdigest
Return hexadecimal digest of the bytes passed to the update() method so far.
-This may be used to exchange the value safely in email or other non-binary
-environments.
+This may be used to exchange the value safely in email or other
+non-binary environments.
[clinic start generated code]*/
static PyObject *
_hashlib_HMAC_hexdigest_impl(HMACobject *self)
-/*[clinic end generated code: output=80d825be1eaae6a7 input=5abc42702874ddcf]*/
+/*[clinic end generated code: output=80d825be1eaae6a7 input=865e6128c7ec0781]*/
{
unsigned char digest[EVP_MAX_MD_SIZE];
unsigned int digest_size = _hashlib_hmac_digest_size(self);
@@ -2038,8 +2038,8 @@ _hashlib.get_fips_mode -> int
Determine the OpenSSL FIPS mode of operation.
For OpenSSL 3.0.0 and newer it returns the state of the default provider
-in the default OSSL context. It's not quite the same as FIPS_mode() but good
-enough for unittests.
+in the default OSSL context. It's not quite the same as FIPS_mode() but
+good enough for unittests.
Effectively any non-zero return value indicates FIPS mode;
values other than 1 may have additional significance.
@@ -2047,7 +2047,7 @@ values other than 1 may have additional significance.
static int
_hashlib_get_fips_mode_impl(PyObject *module)
-/*[clinic end generated code: output=87eece1bab4d3fa9 input=2db61538c41c6fef]*/
+/*[clinic end generated code: output=87eece1bab4d3fa9 input=a6cdb6901421d122]*/
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
diff --git a/contrib/tools/python3/Modules/_interpchannelsmodule.c b/contrib/tools/python3/Modules/_interpchannelsmodule.c
index 460b4e5f4ea..4d5099f3807 100644
--- a/contrib/tools/python3/Modules/_interpchannelsmodule.c
+++ b/contrib/tools/python3/Modules/_interpchannelsmodule.c
@@ -2553,6 +2553,7 @@ _channelid_from_xid(_PyCrossInterpreterData *data)
{
struct _channelid_xid *xid = \
(struct _channelid_xid *)_PyCrossInterpreterData_DATA(data);
+ PyObject *cidobj = NULL;
// It might not be imported yet, so we can't use _get_current_module().
PyObject *mod = PyImport_ImportModule(MODULE_NAME_STR);
@@ -2562,11 +2563,10 @@ _channelid_from_xid(_PyCrossInterpreterData *data)
assert(mod != Py_None);
module_state *state = get_module_state(mod);
if (state == NULL) {
- return NULL;
+ goto done;
}
// Note that we do not preserve the "resolve" flag.
- PyObject *cidobj = NULL;
int err = newchannelid(state->ChannelIDType, xid->cid, xid->end,
_global_channels(), 0, 0,
(channelid **)&cidobj);
diff --git a/contrib/tools/python3/Modules/_interpqueuesmodule.c b/contrib/tools/python3/Modules/_interpqueuesmodule.c
index d84b53d9021..7a89e2f13a1 100644
--- a/contrib/tools/python3/Modules/_interpqueuesmodule.c
+++ b/contrib/tools/python3/Modules/_interpqueuesmodule.c
@@ -1355,6 +1355,7 @@ _queueobj_from_xid(_PyCrossInterpreterData *data)
// XXX import it?
PyErr_SetString(PyExc_RuntimeError,
MODULE_NAME_STR " module not imported yet");
+ Py_DECREF(qidobj);
return NULL;
}
diff --git a/contrib/tools/python3/Modules/_io/_iomodule.c b/contrib/tools/python3/Modules/_io/_iomodule.c
index 269070fe2b0..6c60a3b0b76 100644
--- a/contrib/tools/python3/Modules/_io/_iomodule.c
+++ b/contrib/tools/python3/Modules/_io/_iomodule.c
@@ -86,112 +86,114 @@ Open file and return a stream. Raise OSError upon failure.
file is either a text or byte string giving the name (and the path
if the file isn't in the current working directory) of the file to
be opened or an integer file descriptor of the file to be
-wrapped. (If a file descriptor is given, it is closed when the
+wrapped. (If a file descriptor is given, it is closed when the
returned I/O object is closed, unless closefd is set to False.)
mode is an optional string that specifies the mode in which the file
-is opened. It defaults to 'r' which means open for reading in text
+is opened. It defaults to 'r' which means open for reading in text
mode. Other common values are 'w' for writing (truncating the file if
it already exists), 'x' for creating and writing to a new file, and
'a' for appending (which on some Unix systems, means that all writes
append to the end of the file regardless of the current seek position).
In text mode, if encoding is not specified the encoding used is platform
-dependent: locale.getencoding() is called to get the current locale encoding.
-(For reading and writing raw bytes use binary mode and leave encoding
-unspecified.) The available modes are:
+dependent: locale.getencoding() is called to get the current locale
+encoding. (For reading and writing raw bytes use binary mode and leave
+encoding unspecified.) The available modes are:
-========= ===============================================================
+========= ==========================================================
Character Meaning
---------- ---------------------------------------------------------------
+--------- ----------------------------------------------------------
'r' open for reading (default)
'w' open for writing, truncating the file first
'x' create a new file and open it for writing
-'a' open for writing, appending to the end of the file if it exists
+'a' open for writing, appending to the end of the file if it
+ exists
'b' binary mode
't' text mode (default)
'+' open a disk file for updating (reading and writing)
-========= ===============================================================
+========= ==========================================================
-The default mode is 'rt' (open for reading text). For binary random
+The default mode is 'rt' (open for reading text). For binary random
access, the mode 'w+b' opens and truncates the file to 0 bytes, while
-'r+b' opens the file without truncation. The 'x' mode implies 'w' and
+'r+b' opens the file without truncation. The 'x' mode implies 'w' and
raises an `FileExistsError` if the file already exists.
Python distinguishes between files opened in binary and text modes,
-even when the underlying operating system doesn't. Files opened in
+even when the underlying operating system doesn't. Files opened in
binary mode (appending 'b' to the mode argument) return contents as
-bytes objects without any decoding. In text mode (the default, or when
+bytes objects without any decoding. In text mode (the default, or when
't' is appended to the mode argument), the contents of the file are
returned as strings, the bytes having been first decoded using a
platform-dependent encoding or using the specified encoding if given.
buffering is an optional integer used to set the buffering policy.
-Pass 0 to switch buffering off (only allowed in binary mode), 1 to select
-line buffering (only usable in text mode), and an integer > 1 to indicate
-the size of a fixed-size chunk buffer. When no buffering argument is
-given, the default buffering policy works as follows:
+Pass 0 to switch buffering off (only allowed in binary mode), 1 to
+select line buffering (only usable in text mode), and an integer > 1 to
+indicate the size of a fixed-size chunk buffer. When no buffering
+argument is given, the default buffering policy works as follows:
* Binary files are buffered in fixed-size chunks; the size of the buffer
- is chosen using a heuristic trying to determine the underlying device's
- "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
- On many systems, the buffer will typically be 4096 or 8192 bytes long.
+ is chosen using a heuristic trying to determine the underlying
+ device's "block size" and falling back on `io.DEFAULT_BUFFER_SIZE`.
+ On many systems, the buffer will typically be 4096 or 8192 bytes
+ long.
* "Interactive" text files (files for which isatty() returns True)
use line buffering. Other text files use the policy described above
for binary files.
encoding is the name of the encoding used to decode or encode the
-file. This should only be used in text mode. The default encoding is
+file. This should only be used in text mode. The default encoding is
platform dependent, but any encoding supported by Python can be
passed. See the codecs module for the list of supported encodings.
errors is an optional string that specifies how encoding errors are to
-be handled---this argument should not be used in binary mode. Pass
+be handled---this argument should not be used in binary mode. Pass
'strict' to raise a ValueError exception if there is an encoding error
(the default of None has the same effect), or pass 'ignore' to ignore
-errors. (Note that ignoring encoding errors can lead to data loss.)
+errors. (Note that ignoring encoding errors can lead to data loss.)
See the documentation for codecs.register or run 'help(codecs.Codec)'
for a list of the permitted encoding error strings.
newline controls how universal newlines works (it only applies to text
-mode). It can be None, '', '\n', '\r', and '\r\n'. It works as
+mode). It can be None, '', '\n', '\r', and '\r\n'. It works as
follows:
-* On input, if newline is None, universal newlines mode is
- enabled. Lines in the input can end in '\n', '\r', or '\r\n', and
- these are translated into '\n' before being returned to the
- caller. If it is '', universal newline mode is enabled, but line
- endings are returned to the caller untranslated. If it has any of
- the other legal values, input lines are only terminated by the given
- string, and the line ending is returned to the caller untranslated.
+* On input, if newline is None, universal newlines mode is enabled.
+ Lines in the input can end in '\n', '\r', or '\r\n', and these are
+ translated into '\n' before being returned to the caller. If it is
+ '', universal newline mode is enabled, but line endings are returned
+ to the caller untranslated. If it has any of the other legal values,
+ input lines are only terminated by the given string, and the line
+ ending is returned to the caller untranslated.
* On output, if newline is None, any '\n' characters written are
- translated to the system default line separator, os.linesep. If
- newline is '' or '\n', no translation takes place. If newline is any
+ translated to the system default line separator, os.linesep. If
+ newline is '' or '\n', no translation takes place. If newline is any
of the other legal values, any '\n' characters written are translated
to the given string.
If closefd is False, the underlying file descriptor will be kept open
-when the file is closed. This does not work when a file name is given
+when the file is closed. This does not work when a file name is given
and must be True in that case.
-A custom opener can be used by passing a callable as *opener*. The
+A custom opener can be used by passing a callable as *opener*. The
underlying file descriptor for the file object is then obtained by
-calling *opener* with (*file*, *flags*). *opener* must return an open
+calling *opener* with (*file*, *flags*). *opener* must return an open
file descriptor (passing os.open as *opener* results in functionality
similar to passing None).
open() returns a file object whose type depends on the mode, and
through which the standard file operations such as reading and writing
-are performed. When open() is used to open a file in a text mode ('w',
-'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
+are performed. When open() is used to open a file in a text mode ('w',
+'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open
a file in a binary mode, the returned class varies: in read binary
mode, it returns a BufferedReader; in write binary and append binary
modes, it returns a BufferedWriter, and in read/write mode, it returns
a BufferedRandom.
It is also possible to use a string or bytearray as a file for both
-reading and writing. For strings StringIO can be used like a file
+reading and writing. For strings StringIO can be used like a file
opened in a text mode, and for bytes a BytesIO can be used like a file
opened in a binary mode.
[clinic start generated code]*/
@@ -200,7 +202,7 @@ static PyObject *
_io_open_impl(PyObject *module, PyObject *file, const char *mode,
int buffering, const char *encoding, const char *errors,
const char *newline, int closefd, PyObject *opener)
-/*[clinic end generated code: output=aefafc4ce2b46dc0 input=cd034e7cdfbf4e78]*/
+/*[clinic end generated code: output=aefafc4ce2b46dc0 input=202d0aefc19a36c5]*/
{
unsigned i;
@@ -504,14 +506,14 @@ _io.open_code
Opens the provided file with the intent to import the contents.
-This may perform extra validation beyond open(), but is otherwise interchangeable
-with calling open(path, 'rb').
+This may perform extra validation beyond open(), but is otherwise
+interchangeable with calling open(path, 'rb').
[clinic start generated code]*/
static PyObject *
_io_open_code_impl(PyObject *module, PyObject *path)
-/*[clinic end generated code: output=2fe4ecbd6f3d6844 input=f5c18e23f4b2ed9f]*/
+/*[clinic end generated code: output=2fe4ecbd6f3d6844 input=2803c35aeb63c719]*/
{
return PyFile_OpenCodeObject(path);
}
diff --git a/contrib/tools/python3/Modules/_io/bytesio.c b/contrib/tools/python3/Modules/_io/bytesio.c
index e149823afd3..38d47aafa33 100644
--- a/contrib/tools/python3/Modules/_io/bytesio.c
+++ b/contrib/tools/python3/Modules/_io/bytesio.c
@@ -457,13 +457,13 @@ _io.BytesIO.read1
Read at most size bytes, returned as a bytes object.
-If the size argument is negative or omitted, read until EOF is reached.
-Return an empty bytes object at EOF.
+If the size argument is negative or omitted, read until EOF is
+reached. Return an empty bytes object at EOF.
[clinic start generated code]*/
static PyObject *
_io_BytesIO_read1_impl(bytesio *self, Py_ssize_t size)
-/*[clinic end generated code: output=d0f843285aa95f1c input=440a395bf9129ef5]*/
+/*[clinic end generated code: output=d0f843285aa95f1c input=418f5968cb4f2a01]*/
{
return _io_BytesIO_read_impl(self, size);
}
@@ -730,13 +730,13 @@ _io.BytesIO.writelines
Write lines to the file.
Note that newlines are not added. lines can be any iterable object
-producing bytes-like objects. This is equivalent to calling write() for
-each element.
+producing bytes-like objects. This is equivalent to calling write()
+for each element.
[clinic start generated code]*/
static PyObject *
_io_BytesIO_writelines(bytesio *self, PyObject *lines)
-/*[clinic end generated code: output=7f33aa3271c91752 input=e972539176fc8fc1]*/
+/*[clinic end generated code: output=7f33aa3271c91752 input=f4e24a931ef1d528]*/
{
PyObject *it, *item;
diff --git a/contrib/tools/python3/Modules/_io/clinic/_iomodule.c.h b/contrib/tools/python3/Modules/_io/clinic/_iomodule.c.h
index 112408a95df..356b38f058f 100644
--- a/contrib/tools/python3/Modules/_io/clinic/_iomodule.c.h
+++ b/contrib/tools/python3/Modules/_io/clinic/_iomodule.c.h
@@ -18,112 +18,114 @@ PyDoc_STRVAR(_io_open__doc__,
"file is either a text or byte string giving the name (and the path\n"
"if the file isn\'t in the current working directory) of the file to\n"
"be opened or an integer file descriptor of the file to be\n"
-"wrapped. (If a file descriptor is given, it is closed when the\n"
+"wrapped. (If a file descriptor is given, it is closed when the\n"
"returned I/O object is closed, unless closefd is set to False.)\n"
"\n"
"mode is an optional string that specifies the mode in which the file\n"
-"is opened. It defaults to \'r\' which means open for reading in text\n"
+"is opened. It defaults to \'r\' which means open for reading in text\n"
"mode. Other common values are \'w\' for writing (truncating the file if\n"
"it already exists), \'x\' for creating and writing to a new file, and\n"
"\'a\' for appending (which on some Unix systems, means that all writes\n"
"append to the end of the file regardless of the current seek position).\n"
"In text mode, if encoding is not specified the encoding used is platform\n"
-"dependent: locale.getencoding() is called to get the current locale encoding.\n"
-"(For reading and writing raw bytes use binary mode and leave encoding\n"
-"unspecified.) The available modes are:\n"
+"dependent: locale.getencoding() is called to get the current locale\n"
+"encoding. (For reading and writing raw bytes use binary mode and leave\n"
+"encoding unspecified.) The available modes are:\n"
"\n"
-"========= ===============================================================\n"
+"========= ==========================================================\n"
"Character Meaning\n"
-"--------- ---------------------------------------------------------------\n"
+"--------- ----------------------------------------------------------\n"
"\'r\' open for reading (default)\n"
"\'w\' open for writing, truncating the file first\n"
"\'x\' create a new file and open it for writing\n"
-"\'a\' open for writing, appending to the end of the file if it exists\n"
+"\'a\' open for writing, appending to the end of the file if it\n"
+" exists\n"
"\'b\' binary mode\n"
"\'t\' text mode (default)\n"
"\'+\' open a disk file for updating (reading and writing)\n"
-"========= ===============================================================\n"
+"========= ==========================================================\n"
"\n"
-"The default mode is \'rt\' (open for reading text). For binary random\n"
+"The default mode is \'rt\' (open for reading text). For binary random\n"
"access, the mode \'w+b\' opens and truncates the file to 0 bytes, while\n"
-"\'r+b\' opens the file without truncation. The \'x\' mode implies \'w\' and\n"
+"\'r+b\' opens the file without truncation. The \'x\' mode implies \'w\' and\n"
"raises an `FileExistsError` if the file already exists.\n"
"\n"
"Python distinguishes between files opened in binary and text modes,\n"
-"even when the underlying operating system doesn\'t. Files opened in\n"
+"even when the underlying operating system doesn\'t. Files opened in\n"
"binary mode (appending \'b\' to the mode argument) return contents as\n"
-"bytes objects without any decoding. In text mode (the default, or when\n"
+"bytes objects without any decoding. In text mode (the default, or when\n"
"\'t\' is appended to the mode argument), the contents of the file are\n"
"returned as strings, the bytes having been first decoded using a\n"
"platform-dependent encoding or using the specified encoding if given.\n"
"\n"
"buffering is an optional integer used to set the buffering policy.\n"
-"Pass 0 to switch buffering off (only allowed in binary mode), 1 to select\n"
-"line buffering (only usable in text mode), and an integer > 1 to indicate\n"
-"the size of a fixed-size chunk buffer. When no buffering argument is\n"
-"given, the default buffering policy works as follows:\n"
+"Pass 0 to switch buffering off (only allowed in binary mode), 1 to\n"
+"select line buffering (only usable in text mode), and an integer > 1 to\n"
+"indicate the size of a fixed-size chunk buffer. When no buffering\n"
+"argument is given, the default buffering policy works as follows:\n"
"\n"
"* Binary files are buffered in fixed-size chunks; the size of the buffer\n"
-" is chosen using a heuristic trying to determine the underlying device\'s\n"
-" \"block size\" and falling back on `io.DEFAULT_BUFFER_SIZE`.\n"
-" On many systems, the buffer will typically be 4096 or 8192 bytes long.\n"
+" is chosen using a heuristic trying to determine the underlying\n"
+" device\'s \"block size\" and falling back on `io.DEFAULT_BUFFER_SIZE`.\n"
+" On many systems, the buffer will typically be 4096 or 8192 bytes\n"
+" long.\n"
"\n"
"* \"Interactive\" text files (files for which isatty() returns True)\n"
" use line buffering. Other text files use the policy described above\n"
" for binary files.\n"
"\n"
"encoding is the name of the encoding used to decode or encode the\n"
-"file. This should only be used in text mode. The default encoding is\n"
+"file. This should only be used in text mode. The default encoding is\n"
"platform dependent, but any encoding supported by Python can be\n"
"passed. See the codecs module for the list of supported encodings.\n"
"\n"
"errors is an optional string that specifies how encoding errors are to\n"
-"be handled---this argument should not be used in binary mode. Pass\n"
+"be handled---this argument should not be used in binary mode. Pass\n"
"\'strict\' to raise a ValueError exception if there is an encoding error\n"
"(the default of None has the same effect), or pass \'ignore\' to ignore\n"
-"errors. (Note that ignoring encoding errors can lead to data loss.)\n"
+"errors. (Note that ignoring encoding errors can lead to data loss.)\n"
"See the documentation for codecs.register or run \'help(codecs.Codec)\'\n"
"for a list of the permitted encoding error strings.\n"
"\n"
"newline controls how universal newlines works (it only applies to text\n"
-"mode). It can be None, \'\', \'\\n\', \'\\r\', and \'\\r\\n\'. It works as\n"
+"mode). It can be None, \'\', \'\\n\', \'\\r\', and \'\\r\\n\'. It works as\n"
"follows:\n"
"\n"
-"* On input, if newline is None, universal newlines mode is\n"
-" enabled. Lines in the input can end in \'\\n\', \'\\r\', or \'\\r\\n\', and\n"
-" these are translated into \'\\n\' before being returned to the\n"
-" caller. If it is \'\', universal newline mode is enabled, but line\n"
-" endings are returned to the caller untranslated. If it has any of\n"
-" the other legal values, input lines are only terminated by the given\n"
-" string, and the line ending is returned to the caller untranslated.\n"
+"* On input, if newline is None, universal newlines mode is enabled.\n"
+" Lines in the input can end in \'\\n\', \'\\r\', or \'\\r\\n\', and these are\n"
+" translated into \'\\n\' before being returned to the caller. If it is\n"
+" \'\', universal newline mode is enabled, but line endings are returned\n"
+" to the caller untranslated. If it has any of the other legal values,\n"
+" input lines are only terminated by the given string, and the line\n"
+" ending is returned to the caller untranslated.\n"
"\n"
"* On output, if newline is None, any \'\\n\' characters written are\n"
-" translated to the system default line separator, os.linesep. If\n"
-" newline is \'\' or \'\\n\', no translation takes place. If newline is any\n"
+" translated to the system default line separator, os.linesep. If\n"
+" newline is \'\' or \'\\n\', no translation takes place. If newline is any\n"
" of the other legal values, any \'\\n\' characters written are translated\n"
" to the given string.\n"
"\n"
"If closefd is False, the underlying file descriptor will be kept open\n"
-"when the file is closed. This does not work when a file name is given\n"
+"when the file is closed. This does not work when a file name is given\n"
"and must be True in that case.\n"
"\n"
-"A custom opener can be used by passing a callable as *opener*. The\n"
+"A custom opener can be used by passing a callable as *opener*. The\n"
"underlying file descriptor for the file object is then obtained by\n"
-"calling *opener* with (*file*, *flags*). *opener* must return an open\n"
+"calling *opener* with (*file*, *flags*). *opener* must return an open\n"
"file descriptor (passing os.open as *opener* results in functionality\n"
"similar to passing None).\n"
"\n"
"open() returns a file object whose type depends on the mode, and\n"
"through which the standard file operations such as reading and writing\n"
-"are performed. When open() is used to open a file in a text mode (\'w\',\n"
-"\'r\', \'wt\', \'rt\', etc.), it returns a TextIOWrapper. When used to open\n"
+"are performed. When open() is used to open a file in a text mode (\'w\',\n"
+"\'r\', \'wt\', \'rt\', etc.), it returns a TextIOWrapper. When used to open\n"
"a file in a binary mode, the returned class varies: in read binary\n"
"mode, it returns a BufferedReader; in write binary and append binary\n"
"modes, it returns a BufferedWriter, and in read/write mode, it returns\n"
"a BufferedRandom.\n"
"\n"
"It is also possible to use a string or bytearray as a file for both\n"
-"reading and writing. For strings StringIO can be used like a file\n"
+"reading and writing. For strings StringIO can be used like a file\n"
"opened in a text mode, and for bytes a BytesIO can be used like a file\n"
"opened in a binary mode.");
@@ -349,8 +351,8 @@ PyDoc_STRVAR(_io_open_code__doc__,
"\n"
"Opens the provided file with the intent to import the contents.\n"
"\n"
-"This may perform extra validation beyond open(), but is otherwise interchangeable\n"
-"with calling open(path, \'rb\').");
+"This may perform extra validation beyond open(), but is otherwise\n"
+"interchangeable with calling open(path, \'rb\').");
#define _IO_OPEN_CODE_METHODDEF \
{"open_code", _PyCFunction_CAST(_io_open_code), METH_FASTCALL|METH_KEYWORDS, _io_open_code__doc__},
@@ -404,4 +406,4 @@ _io_open_code(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
exit:
return return_value;
}
-/*[clinic end generated code: output=5d60f4e778a600a4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6fb7864751a4cbd8 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_io/clinic/bytesio.c.h b/contrib/tools/python3/Modules/_io/clinic/bytesio.c.h
index 620e9e3b84e..49234d43dd3 100644
--- a/contrib/tools/python3/Modules/_io/clinic/bytesio.c.h
+++ b/contrib/tools/python3/Modules/_io/clinic/bytesio.c.h
@@ -202,8 +202,8 @@ PyDoc_STRVAR(_io_BytesIO_read1__doc__,
"\n"
"Read at most size bytes, returned as a bytes object.\n"
"\n"
-"If the size argument is negative or omitted, read until EOF is reached.\n"
-"Return an empty bytes object at EOF.");
+"If the size argument is negative or omitted, read until EOF is\n"
+"reached. Return an empty bytes object at EOF.");
#define _IO_BYTESIO_READ1_METHODDEF \
{"read1", _PyCFunction_CAST(_io_BytesIO_read1), METH_FASTCALL, _io_BytesIO_read1__doc__},
@@ -452,8 +452,8 @@ PyDoc_STRVAR(_io_BytesIO_writelines__doc__,
"Write lines to the file.\n"
"\n"
"Note that newlines are not added. lines can be any iterable object\n"
-"producing bytes-like objects. This is equivalent to calling write() for\n"
-"each element.");
+"producing bytes-like objects. This is equivalent to calling write()\n"
+"for each element.");
#define _IO_BYTESIO_WRITELINES_METHODDEF \
{"writelines", (PyCFunction)_io_BytesIO_writelines, METH_O, _io_BytesIO_writelines__doc__},
@@ -534,4 +534,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=ef116925b8b9e535 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=502699cd403dd3a0 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_io/clinic/fileio.c.h b/contrib/tools/python3/Modules/_io/clinic/fileio.c.h
index 5b5487d63eb..67c9847a5a6 100644
--- a/contrib/tools/python3/Modules/_io/clinic/fileio.c.h
+++ b/contrib/tools/python3/Modules/_io/clinic/fileio.c.h
@@ -15,8 +15,8 @@ PyDoc_STRVAR(_io_FileIO_close__doc__,
"\n"
"Close the file.\n"
"\n"
-"A closed file cannot be used for further I/O operations. close() may be\n"
-"called more than once without error.");
+"A closed file cannot be used for further I/O operations. close()\n"
+"may be called more than once without error.");
#define _IO_FILEIO_CLOSE_METHODDEF \
{"close", _PyCFunction_CAST(_io_FileIO_close), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_close__doc__},
@@ -41,16 +41,19 @@ PyDoc_STRVAR(_io_FileIO___init____doc__,
"Open a file.\n"
"\n"
"The mode can be \'r\' (default), \'w\', \'x\' or \'a\' for reading,\n"
-"writing, exclusive creation or appending. The file will be created if it\n"
-"doesn\'t exist when opened for writing or appending; it will be truncated\n"
-"when opened for writing. A FileExistsError will be raised if it already\n"
-"exists when opened for creating. Opening a file for creating implies\n"
-"writing so this mode behaves in a similar way to \'w\'.Add a \'+\' to the mode\n"
-"to allow simultaneous reading and writing. A custom opener can be used by\n"
-"passing a callable as *opener*. The underlying file descriptor for the file\n"
-"object is then obtained by calling opener with (*name*, *flags*).\n"
-"*opener* must return an open file descriptor (passing os.open as *opener*\n"
-"results in functionality similar to passing None).");
+"writing, exclusive creation or appending. The file will be created\n"
+"if it doesn\'t exist when opened for writing or appending; it will be\n"
+"truncated when opened for writing. A FileExistsError will be raised\n"
+"if it already exists when opened for creating. Opening a file for\n"
+"creating implies writing so this mode behaves in a similar way to\n"
+"\'w\'. Add a \'+\' to the mode to allow simultaneous reading and\n"
+"writing.\n"
+"\n"
+"A custom opener can be used by passing a callable as *opener*.\n"
+"The underlying file descriptor for the file object is then obtained\n"
+"by calling opener with (*name*, *flags*). *opener* must return\n"
+"an open file descriptor (passing os.open as *opener* results in\n"
+"functionality similar to passing None).");
static int
_io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
@@ -267,7 +270,8 @@ PyDoc_STRVAR(_io_FileIO_readall__doc__,
"Read all data from the file, returned as bytes.\n"
"\n"
"In non-blocking mode, returns as much as is immediately available,\n"
-"or None if no data is available. Return an empty bytes object at EOF.");
+"or None if no data is available. Return an empty bytes object at\n"
+"EOF.");
#define _IO_FILEIO_READALL_METHODDEF \
{"readall", (PyCFunction)_io_FileIO_readall, METH_NOARGS, _io_FileIO_readall__doc__},
@@ -287,9 +291,9 @@ PyDoc_STRVAR(_io_FileIO_read__doc__,
"\n"
"Read at most size bytes, returned as bytes.\n"
"\n"
-"Only makes one system call, so less data may be returned than requested.\n"
-"In non-blocking mode, returns None if no data is available.\n"
-"Return an empty bytes object at EOF.");
+"Only makes one system call, so less data may be returned than\n"
+"requested. In non-blocking mode, returns None if no data is\n"
+"available. Return an empty bytes object at EOF.");
#define _IO_FILEIO_READ_METHODDEF \
{"read", _PyCFunction_CAST(_io_FileIO_read), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_read__doc__},
@@ -341,8 +345,8 @@ PyDoc_STRVAR(_io_FileIO_write__doc__,
"Write buffer b to file, return number of bytes written.\n"
"\n"
"Only makes one system call, so not all of the data may be written.\n"
-"The number of bytes actually written is returned. In non-blocking mode,\n"
-"returns None if the write would block.");
+"The number of bytes actually written is returned. In non-blocking\n"
+"mode, returns None if the write would block.");
#define _IO_FILEIO_WRITE_METHODDEF \
{"write", _PyCFunction_CAST(_io_FileIO_write), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io_FileIO_write__doc__},
@@ -394,11 +398,12 @@ PyDoc_STRVAR(_io_FileIO_seek__doc__,
"\n"
"Move to new file position and return the file position.\n"
"\n"
-"Argument offset is a byte count. Optional argument whence defaults to\n"
-"SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values\n"
-"are SEEK_CUR or 1 (move relative to current position, positive or negative),\n"
-"and SEEK_END or 2 (move relative to end of file, usually negative, although\n"
-"many platforms allow seeking beyond the end of a file).\n"
+"Argument offset is a byte count. Optional argument whence defaults\n"
+"to SEEK_SET or 0 (offset from start of file, offset should be >= 0);\n"
+"other values are SEEK_CUR or 1 (move relative to current position,\n"
+"positive or negative), and SEEK_END or 2 (move relative to end of\n"
+"file, usually negative, although many platforms allow seeking beyond\n"
+"the end of a file).\n"
"\n"
"Note that not all file objects are seekable.");
@@ -528,4 +533,4 @@ _io_FileIO_isatty(fileio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO_FILEIO_TRUNCATE_METHODDEF
#define _IO_FILEIO_TRUNCATE_METHODDEF
#endif /* !defined(_IO_FILEIO_TRUNCATE_METHODDEF) */
-/*[clinic end generated code: output=e3d9446b4087020e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=287b778e8b575c06 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_io/clinic/iobase.c.h b/contrib/tools/python3/Modules/_io/clinic/iobase.c.h
index a35cac7dc0b..70c03bd1d5a 100644
--- a/contrib/tools/python3/Modules/_io/clinic/iobase.c.h
+++ b/contrib/tools/python3/Modules/_io/clinic/iobase.c.h
@@ -19,11 +19,13 @@ PyDoc_STRVAR(_io__IOBase_seek__doc__,
" whence\n"
" The relative position to seek from.\n"
"\n"
-"The offset is interpreted relative to the position indicated by whence.\n"
-"Values for whence are:\n"
+"The offset is interpreted relative to the position indicated by\n"
+"whence. Values for whence are:\n"
"\n"
-"* os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive\n"
-"* os.SEEK_CUR or 1 -- current stream position; offset may be negative\n"
+"* os.SEEK_SET or 0 -- start of stream (the default); offset should\n"
+" be zero or positive\n"
+"* os.SEEK_CUR or 1 -- current stream position; offset may be\n"
+" negative\n"
"* os.SEEK_END or 2 -- end of stream; offset is usually negative\n"
"\n"
"Return the new absolute position.");
@@ -102,8 +104,8 @@ PyDoc_STRVAR(_io__IOBase_truncate__doc__,
"\n"
"Truncate file to size bytes.\n"
"\n"
-"File pointer is left unchanged. Size defaults to the current IO position\n"
-"as reported by tell(). Return the new size.");
+"File pointer is left unchanged. Size defaults to the current IO\n"
+"position as reported by tell(). Return the new size.");
#define _IO__IOBASE_TRUNCATE_METHODDEF \
{"truncate", _PyCFunction_CAST(_io__IOBase_truncate), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io__IOBase_truncate__doc__},
@@ -441,4 +443,4 @@ _io__RawIOBase_readall(PyObject *self, PyObject *Py_UNUSED(ignored))
{
return _io__RawIOBase_readall_impl(self);
}
-/*[clinic end generated code: output=dab5e9323d191e32 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=23596f673b4acd03 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_io/clinic/stringio.c.h b/contrib/tools/python3/Modules/_io/clinic/stringio.c.h
index e8259d26e82..cf47c2e8452 100644
--- a/contrib/tools/python3/Modules/_io/clinic/stringio.c.h
+++ b/contrib/tools/python3/Modules/_io/clinic/stringio.c.h
@@ -181,7 +181,8 @@ PyDoc_STRVAR(_io_StringIO_seek__doc__,
"\n"
"Change stream position.\n"
"\n"
-"Seek to character offset pos relative to position indicated by whence:\n"
+"Seek to character offset pos relative to position indicated by\n"
+"whence:\n"
" 0 Start of stream (the default). pos should be >= 0;\n"
" 1 Current position - pos must be 0;\n"
" 2 End of stream - pos must be 0.\n"
@@ -549,4 +550,4 @@ _io_StringIO_newlines_get(stringio *self, void *Py_UNUSED(context))
return return_value;
}
-/*[clinic end generated code: output=b16edb931e4fa548 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=499d9098fb8b603d input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_io/clinic/textio.c.h b/contrib/tools/python3/Modules/_io/clinic/textio.c.h
index efa992fca71..f35538ee75f 100644
--- a/contrib/tools/python3/Modules/_io/clinic/textio.c.h
+++ b/contrib/tools/python3/Modules/_io/clinic/textio.c.h
@@ -16,7 +16,8 @@ PyDoc_STRVAR(_io__TextIOBase_detach__doc__,
"\n"
"Separate the underlying buffer from the TextIOBase and return it.\n"
"\n"
-"After the underlying buffer has been detached, the TextIO is in an unusable state.");
+"After the underlying buffer has been detached, the TextIO is in\n"
+"an unusable state.");
#define _IO__TEXTIOBASE_DETACH_METHODDEF \
{"detach", _PyCFunction_CAST(_io__TextIOBase_detach), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io__TextIOBase_detach__doc__},
@@ -40,8 +41,8 @@ PyDoc_STRVAR(_io__TextIOBase_read__doc__,
"\n"
"Read at most size characters from stream.\n"
"\n"
-"Read from underlying buffer until we have size characters or we hit EOF.\n"
-"If size is negative or omitted, read until EOF.");
+"Read from underlying buffer until we have size characters or we hit\n"
+"EOF. If size is negative or omitted, read until EOF.");
#define _IO__TEXTIOBASE_READ_METHODDEF \
{"read", _PyCFunction_CAST(_io__TextIOBase_read), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _io__TextIOBase_read__doc__},
@@ -623,7 +624,9 @@ _io_TextIOWrapper___init__(PyObject *self, PyObject *args, PyObject *kwargs)
goto exit;
}
skip_optional_pos:
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = _io_TextIOWrapper___init___impl((textio *)self, buffer, encoding, errors, newline, line_buffering, write_through);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
@@ -919,8 +922,8 @@ PyDoc_STRVAR(_io_TextIOWrapper_tell__doc__,
"\n"
"Return the stream position as an opaque number.\n"
"\n"
-"The return value of tell() can be given as input to seek(), to restore a\n"
-"previous stream position.");
+"The return value of tell() can be given as input to seek(), to\n"
+"restore a previous stream position.");
#define _IO_TEXTIOWRAPPER_TELL_METHODDEF \
{"tell", (PyCFunction)_io_TextIOWrapper_tell, METH_NOARGS, _io_TextIOWrapper_tell__doc__},
@@ -1283,4 +1286,4 @@ _io_TextIOWrapper__CHUNK_SIZE_set(textio *self, PyObject *value, void *Py_UNUSED
return return_value;
}
-/*[clinic end generated code: output=6f78a6d99fad4893 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2d73d5adb0ce09a8 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_io/clinic/winconsoleio.c.h b/contrib/tools/python3/Modules/_io/clinic/winconsoleio.c.h
index 4696ecc5c84..8e4ae031204 100644
--- a/contrib/tools/python3/Modules/_io/clinic/winconsoleio.c.h
+++ b/contrib/tools/python3/Modules/_io/clinic/winconsoleio.c.h
@@ -46,9 +46,9 @@ PyDoc_STRVAR(_io__WindowsConsoleIO___init____doc__,
"\n"
"Open a console buffer by file descriptor.\n"
"\n"
-"The mode can be \'rb\' (default), or \'wb\' for reading or writing bytes. All\n"
-"other mode characters will be ignored. Mode \'b\' will be assumed if it is\n"
-"omitted. The *opener* parameter is always ignored.");
+"The mode can be \'rb\' (default), or \'wb\' for reading or writing\n"
+"bytes. All other mode characters will be ignored. Mode \'b\' will be\n"
+"assumed if it is omitted. The *opener* parameter is always ignored.");
static int
_io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
@@ -457,4 +457,4 @@ _io__WindowsConsoleIO_isatty(winconsoleio *self, PyObject *Py_UNUSED(ignored))
#ifndef _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#define _IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF
#endif /* !defined(_IO__WINDOWSCONSOLEIO_ISATTY_METHODDEF) */
-/*[clinic end generated code: output=2c2bc86713b21dd6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2d7f2c99f2ab3e17 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_io/fileio.c b/contrib/tools/python3/Modules/_io/fileio.c
index 65957a713b6..95219661575 100644
--- a/contrib/tools/python3/Modules/_io/fileio.c
+++ b/contrib/tools/python3/Modules/_io/fileio.c
@@ -140,13 +140,13 @@ _io.FileIO.close
Close the file.
-A closed file cannot be used for further I/O operations. close() may be
-called more than once without error.
+A closed file cannot be used for further I/O operations. close()
+may be called more than once without error.
[clinic start generated code]*/
static PyObject *
_io_FileIO_close_impl(fileio *self, PyTypeObject *cls)
-/*[clinic end generated code: output=c30cbe9d1f23ca58 input=70da49e63db7c64d]*/
+/*[clinic end generated code: output=c30cbe9d1f23ca58 input=b405751dc4163da3]*/
{
PyObject *res;
int rc;
@@ -218,22 +218,25 @@ _io.FileIO.__init__
Open a file.
The mode can be 'r' (default), 'w', 'x' or 'a' for reading,
-writing, exclusive creation or appending. The file will be created if it
-doesn't exist when opened for writing or appending; it will be truncated
-when opened for writing. A FileExistsError will be raised if it already
-exists when opened for creating. Opening a file for creating implies
-writing so this mode behaves in a similar way to 'w'.Add a '+' to the mode
-to allow simultaneous reading and writing. A custom opener can be used by
-passing a callable as *opener*. The underlying file descriptor for the file
-object is then obtained by calling opener with (*name*, *flags*).
-*opener* must return an open file descriptor (passing os.open as *opener*
-results in functionality similar to passing None).
+writing, exclusive creation or appending. The file will be created
+if it doesn't exist when opened for writing or appending; it will be
+truncated when opened for writing. A FileExistsError will be raised
+if it already exists when opened for creating. Opening a file for
+creating implies writing so this mode behaves in a similar way to
+'w'. Add a '+' to the mode to allow simultaneous reading and
+writing.
+
+A custom opener can be used by passing a callable as *opener*.
+The underlying file descriptor for the file object is then obtained
+by calling opener with (*name*, *flags*). *opener* must return
+an open file descriptor (passing os.open as *opener* results in
+functionality similar to passing None).
[clinic start generated code]*/
static int
_io_FileIO___init___impl(fileio *self, PyObject *nameobj, const char *mode,
int closefd, PyObject *opener)
-/*[clinic end generated code: output=23413f68e6484bbd input=588aac967e0ba74b]*/
+/*[clinic end generated code: output=23413f68e6484bbd input=bac4efcd8f930bf3]*/
{
#ifdef MS_WINDOWS
wchar_t *widename = NULL;
@@ -700,12 +703,13 @@ _io.FileIO.readall
Read all data from the file, returned as bytes.
In non-blocking mode, returns as much as is immediately available,
-or None if no data is available. Return an empty bytes object at EOF.
+or None if no data is available. Return an empty bytes object at
+EOF.
[clinic start generated code]*/
static PyObject *
_io_FileIO_readall_impl(fileio *self)
-/*[clinic end generated code: output=faa0292b213b4022 input=dbdc137f55602834]*/
+/*[clinic end generated code: output=faa0292b213b4022 input=92f0b7ef378a9ef4]*/
{
struct _Py_stat_struct status;
Py_off_t pos, end;
@@ -801,14 +805,14 @@ _io.FileIO.read
Read at most size bytes, returned as bytes.
-Only makes one system call, so less data may be returned than requested.
-In non-blocking mode, returns None if no data is available.
-Return an empty bytes object at EOF.
+Only makes one system call, so less data may be returned than
+requested. In non-blocking mode, returns None if no data is
+available. Return an empty bytes object at EOF.
[clinic start generated code]*/
static PyObject *
_io_FileIO_read_impl(fileio *self, PyTypeObject *cls, Py_ssize_t size)
-/*[clinic end generated code: output=bbd749c7c224143e input=f613d2057e4a1918]*/
+/*[clinic end generated code: output=bbd749c7c224143e input=5a5d6d3651fcbdc8]*/
{
char *ptr;
Py_ssize_t n;
@@ -864,13 +868,13 @@ _io.FileIO.write
Write buffer b to file, return number of bytes written.
Only makes one system call, so not all of the data may be written.
-The number of bytes actually written is returned. In non-blocking mode,
-returns None if the write would block.
+The number of bytes actually written is returned. In non-blocking
+mode, returns None if the write would block.
[clinic start generated code]*/
static PyObject *
_io_FileIO_write_impl(fileio *self, PyTypeObject *cls, Py_buffer *b)
-/*[clinic end generated code: output=927e25be80f3b77b input=2776314f043088f5]*/
+/*[clinic end generated code: output=927e25be80f3b77b input=233f1f70f9e8b09e]*/
{
Py_ssize_t n;
int err;
@@ -971,18 +975,19 @@ _io.FileIO.seek
Move to new file position and return the file position.
-Argument offset is a byte count. Optional argument whence defaults to
-SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values
-are SEEK_CUR or 1 (move relative to current position, positive or negative),
-and SEEK_END or 2 (move relative to end of file, usually negative, although
-many platforms allow seeking beyond the end of a file).
+Argument offset is a byte count. Optional argument whence defaults
+to SEEK_SET or 0 (offset from start of file, offset should be >= 0);
+other values are SEEK_CUR or 1 (move relative to current position,
+positive or negative), and SEEK_END or 2 (move relative to end of
+file, usually negative, although many platforms allow seeking beyond
+the end of a file).
Note that not all file objects are seekable.
[clinic start generated code]*/
static PyObject *
_io_FileIO_seek_impl(fileio *self, PyObject *pos, int whence)
-/*[clinic end generated code: output=c976acdf054e6655 input=0439194b0774d454]*/
+/*[clinic end generated code: output=c976acdf054e6655 input=f165a1b4f5d494ad]*/
{
if (self->fd < 0)
return err_closed();
diff --git a/contrib/tools/python3/Modules/_io/iobase.c b/contrib/tools/python3/Modules/_io/iobase.c
index 618652b371a..bbf54dda448 100644
--- a/contrib/tools/python3/Modules/_io/iobase.c
+++ b/contrib/tools/python3/Modules/_io/iobase.c
@@ -100,11 +100,13 @@ _io._IOBase.seek
Change the stream position to the given byte offset.
-The offset is interpreted relative to the position indicated by whence.
-Values for whence are:
+The offset is interpreted relative to the position indicated by
+whence. Values for whence are:
-* os.SEEK_SET or 0 -- start of stream (the default); offset should be zero or positive
-* os.SEEK_CUR or 1 -- current stream position; offset may be negative
+* os.SEEK_SET or 0 -- start of stream (the default); offset should
+ be zero or positive
+* os.SEEK_CUR or 1 -- current stream position; offset may be
+ negative
* os.SEEK_END or 2 -- end of stream; offset is usually negative
Return the new absolute position.
@@ -113,7 +115,7 @@ Return the new absolute position.
static PyObject *
_io__IOBase_seek_impl(PyObject *self, PyTypeObject *cls,
int Py_UNUSED(offset), int Py_UNUSED(whence))
-/*[clinic end generated code: output=8bd74ea6538ded53 input=74211232b363363e]*/
+/*[clinic end generated code: output=8bd74ea6538ded53 input=22eaf07a7a0ee289]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return iobase_unsupported(state, "seek");
@@ -140,14 +142,14 @@ _io._IOBase.truncate
Truncate file to size bytes.
-File pointer is left unchanged. Size defaults to the current IO position
-as reported by tell(). Return the new size.
+File pointer is left unchanged. Size defaults to the current IO
+position as reported by tell(). Return the new size.
[clinic start generated code]*/
static PyObject *
_io__IOBase_truncate_impl(PyObject *self, PyTypeObject *cls,
PyObject *Py_UNUSED(size))
-/*[clinic end generated code: output=2013179bff1fe8ef input=660ac20936612c27]*/
+/*[clinic end generated code: output=2013179bff1fe8ef input=5b3b6ab3c7abd806]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return iobase_unsupported(state, "truncate");
diff --git a/contrib/tools/python3/Modules/_io/stringio.c b/contrib/tools/python3/Modules/_io/stringio.c
index e4c39a0a905..f0244f0fc56 100644
--- a/contrib/tools/python3/Modules/_io/stringio.c
+++ b/contrib/tools/python3/Modules/_io/stringio.c
@@ -480,7 +480,8 @@ _io.StringIO.seek
Change stream position.
-Seek to character offset pos relative to position indicated by whence:
+Seek to character offset pos relative to position indicated by
+whence:
0 Start of stream (the default). pos should be >= 0;
1 Current position - pos must be 0;
2 End of stream - pos must be 0.
@@ -489,7 +490,7 @@ Returns the new absolute position.
static PyObject *
_io_StringIO_seek_impl(stringio *self, Py_ssize_t pos, int whence)
-/*[clinic end generated code: output=e9e0ac9a8ae71c25 input=c75ced09343a00d7]*/
+/*[clinic end generated code: output=e9e0ac9a8ae71c25 input=ffef24668fd71a5d]*/
{
CHECK_INITIALIZED(self);
CHECK_CLOSED(self);
diff --git a/contrib/tools/python3/Modules/_io/textio.c b/contrib/tools/python3/Modules/_io/textio.c
index db6c709c00c..d093514aa66 100644
--- a/contrib/tools/python3/Modules/_io/textio.c
+++ b/contrib/tools/python3/Modules/_io/textio.c
@@ -58,12 +58,13 @@ _io._TextIOBase.detach
Separate the underlying buffer from the TextIOBase and return it.
-After the underlying buffer has been detached, the TextIO is in an unusable state.
+After the underlying buffer has been detached, the TextIO is in
+an unusable state.
[clinic start generated code]*/
static PyObject *
_io__TextIOBase_detach_impl(PyObject *self, PyTypeObject *cls)
-/*[clinic end generated code: output=50915f40c609eaa4 input=987ca3640d0a3776]*/
+/*[clinic end generated code: output=50915f40c609eaa4 input=8099c088abcb87d8]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return _unsupported(state, "detach");
@@ -77,14 +78,14 @@ _io._TextIOBase.read
Read at most size characters from stream.
-Read from underlying buffer until we have size characters or we hit EOF.
-If size is negative or omitted, read until EOF.
+Read from underlying buffer until we have size characters or we hit
+EOF. If size is negative or omitted, read until EOF.
[clinic start generated code]*/
static PyObject *
_io__TextIOBase_read_impl(PyObject *self, PyTypeObject *cls,
int Py_UNUSED(size))
-/*[clinic end generated code: output=51a5178a309ce647 input=f5e37720f9fc563f]*/
+/*[clinic end generated code: output=51a5178a309ce647 input=c9fd4cc1cf1b4614]*/
{
_PyIO_State *state = get_io_state_by_cls(cls);
return _unsupported(state, "read");
@@ -1048,6 +1049,7 @@ io_check_errors(PyObject *errors)
/*[clinic input]
+@critical_section
_io.TextIOWrapper.__init__
buffer: object
encoding: str(accept={str, NoneType}) = None
@@ -1091,7 +1093,7 @@ _io_TextIOWrapper___init___impl(textio *self, PyObject *buffer,
const char *encoding, PyObject *errors,
const char *newline, int line_buffering,
int write_through)
-/*[clinic end generated code: output=72267c0c01032ed2 input=e6cfaaaf6059d4f5]*/
+/*[clinic end generated code: output=72267c0c01032ed2 input=0f077220214c40a4]*/
{
PyObject *raw, *codec_info = NULL;
PyObject *res;
@@ -2707,13 +2709,13 @@ _io.TextIOWrapper.tell
Return the stream position as an opaque number.
-The return value of tell() can be given as input to seek(), to restore a
-previous stream position.
+The return value of tell() can be given as input to seek(), to
+restore a previous stream position.
[clinic start generated code]*/
static PyObject *
_io_TextIOWrapper_tell_impl(textio *self)
-/*[clinic end generated code: output=4f168c08bf34ad5f input=415d6b4e4f8e6e8c]*/
+/*[clinic end generated code: output=4f168c08bf34ad5f input=aeece020f747fd92]*/
{
PyObject *res;
PyObject *posobj = NULL;
diff --git a/contrib/tools/python3/Modules/_io/winconsoleio.c b/contrib/tools/python3/Modules/_io/winconsoleio.c
index 008f8bf1188..5337cf4918f 100644
--- a/contrib/tools/python3/Modules/_io/winconsoleio.c
+++ b/contrib/tools/python3/Modules/_io/winconsoleio.c
@@ -313,16 +313,16 @@ _io._WindowsConsoleIO.__init__
Open a console buffer by file descriptor.
-The mode can be 'rb' (default), or 'wb' for reading or writing bytes. All
-other mode characters will be ignored. Mode 'b' will be assumed if it is
-omitted. The *opener* parameter is always ignored.
+The mode can be 'rb' (default), or 'wb' for reading or writing
+bytes. All other mode characters will be ignored. Mode 'b' will be
+assumed if it is omitted. The *opener* parameter is always ignored.
[clinic start generated code]*/
static int
_io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj,
const char *mode, int closefd,
PyObject *opener)
-/*[clinic end generated code: output=3fd9cbcdd8d95429 input=7a3eed6bbe998fd9]*/
+/*[clinic end generated code: output=3fd9cbcdd8d95429 input=f31100e2cd724617]*/
{
const char *s;
wchar_t *name = NULL;
@@ -669,12 +669,13 @@ read_console_w(HANDLE handle, DWORD maxlen, DWORD *readlen) {
maxlen += 1;
Py_BLOCK_THREADS
newbuf = (wchar_t*)PyMem_Realloc(buf, maxlen * sizeof(wchar_t));
- Py_UNBLOCK_THREADS
if (!newbuf) {
sig = -1;
PyErr_NoMemory();
+ Py_UNBLOCK_THREADS
break;
}
+ Py_UNBLOCK_THREADS
buf = newbuf;
/* Only advance by n and not BUFSIZ in this case */
off += n;
diff --git a/contrib/tools/python3/Modules/_json.c b/contrib/tools/python3/Modules/_json.c
index afefc71bfbd..25cbd9b9bb8 100644
--- a/contrib/tools/python3/Modules/_json.c
+++ b/contrib/tools/python3/Modules/_json.c
@@ -1602,9 +1602,13 @@ encoder_listencode_dict(PyEncoderObject *s, _PyUnicodeWriter *writer,
for (Py_ssize_t i = 0; i < PyList_GET_SIZE(items); i++) {
PyObject *item = PyList_GET_ITEM(items, i);
+ // gh-142831: encoder_encode_key_value() can invoke user code
+ // that mutates the items list, invalidating this borrowed ref.
+ Py_INCREF(item);
if (!PyTuple_Check(item) || PyTuple_GET_SIZE(item) != 2) {
PyErr_SetString(PyExc_ValueError, "items must return 2-tuples");
+ Py_DECREF(item);
goto bail;
}
@@ -1612,18 +1616,30 @@ encoder_listencode_dict(PyEncoderObject *s, _PyUnicodeWriter *writer,
value = PyTuple_GET_ITEM(item, 1);
if (encoder_encode_key_value(s, writer, &first, key, value,
new_newline_indent,
- current_item_separator) < 0)
+ current_item_separator) < 0) {
+ Py_DECREF(item);
goto bail;
+ }
+ Py_DECREF(item);
}
Py_CLEAR(items);
} else {
Py_ssize_t pos = 0;
while (PyDict_Next(dct, &pos, &key, &value)) {
+ // gh-142831: encoder_encode_key_value() can invoke user code
+ // that mutates the dict, invalidating these borrowed refs.
+ Py_INCREF(key);
+ Py_INCREF(value);
if (encoder_encode_key_value(s, writer, &first, key, value,
new_newline_indent,
- current_item_separator) < 0)
+ current_item_separator) < 0) {
+ Py_DECREF(key);
+ Py_DECREF(value);
goto bail;
+ }
+ Py_DECREF(key);
+ Py_DECREF(value);
}
}
@@ -1712,12 +1728,20 @@ encoder_listencode_list(PyEncoderObject *s, _PyUnicodeWriter *writer,
}
for (i = 0; i < PySequence_Fast_GET_SIZE(s_fast); i++) {
PyObject *obj = PySequence_Fast_GET_ITEM(s_fast, i);
+ // gh-142831: encoder_listencode_obj() can invoke user code
+ // that mutates the sequence, invalidating this borrowed ref.
+ Py_INCREF(obj);
if (i) {
- if (_PyUnicodeWriter_WriteStr(writer, separator) < 0)
+ if (_PyUnicodeWriter_WriteStr(writer, separator) < 0) {
+ Py_DECREF(obj);
goto bail;
+ }
}
- if (encoder_listencode_obj(s, writer, obj, new_newline_indent))
+ if (encoder_listencode_obj(s, writer, obj, new_newline_indent)) {
+ Py_DECREF(obj);
goto bail;
+ }
+ Py_DECREF(obj);
}
if (ident != NULL) {
if (PyDict_DelItem(s->markers, ident))
diff --git a/contrib/tools/python3/Modules/_lzmamodule.c b/contrib/tools/python3/Modules/_lzmamodule.c
index 97f3a8f03da..c4ad5dfbb3f 100644
--- a/contrib/tools/python3/Modules/_lzmamodule.c
+++ b/contrib/tools/python3/Modules/_lzmamodule.c
@@ -1112,6 +1112,7 @@ decompress(Decompressor *d, uint8_t *data, size_t len, Py_ssize_t max_length)
return result;
error:
+ lzs->next_in = NULL;
Py_XDECREF(result);
return NULL;
}
@@ -1124,24 +1125,25 @@ _lzma.LZMADecompressor.decompress
Decompress *data*, returning uncompressed data as bytes.
-If *max_length* is nonnegative, returns at most *max_length* bytes of
-decompressed data. If this limit is reached and further output can be
-produced, *self.needs_input* will be set to ``False``. In this case, the next
-call to *decompress()* may provide *data* as b'' to obtain more of the output.
+If *max_length* is nonnegative, returns at most *max_length* bytes
+of decompressed data. If this limit is reached and further output
+can be produced, *self.needs_input* will be set to ``False``. In
+this case, the next call to *decompress()* may provide *data* as b''
+to obtain more of the output.
-If all of the input data was decompressed and returned (either because this
-was less than *max_length* bytes, or because *max_length* was negative),
-*self.needs_input* will be set to True.
+If all of the input data was decompressed and returned (either
+because this was less than *max_length* bytes, or because
+*max_length* was negative), *self.needs_input* will be set to True.
-Attempting to decompress data after the end of stream is reached raises an
-EOFError. Any data found after the end of the stream is ignored and saved in
-the unused_data attribute.
+Attempting to decompress data after the end of stream is reached
+raises an EOFError. Any data found after the end of the stream is
+ignored and saved in the unused_data attribute.
[clinic start generated code]*/
static PyObject *
_lzma_LZMADecompressor_decompress_impl(Decompressor *self, Py_buffer *data,
Py_ssize_t max_length)
-/*[clinic end generated code: output=ef4e20ec7122241d input=60c1f135820e309d]*/
+/*[clinic end generated code: output=ef4e20ec7122241d input=0eb62669c4315dee]*/
{
PyObject *result = NULL;
diff --git a/contrib/tools/python3/Modules/_multiprocessing/clinic/posixshmem.c.h b/contrib/tools/python3/Modules/_multiprocessing/clinic/posixshmem.c.h
index 1b894ea4c67..5913c379524 100644
--- a/contrib/tools/python3/Modules/_multiprocessing/clinic/posixshmem.c.h
+++ b/contrib/tools/python3/Modules/_multiprocessing/clinic/posixshmem.c.h
@@ -50,9 +50,9 @@ PyDoc_STRVAR(_posixshmem_shm_unlink__doc__,
"\n"
"Remove a shared memory object (similar to unlink()).\n"
"\n"
-"Remove a shared memory object name, and, once all processes have unmapped\n"
-"the object, de-allocates and destroys the contents of the associated memory\n"
-"region.");
+"Remove a shared memory object name, and, once all processes have\n"
+"unmapped the object, de-allocates and destroys the contents of the\n"
+"associated memory region.");
#define _POSIXSHMEM_SHM_UNLINK_METHODDEF \
{"shm_unlink", (PyCFunction)(void(*)(void))_posixshmem_shm_unlink, METH_VARARGS|METH_KEYWORDS, _posixshmem_shm_unlink__doc__},
@@ -85,4 +85,4 @@ exit:
#ifndef _POSIXSHMEM_SHM_UNLINK_METHODDEF
#define _POSIXSHMEM_SHM_UNLINK_METHODDEF
#endif /* !defined(_POSIXSHMEM_SHM_UNLINK_METHODDEF) */
-/*[clinic end generated code: output=be0661dbed83ea23 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=12fb6a177b317c7f input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_multiprocessing/posixshmem.c b/contrib/tools/python3/Modules/_multiprocessing/posixshmem.c
index aeb2d79de6f..f352ceb916c 100644
--- a/contrib/tools/python3/Modules/_multiprocessing/posixshmem.c
+++ b/contrib/tools/python3/Modules/_multiprocessing/posixshmem.c
@@ -80,15 +80,15 @@ _posixshmem.shm_unlink
Remove a shared memory object (similar to unlink()).
-Remove a shared memory object name, and, once all processes have unmapped
-the object, de-allocates and destroys the contents of the associated memory
-region.
+Remove a shared memory object name, and, once all processes have
+unmapped the object, de-allocates and destroys the contents of the
+associated memory region.
[clinic start generated code]*/
static PyObject *
_posixshmem_shm_unlink_impl(PyObject *module, PyObject *path)
-/*[clinic end generated code: output=42f8b23d134b9ff5 input=8dc0f87143e3b300]*/
+/*[clinic end generated code: output=42f8b23d134b9ff5 input=239da7d9ea49e7db]*/
{
int rv;
int async_err = 0;
diff --git a/contrib/tools/python3/Modules/_opcode.c b/contrib/tools/python3/Modules/_opcode.c
index 4bf63932d22..241d68f3b88 100644
--- a/contrib/tools/python3/Modules/_opcode.c
+++ b/contrib/tools/python3/Modules/_opcode.c
@@ -118,7 +118,6 @@ _opcode_has_const_impl(PyObject *module, int opcode)
}
/*[clinic input]
-
_opcode.has_name -> bool
opcode: int
@@ -128,7 +127,7 @@ Return True if the opcode accesses an attribute by name, False otherwise.
static int
_opcode_has_name_impl(PyObject *module, int opcode)
-/*[clinic end generated code: output=b49a83555c2fa517 input=448aa5e4bcc947ba]*/
+/*[clinic end generated code: output=b49a83555c2fa517 input=3032469628dd0849]*/
{
return _PyCompile_OpcodeIsValid(opcode) &&
_PyCompile_OpcodeHasName(opcode);
diff --git a/contrib/tools/python3/Modules/_posixsubprocess.c b/contrib/tools/python3/Modules/_posixsubprocess.c
index 0a7ef74e26f..eef2743f392 100644
--- a/contrib/tools/python3/Modules/_posixsubprocess.c
+++ b/contrib/tools/python3/Modules/_posixsubprocess.c
@@ -988,15 +988,15 @@ _posixsubprocess.fork_exec as subprocess_fork_exec
Spawn a fresh new child process.
-Fork a child process, close parent file descriptors as appropriate in the
-child and duplicate the few that are needed before calling exec() in the
-child process.
+Fork a child process, close parent file descriptors as appropriate in
+the child and duplicate the few that are needed before calling exec() in
+the child process.
-If close_fds is True, close file descriptors 3 and higher, except those listed
-in the sorted tuple pass_fds.
+If close_fds is True, close file descriptors 3 and higher, except those
+listed in the sorted tuple pass_fds.
-The preexec_fn, if supplied, will be called immediately before closing file
-descriptors and exec.
+The preexec_fn, if supplied, will be called immediately before closing
+file descriptors and exec.
WARNING: preexec_fn is NOT SAFE if your application uses threads.
It may trigger infrequent, difficult to debug deadlocks.
@@ -1021,7 +1021,7 @@ subprocess_fork_exec_impl(PyObject *module, PyObject *process_args,
PyObject *extra_groups_packed,
PyObject *uid_object, int child_umask,
PyObject *preexec_fn, int allow_vfork)
-/*[clinic end generated code: output=7ee4f6ee5cf22b5b input=51757287ef266ffa]*/
+/*[clinic end generated code: output=7ee4f6ee5cf22b5b input=53eb802a43d5c5fc]*/
{
PyObject *converted_args = NULL, *fast_args = NULL;
PyObject *preexec_fn_args_tuple = NULL;
diff --git a/contrib/tools/python3/Modules/_queuemodule.c b/contrib/tools/python3/Modules/_queuemodule.c
index 9f1c9a1b0d4..4ac43748fdd 100644
--- a/contrib/tools/python3/Modules/_queuemodule.c
+++ b/contrib/tools/python3/Modules/_queuemodule.c
@@ -290,15 +290,16 @@ _queue.SimpleQueue.put
Put the item on the queue.
-The optional 'block' and 'timeout' arguments are ignored, as this method
-never blocks. They are provided for compatibility with the Queue class.
+The optional 'block' and 'timeout' arguments are ignored, as this
+method never blocks. They are provided for compatibility with the
+Queue class.
[clinic start generated code]*/
static PyObject *
_queue_SimpleQueue_put_impl(simplequeueobject *self, PyObject *item,
int block, PyObject *timeout)
-/*[clinic end generated code: output=4333136e88f90d8b input=a16dbb33363c0fa8]*/
+/*[clinic end generated code: output=4333136e88f90d8b input=9f9ff270a74670c3]*/
{
HandoffData data = {
.handed_off = 0,
@@ -358,10 +359,11 @@ _queue.SimpleQueue.get
Remove and return an item from the queue.
-If optional args 'block' is true and 'timeout' is None (the default),
-block if necessary until an item is available. If 'timeout' is
-a non-negative number, it blocks at most 'timeout' seconds and raises
-the Empty exception if no item was available within that time.
+If optional args 'block' is true and 'timeout' is None (the
+default), block if necessary until an item is available. If
+'timeout' is a non-negative number, it blocks at most 'timeout'
+seconds and raises the Empty exception if no item was available
+within that time.
Otherwise ('block' is false), return an item if one is immediately
available, else raise the Empty exception ('timeout' is ignored
in that case).
@@ -371,7 +373,7 @@ in that case).
static PyObject *
_queue_SimpleQueue_get_impl(simplequeueobject *self, PyTypeObject *cls,
int block, PyObject *timeout_obj)
-/*[clinic end generated code: output=5c2cca914cd1e55b input=f7836c65e5839c51]*/
+/*[clinic end generated code: output=5c2cca914cd1e55b input=afa0889bbc6b4761]*/
{
PyTime_t endtime = 0;
@@ -529,7 +531,7 @@ static PyMethodDef simplequeue_methods[] = {
_QUEUE_SIMPLEQUEUE_PUT_NOWAIT_METHODDEF
_QUEUE_SIMPLEQUEUE_QSIZE_METHODDEF
{"__class_getitem__", Py_GenericAlias,
- METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ METH_O|METH_CLASS, PyDoc_STR("SimpleQueues are generic over the type of their contents")},
{NULL, NULL} /* sentinel */
};
diff --git a/contrib/tools/python3/Modules/_sqlite/blob.c b/contrib/tools/python3/Modules/_sqlite/blob.c
index 4db1ac474ef..c09c8582f89 100644
--- a/contrib/tools/python3/Modules/_sqlite/blob.c
+++ b/contrib/tools/python3/Modules/_sqlite/blob.c
@@ -167,14 +167,14 @@ _sqlite3.Blob.read as blob_read
Read data at the current offset position.
-If the end of the blob is reached, the data up to end of file will be returned.
-When length is not specified, or is negative, Blob.read() will read until the
-end of the blob.
+If the end of the blob is reached, the data up to end of file will
+be returned. When length is not specified, or is negative,
+Blob.read() will read until the end of the blob.
[clinic start generated code]*/
static PyObject *
blob_read_impl(pysqlite_Blob *self, int length)
-/*[clinic end generated code: output=1fc99b2541360dde input=f2e4aa4378837250]*/
+/*[clinic end generated code: output=1fc99b2541360dde input=6b745ad37720e556]*/
{
if (!check_blob(self)) {
return NULL;
@@ -234,13 +234,13 @@ _sqlite3.Blob.write as blob_write
Write data at the current offset.
-This function cannot change the blob length. Writing beyond the end of the
-blob will result in an exception being raised.
+This function cannot change the blob length. Writing beyond the end
+of the blob will result in an exception being raised.
[clinic start generated code]*/
static PyObject *
blob_write_impl(pysqlite_Blob *self, Py_buffer *data)
-/*[clinic end generated code: output=b34cf22601b570b2 input=a84712f24a028e6d]*/
+/*[clinic end generated code: output=b34cf22601b570b2 input=0d372cb0240a5d49]*/
{
if (!check_blob(self)) {
return NULL;
@@ -264,14 +264,15 @@ _sqlite3.Blob.seek as blob_seek
Set the current access position to offset.
-The origin argument defaults to os.SEEK_SET (absolute blob positioning).
-Other values for origin are os.SEEK_CUR (seek relative to the current position)
-and os.SEEK_END (seek relative to the blob's end).
+The origin argument defaults to os.SEEK_SET (absolute blob
+positioning). Other values for origin are os.SEEK_CUR (seek
+relative to the current position) and os.SEEK_END (seek relative to
+the blob's end).
[clinic start generated code]*/
static PyObject *
blob_seek_impl(pysqlite_Blob *self, int offset, int origin)
-/*[clinic end generated code: output=854c5a0e208547a5 input=5da9a07e55fe6bb6]*/
+/*[clinic end generated code: output=854c5a0e208547a5 input=84aea1b6b48607dd]*/
{
if (!check_blob(self)) {
return NULL;
@@ -516,21 +517,25 @@ ass_subscript_slice(pysqlite_Blob *self, PyObject *item, PyObject *value)
return -1;
}
- if (len == 0) {
- return 0;
- }
-
Py_buffer vbuf;
if (PyObject_GetBuffer(value, &vbuf, PyBUF_SIMPLE) < 0) {
return -1;
}
- int rc = -1;
if (vbuf.len != len) {
PyErr_SetString(PyExc_IndexError,
"Blob slice assignment is wrong size");
+ PyBuffer_Release(&vbuf);
+ return -1;
}
- else if (step == 1) {
+
+ if (len == 0) {
+ PyBuffer_Release(&vbuf);
+ return 0;
+ }
+
+ int rc = -1;
+ if (step == 1) {
rc = inner_write(self, vbuf.buf, len, start);
}
else {
diff --git a/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h b/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h
index b95ba948aaf..bfafcf05410 100644
--- a/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h
+++ b/contrib/tools/python3/Modules/_sqlite/clinic/blob.c.h
@@ -31,9 +31,9 @@ PyDoc_STRVAR(blob_read__doc__,
" length\n"
" Read length in bytes.\n"
"\n"
-"If the end of the blob is reached, the data up to end of file will be returned.\n"
-"When length is not specified, or is negative, Blob.read() will read until the\n"
-"end of the blob.");
+"If the end of the blob is reached, the data up to end of file will\n"
+"be returned. When length is not specified, or is negative,\n"
+"Blob.read() will read until the end of the blob.");
#define BLOB_READ_METHODDEF \
{"read", _PyCFunction_CAST(blob_read), METH_FASTCALL, blob_read__doc__},
@@ -70,8 +70,8 @@ PyDoc_STRVAR(blob_write__doc__,
"\n"
"Write data at the current offset.\n"
"\n"
-"This function cannot change the blob length. Writing beyond the end of the\n"
-"blob will result in an exception being raised.");
+"This function cannot change the blob length. Writing beyond the end\n"
+"of the blob will result in an exception being raised.");
#define BLOB_WRITE_METHODDEF \
{"write", (PyCFunction)blob_write, METH_O, blob_write__doc__},
@@ -105,9 +105,10 @@ PyDoc_STRVAR(blob_seek__doc__,
"\n"
"Set the current access position to offset.\n"
"\n"
-"The origin argument defaults to os.SEEK_SET (absolute blob positioning).\n"
-"Other values for origin are os.SEEK_CUR (seek relative to the current position)\n"
-"and os.SEEK_END (seek relative to the blob\'s end).");
+"The origin argument defaults to os.SEEK_SET (absolute blob\n"
+"positioning). Other values for origin are os.SEEK_CUR (seek\n"
+"relative to the current position) and os.SEEK_END (seek relative to\n"
+"the blob\'s end).");
#define BLOB_SEEK_METHODDEF \
{"seek", _PyCFunction_CAST(blob_seek), METH_FASTCALL, blob_seek__doc__},
@@ -211,4 +212,4 @@ blob_exit(pysqlite_Blob *self, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=31abd55660e0c5af input=a9049054013a1b77]*/
+/*[clinic end generated code: output=45168bcaeea61140 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h b/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h
index c44b761aca6..4eede407f9a 100644
--- a/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h
+++ b/contrib/tools/python3/Modules/_sqlite/clinic/connection.c.h
@@ -799,13 +799,14 @@ PyDoc_STRVAR(pysqlite_connection_set_progress_handler__doc__,
"\n"
" progress_handler\n"
" A callable that takes no arguments.\n"
-" If the callable returns non-zero, the current query is terminated,\n"
-" and an exception is raised.\n"
+" If the callable returns non-zero, the current query is\n"
+" terminated, and an exception is raised.\n"
" n\n"
" The number of SQLite virtual machine instructions that are\n"
" executed between invocations of \'progress_handler\'.\n"
"\n"
-"If \'progress_handler\' is None or \'n\' is 0, the progress handler is disabled.\n"
+"If \'progress_handler\' is None or \'n\' is 0, the progress handler is\n"
+"disabled.\n"
"\n"
"Note: Passing keyword argument \'progress_handler\' to\n"
"_sqlite3.Connection.set_progress_handler() is deprecated. Parameter\n"
@@ -1453,10 +1454,10 @@ PyDoc_STRVAR(serialize__doc__,
" name\n"
" Which database to serialize.\n"
"\n"
-"For an ordinary on-disk database file, the serialization is just a copy of the\n"
-"disk file. For an in-memory database or a \"temp\" database, the serialization is\n"
-"the same sequence of bytes which would be written to disk if that database\n"
-"were backed up to disk.");
+"For an ordinary on-disk database file, the serialization is just\n"
+"a copy of the disk file. For an in-memory database or a \"temp\"\n"
+"database, the serialization is the same sequence of bytes which\n"
+"would be written to disk if that database were backed up to disk.");
#define SERIALIZE_METHODDEF \
{"serialize", _PyCFunction_CAST(serialize), METH_FASTCALL|METH_KEYWORDS, serialize__doc__},
@@ -1539,12 +1540,13 @@ PyDoc_STRVAR(deserialize__doc__,
" name\n"
" Which database to reopen with the deserialization.\n"
"\n"
-"The deserialize interface causes the database connection to disconnect from the\n"
-"target database, and then reopen it as an in-memory database based on the given\n"
-"serialized data.\n"
+"The deserialize interface causes the database connection to\n"
+"disconnect from the target database, and then reopen it as\n"
+"an in-memory database based on the given serialized data.\n"
"\n"
-"The deserialize interface will fail with SQLITE_BUSY if the database is\n"
-"currently in a read transaction or is involved in a backup operation.");
+"The deserialize interface will fail with SQLITE_BUSY if the database\n"
+"is currently in a read transaction or is involved in a backup\n"
+"operation.");
#define DESERIALIZE_METHODDEF \
{"deserialize", _PyCFunction_CAST(deserialize), METH_FASTCALL|METH_KEYWORDS, deserialize__doc__},
@@ -1662,7 +1664,8 @@ PyDoc_STRVAR(pysqlite_connection_exit__doc__,
"\n"
"Called when the connection is used as a context manager.\n"
"\n"
-"If there was any exception, a rollback takes place; otherwise we commit.");
+"If there was any exception, a rollback takes place; otherwise we\n"
+"commit.");
#define PYSQLITE_CONNECTION_EXIT_METHODDEF \
{"__exit__", _PyCFunction_CAST(pysqlite_connection_exit), METH_FASTCALL, pysqlite_connection_exit__doc__},
@@ -1700,12 +1703,12 @@ PyDoc_STRVAR(setlimit__doc__,
" category\n"
" The limit category to be set.\n"
" limit\n"
-" The new limit. If the new limit is a negative number, the limit is\n"
-" unchanged.\n"
+" The new limit. If the new limit is a negative number, the limit\n"
+" is unchanged.\n"
"\n"
-"Attempts to increase a limit above its hard upper bound are silently truncated\n"
-"to the hard upper bound. Regardless of whether or not the limit was changed,\n"
-"the prior value of the limit is returned.");
+"Attempts to increase a limit above its hard upper bound are silently\n"
+"truncated to the hard upper bound. Regardless of whether or not the\n"
+"limit was changed, the prior value of the limit is returned.");
#define SETLIMIT_METHODDEF \
{"setlimit", _PyCFunction_CAST(setlimit), METH_FASTCALL, setlimit__doc__},
@@ -1866,4 +1869,4 @@ exit:
#ifndef DESERIALIZE_METHODDEF
#define DESERIALIZE_METHODDEF
#endif /* !defined(DESERIALIZE_METHODDEF) */
-/*[clinic end generated code: output=fa34f4c5f8837a7c input=a9049054013a1b77]*/
+/*[clinic end generated code: output=5e0bcef289eb64cc input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_sqlite/connection.c b/contrib/tools/python3/Modules/_sqlite/connection.c
index 5f888ac19ec..bf5307ffac8 100644
--- a/contrib/tools/python3/Modules/_sqlite/connection.c
+++ b/contrib/tools/python3/Modules/_sqlite/connection.c
@@ -570,6 +570,47 @@ pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory)
return cursor;
}
+static PyObject *
+connection_get_row_factory(PyObject *op, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ return Py_NewRef(self->row_factory);
+}
+
+static int
+connection_set_row_factory(PyObject *op, PyObject *value, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ if (value == NULL) {
+ PyErr_SetString(PyExc_AttributeError,
+ "cannot delete row_factory attribute");
+ return -1;
+ }
+ Py_XSETREF(self->row_factory, Py_NewRef(value));
+ return 0;
+}
+
+static PyObject *
+connection_get_text_factory(PyObject *op, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ return Py_NewRef(self->text_factory);
+}
+
+static int
+connection_set_text_factory(PyObject *op, PyObject *value, void *closure)
+{
+ pysqlite_Connection *self = (pysqlite_Connection *)op;
+ if (value == NULL) {
+ PyErr_SetString(PyExc_AttributeError,
+ "cannot delete text_factory attribute");
+ return -1;
+ }
+ Py_XSETREF(self->text_factory, Py_NewRef(value));
+ return 0;
+}
+
+
/*[clinic input]
_sqlite3.Connection.blobopen as blobopen
@@ -1590,8 +1631,8 @@ _sqlite3.Connection.set_progress_handler as pysqlite_connection_set_progress_han
cls: defining_class
progress_handler as callable: object
A callable that takes no arguments.
- If the callable returns non-zero, the current query is terminated,
- and an exception is raised.
+ If the callable returns non-zero, the current query is
+ terminated, and an exception is raised.
/ [from 3.15]
n: int
The number of SQLite virtual machine instructions that are
@@ -1599,14 +1640,15 @@ _sqlite3.Connection.set_progress_handler as pysqlite_connection_set_progress_han
Set progress handler callback.
-If 'progress_handler' is None or 'n' is 0, the progress handler is disabled.
+If 'progress_handler' is None or 'n' is 0, the progress handler is
+disabled.
[clinic start generated code]*/
static PyObject *
pysqlite_connection_set_progress_handler_impl(pysqlite_Connection *self,
PyTypeObject *cls,
PyObject *callable, int n)
-/*[clinic end generated code: output=0739957fd8034a50 input=b4d6e2ef8b4d32f9]*/
+/*[clinic end generated code: output=0739957fd8034a50 input=d46887797f0c0ecf]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2234,15 +2276,15 @@ _sqlite3.Connection.serialize as serialize
Serialize a database into a byte string.
-For an ordinary on-disk database file, the serialization is just a copy of the
-disk file. For an in-memory database or a "temp" database, the serialization is
-the same sequence of bytes which would be written to disk if that database
-were backed up to disk.
+For an ordinary on-disk database file, the serialization is just
+a copy of the disk file. For an in-memory database or a "temp"
+database, the serialization is the same sequence of bytes which
+would be written to disk if that database were backed up to disk.
[clinic start generated code]*/
static PyObject *
serialize_impl(pysqlite_Connection *self, const char *name)
-/*[clinic end generated code: output=97342b0e55239dd3 input=d2eb5194a65abe2b]*/
+/*[clinic end generated code: output=97342b0e55239dd3 input=7e48654e8e082fa8]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2287,18 +2329,19 @@ _sqlite3.Connection.deserialize as deserialize
Load a serialized database.
-The deserialize interface causes the database connection to disconnect from the
-target database, and then reopen it as an in-memory database based on the given
-serialized data.
+The deserialize interface causes the database connection to
+disconnect from the target database, and then reopen it as
+an in-memory database based on the given serialized data.
-The deserialize interface will fail with SQLITE_BUSY if the database is
-currently in a read transaction or is involved in a backup operation.
+The deserialize interface will fail with SQLITE_BUSY if the database
+is currently in a read transaction or is involved in a backup
+operation.
[clinic start generated code]*/
static PyObject *
deserialize_impl(pysqlite_Connection *self, Py_buffer *data,
const char *name)
-/*[clinic end generated code: output=e394c798b98bad89 input=1be4ca1faacf28f2]*/
+/*[clinic end generated code: output=e394c798b98bad89 input=5d20e028d98c0686]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2371,13 +2414,14 @@ _sqlite3.Connection.__exit__ as pysqlite_connection_exit
Called when the connection is used as a context manager.
-If there was any exception, a rollback takes place; otherwise we commit.
+If there was any exception, a rollback takes place; otherwise we
+commit.
[clinic start generated code]*/
static PyObject *
pysqlite_connection_exit_impl(pysqlite_Connection *self, PyObject *exc_type,
PyObject *exc_value, PyObject *exc_tb)
-/*[clinic end generated code: output=0705200e9321202a input=bd66f1532c9c54a7]*/
+/*[clinic end generated code: output=0705200e9321202a input=8fdb0392ee6f3466]*/
{
int commit = 0;
PyObject* result;
@@ -2417,20 +2461,20 @@ _sqlite3.Connection.setlimit as setlimit
category: int
The limit category to be set.
limit: int
- The new limit. If the new limit is a negative number, the limit is
- unchanged.
+ The new limit. If the new limit is a negative number, the limit
+ is unchanged.
/
Set connection run-time limits.
-Attempts to increase a limit above its hard upper bound are silently truncated
-to the hard upper bound. Regardless of whether or not the limit was changed,
-the prior value of the limit is returned.
+Attempts to increase a limit above its hard upper bound are silently
+truncated to the hard upper bound. Regardless of whether or not the
+limit was changed, the prior value of the limit is returned.
[clinic start generated code]*/
static PyObject *
setlimit_impl(pysqlite_Connection *self, int category, int limit)
-/*[clinic end generated code: output=0d208213f8d68ccd input=9bd469537e195635]*/
+/*[clinic end generated code: output=0d208213f8d68ccd input=5c2e430091206677]*/
{
if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
return NULL;
@@ -2628,6 +2672,10 @@ static PyGetSetDef connection_getset[] = {
{"in_transaction", (getter)pysqlite_connection_get_in_transaction, (setter)0},
{"autocommit", (getter)get_autocommit, (setter)set_autocommit},
{"__text_signature__", get_sig, (setter)0},
+ {"row_factory", connection_get_row_factory,
+ connection_set_row_factory},
+ {"text_factory", connection_get_text_factory,
+ connection_set_text_factory},
{NULL}
};
@@ -2675,8 +2723,6 @@ static struct PyMemberDef connection_members[] =
{"InternalError", _Py_T_OBJECT, offsetof(pysqlite_Connection, InternalError), Py_READONLY},
{"ProgrammingError", _Py_T_OBJECT, offsetof(pysqlite_Connection, ProgrammingError), Py_READONLY},
{"NotSupportedError", _Py_T_OBJECT, offsetof(pysqlite_Connection, NotSupportedError), Py_READONLY},
- {"row_factory", _Py_T_OBJECT, offsetof(pysqlite_Connection, row_factory)},
- {"text_factory", _Py_T_OBJECT, offsetof(pysqlite_Connection, text_factory)},
{NULL}
};
diff --git a/contrib/tools/python3/Modules/_sqlite/ya.make b/contrib/tools/python3/Modules/_sqlite/ya.make
index 56ee483669e..594b73af8c5 100644
--- a/contrib/tools/python3/Modules/_sqlite/ya.make
+++ b/contrib/tools/python3/Modules/_sqlite/ya.make
@@ -2,9 +2,9 @@
PY3_LIBRARY()
-VERSION(3.13.13)
+VERSION(3.13.14)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.13.13.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.13.14.tar.gz)
LICENSE(Python-2.0)
diff --git a/contrib/tools/python3/Modules/_sre/sre.c b/contrib/tools/python3/Modules/_sre/sre.c
index c0cc8268d2d..2a2a5f8ef9e 100644
--- a/contrib/tools/python3/Modules/_sre/sre.c
+++ b/contrib/tools/python3/Modules/_sre/sre.c
@@ -3150,7 +3150,7 @@ static PyMethodDef pattern_methods[] = {
_SRE_SRE_PATTERN___DEEPCOPY___METHODDEF
_SRE_SRE_PATTERN__FAIL_AFTER_METHODDEF
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
- PyDoc_STR("See PEP 585")},
+ PyDoc_STR("Patterns are generic over the type of string they handle (str or bytes)")},
{NULL, NULL}
};
@@ -3206,7 +3206,7 @@ static PyMethodDef match_methods[] = {
_SRE_SRE_MATCH___COPY___METHODDEF
_SRE_SRE_MATCH___DEEPCOPY___METHODDEF
{"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
- PyDoc_STR("See PEP 585")},
+ PyDoc_STR("Matches are generic over the type of string which was matched (str or bytes)")},
{NULL, NULL}
};
diff --git a/contrib/tools/python3/Modules/_ssl.c b/contrib/tools/python3/Modules/_ssl.c
index 812125b80f9..69195d808e3 100644
--- a/contrib/tools/python3/Modules/_ssl.c
+++ b/contrib/tools/python3/Modules/_ssl.c
@@ -296,7 +296,7 @@ typedef struct {
int post_handshake_auth;
#endif
PyObject *msg_cb;
- PyObject *keylog_filename;
+ PyObject *keylog_filename; // can be anything accepted by Py_fopen()
BIO *keylog_bio;
/* Cached module state, also used in SSLSocket and SSLSession code. */
_sslmodulestate *state;
@@ -324,7 +324,7 @@ typedef struct {
PySSLContext *ctx; /* weakref to SSL context */
char shutdown_seen_zero;
enum py_ssl_server_or_client socket_type;
- PyObject *owner; /* Python level "owner" passed to servername callback */
+ PyObject *owner; /* weakref to Python level "owner" passed to servername callback */
PyObject *server_hostname;
_PySSLError err; /* last seen error from various sources */
/* Some SSL callbacks don't have error reporting. Callback wrappers
@@ -2173,14 +2173,15 @@ _ssl._SSLSocket.context
This changes the context associated with the SSLSocket.
-This is typically used from within a callback function set by the sni_callback
-on the SSLContext to change the certificate information associated with the
-SSLSocket before the cryptographic exchange handshake messages.
+This is typically used from within a callback function set by the
+sni_callback on the SSLContext to change the certificate information
+associated with the SSLSocket before the cryptographic exchange
+handshake messages.
[clinic start generated code]*/
static PyObject *
_ssl__SSLSocket_context_get_impl(PySSLSocket *self)
-/*[clinic end generated code: output=d23e82f72f32e3d7 input=7cbb97407c2ace30]*/
+/*[clinic end generated code: output=d23e82f72f32e3d7 input=b845dea1f9710ebe]*/
{
return Py_NewRef(self->ctx);
}
@@ -2294,6 +2295,10 @@ PySSL_traverse(PySSLSocket *self, visitproc visit, void *arg)
static int
PySSL_clear(PySSLSocket *self)
{
+ Py_CLEAR(self->Socket);
+ Py_CLEAR(self->ctx);
+ Py_CLEAR(self->owner);
+ Py_CLEAR(self->server_hostname);
Py_CLEAR(self->exc);
return 0;
}
@@ -2317,10 +2322,7 @@ PySSL_dealloc(PySSLSocket *self)
SSL_set_shutdown(self->ssl, SSL_SENT_SHUTDOWN | SSL_get_shutdown(self->ssl));
SSL_free(self->ssl);
}
- Py_XDECREF(self->Socket);
- Py_XDECREF(self->ctx);
- Py_XDECREF(self->server_hostname);
- Py_XDECREF(self->owner);
+ (void)PySSL_clear(self);
PyObject_GC_Del(self);
Py_DECREF(tp);
}
@@ -2807,15 +2809,16 @@ _ssl._SSLSocket.get_channel_binding
Get channel binding data for current connection.
-Raise ValueError if the requested `cb_type` is not supported. Return bytes
-of the data or None if the data is not available (e.g. before the handshake).
+Raise ValueError if the requested `cb_type` is not supported.
+Return bytes of the data or None if the data is not available (e.g.
+before the handshake).
Only 'tls-unique' channel binding data from RFC 5929 is supported.
[clinic start generated code]*/
static PyObject *
_ssl__SSLSocket_get_channel_binding_impl(PySSLSocket *self,
const char *cb_type)
-/*[clinic end generated code: output=34bac9acb6a61d31 input=e008004fc08744db]*/
+/*[clinic end generated code: output=34bac9acb6a61d31 input=bed81ef7936535a0]*/
{
char buf[PySSL_CB_MAXLEN];
size_t len;
@@ -3257,6 +3260,11 @@ context_traverse(PySSLContext *self, visitproc visit, void *arg)
{
Py_VISIT(self->set_sni_cb);
Py_VISIT(self->msg_cb);
+ Py_VISIT(self->keylog_filename);
+#ifndef OPENSSL_NO_PSK
+ Py_VISIT(self->psk_client_callback);
+ Py_VISIT(self->psk_server_callback);
+#endif
Py_VISIT(Py_TYPE(self));
return 0;
}
@@ -4707,15 +4715,16 @@ _ssl._SSLContext.sni_callback
Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension.
-If the argument is None then the callback is disabled. The method is called
-with the SSLSocket, the server name as a string, and the SSLContext object.
+If the argument is None then the callback is disabled. The method
+is called with the SSLSocket, the server name as a string, and the
+SSLContext object.
See RFC 6066 for details of the SNI extension.
[clinic start generated code]*/
static PyObject *
_ssl__SSLContext_sni_callback_get_impl(PySSLContext *self)
-/*[clinic end generated code: output=961e6575cdfaf036 input=9b2473c5e984cfe6]*/
+/*[clinic end generated code: output=961e6575cdfaf036 input=280120c01d089dc3]*/
{
PyObject *cb = self->set_sni_cb;
if (cb == NULL) {
@@ -4807,16 +4816,16 @@ _ssl._SSLContext.cert_store_stats
Returns quantities of loaded X.509 certificates.
-X.509 certificates with a CA extension and certificate revocation lists
-inside the context's cert store.
+X.509 certificates with a CA extension and certificate revocation
+lists inside the context's cert store.
-NOTE: Certificates in a capath directory aren't loaded unless they have
-been used at least once.
+NOTE: Certificates in a capath directory aren't loaded unless they
+have been used at least once.
[clinic start generated code]*/
static PyObject *
_ssl__SSLContext_cert_store_stats_impl(PySSLContext *self)
-/*[clinic end generated code: output=5f356f4d9cca874d input=d13c6e3f2b48539b]*/
+/*[clinic end generated code: output=5f356f4d9cca874d input=9e5094e094b892a3]*/
{
X509_STORE *store;
STACK_OF(X509_OBJECT) *objs;
@@ -4859,16 +4868,16 @@ _ssl._SSLContext.get_ca_certs
Returns a list of dicts with information of loaded CA certs.
-If the optional argument is True, returns a DER-encoded copy of the CA
-certificate.
+If the optional argument is True, returns a DER-encoded copy of the
+CA certificate.
-NOTE: Certificates in a capath directory aren't loaded unless they have
-been used at least once.
+NOTE: Certificates in a capath directory aren't loaded unless they
+have been used at least once.
[clinic start generated code]*/
static PyObject *
_ssl__SSLContext_get_ca_certs_impl(PySSLContext *self, int binary_form)
-/*[clinic end generated code: output=0d58f148f37e2938 input=eb0592909c9ad6e7]*/
+/*[clinic end generated code: output=0d58f148f37e2938 input=9f71af5aa4e67076]*/
{
X509_STORE *store;
STACK_OF(X509_OBJECT) *objs;
@@ -5756,13 +5765,13 @@ _ssl.RAND_status
Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.
-It is necessary to seed the PRNG with RAND_add() on some platforms before
-using the ssl() function.
+It is necessary to seed the PRNG with RAND_add() on some platforms
+before using the ssl() function.
[clinic start generated code]*/
static PyObject *
_ssl_RAND_status_impl(PyObject *module)
-/*[clinic end generated code: output=7e0aaa2d39fdc1ad input=636fb5659ea2e727]*/
+/*[clinic end generated code: output=7e0aaa2d39fdc1ad input=844b0dc0f2165e87]*/
{
return PyBool_FromLong(RAND_status());
}
@@ -6024,16 +6033,16 @@ _ssl.enum_certificates
Retrieve certificates from Windows' cert store.
-store_name may be one of 'CA', 'ROOT' or 'MY'. The system may provide
-more cert storages, too. The function returns a list of (bytes,
-encoding_type, trust) tuples. The encoding_type flag can be interpreted
-with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The trust setting is either
-a set of OIDs or the boolean True.
+store_name may be one of 'CA', 'ROOT' or 'MY'. The system may
+provide more cert storages, too. The function returns a list of
+(bytes, encoding_type, trust) tuples. The encoding_type flag can be
+interpreted with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The
+trust setting is either a set of OIDs or the boolean True.
[clinic start generated code]*/
static PyObject *
_ssl_enum_certificates_impl(PyObject *module, const char *store_name)
-/*[clinic end generated code: output=5134dc8bb3a3c893 input=263c22e6c6988cf3]*/
+/*[clinic end generated code: output=5134dc8bb3a3c893 input=ef81b4bd1b7ab8e9]*/
{
HCERTSTORE hCollectionStore = NULL;
PCCERT_CONTEXT pCertCtx = NULL;
diff --git a/contrib/tools/python3/Modules/_struct.c b/contrib/tools/python3/Modules/_struct.c
index f5e1c62bb24..8ca52b23fd1 100644
--- a/contrib/tools/python3/Modules/_struct.c
+++ b/contrib/tools/python3/Modules/_struct.c
@@ -1,7 +1,7 @@
/* struct module -- pack values into and (out of) bytes objects */
/* New version supporting byte order, alignment and size options,
- character strings, and unsigned numbers */
+ byte strings, and unsigned numbers */
#ifndef Py_BUILD_CORE_BUILTIN
# define Py_BUILD_CORE_MODULE 1
@@ -1947,7 +1947,7 @@ Struct_iter_unpack(PyStructObject *self, PyObject *buffer)
*
* Takes a struct object, a tuple of arguments, and offset in that tuple of
* argument for where to start processing the arguments for packing, and a
- * character buffer for writing the packed string. The caller must insure
+ * character buffer for writing the packed data. The caller must ensure
* that the buffer may contain the required length for packing the arguments.
* 0 is returned on success, 1 is returned if there is an error.
*
@@ -2484,8 +2484,8 @@ static struct PyMethodDef module_functions[] = {
PyDoc_STRVAR(module_doc,
"Functions to convert between Python values and C structs.\n\
-Python bytes objects are used to hold the data representing the C struct\n\
-and also as format strings (explained below) to describe the layout of data\n\
+Python bytes objects are used to hold the data representing the C struct.\n\
+The format string (explained below) describes the layout of data\n\
in the C struct.\n\
\n\
The optional first format char indicates byte order, size and alignment:\n\
@@ -2495,18 +2495,17 @@ The optional first format char indicates byte order, size and alignment:\n\
>: big-endian, std. size & alignment\n\
!: same as >\n\
\n\
-The remaining chars indicate types of args and must match exactly;\n\
+The remaining characters indicate types of args and must match exactly;\n\
these can be preceded by a decimal repeat count:\n\
- x: pad byte (no data); c:char; b:signed byte; B:unsigned byte;\n\
- ?:_Bool; h:short; H:unsigned short; i:int; I:unsigned int;\n\
- l:long; L:unsigned long; f:float; d:double; e:half-float.\n\
+ x: pad byte (no data); c: char; b: signed byte; B: unsigned byte;\n\
+ ?: _Bool; h: short; H: unsigned short; i: int; I: unsigned int;\n\
+ l: long; L: unsigned long; q: long long; Q: unsigned long long;\n\
+ f: float; d: double; e: half-float;\n\
Special cases (preceding decimal count indicates length):\n\
- s:string (array of char); p: pascal string (with count byte).\n\
+ s: byte string (array of char); p: Pascal string (with count byte).\n\
Special cases (only available in native format):\n\
- n:ssize_t; N:size_t;\n\
- P:an integer type that is wide enough to hold a pointer.\n\
-Special case (not in native mode unless 'long long' in platform C):\n\
- q:long long; Q:unsigned long long\n\
+ n: ssize_t; N: size_t;\n\
+ P: an integer type that is wide enough to hold a pointer.\n\
Whitespace between formats is ignored.\n\
\n\
The variable struct.error is an exception raised on errors.\n");
diff --git a/contrib/tools/python3/Modules/_testlimitedcapi/clinic/long.c.h b/contrib/tools/python3/Modules/_testlimitedcapi/clinic/long.c.h
index ebaeb53921a..f9852aba266 100644
--- a/contrib/tools/python3/Modules/_testlimitedcapi/clinic/long.c.h
+++ b/contrib/tools/python3/Modules/_testlimitedcapi/clinic/long.c.h
@@ -84,8 +84,8 @@ PyDoc_STRVAR(_testlimitedcapi_test_long_as_size_t__doc__,
"\n"
"Test the PyLong_As{Size,Ssize}_t API.\n"
"\n"
-"At present this just tests that non-integer arguments are handled correctly.\n"
-"It should be extended to test overflow handling.");
+"At present this just tests that non-integer arguments are handled\n"
+"correctly. It should be extended to test overflow handling.");
#define _TESTLIMITEDCAPI_TEST_LONG_AS_SIZE_T_METHODDEF \
{"test_long_as_size_t", (PyCFunction)_testlimitedcapi_test_long_as_size_t, METH_NOARGS, _testlimitedcapi_test_long_as_size_t__doc__},
@@ -140,4 +140,4 @@ PyDoc_STRVAR(_testlimitedcapi_PyLong_AsInt__doc__,
#define _TESTLIMITEDCAPI_PYLONG_ASINT_METHODDEF \
{"PyLong_AsInt", (PyCFunction)_testlimitedcapi_PyLong_AsInt, METH_O, _testlimitedcapi_PyLong_AsInt__doc__},
-/*[clinic end generated code: output=bc52b73c599f96c2 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fb5c95bd0a4bdad8 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/_testlimitedcapi/long.c b/contrib/tools/python3/Modules/_testlimitedcapi/long.c
index e2af09d0840..35505ef33f4 100644
--- a/contrib/tools/python3/Modules/_testlimitedcapi/long.c
+++ b/contrib/tools/python3/Modules/_testlimitedcapi/long.c
@@ -451,13 +451,13 @@ _testlimitedcapi.test_long_as_size_t
Test the PyLong_As{Size,Ssize}_t API.
-At present this just tests that non-integer arguments are handled correctly.
-It should be extended to test overflow handling.
+At present this just tests that non-integer arguments are handled
+correctly. It should be extended to test overflow handling.
[clinic start generated code]*/
static PyObject *
_testlimitedcapi_test_long_as_size_t_impl(PyObject *module)
-/*[clinic end generated code: output=297a9f14a42f55af input=8923d8f2038c46f4]*/
+/*[clinic end generated code: output=297a9f14a42f55af input=692e73744b35bf6e]*/
{
size_t out_u;
Py_ssize_t out_s;
diff --git a/contrib/tools/python3/Modules/_testlimitedcapi/parts.h b/contrib/tools/python3/Modules/_testlimitedcapi/parts.h
index 11b2e5c6b83..4058df7fdef 100644
--- a/contrib/tools/python3/Modules/_testlimitedcapi/parts.h
+++ b/contrib/tools/python3/Modules/_testlimitedcapi/parts.h
@@ -41,5 +41,6 @@ int _PyTestLimitedCAPI_Init_Tuple(PyObject *module);
int _PyTestLimitedCAPI_Init_Unicode(PyObject *module);
int _PyTestLimitedCAPI_Init_VectorcallLimited(PyObject *module);
int _PyTestLimitedCAPI_Init_File(PyObject *module);
+int _PyTestLimitedCAPI_Init_Weakref(PyObject *module);
#endif // Py_TESTLIMITEDCAPI_PARTS_H
diff --git a/contrib/tools/python3/Modules/_testlimitedcapi/weakref.c b/contrib/tools/python3/Modules/_testlimitedcapi/weakref.c
new file mode 100644
index 00000000000..e7f9d54d1a0
--- /dev/null
+++ b/contrib/tools/python3/Modules/_testlimitedcapi/weakref.c
@@ -0,0 +1,78 @@
+#include "pyconfig.h" // Py_GIL_DISABLED
+#ifndef Py_GIL_DISABLED
+ // Need limited C API 3.5 for PyModule_AddFunctions()
+# define Py_LIMITED_API 0x03050000
+#endif
+
+#include "parts.h"
+#include "util.h"
+
+
+static PyObject *
+pyweakref_check(PyObject *module, PyObject *obj)
+{
+ NULLABLE(obj);
+ return PyLong_FromLong(PyWeakref_Check(obj));
+}
+
+static PyObject *
+pyweakref_checkref(PyObject *module, PyObject *obj)
+{
+ NULLABLE(obj);
+ return PyLong_FromLong(PyWeakref_CheckRef(obj));
+}
+
+static PyObject *
+pyweakref_checkrefexact(PyObject *module, PyObject *obj)
+{
+ NULLABLE(obj);
+ return PyLong_FromLong(PyWeakref_CheckRefExact(obj));
+}
+
+static PyObject *
+pyweakref_checkproxy(PyObject *module, PyObject *obj)
+{
+ NULLABLE(obj);
+ return PyLong_FromLong(PyWeakref_CheckProxy(obj));
+}
+
+static PyObject *
+pyweakref_newref(PyObject *module, PyObject *args)
+{
+ PyObject *obj;
+ PyObject *callback = NULL;
+ if (!PyArg_ParseTuple(args, "O|O", &obj, &callback)) {
+ return NULL;
+ }
+ NULLABLE(obj);
+ return PyWeakref_NewRef(obj, callback);
+}
+
+static PyObject *
+pyweakref_newproxy(PyObject *module, PyObject *args)
+{
+ PyObject *obj;
+ PyObject *callback = NULL;
+ if (!PyArg_ParseTuple(args, "O|O", &obj, &callback)) {
+ return NULL;
+ }
+ NULLABLE(obj);
+ return PyWeakref_NewProxy(obj, callback);
+}
+
+
+static PyMethodDef test_methods[] = {
+ {"pyweakref_check", pyweakref_check, METH_O},
+ {"pyweakref_checkref", pyweakref_checkref, METH_O},
+ {"pyweakref_checkrefexact", pyweakref_checkrefexact, METH_O},
+ {"pyweakref_checkproxy", pyweakref_checkproxy, METH_O},
+ {"pyweakref_newref", pyweakref_newref, METH_VARARGS},
+ {"pyweakref_newproxy", pyweakref_newproxy, METH_VARARGS},
+ {NULL},
+};
+
+int
+_PyTestLimitedCAPI_Init_Weakref(PyObject *m)
+{
+ return PyModule_AddFunctions(m, test_methods);
+}
diff --git a/contrib/tools/python3/Modules/_winapi.c b/contrib/tools/python3/Modules/_winapi.c
index d51586e6025..4d486400a09 100644
--- a/contrib/tools/python3/Modules/_winapi.c
+++ b/contrib/tools/python3/Modules/_winapi.c
@@ -1184,8 +1184,10 @@ gethandlelist(PyObject *mapping, const char *name, Py_ssize_t *size)
}
ret = PyMem_Malloc(*size);
- if (ret == NULL)
+ if (ret == NULL) {
+ PyErr_NoMemory();
goto cleanup;
+ }
for (i = 0; i < PySequence_Fast_GET_SIZE(value_fast); i++) {
ret[i] = PYNUM_TO_HANDLE(PySequence_Fast_GET_ITEM(value_fast, i));
@@ -1268,6 +1270,7 @@ getattributelist(PyObject *obj, const char *name, AttributeList *attribute_list)
attribute_list->attribute_list = PyMem_Malloc(attribute_list_size);
if (attribute_list->attribute_list == NULL) {
ret = -1;
+ PyErr_NoMemory();
goto cleanup;
}
diff --git a/contrib/tools/python3/Modules/arraymodule.c b/contrib/tools/python3/Modules/arraymodule.c
index 4c7cc4d47c0..25694e9cf33 100644
--- a/contrib/tools/python3/Modules/arraymodule.c
+++ b/contrib/tools/python3/Modules/arraymodule.c
@@ -1415,13 +1415,13 @@ array.array.buffer_info
Return a tuple (address, length) giving the current memory address and the length in items of the buffer used to hold array's contents.
-The length should be multiplied by the itemsize attribute to calculate
-the buffer length in bytes.
+The length should be multiplied by the itemsize attribute to
+calculate the buffer length in bytes.
[clinic start generated code]*/
static PyObject *
array_array_buffer_info_impl(arrayobject *self)
-/*[clinic end generated code: output=9b2a4ec3ae7e98e7 input=a58bae5c6e1ac6a6]*/
+/*[clinic end generated code: output=9b2a4ec3ae7e98e7 input=f4d34398d5dfc856]*/
{
PyObject *retval = NULL, *v;
@@ -1467,13 +1467,13 @@ array.array.byteswap
Byteswap all items of the array.
-If the items in the array are not 1, 2, 4, or 8 bytes in size, RuntimeError is
-raised.
+If the items in the array are not 1, 2, 4, or 8 bytes in size,
+RuntimeError is raised.
[clinic start generated code]*/
static PyObject *
array_array_byteswap_impl(arrayobject *self)
-/*[clinic end generated code: output=5f8236cbdf0d90b5 input=6a85591b950a0186]*/
+/*[clinic end generated code: output=5f8236cbdf0d90b5 input=3005a63cc263b839]*/
{
char *p;
Py_ssize_t i;
@@ -1817,14 +1817,14 @@ array.array.fromunicode
Extends this array with data from the unicode string ustr.
-The array must be a unicode type array; otherwise a ValueError is raised.
-Use array.frombytes(ustr.encode(...)) to append Unicode data to an array of
-some other type.
+The array must be a unicode type array; otherwise a ValueError is
+raised. Use array.frombytes(ustr.encode(...)) to append Unicode
+data to an array of some other type.
[clinic start generated code]*/
static PyObject *
array_array_fromunicode_impl(arrayobject *self, PyObject *ustr)
-/*[clinic end generated code: output=24359f5e001a7f2b input=025db1fdade7a4ce]*/
+/*[clinic end generated code: output=24359f5e001a7f2b input=01fa592ec7b948b6]*/
{
int typecode = self->ob_descr->typecode;
if (typecode != 'u' && typecode != 'w') {
@@ -1876,14 +1876,15 @@ array.array.tounicode
Extends this array with data from the unicode string ustr.
-Convert the array to a unicode string. The array must be a unicode type array;
-otherwise a ValueError is raised. Use array.tobytes().decode() to obtain a
-unicode string from an array of some other type.
+Convert the array to a unicode string. The array must be a unicode
+type array; otherwise a ValueError is raised. Use
+array.tobytes().decode() to obtain a unicode string from an array of
+some other type.
[clinic start generated code]*/
static PyObject *
array_array_tounicode_impl(arrayobject *self)
-/*[clinic end generated code: output=08e442378336e1ef input=127242eebe70b66d]*/
+/*[clinic end generated code: output=08e442378336e1ef input=d4d5f398aa71a2be]*/
{
int typecode = self->ob_descr->typecode;
if (typecode != 'u' && typecode != 'w') {
@@ -2440,7 +2441,8 @@ static PyMethodDef array_methods[] = {
ARRAY_ARRAY_TOBYTES_METHODDEF
ARRAY_ARRAY_TOUNICODE_METHODDEF
ARRAY_ARRAY___SIZEOF___METHODDEF
- {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS,
+ PyDoc_STR("Arrays are generic over the type of their elements")},
{NULL, NULL} /* sentinel */
};
@@ -2821,8 +2823,10 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
len = 0;
a = newarrayobject(type, len, descr);
- if (a == NULL)
+ if (a == NULL) {
+ Py_XDECREF(it);
return NULL;
+ }
if (len > 0 && !array_Check(initial, state)) {
Py_ssize_t i;
@@ -2831,11 +2835,13 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PySequence_GetItem(initial, i);
if (v == NULL) {
Py_DECREF(a);
+ Py_XDECREF(it);
return NULL;
}
if (setarrayitem(a, i, v) != 0) {
Py_DECREF(v);
Py_DECREF(a);
+ Py_XDECREF(it);
return NULL;
}
Py_DECREF(v);
@@ -2848,6 +2854,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
initial);
if (v == NULL) {
Py_DECREF(a);
+ Py_XDECREF(it);
return NULL;
}
Py_DECREF(v);
@@ -2858,6 +2865,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
wchar_t *ustr = PyUnicode_AsWideCharString(initial, &n);
if (ustr == NULL) {
Py_DECREF(a);
+ Py_XDECREF(it);
return NULL;
}
@@ -2878,6 +2886,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
Py_UCS4 *ustr = PyUnicode_AsUCS4Copy(initial);
if (ustr == NULL) {
Py_DECREF(a);
+ Py_XDECREF(it);
return NULL;
}
@@ -2905,6 +2914,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
return a;
}
}
+ Py_XDECREF(it);
PyErr_SetString(PyExc_ValueError,
"bad typecode (must be b, B, u, w, h, H, i, I, l, L, q, Q, f or d)");
return NULL;
diff --git a/contrib/tools/python3/Modules/binascii.c b/contrib/tools/python3/Modules/binascii.c
index 1030eb15f41..6b762b809b5 100644
--- a/contrib/tools/python3/Modules/binascii.c
+++ b/contrib/tools/python3/Modules/binascii.c
@@ -219,6 +219,14 @@ binascii_a2b_uu_impl(PyObject *module, Py_buffer *data)
assert(ascii_len >= 0);
/* First byte: binary data length (in bytes) */
+ if (ascii_len == 0) {
+ state = get_binascii_state(module);
+ if (state == NULL) {
+ return NULL;
+ }
+ PyErr_SetString(state->Error, "Missing length byte");
+ return NULL;
+ }
bin_len = (*ascii_data++ - ' ') & 077;
ascii_len--;
diff --git a/contrib/tools/python3/Modules/cjkcodecs/clinic/multibytecodec.c.h b/contrib/tools/python3/Modules/cjkcodecs/clinic/multibytecodec.c.h
index b5639d5cf10..0fef4982a49 100644
--- a/contrib/tools/python3/Modules/cjkcodecs/clinic/multibytecodec.c.h
+++ b/contrib/tools/python3/Modules/cjkcodecs/clinic/multibytecodec.c.h
@@ -14,10 +14,11 @@ PyDoc_STRVAR(_multibytecodec_MultibyteCodec_encode__doc__,
"\n"
"Return an encoded string version of `input\'.\n"
"\n"
-"\'errors\' may be given to set a different error handling scheme. Default is\n"
-"\'strict\' meaning that encoding errors raise a UnicodeEncodeError. Other possible\n"
-"values are \'ignore\', \'replace\' and \'xmlcharrefreplace\' as well as any other name\n"
-"registered with codecs.register_error that can handle UnicodeEncodeErrors.");
+"\'errors\' may be given to set a different error handling scheme.\n"
+"Default is \'strict\' meaning that encoding errors raise\n"
+"a UnicodeEncodeError. Other possible values are \'ignore\', \'replace\'\n"
+"and \'xmlcharrefreplace\' as well as any other name registered with\n"
+"codecs.register_error that can handle UnicodeEncodeErrors.");
#define _MULTIBYTECODEC_MULTIBYTECODEC_ENCODE_METHODDEF \
{"encode", _PyCFunction_CAST(_multibytecodec_MultibyteCodec_encode), METH_FASTCALL|METH_KEYWORDS, _multibytecodec_MultibyteCodec_encode__doc__},
@@ -100,9 +101,10 @@ PyDoc_STRVAR(_multibytecodec_MultibyteCodec_decode__doc__,
"\n"
"Decodes \'input\'.\n"
"\n"
-"\'errors\' may be given to set a different error handling scheme. Default is\n"
-"\'strict\' meaning that encoding errors raise a UnicodeDecodeError. Other possible\n"
-"values are \'ignore\' and \'replace\' as well as any other name registered with\n"
+"\'errors\' may be given to set a different error handling scheme.\n"
+"Default is \'strict\' meaning that encoding errors raise\n"
+"a UnicodeDecodeError. Other possible values are \'ignore\' and\n"
+"\'replace\' as well as any other name registered with\n"
"codecs.register_error that is able to handle UnicodeDecodeErrors.\"");
#define _MULTIBYTECODEC_MULTIBYTECODEC_DECODE_METHODDEF \
@@ -682,4 +684,4 @@ PyDoc_STRVAR(_multibytecodec___create_codec__doc__,
#define _MULTIBYTECODEC___CREATE_CODEC_METHODDEF \
{"__create_codec", (PyCFunction)_multibytecodec___create_codec, METH_O, _multibytecodec___create_codec__doc__},
-/*[clinic end generated code: output=ee767a6d93c7108a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=de24dedc0342de51 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/cjkcodecs/multibytecodec.c b/contrib/tools/python3/Modules/cjkcodecs/multibytecodec.c
index 1c671adb4ff..1274ba40940 100644
--- a/contrib/tools/python3/Modules/cjkcodecs/multibytecodec.c
+++ b/contrib/tools/python3/Modules/cjkcodecs/multibytecodec.c
@@ -576,17 +576,18 @@ _multibytecodec.MultibyteCodec.encode
Return an encoded string version of `input'.
-'errors' may be given to set a different error handling scheme. Default is
-'strict' meaning that encoding errors raise a UnicodeEncodeError. Other possible
-values are 'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name
-registered with codecs.register_error that can handle UnicodeEncodeErrors.
+'errors' may be given to set a different error handling scheme.
+Default is 'strict' meaning that encoding errors raise
+a UnicodeEncodeError. Other possible values are 'ignore', 'replace'
+and 'xmlcharrefreplace' as well as any other name registered with
+codecs.register_error that can handle UnicodeEncodeErrors.
[clinic start generated code]*/
static PyObject *
_multibytecodec_MultibyteCodec_encode_impl(MultibyteCodecObject *self,
PyObject *input,
const char *errors)
-/*[clinic end generated code: output=7b26652045ba56a9 input=606d0e128a577bae]*/
+/*[clinic end generated code: output=7b26652045ba56a9 input=e047a75a21752801]*/
{
MultibyteCodec_State state;
PyObject *errorcb, *r, *ucvt;
@@ -641,9 +642,10 @@ _multibytecodec.MultibyteCodec.decode
Decodes 'input'.
-'errors' may be given to set a different error handling scheme. Default is
-'strict' meaning that encoding errors raise a UnicodeDecodeError. Other possible
-values are 'ignore' and 'replace' as well as any other name registered with
+'errors' may be given to set a different error handling scheme.
+Default is 'strict' meaning that encoding errors raise
+a UnicodeDecodeError. Other possible values are 'ignore' and
+'replace' as well as any other name registered with
codecs.register_error that is able to handle UnicodeDecodeErrors."
[clinic start generated code]*/
@@ -651,7 +653,7 @@ static PyObject *
_multibytecodec_MultibyteCodec_decode_impl(MultibyteCodecObject *self,
Py_buffer *input,
const char *errors)
-/*[clinic end generated code: output=ff419f65bad6cc77 input=e0c78fc7ab190def]*/
+/*[clinic end generated code: output=ff419f65bad6cc77 input=dbf93d8bb98ca440]*/
{
MultibyteCodec_State state;
MultibyteDecodeBuffer buf;
diff --git a/contrib/tools/python3/Modules/clinic/_abc.c.h b/contrib/tools/python3/Modules/clinic/_abc.c.h
index 04681fa2206..fa1c57dc26b 100644
--- a/contrib/tools/python3/Modules/clinic/_abc.c.h
+++ b/contrib/tools/python3/Modules/clinic/_abc.c.h
@@ -146,9 +146,9 @@ PyDoc_STRVAR(_abc_get_cache_token__doc__,
"\n"
"Returns the current ABC cache token.\n"
"\n"
-"The token is an opaque object (supporting equality testing) identifying the\n"
-"current version of the ABC cache for virtual subclasses. The token changes\n"
-"with every call to register() on any ABC.");
+"The token is an opaque object (supporting equality testing) identifying\n"
+"the current version of the ABC cache for virtual subclasses. The token\n"
+"changes with every call to register() on any ABC.");
#define _ABC_GET_CACHE_TOKEN_METHODDEF \
{"get_cache_token", (PyCFunction)_abc_get_cache_token, METH_NOARGS, _abc_get_cache_token__doc__},
@@ -161,4 +161,4 @@ _abc_get_cache_token(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return _abc_get_cache_token_impl(module);
}
-/*[clinic end generated code: output=1989b6716c950e17 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b05d599656aeb1e1 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_asynciomodule.c.h b/contrib/tools/python3/Modules/clinic/_asynciomodule.c.h
index 6a9c8ff6d8f..0cbf1475d64 100644
--- a/contrib/tools/python3/Modules/clinic/_asynciomodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_asynciomodule.c.h
@@ -86,7 +86,8 @@ PyDoc_STRVAR(_asyncio_Future_result__doc__,
"\n"
"If the future has been cancelled, raises CancelledError. If the\n"
"future\'s result isn\'t yet available, raises InvalidStateError. If\n"
-"the future is done and has an exception set, this exception is raised.");
+"the future is done and has an exception set, this exception is\n"
+"raised.");
#define _ASYNCIO_FUTURE_RESULT_METHODDEF \
{"result", (PyCFunction)_asyncio_Future_result, METH_NOARGS, _asyncio_Future_result__doc__},
@@ -227,8 +228,8 @@ PyDoc_STRVAR(_asyncio_Future_add_done_callback__doc__,
"\n"
"Add a callback to be run when the future becomes done.\n"
"\n"
-"The callback is called with a single argument - the future object. If\n"
-"the future is already done when this is called, the callback is\n"
+"The callback is called with a single argument - the future object.\n"
+"If the future is already done when this is called, the callback is\n"
"scheduled with call_soon.");
#define _ASYNCIO_FUTURE_ADD_DONE_CALLBACK_METHODDEF \
@@ -340,9 +341,9 @@ PyDoc_STRVAR(_asyncio_Future_cancel__doc__,
"\n"
"Cancel the future and schedule callbacks.\n"
"\n"
-"If the future is already done or cancelled, return False. Otherwise,\n"
-"change the future\'s state to cancelled, schedule the callbacks and\n"
-"return True.");
+"If the future is already done or cancelled, return False.\n"
+"Otherwise, change the future\'s state to cancelled, schedule the\n"
+"callbacks and return True.");
#define _ASYNCIO_FUTURE_CANCEL_METHODDEF \
{"cancel", _PyCFunction_CAST(_asyncio_Future_cancel), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _asyncio_Future_cancel__doc__},
@@ -423,8 +424,8 @@ PyDoc_STRVAR(_asyncio_Future_done__doc__,
"\n"
"Return True if the future is done.\n"
"\n"
-"Done means either that a result / exception are available, or that the\n"
-"future was cancelled.");
+"Done means either that a result / exception are available, or that\n"
+"the future was cancelled.");
#define _ASYNCIO_FUTURE_DONE_METHODDEF \
{"done", (PyCFunction)_asyncio_Future_done, METH_NOARGS, _asyncio_Future_done__doc__},
@@ -1487,4 +1488,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=b26155080c82c472 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1842473913c9f884 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_bisectmodule.c.h b/contrib/tools/python3/Modules/clinic/_bisectmodule.c.h
index 528602c84a9..25ebb1727fd 100644
--- a/contrib/tools/python3/Modules/clinic/_bisectmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_bisectmodule.c.h
@@ -16,8 +16,8 @@ PyDoc_STRVAR(_bisect_bisect_right__doc__,
"Return the index where to insert item x in list a, assuming a is sorted.\n"
"\n"
"The return value i is such that all e in a[:i] have e <= x, and all e in\n"
-"a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will\n"
-"insert just after the rightmost x already there.\n"
+"a[i:] have e > x. So if x already appears in the list, a.insert(i, x)\n"
+"will insert just after the rightmost x already there.\n"
"\n"
"Optional args lo (default 0) and hi (default len(a)) bound the\n"
"slice of a to be searched.\n"
@@ -229,8 +229,8 @@ PyDoc_STRVAR(_bisect_bisect_left__doc__,
"Return the index where to insert item x in list a, assuming a is sorted.\n"
"\n"
"The return value i is such that all e in a[:i] have e < x, and all e in\n"
-"a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will\n"
-"insert just before the leftmost x already there.\n"
+"a[i:] have e >= x. So if x already appears in the list, a.insert(i, x)\n"
+"will insert just before the leftmost x already there.\n"
"\n"
"Optional args lo (default 0) and hi (default len(a)) bound the\n"
"slice of a to be searched.\n"
@@ -434,4 +434,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=0a8d5a32dd0a3f04 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=97bfe6ec4565161a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_bz2module.c.h b/contrib/tools/python3/Modules/clinic/_bz2module.c.h
index de7b3993596..3c5f228a933 100644
--- a/contrib/tools/python3/Modules/clinic/_bz2module.c.h
+++ b/contrib/tools/python3/Modules/clinic/_bz2module.c.h
@@ -116,18 +116,19 @@ PyDoc_STRVAR(_bz2_BZ2Decompressor_decompress__doc__,
"\n"
"Decompress *data*, returning uncompressed data as bytes.\n"
"\n"
-"If *max_length* is nonnegative, returns at most *max_length* bytes of\n"
-"decompressed data. If this limit is reached and further output can be\n"
-"produced, *self.needs_input* will be set to ``False``. In this case, the next\n"
-"call to *decompress()* may provide *data* as b\'\' to obtain more of the output.\n"
+"If *max_length* is nonnegative, returns at most *max_length* bytes\n"
+"of decompressed data. If this limit is reached and further output\n"
+"can be produced, *self.needs_input* will be set to ``False``. In\n"
+"this case, the next call to *decompress()* may provide *data* as b\'\'\n"
+"to obtain more of the output.\n"
"\n"
-"If all of the input data was decompressed and returned (either because this\n"
-"was less than *max_length* bytes, or because *max_length* was negative),\n"
-"*self.needs_input* will be set to True.\n"
+"If all of the input data was decompressed and returned (either\n"
+"because this was less than *max_length* bytes, or because\n"
+"*max_length* was negative), *self.needs_input* will be set to True.\n"
"\n"
-"Attempting to decompress data after the end of stream is reached raises an\n"
-"EOFError. Any data found after the end of the stream is ignored and saved in\n"
-"the unused_data attribute.");
+"Attempting to decompress data after the end of stream is reached\n"
+"raises an EOFError. Any data found after the end of the stream is\n"
+"ignored and saved in the unused_data attribute.");
#define _BZ2_BZ2DECOMPRESSOR_DECOMPRESS_METHODDEF \
{"decompress", _PyCFunction_CAST(_bz2_BZ2Decompressor_decompress), METH_FASTCALL|METH_KEYWORDS, _bz2_BZ2Decompressor_decompress__doc__},
@@ -234,4 +235,4 @@ _bz2_BZ2Decompressor(PyTypeObject *type, PyObject *args, PyObject *kwargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=8daa62f47cc4853d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=3f17a58daa209221 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_codecsmodule.c.h b/contrib/tools/python3/Modules/clinic/_codecsmodule.c.h
index 1c0f37442ab..6e7f26c95ec 100644
--- a/contrib/tools/python3/Modules/clinic/_codecsmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_codecsmodule.c.h
@@ -14,9 +14,10 @@ PyDoc_STRVAR(_codecs_register__doc__,
"\n"
"Register a codec search function.\n"
"\n"
-"Search functions are expected to take one argument, the encoding name in\n"
-"all lower case letters, and either return None, or a tuple of functions\n"
-"(encoder, decoder, stream_reader, stream_writer) (or a CodecInfo object).");
+"Search functions are expected to take one argument, the encoding\n"
+"name in all lower case letters, and either return None, or a tuple\n"
+"of functions (encoder, decoder, stream_reader, stream_writer) (or\n"
+"a CodecInfo object).");
#define _CODECS_REGISTER_METHODDEF \
{"register", (PyCFunction)_codecs_register, METH_O, _codecs_register__doc__},
@@ -76,10 +77,10 @@ PyDoc_STRVAR(_codecs_encode__doc__,
"Encodes obj using the codec registered for encoding.\n"
"\n"
"The default encoding is \'utf-8\'. errors may be given to set a\n"
-"different error handling scheme. Default is \'strict\' meaning that encoding\n"
-"errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n"
-"and \'backslashreplace\' as well as any other name registered with\n"
-"codecs.register_error that can handle ValueErrors.");
+"different error handling scheme. Default is \'strict\' meaning that\n"
+"encoding errors raise a ValueError. Other possible values are \'ignore\',\n"
+"\'replace\' and \'backslashreplace\' as well as any other name registered\n"
+"with codecs.register_error that can handle ValueErrors.");
#define _CODECS_ENCODE_METHODDEF \
{"encode", _PyCFunction_CAST(_codecs_encode), METH_FASTCALL|METH_KEYWORDS, _codecs_encode__doc__},
@@ -176,10 +177,10 @@ PyDoc_STRVAR(_codecs_decode__doc__,
"Decodes obj using the codec registered for encoding.\n"
"\n"
"Default encoding is \'utf-8\'. errors may be given to set a\n"
-"different error handling scheme. Default is \'strict\' meaning that encoding\n"
-"errors raise a ValueError. Other possible values are \'ignore\', \'replace\'\n"
-"and \'backslashreplace\' as well as any other name registered with\n"
-"codecs.register_error that can handle ValueErrors.");
+"different error handling scheme. Default is \'strict\' meaning that\n"
+"encoding errors raise a ValueError. Other possible values are \'ignore\',\n"
+"\'replace\' and \'backslashreplace\' as well as any other name registered\n"
+"with codecs.register_error that can handle ValueErrors.");
#define _CODECS_DECODE_METHODDEF \
{"decode", _PyCFunction_CAST(_codecs_decode), METH_FASTCALL|METH_KEYWORDS, _codecs_decode__doc__},
@@ -2643,8 +2644,9 @@ PyDoc_STRVAR(_codecs_register_error__doc__,
"Register the specified error handler under the name errors.\n"
"\n"
"handler must be a callable object, that will be called with an exception\n"
-"instance containing information about the location of the encoding/decoding\n"
-"error and must return a (replacement, new position) tuple.");
+"instance containing information about the location of the\n"
+"encoding/decoding error and must return a (replacement, new position)\n"
+"tuple.");
#define _CODECS_REGISTER_ERROR_METHODDEF \
{"register_error", _PyCFunction_CAST(_codecs_register_error), METH_FASTCALL, _codecs_register_error__doc__},
@@ -2689,8 +2691,8 @@ PyDoc_STRVAR(_codecs_lookup_error__doc__,
"\n"
"lookup_error(errors) -> handler\n"
"\n"
-"Return the error handler for the specified error handling name or raise a\n"
-"LookupError, if no handler exists under this name.");
+"Return the error handler for the specified error handling name or raise\n"
+"a LookupError, if no handler exists under this name.");
#define _CODECS_LOOKUP_ERROR_METHODDEF \
{"lookup_error", (PyCFunction)_codecs_lookup_error, METH_O, _codecs_lookup_error__doc__},
@@ -2746,4 +2748,4 @@ exit:
#ifndef _CODECS_CODE_PAGE_ENCODE_METHODDEF
#define _CODECS_CODE_PAGE_ENCODE_METHODDEF
#endif /* !defined(_CODECS_CODE_PAGE_ENCODE_METHODDEF) */
-/*[clinic end generated code: output=e50d5fdf65bd45fa input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2badac642569e7a5 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_curses_panel.c.h b/contrib/tools/python3/Modules/clinic/_curses_panel.c.h
index c8788c461f7..520a0afb4c1 100644
--- a/contrib/tools/python3/Modules/clinic/_curses_panel.c.h
+++ b/contrib/tools/python3/Modules/clinic/_curses_panel.c.h
@@ -35,7 +35,8 @@ PyDoc_STRVAR(_curses_panel_panel_hide__doc__,
"\n"
"Hide the panel.\n"
"\n"
-"This does not delete the object, it just makes the window on screen invisible.");
+"This does not delete the object, it just makes the window on screen\n"
+"invisible.");
#define _CURSES_PANEL_PANEL_HIDE_METHODDEF \
{"hide", _PyCFunction_CAST(_curses_panel_panel_hide), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _curses_panel_panel_hide__doc__},
@@ -408,7 +409,8 @@ PyDoc_STRVAR(_curses_panel_update_panels__doc__,
"\n"
"Updates the virtual screen after changes in the panel stack.\n"
"\n"
-"This does not call curses.doupdate(), so you\'ll have to do this yourself.");
+"This does not call curses.doupdate(), so you\'ll have to do this\n"
+"yourself.");
#define _CURSES_PANEL_UPDATE_PANELS_METHODDEF \
{"update_panels", (PyCFunction)_curses_panel_update_panels, METH_NOARGS, _curses_panel_update_panels__doc__},
@@ -421,4 +423,4 @@ _curses_panel_update_panels(PyObject *module, PyObject *Py_UNUSED(ignored))
{
return _curses_panel_update_panels_impl(module);
}
-/*[clinic end generated code: output=18dc5571174c7189 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=256acf1bc500a868 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_cursesmodule.c.h b/contrib/tools/python3/Modules/clinic/_cursesmodule.c.h
index b4b3dca1f4c..16d70e4a1a5 100644
--- a/contrib/tools/python3/Modules/clinic/_cursesmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_cursesmodule.c.h
@@ -422,10 +422,10 @@ PyDoc_STRVAR(_curses_window_border__doc__,
" br\n"
" Bottom-right corner.\n"
"\n"
-"Each parameter specifies the character to use for a specific part of the\n"
-"border. The characters can be specified as integers or as one-character\n"
-"strings. A 0 value for any parameter will cause the default character to be\n"
-"used for that parameter.");
+"Each parameter specifies the character to use for a specific part of\n"
+"the border. The characters can be specified as integers or as\n"
+"one-character strings. A 0 value for any parameter will cause the\n"
+"default character to be used for that parameter.");
#define _CURSES_WINDOW_BORDER_METHODDEF \
{"border", _PyCFunction_CAST(_curses_window_border), METH_FASTCALL, _curses_window_border__doc__},
@@ -500,8 +500,9 @@ PyDoc_STRVAR(_curses_window_box__doc__,
" horch\n"
" Top and bottom side.\n"
"\n"
-"Similar to border(), but both ls and rs are verch and both ts and bs are\n"
-"horch. The default corner characters are always used by this function.");
+"Similar to border(), but both ls and rs are verch and both ts and bs\n"
+"are horch. The default corner characters are always used by this\n"
+"function.");
#define _CURSES_WINDOW_BOX_METHODDEF \
{"box", (PyCFunction)_curses_window_box, METH_VARARGS, _curses_window_box__doc__},
@@ -593,9 +594,9 @@ PyDoc_STRVAR(_curses_window_derwin__doc__,
" begin_x\n"
" Left side x-coordinate.\n"
"\n"
-"derwin() is the same as calling subwin(), except that begin_y and begin_x\n"
-"are relative to the origin of the window, rather than relative to the entire\n"
-"screen.");
+"derwin() is the same as calling subwin(), except that begin_y and\n"
+"begin_x are relative to the origin of the window, rather than\n"
+"relative to the entire screen.");
#define _CURSES_WINDOW_DERWIN_METHODDEF \
{"derwin", (PyCFunction)_curses_window_derwin, METH_VARARGS, _curses_window_derwin__doc__},
@@ -761,9 +762,10 @@ PyDoc_STRVAR(_curses_window_getch__doc__,
" x\n"
" X-coordinate.\n"
"\n"
-"The integer returned does not have to be in ASCII range: function keys,\n"
-"keypad keys and so on return numbers higher than 256. In no-delay mode, -1\n"
-"is returned if there is no input, else getch() waits until a key is pressed.");
+"The integer returned does not have to be in ASCII range: function\n"
+"keys, keypad keys and so on return numbers higher than 256. In\n"
+"no-delay mode, -1 is returned if there is no input, else getch()\n"
+"waits until a key is pressed.");
#define _CURSES_WINDOW_GETCH_METHODDEF \
{"getch", (PyCFunction)_curses_window_getch, METH_VARARGS, _curses_window_getch__doc__},
@@ -808,9 +810,10 @@ PyDoc_STRVAR(_curses_window_getkey__doc__,
" x\n"
" X-coordinate.\n"
"\n"
-"Returning a string instead of an integer, as getch() does. Function keys,\n"
-"keypad keys and other special keys return a multibyte string containing the\n"
-"key name. In no-delay mode, an exception is raised if there is no input.");
+"Returning a string instead of an integer, as getch() does. Function\n"
+"keys, keypad keys and other special keys return a multibyte string\n"
+"containing the key name. In no-delay mode, an exception is raised\n"
+"if there is no input.");
#define _CURSES_WINDOW_GETKEY_METHODDEF \
{"getkey", (PyCFunction)_curses_window_getkey, METH_VARARGS, _curses_window_getkey__doc__},
@@ -979,8 +982,8 @@ PyDoc_STRVAR(_curses_window_insch__doc__,
" attr\n"
" Attributes for the character.\n"
"\n"
-"All characters to the right of the cursor are shifted one position right, with\n"
-"the rightmost characters on the line being lost.");
+"All characters to the right of the cursor are shifted one position\n"
+"right, with the rightmost characters on the line being lost.");
#define _CURSES_WINDOW_INSCH_METHODDEF \
{"insch", (PyCFunction)_curses_window_insch, METH_VARARGS, _curses_window_insch__doc__},
@@ -1045,7 +1048,8 @@ PyDoc_STRVAR(_curses_window_inch__doc__,
" x\n"
" X-coordinate.\n"
"\n"
-"The bottom 8 bits are the character proper, and upper bits are the attributes.");
+"The bottom 8 bits are the character proper, and upper bits are the\n"
+"attributes.");
#define _CURSES_WINDOW_INCH_METHODDEF \
{"inch", (PyCFunction)_curses_window_inch, METH_VARARGS, _curses_window_inch__doc__},
@@ -1099,11 +1103,11 @@ PyDoc_STRVAR(_curses_window_insstr__doc__,
" attr\n"
" Attributes for characters.\n"
"\n"
-"Insert a character string (as many characters as will fit on the line)\n"
-"before the character under the cursor. All characters to the right of\n"
-"the cursor are shifted right, with the rightmost characters on the line\n"
-"being lost. The cursor position does not change (after moving to y, x,\n"
-"if specified).");
+"Insert a character string (as many characters as will fit on the\n"
+"line) before the character under the cursor. All characters to the\n"
+"right of the cursor are shifted right, with the rightmost characters\n"
+"on the line being lost. The cursor position does not change (after\n"
+"moving to y, x, if specified).");
#define _CURSES_WINDOW_INSSTR_METHODDEF \
{"insstr", (PyCFunction)_curses_window_insstr, METH_VARARGS, _curses_window_insstr__doc__},
@@ -1174,12 +1178,12 @@ PyDoc_STRVAR(_curses_window_insnstr__doc__,
" attr\n"
" Attributes for characters.\n"
"\n"
-"Insert a character string (as many characters as will fit on the line)\n"
-"before the character under the cursor, up to n characters. If n is zero\n"
-"or negative, the entire string is inserted. All characters to the right\n"
-"of the cursor are shifted right, with the rightmost characters on the line\n"
-"being lost. The cursor position does not change (after moving to y, x, if\n"
-"specified).");
+"Insert a character string (as many characters as will fit on the\n"
+"line) before the character under the cursor, up to n characters. If\n"
+"n is zero or negative, the entire string is inserted. All\n"
+"characters to the right of the cursor are shifted right, with the\n"
+"rightmost characters on the line being lost. The cursor position\n"
+"does not change (after moving to y, x, if specified).");
#define _CURSES_WINDOW_INSNSTR_METHODDEF \
{"insnstr", (PyCFunction)_curses_window_insnstr, METH_VARARGS, _curses_window_insnstr__doc__},
@@ -1245,7 +1249,8 @@ PyDoc_STRVAR(_curses_window_is_linetouched__doc__,
" line\n"
" Line number.\n"
"\n"
-"Raise a curses.error exception if line is not valid for the given window.");
+"Raise a curses.error exception if line is not valid for the given\n"
+"window.");
#define _CURSES_WINDOW_IS_LINETOUCHED_METHODDEF \
{"is_linetouched", (PyCFunction)_curses_window_is_linetouched, METH_O, _curses_window_is_linetouched__doc__},
@@ -1275,9 +1280,9 @@ PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
"noutrefresh([pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol])\n"
"Mark for refresh but wait.\n"
"\n"
-"This function updates the data structure representing the desired state of the\n"
-"window, but does not force an update of the physical screen. To accomplish\n"
-"that, call doupdate().");
+"This function updates the data structure representing the desired\n"
+"state of the window, but does not force an update of the physical\n"
+"screen. To accomplish that, call doupdate().");
#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF \
{"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_VARARGS, _curses_window_noutrefresh__doc__},
@@ -1329,9 +1334,9 @@ PyDoc_STRVAR(_curses_window_noutrefresh__doc__,
"\n"
"Mark for refresh but wait.\n"
"\n"
-"This function updates the data structure representing the desired state of the\n"
-"window, but does not force an update of the physical screen. To accomplish\n"
-"that, call doupdate().");
+"This function updates the data structure representing the desired\n"
+"state of the window, but does not force an update of the physical\n"
+"screen. To accomplish that, call doupdate().");
#define _CURSES_WINDOW_NOUTREFRESH_METHODDEF \
{"noutrefresh", (PyCFunction)_curses_window_noutrefresh, METH_NOARGS, _curses_window_noutrefresh__doc__},
@@ -1351,14 +1356,15 @@ PyDoc_STRVAR(_curses_window_overlay__doc__,
"overlay(destwin, [sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol])\n"
"Overlay the window on top of destwin.\n"
"\n"
-"The windows need not be the same size, only the overlapping region is copied.\n"
-"This copy is non-destructive, which means that the current background\n"
-"character does not overwrite the old contents of destwin.\n"
+"The windows need not be the same size, only the overlapping region\n"
+"is copied. This copy is non-destructive, which means that the\n"
+"current background character does not overwrite the old contents of\n"
+"destwin.\n"
"\n"
-"To get fine-grained control over the copied region, the second form of\n"
-"overlay() can be used. sminrow and smincol are the upper-left coordinates\n"
-"of the source window, and the other variables mark a rectangle in the\n"
-"destination window.");
+"To get fine-grained control over the copied region, the second form\n"
+"of overlay() can be used. sminrow and smincol are the upper-left\n"
+"coordinates of the source window, and the other variables mark\n"
+"a rectangle in the destination window.");
#define _CURSES_WINDOW_OVERLAY_METHODDEF \
{"overlay", (PyCFunction)_curses_window_overlay, METH_VARARGS, _curses_window_overlay__doc__},
@@ -1409,14 +1415,15 @@ PyDoc_STRVAR(_curses_window_overwrite__doc__,
" dmaxcol])\n"
"Overwrite the window on top of destwin.\n"
"\n"
-"The windows need not be the same size, in which case only the overlapping\n"
-"region is copied. This copy is destructive, which means that the current\n"
-"background character overwrites the old contents of destwin.\n"
+"The windows need not be the same size, in which case only the\n"
+"overlapping region is copied. This copy is destructive, which means\n"
+"that the current background character overwrites the old contents of\n"
+"destwin.\n"
"\n"
-"To get fine-grained control over the copied region, the second form of\n"
-"overwrite() can be used. sminrow and smincol are the upper-left coordinates\n"
-"of the source window, the other variables mark a rectangle in the destination\n"
-"window.");
+"To get fine-grained control over the copied region, the second form\n"
+"of overwrite() can be used. sminrow and smincol are the upper-left\n"
+"coordinates of the source window, the other variables mark\n"
+"a rectangle in the destination window.");
#define _CURSES_WINDOW_OVERWRITE_METHODDEF \
{"overwrite", (PyCFunction)_curses_window_overwrite, METH_VARARGS, _curses_window_overwrite__doc__},
@@ -1522,16 +1529,17 @@ PyDoc_STRVAR(_curses_window_refresh__doc__,
"Update the display immediately.\n"
"\n"
"Synchronize actual screen with previous drawing/deleting methods.\n"
-"The 6 optional arguments can only be specified when the window is a pad\n"
-"created with newpad(). The additional parameters are needed to indicate\n"
-"what part of the pad and screen are involved. pminrow and pmincol specify\n"
-"the upper left-hand corner of the rectangle to be displayed in the pad.\n"
-"sminrow, smincol, smaxrow, and smaxcol specify the edges of the rectangle to\n"
-"be displayed on the screen. The lower right-hand corner of the rectangle to\n"
-"be displayed in the pad is calculated from the screen coordinates, since the\n"
-"rectangles must be the same size. Both rectangles must be entirely contained\n"
-"within their respective structures. Negative values of pminrow, pmincol,\n"
-"sminrow, or smincol are treated as if they were zero.");
+"The 6 optional arguments can only be specified when the window is\n"
+"a pad created with newpad(). The additional parameters are needed\n"
+"to indicate what part of the pad and screen are involved. pminrow\n"
+"and pmincol specify the upper left-hand corner of the rectangle to\n"
+"be displayed in the pad. sminrow, smincol, smaxrow, and smaxcol\n"
+"specify the edges of the rectangle to be displayed on the screen.\n"
+"The lower right-hand corner of the rectangle to be displayed in the\n"
+"pad is calculated from the screen coordinates, since the rectangles\n"
+"must be the same size. Both rectangles must be entirely contained\n"
+"within their respective structures. Negative values of pminrow,\n"
+"pmincol, sminrow, or smincol are treated as if they were zero.");
#define _CURSES_WINDOW_REFRESH_METHODDEF \
{"refresh", (PyCFunction)_curses_window_refresh, METH_VARARGS, _curses_window_refresh__doc__},
@@ -1629,8 +1637,8 @@ PyDoc_STRVAR(_curses_window_subwin__doc__,
" begin_x\n"
" Left side x-coordinate.\n"
"\n"
-"By default, the sub-window will extend from the specified position to the\n"
-"lower right corner of the window.");
+"By default, the sub-window will extend from the specified position\n"
+"to the lower right corner of the window.");
#define _CURSES_WINDOW_SUBWIN_METHODDEF \
{"subwin", (PyCFunction)_curses_window_subwin, METH_VARARGS, _curses_window_subwin__doc__},
@@ -1678,7 +1686,8 @@ PyDoc_STRVAR(_curses_window_scroll__doc__,
" lines\n"
" Number of lines to scroll.\n"
"\n"
-"Scroll upward if the argument is positive and downward if it is negative.");
+"Scroll upward if the argument is positive and downward if it is\n"
+"negative.");
#define _CURSES_WINDOW_SCROLL_METHODDEF \
{"scroll", (PyCFunction)_curses_window_scroll, METH_VARARGS, _curses_window_scroll__doc__},
@@ -1717,8 +1726,9 @@ PyDoc_STRVAR(_curses_window_touchline__doc__,
"touchline(start, count, [changed=True])\n"
"Pretend count lines have been changed, starting with line start.\n"
"\n"
-"If changed is supplied, it specifies whether the affected lines are marked\n"
-"as having been changed (changed=True) or unchanged (changed=False).");
+"If changed is supplied, it specifies whether the affected lines are\n"
+"marked as having been changed (changed=True) or unchanged\n"
+"(changed=False).");
#define _CURSES_WINDOW_TOUCHLINE_METHODDEF \
{"touchline", (PyCFunction)_curses_window_touchline, METH_VARARGS, _curses_window_touchline__doc__},
@@ -1912,11 +1922,12 @@ PyDoc_STRVAR(_curses_cbreak__doc__,
" flag\n"
" If false, the effect is the same as calling nocbreak().\n"
"\n"
-"In cbreak mode (sometimes called \"rare\" mode) normal tty line buffering is\n"
-"turned off and characters are available to be read one by one. However,\n"
-"unlike raw mode, special characters (interrupt, quit, suspend, and flow\n"
-"control) retain their effects on the tty driver and calling program.\n"
-"Calling first raw() then cbreak() leaves the terminal in cbreak mode.");
+"In cbreak mode (sometimes called \"rare\" mode) normal tty line buffering\n"
+"is turned off and characters are available to be read one by one.\n"
+"However, unlike raw mode, special characters (interrupt, quit, suspend,\n"
+"and flow control) retain their effects on the tty driver and calling\n"
+"program. Calling first raw() then cbreak() leaves the terminal in\n"
+"cbreak mode.");
#define _CURSES_CBREAK_METHODDEF \
{"cbreak", _PyCFunction_CAST(_curses_cbreak), METH_FASTCALL, _curses_cbreak__doc__},
@@ -1956,8 +1967,9 @@ PyDoc_STRVAR(_curses_color_content__doc__,
" color_number\n"
" The number of the color (0 - (COLORS-1)).\n"
"\n"
-"A 3-tuple is returned, containing the R, G, B values for the given color,\n"
-"which will be between 0 (no component) and 1000 (maximum amount of component).");
+"A 3-tuple is returned, containing the R, G, B values for the given\n"
+"color, which will be between 0 (no component) and 1000 (maximum amount\n"
+"of component).");
#define _CURSES_COLOR_CONTENT_METHODDEF \
{"color_content", (PyCFunction)_curses_color_content, METH_O, _curses_color_content__doc__},
@@ -1990,7 +2002,8 @@ PyDoc_STRVAR(_curses_color_pair__doc__,
" The number of the color pair.\n"
"\n"
"This attribute value can be combined with A_STANDOUT, A_REVERSE, and the\n"
-"other A_* attributes. pair_number() is the counterpart to this function.");
+"other A_* attributes. pair_number() is the counterpart to this\n"
+"function.");
#define _CURSES_COLOR_PAIR_METHODDEF \
{"color_pair", (PyCFunction)_curses_color_pair, METH_O, _curses_color_pair__doc__},
@@ -2024,9 +2037,9 @@ PyDoc_STRVAR(_curses_curs_set__doc__,
" 0 for invisible, 1 for normal visible, or 2 for very visible.\n"
"\n"
"If the terminal supports the visibility requested, the previous cursor\n"
-"state is returned; otherwise, an exception is raised. On many terminals,\n"
-"the \"visible\" mode is an underline cursor and the \"very visible\" mode is\n"
-"a block cursor.");
+"state is returned; otherwise, an exception is raised. On many\n"
+"terminals, the \"visible\" mode is an underline cursor and the \"very\n"
+"visible\" mode is a block cursor.");
#define _CURSES_CURS_SET_METHODDEF \
{"curs_set", (PyCFunction)_curses_curs_set, METH_O, _curses_curs_set__doc__},
@@ -2078,7 +2091,8 @@ PyDoc_STRVAR(_curses_def_shell_mode__doc__,
"\n"
"Save the current terminal mode as the \"shell\" mode.\n"
"\n"
-"The \"shell\" mode is the mode when the running program is not using curses.\n"
+"The \"shell\" mode is the mode when the running program is not using\n"
+"curses.\n"
"\n"
"Subsequent calls to reset_shell_mode() will restore this mode.");
@@ -2152,7 +2166,8 @@ PyDoc_STRVAR(_curses_echo__doc__,
" flag\n"
" If false, the effect is the same as calling noecho().\n"
"\n"
-"In echo mode, each character input is echoed to the screen as it is entered.");
+"In echo mode, each character input is echoed to the screen as it is\n"
+"entered.");
#define _CURSES_ECHO_METHODDEF \
{"echo", _PyCFunction_CAST(_curses_echo), METH_FASTCALL, _curses_echo__doc__},
@@ -2225,7 +2240,8 @@ PyDoc_STRVAR(_curses_flash__doc__,
"\n"
"Flash the screen.\n"
"\n"
-"That is, change it to reverse-video and then change it back in a short interval.");
+"That is, change it to reverse-video and then change it back in a short\n"
+"interval.");
#define _CURSES_FLASH_METHODDEF \
{"flash", (PyCFunction)_curses_flash, METH_NOARGS, _curses_flash__doc__},
@@ -2245,8 +2261,8 @@ PyDoc_STRVAR(_curses_flushinp__doc__,
"\n"
"Flush all input buffers.\n"
"\n"
-"This throws away any typeahead that has been typed by the user and has not\n"
-"yet been processed by the program.");
+"This throws away any typeahead that has been typed by the user and has\n"
+"not yet been processed by the program.");
#define _CURSES_FLUSHINP_METHODDEF \
{"flushinp", (PyCFunction)_curses_flushinp, METH_NOARGS, _curses_flushinp__doc__},
@@ -2601,8 +2617,9 @@ PyDoc_STRVAR(_curses_init_pair__doc__,
" bg\n"
" Background color number (-1 - (COLORS-1)).\n"
"\n"
-"If the color-pair was previously initialized, the screen is refreshed and\n"
-"all occurrences of that color-pair are changed to the new definition.");
+"If the color-pair was previously initialized, the screen is refreshed\n"
+"and all occurrences of that color-pair are changed to the new\n"
+"definition.");
#define _CURSES_INIT_PAIR_METHODDEF \
{"init_pair", _PyCFunction_CAST(_curses_init_pair), METH_FASTCALL, _curses_init_pair__doc__},
@@ -2758,9 +2775,9 @@ PyDoc_STRVAR(_curses_get_escdelay__doc__,
"\n"
"Gets the curses ESCDELAY setting.\n"
"\n"
-"Gets the number of milliseconds to wait after reading an escape character,\n"
-"to distinguish between an individual escape character entered on the\n"
-"keyboard from escape sequences sent by cursor and function keys.");
+"Gets the number of milliseconds to wait after reading an escape\n"
+"character, to distinguish between an individual escape character entered\n"
+"on the keyboard from escape sequences sent by cursor and function keys.");
#define _CURSES_GET_ESCDELAY_METHODDEF \
{"get_escdelay", (PyCFunction)_curses_get_escdelay, METH_NOARGS, _curses_get_escdelay__doc__},
@@ -2787,9 +2804,9 @@ PyDoc_STRVAR(_curses_set_escdelay__doc__,
" ms\n"
" length of the delay in milliseconds.\n"
"\n"
-"Sets the number of milliseconds to wait after reading an escape character,\n"
-"to distinguish between an individual escape character entered on the\n"
-"keyboard from escape sequences sent by cursor and function keys.");
+"Sets the number of milliseconds to wait after reading an escape\n"
+"character, to distinguish between an individual escape character entered\n"
+"on the keyboard from escape sequences sent by cursor and function keys.");
#define _CURSES_SET_ESCDELAY_METHODDEF \
{"set_escdelay", (PyCFunction)_curses_set_escdelay, METH_O, _curses_set_escdelay__doc__},
@@ -2823,8 +2840,8 @@ PyDoc_STRVAR(_curses_get_tabsize__doc__,
"\n"
"Gets the curses TABSIZE setting.\n"
"\n"
-"Gets the number of columns used by the curses library when converting a tab\n"
-"character to spaces as it adds the tab to a window.");
+"Gets the number of columns used by the curses library when converting\n"
+"a tab character to spaces as it adds the tab to a window.");
#define _CURSES_GET_TABSIZE_METHODDEF \
{"get_tabsize", (PyCFunction)_curses_get_tabsize, METH_NOARGS, _curses_get_tabsize__doc__},
@@ -2851,8 +2868,8 @@ PyDoc_STRVAR(_curses_set_tabsize__doc__,
" size\n"
" rendered cell width of a tab character.\n"
"\n"
-"Sets the number of columns used by the curses library when converting a tab\n"
-"character to spaces as it adds the tab to a window.");
+"Sets the number of columns used by the curses library when converting\n"
+"a tab character to spaces as it adds the tab to a window.");
#define _CURSES_SET_TABSIZE_METHODDEF \
{"set_tabsize", (PyCFunction)_curses_set_tabsize, METH_O, _curses_set_tabsize__doc__},
@@ -3023,8 +3040,8 @@ PyDoc_STRVAR(_curses_longname__doc__,
"\n"
"Return the terminfo long name field describing the current terminal.\n"
"\n"
-"The maximum length of a verbose description is 128 characters. It is defined\n"
-"only after the call to initscr().");
+"The maximum length of a verbose description is 128 characters. It is\n"
+"defined only after the call to initscr().");
#define _CURSES_LONGNAME_METHODDEF \
{"longname", (PyCFunction)_curses_longname, METH_NOARGS, _curses_longname__doc__},
@@ -3081,8 +3098,8 @@ PyDoc_STRVAR(_curses_mouseinterval__doc__,
" Time in milliseconds.\n"
"\n"
"Set the maximum time that can elapse between press and release events in\n"
-"order for them to be recognized as a click, and return the previous interval\n"
-"value.");
+"order for them to be recognized as a click, and return the previous\n"
+"interval value.");
#define _CURSES_MOUSEINTERVAL_METHODDEF \
{"mouseinterval", (PyCFunction)_curses_mouseinterval, METH_O, _curses_mouseinterval__doc__},
@@ -3117,9 +3134,10 @@ PyDoc_STRVAR(_curses_mousemask__doc__,
"Set the mouse events to be reported, and return a tuple (availmask, oldmask).\n"
"\n"
"Return a tuple (availmask, oldmask). availmask indicates which of the\n"
-"specified mouse events can be reported; on complete failure it returns 0.\n"
-"oldmask is the previous value of the given window\'s mouse event mask.\n"
-"If this function is never called, no mouse events are ever reported.");
+"specified mouse events can be reported; on complete failure it returns\n"
+"0. oldmask is the previous value of the given window\'s mouse event\n"
+"mask. If this function is never called, no mouse events are ever\n"
+"reported.");
#define _CURSES_MOUSEMASK_METHODDEF \
{"mousemask", (PyCFunction)_curses_mousemask, METH_O, _curses_mousemask__doc__},
@@ -3236,8 +3254,8 @@ PyDoc_STRVAR(_curses_newwin__doc__,
" begin_x\n"
" Left side x-coordinate.\n"
"\n"
-"By default, the window will extend from the specified position to the lower\n"
-"right corner of the screen.");
+"By default, the window will extend from the specified position to the\n"
+"lower right corner of the screen.");
#define _CURSES_NEWWIN_METHODDEF \
{"newwin", (PyCFunction)_curses_newwin, METH_VARARGS, _curses_newwin__doc__},
@@ -3287,8 +3305,9 @@ PyDoc_STRVAR(_curses_nl__doc__,
" flag\n"
" If false, the effect is the same as calling nonl().\n"
"\n"
-"This mode translates the return key into newline on input, and translates\n"
-"newline into return and line-feed on output. Newline mode is initially on.");
+"This mode translates the return key into newline on input, and\n"
+"translates newline into return and line-feed on output. Newline mode\n"
+"is initially on.");
#define _CURSES_NL_METHODDEF \
{"nl", _PyCFunction_CAST(_curses_nl), METH_FASTCALL, _curses_nl__doc__},
@@ -3365,8 +3384,8 @@ PyDoc_STRVAR(_curses_nonl__doc__,
"\n"
"Leave newline mode.\n"
"\n"
-"Disable translation of return into newline on input, and disable low-level\n"
-"translation of newline into newline/return on output.");
+"Disable translation of return into newline on input, and disable\n"
+"low-level translation of newline into newline/return on output.");
#define _CURSES_NONL_METHODDEF \
{"nonl", (PyCFunction)_curses_nonl, METH_NOARGS, _curses_nonl__doc__},
@@ -3582,8 +3601,8 @@ PyDoc_STRVAR(_curses_raw__doc__,
" If false, the effect is the same as calling noraw().\n"
"\n"
"In raw mode, normal line buffering and processing of interrupt, quit,\n"
-"suspend, and flow control keys are turned off; characters are presented to\n"
-"curses input functions one by one.");
+"suspend, and flow control keys are turned off; characters are presented\n"
+"to curses input functions one by one.");
#define _CURSES_RAW_METHODDEF \
{"raw", _PyCFunction_CAST(_curses_raw), METH_FASTCALL, _curses_raw__doc__},
@@ -3681,8 +3700,8 @@ PyDoc_STRVAR(_curses_resizeterm__doc__,
" ncols\n"
" Width.\n"
"\n"
-"Adjusts other bookkeeping data used by the curses library that record the\n"
-"window dimensions (in particular the SIGWINCH handler).");
+"Adjusts other bookkeeping data used by the curses library that record\n"
+"the window dimensions (in particular the SIGWINCH handler).");
#define _CURSES_RESIZETERM_METHODDEF \
{"resizeterm", _PyCFunction_CAST(_curses_resizeterm), METH_FASTCALL, _curses_resizeterm__doc__},
@@ -3760,10 +3779,11 @@ PyDoc_STRVAR(_curses_resize_term__doc__,
" Width.\n"
"\n"
"When resizing the windows, resize_term() blank-fills the areas that are\n"
-"extended. The calling application should fill in these areas with appropriate\n"
-"data. The resize_term() function attempts to resize all windows. However,\n"
-"due to the calling convention of pads, it is not possible to resize these\n"
-"without additional interaction with the application.");
+"extended. The calling application should fill in these areas with\n"
+"appropriate data. The resize_term() function attempts to resize all\n"
+"windows. However, due to the calling convention of pads, it is not\n"
+"possible to resize these without additional interaction with the\n"
+"application.");
#define _CURSES_RESIZE_TERM_METHODDEF \
{"resize_term", _PyCFunction_CAST(_curses_resize_term), METH_FASTCALL, _curses_resize_term__doc__},
@@ -3898,12 +3918,12 @@ PyDoc_STRVAR(_curses_start_color__doc__,
"\n"
"Initializes eight basic colors and global variables COLORS and COLOR_PAIRS.\n"
"\n"
-"Must be called if the programmer wants to use colors, and before any other\n"
-"color manipulation routine is called. It is good practice to call this\n"
-"routine right after initscr().\n"
+"Must be called if the programmer wants to use colors, and before any\n"
+"other color manipulation routine is called. It is good practice to call\n"
+"this routine right after initscr().\n"
"\n"
-"It also restores the colors on the terminal to the values they had when the\n"
-"terminal was just turned on.");
+"It also restores the colors on the terminal to the values they had when\n"
+"the terminal was just turned on.");
#define _CURSES_START_COLOR_METHODDEF \
{"start_color", (PyCFunction)_curses_start_color, METH_NOARGS, _curses_start_color__doc__},
@@ -4005,8 +4025,8 @@ PyDoc_STRVAR(_curses_tigetnum__doc__,
" capname\n"
" The terminfo capability name.\n"
"\n"
-"The value -2 is returned if capname is not a numeric capability, or -1 if\n"
-"it is canceled or absent from the terminal description.");
+"The value -2 is returned if capname is not a numeric capability, or -1\n"
+"if it is canceled or absent from the terminal description.");
#define _CURSES_TIGETNUM_METHODDEF \
{"tigetnum", (PyCFunction)_curses_tigetnum, METH_O, _curses_tigetnum__doc__},
@@ -4048,8 +4068,8 @@ PyDoc_STRVAR(_curses_tigetstr__doc__,
" capname\n"
" The terminfo capability name.\n"
"\n"
-"None is returned if capname is not a string capability, or is canceled or\n"
-"absent from the terminal description.");
+"None is returned if capname is not a string capability, or is canceled\n"
+"or absent from the terminal description.");
#define _CURSES_TIGETSTR_METHODDEF \
{"tigetstr", (PyCFunction)_curses_tigetstr, METH_O, _curses_tigetstr__doc__},
@@ -4203,14 +4223,14 @@ PyDoc_STRVAR(_curses_use_env__doc__,
"\n"
"Use environment variables LINES and COLUMNS.\n"
"\n"
-"If used, this function should be called before initscr() or newterm() are\n"
-"called.\n"
+"If used, this function should be called before initscr() or newterm()\n"
+"are called.\n"
"\n"
-"When flag is False, the values of lines and columns specified in the terminfo\n"
-"database will be used, even if environment variables LINES and COLUMNS (used\n"
-"by default) are set, or if curses is running in a window (in which case\n"
-"default behavior would be to use the window size if LINES and COLUMNS are\n"
-"not set).");
+"When flag is False, the values of lines and columns specified in the\n"
+"terminfo database will be used, even if environment variables LINES and\n"
+"COLUMNS (used by default) are set, or if curses is running in a window\n"
+"(in which case default behavior would be to use the window size if LINES\n"
+"and COLUMNS are not set).");
#define _CURSES_USE_ENV_METHODDEF \
{"use_env", (PyCFunction)_curses_use_env, METH_O, _curses_use_env__doc__},
@@ -4373,4 +4393,4 @@ _curses_has_extended_color_support(PyObject *module, PyObject *Py_UNUSED(ignored
#ifndef _CURSES_USE_DEFAULT_COLORS_METHODDEF
#define _CURSES_USE_DEFAULT_COLORS_METHODDEF
#endif /* !defined(_CURSES_USE_DEFAULT_COLORS_METHODDEF) */
-/*[clinic end generated code: output=265cd9f5affbad5e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=833ee704415ce160 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_datetimemodule.c.h b/contrib/tools/python3/Modules/clinic/_datetimemodule.c.h
index 48499e0aaf7..f8987d3eded 100644
--- a/contrib/tools/python3/Modules/clinic/_datetimemodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_datetimemodule.c.h
@@ -14,8 +14,8 @@ PyDoc_STRVAR(datetime_date_fromtimestamp__doc__,
"\n"
"Create a date from a POSIX timestamp.\n"
"\n"
-"The timestamp is a number, e.g. created via time.time(), that is interpreted\n"
-"as local time.");
+"The timestamp is a number, e.g. created via time.time(), that is\n"
+"interpreted as local time.");
#define DATETIME_DATE_FROMTIMESTAMP_METHODDEF \
{"fromtimestamp", (PyCFunction)datetime_date_fromtimestamp, METH_O|METH_CLASS, datetime_date_fromtimestamp__doc__},
@@ -496,4 +496,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=c7a04b865b1e0890 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1ba8c631dace0000 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_dbmmodule.c.h b/contrib/tools/python3/Modules/clinic/_dbmmodule.c.h
index 4379b433db3..cd0192a19d4 100644
--- a/contrib/tools/python3/Modules/clinic/_dbmmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_dbmmodule.c.h
@@ -97,7 +97,8 @@ PyDoc_STRVAR(_dbm_dbm_setdefault__doc__,
"\n"
"Return the value for key if present, otherwise default.\n"
"\n"
-"If key is not in the database, it is inserted with default as the value.");
+"If key is not in the database, it is inserted with default as the\n"
+"value.");
#define _DBM_DBM_SETDEFAULT_METHODDEF \
{"setdefault", _PyCFunction_CAST(_dbm_dbm_setdefault), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _dbm_dbm_setdefault__doc__},
@@ -221,4 +222,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=f7d9a87d80a64278 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=43f744d870dc6036 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_gdbmmodule.c.h b/contrib/tools/python3/Modules/clinic/_gdbmmodule.c.h
index bbf4365114c..b776b602cb3 100644
--- a/contrib/tools/python3/Modules/clinic/_gdbmmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_gdbmmodule.c.h
@@ -122,9 +122,9 @@ PyDoc_STRVAR(_gdbm_gdbm_firstkey__doc__,
"\n"
"Return the starting key for the traversal.\n"
"\n"
-"It\'s possible to loop over every key in the database using this method\n"
-"and the nextkey() method. The traversal is ordered by GDBM\'s internal\n"
-"hash values, and won\'t be sorted by the key values.");
+"It\'s possible to loop over every key in the database using this\n"
+"method and the nextkey() method. The traversal is ordered by GDBM\'s\n"
+"internal hash values, and won\'t be sorted by the key values.");
#define _GDBM_GDBM_FIRSTKEY_METHODDEF \
{"firstkey", _PyCFunction_CAST(_gdbm_gdbm_firstkey), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_firstkey__doc__},
@@ -148,8 +148,8 @@ PyDoc_STRVAR(_gdbm_gdbm_nextkey__doc__,
"\n"
"Returns the key that follows key in the traversal.\n"
"\n"
-"The following code prints every key in the database db, without having\n"
-"to create a list in memory that contains them all:\n"
+"The following code prints every key in the database db, without\n"
+"having to create a list in memory that contains them all:\n"
"\n"
" k = db.firstkey()\n"
" while k is not None:\n"
@@ -201,9 +201,9 @@ PyDoc_STRVAR(_gdbm_gdbm_reorganize__doc__,
"\n"
"If you have carried out a lot of deletions and would like to shrink\n"
"the space used by the GDBM file, this routine will reorganize the\n"
-"database. GDBM will not shorten the length of a database file except\n"
-"by using this reorganization; otherwise, deleted file space will be\n"
-"kept and reused as new (key,value) pairs are added.");
+"database. GDBM will not shorten the length of a database file\n"
+"except by using this reorganization; otherwise, deleted file space\n"
+"will be kept and reused as new (key,value) pairs are added.");
#define _GDBM_GDBM_REORGANIZE_METHODDEF \
{"reorganize", _PyCFunction_CAST(_gdbm_gdbm_reorganize), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _gdbm_gdbm_reorganize__doc__},
@@ -343,4 +343,4 @@ skip_optional:
exit:
return return_value;
}
-/*[clinic end generated code: output=07bdeb4a8ecb328e input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9c85138071dd473a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_hashopenssl.c.h b/contrib/tools/python3/Modules/clinic/_hashopenssl.c.h
index 621093e7e76..e323708f559 100644
--- a/contrib/tools/python3/Modules/clinic/_hashopenssl.c.h
+++ b/contrib/tools/python3/Modules/clinic/_hashopenssl.c.h
@@ -1812,8 +1812,8 @@ PyDoc_STRVAR(_hashlib_HMAC_hexdigest__doc__,
"\n"
"Return hexadecimal digest of the bytes passed to the update() method so far.\n"
"\n"
-"This may be used to exchange the value safely in email or other non-binary\n"
-"environments.");
+"This may be used to exchange the value safely in email or other\n"
+"non-binary environments.");
#define _HASHLIB_HMAC_HEXDIGEST_METHODDEF \
{"hexdigest", (PyCFunction)_hashlib_HMAC_hexdigest, METH_NOARGS, _hashlib_HMAC_hexdigest__doc__},
@@ -1834,8 +1834,8 @@ PyDoc_STRVAR(_hashlib_get_fips_mode__doc__,
"Determine the OpenSSL FIPS mode of operation.\n"
"\n"
"For OpenSSL 3.0.0 and newer it returns the state of the default provider\n"
-"in the default OSSL context. It\'s not quite the same as FIPS_mode() but good\n"
-"enough for unittests.\n"
+"in the default OSSL context. It\'s not quite the same as FIPS_mode() but\n"
+"good enough for unittests.\n"
"\n"
"Effectively any non-zero return value indicates FIPS mode;\n"
"values other than 1 may have additional significance.");
@@ -1937,4 +1937,4 @@ exit:
#ifndef _HASHLIB_SCRYPT_METHODDEF
#define _HASHLIB_SCRYPT_METHODDEF
#endif /* !defined(_HASHLIB_SCRYPT_METHODDEF) */
-/*[clinic end generated code: output=4c9222b02b194662 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=b210ba56e3dfb58a input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_lzmamodule.c.h b/contrib/tools/python3/Modules/clinic/_lzmamodule.c.h
index 51fab5eab3f..233d41bbf4a 100644
--- a/contrib/tools/python3/Modules/clinic/_lzmamodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_lzmamodule.c.h
@@ -74,18 +74,19 @@ PyDoc_STRVAR(_lzma_LZMADecompressor_decompress__doc__,
"\n"
"Decompress *data*, returning uncompressed data as bytes.\n"
"\n"
-"If *max_length* is nonnegative, returns at most *max_length* bytes of\n"
-"decompressed data. If this limit is reached and further output can be\n"
-"produced, *self.needs_input* will be set to ``False``. In this case, the next\n"
-"call to *decompress()* may provide *data* as b\'\' to obtain more of the output.\n"
+"If *max_length* is nonnegative, returns at most *max_length* bytes\n"
+"of decompressed data. If this limit is reached and further output\n"
+"can be produced, *self.needs_input* will be set to ``False``. In\n"
+"this case, the next call to *decompress()* may provide *data* as b\'\'\n"
+"to obtain more of the output.\n"
"\n"
-"If all of the input data was decompressed and returned (either because this\n"
-"was less than *max_length* bytes, or because *max_length* was negative),\n"
-"*self.needs_input* will be set to True.\n"
+"If all of the input data was decompressed and returned (either\n"
+"because this was less than *max_length* bytes, or because\n"
+"*max_length* was negative), *self.needs_input* will be set to True.\n"
"\n"
-"Attempting to decompress data after the end of stream is reached raises an\n"
-"EOFError. Any data found after the end of the stream is ignored and saved in\n"
-"the unused_data attribute.");
+"Attempting to decompress data after the end of stream is reached\n"
+"raises an EOFError. Any data found after the end of the stream is\n"
+"ignored and saved in the unused_data attribute.");
#define _LZMA_LZMADECOMPRESSOR_DECOMPRESS_METHODDEF \
{"decompress", _PyCFunction_CAST(_lzma_LZMADecompressor_decompress), METH_FASTCALL|METH_KEYWORDS, _lzma_LZMADecompressor_decompress__doc__},
@@ -327,4 +328,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=5e79c05ace76dc96 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0edad6505009133f input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_posixsubprocess.c.h b/contrib/tools/python3/Modules/clinic/_posixsubprocess.c.h
index dd7644de6b7..3a0a1f738aa 100644
--- a/contrib/tools/python3/Modules/clinic/_posixsubprocess.c.h
+++ b/contrib/tools/python3/Modules/clinic/_posixsubprocess.c.h
@@ -14,15 +14,15 @@ PyDoc_STRVAR(subprocess_fork_exec__doc__,
"\n"
"Spawn a fresh new child process.\n"
"\n"
-"Fork a child process, close parent file descriptors as appropriate in the\n"
-"child and duplicate the few that are needed before calling exec() in the\n"
-"child process.\n"
+"Fork a child process, close parent file descriptors as appropriate in\n"
+"the child and duplicate the few that are needed before calling exec() in\n"
+"the child process.\n"
"\n"
-"If close_fds is True, close file descriptors 3 and higher, except those listed\n"
-"in the sorted tuple pass_fds.\n"
+"If close_fds is True, close file descriptors 3 and higher, except those\n"
+"listed in the sorted tuple pass_fds.\n"
"\n"
-"The preexec_fn, if supplied, will be called immediately before closing file\n"
-"descriptors and exec.\n"
+"The preexec_fn, if supplied, will be called immediately before closing\n"
+"file descriptors and exec.\n"
"\n"
"WARNING: preexec_fn is NOT SAFE if your application uses threads.\n"
" It may trigger infrequent, difficult to debug deadlocks.\n"
@@ -155,4 +155,4 @@ subprocess_fork_exec(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=48555f5965a871be input=a9049054013a1b77]*/
+/*[clinic end generated code: output=47682cb62b0b08b2 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_queuemodule.c.h b/contrib/tools/python3/Modules/clinic/_queuemodule.c.h
index 6f4c715c722..3f19520352b 100644
--- a/contrib/tools/python3/Modules/clinic/_queuemodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/_queuemodule.c.h
@@ -44,8 +44,9 @@ PyDoc_STRVAR(_queue_SimpleQueue_put__doc__,
"\n"
"Put the item on the queue.\n"
"\n"
-"The optional \'block\' and \'timeout\' arguments are ignored, as this method\n"
-"never blocks. They are provided for compatibility with the Queue class.");
+"The optional \'block\' and \'timeout\' arguments are ignored, as this\n"
+"method never blocks. They are provided for compatibility with the\n"
+"Queue class.");
#define _QUEUE_SIMPLEQUEUE_PUT_METHODDEF \
{"put", _PyCFunction_CAST(_queue_SimpleQueue_put), METH_FASTCALL|METH_KEYWORDS, _queue_SimpleQueue_put__doc__},
@@ -182,10 +183,11 @@ PyDoc_STRVAR(_queue_SimpleQueue_get__doc__,
"\n"
"Remove and return an item from the queue.\n"
"\n"
-"If optional args \'block\' is true and \'timeout\' is None (the default),\n"
-"block if necessary until an item is available. If \'timeout\' is\n"
-"a non-negative number, it blocks at most \'timeout\' seconds and raises\n"
-"the Empty exception if no item was available within that time.\n"
+"If optional args \'block\' is true and \'timeout\' is None (the\n"
+"default), block if necessary until an item is available. If\n"
+"\'timeout\' is a non-negative number, it blocks at most \'timeout\'\n"
+"seconds and raises the Empty exception if no item was available\n"
+"within that time.\n"
"Otherwise (\'block\' is false), return an item if one is immediately\n"
"available, else raise the Empty exception (\'timeout\' is ignored\n"
"in that case).");
@@ -349,4 +351,4 @@ _queue_SimpleQueue_qsize(simplequeueobject *self, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=44a718f40072018a input=a9049054013a1b77]*/
+/*[clinic end generated code: output=25c2af38811bc536 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_ssl.c.h b/contrib/tools/python3/Modules/clinic/_ssl.c.h
index 628bd877fe1..2cb60b7dca8 100644
--- a/contrib/tools/python3/Modules/clinic/_ssl.c.h
+++ b/contrib/tools/python3/Modules/clinic/_ssl.c.h
@@ -264,9 +264,10 @@ _ssl__SSLSocket_compression(PySSLSocket *self, PyObject *Py_UNUSED(ignored))
PyDoc_STRVAR(_ssl__SSLSocket_context__doc__,
"This changes the context associated with the SSLSocket.\n"
"\n"
-"This is typically used from within a callback function set by the sni_callback\n"
-"on the SSLContext to change the certificate information associated with the\n"
-"SSLSocket before the cryptographic exchange handshake messages.");
+"This is typically used from within a callback function set by the\n"
+"sni_callback on the SSLContext to change the certificate information\n"
+"associated with the SSLSocket before the cryptographic exchange\n"
+"handshake messages.");
#if defined(_ssl__SSLSocket_context_DOCSTR)
# undef _ssl__SSLSocket_context_DOCSTR
#endif
@@ -583,8 +584,9 @@ PyDoc_STRVAR(_ssl__SSLSocket_get_channel_binding__doc__,
"\n"
"Get channel binding data for current connection.\n"
"\n"
-"Raise ValueError if the requested `cb_type` is not supported. Return bytes\n"
-"of the data or None if the data is not available (e.g. before the handshake).\n"
+"Raise ValueError if the requested `cb_type` is not supported.\n"
+"Return bytes of the data or None if the data is not available (e.g.\n"
+"before the handshake).\n"
"Only \'tls-unique\' channel binding data from RFC 5929 is supported.");
#define _SSL__SSLSOCKET_GET_CHANNEL_BINDING_METHODDEF \
@@ -1796,8 +1798,9 @@ _ssl__SSLContext_set_ecdh_curve(PySSLContext *self, PyObject *name)
PyDoc_STRVAR(_ssl__SSLContext_sni_callback__doc__,
"Set a callback that will be called when a server name is provided by the SSL/TLS client in the SNI extension.\n"
"\n"
-"If the argument is None then the callback is disabled. The method is called\n"
-"with the SSLSocket, the server name as a string, and the SSLContext object.\n"
+"If the argument is None then the callback is disabled. The method\n"
+"is called with the SSLSocket, the server name as a string, and the\n"
+"SSLContext object.\n"
"\n"
"See RFC 6066 for details of the SNI extension.");
#if defined(_ssl__SSLContext_sni_callback_DOCSTR)
@@ -1861,11 +1864,11 @@ PyDoc_STRVAR(_ssl__SSLContext_cert_store_stats__doc__,
"\n"
"Returns quantities of loaded X.509 certificates.\n"
"\n"
-"X.509 certificates with a CA extension and certificate revocation lists\n"
-"inside the context\'s cert store.\n"
+"X.509 certificates with a CA extension and certificate revocation\n"
+"lists inside the context\'s cert store.\n"
"\n"
-"NOTE: Certificates in a capath directory aren\'t loaded unless they have\n"
-"been used at least once.");
+"NOTE: Certificates in a capath directory aren\'t loaded unless they\n"
+"have been used at least once.");
#define _SSL__SSLCONTEXT_CERT_STORE_STATS_METHODDEF \
{"cert_store_stats", (PyCFunction)_ssl__SSLContext_cert_store_stats, METH_NOARGS, _ssl__SSLContext_cert_store_stats__doc__},
@@ -1891,11 +1894,11 @@ PyDoc_STRVAR(_ssl__SSLContext_get_ca_certs__doc__,
"\n"
"Returns a list of dicts with information of loaded CA certs.\n"
"\n"
-"If the optional argument is True, returns a DER-encoded copy of the CA\n"
-"certificate.\n"
+"If the optional argument is True, returns a DER-encoded copy of the\n"
+"CA certificate.\n"
"\n"
-"NOTE: Certificates in a capath directory aren\'t loaded unless they have\n"
-"been used at least once.");
+"NOTE: Certificates in a capath directory aren\'t loaded unless they\n"
+"have been used at least once.");
#define _SSL__SSLCONTEXT_GET_CA_CERTS_METHODDEF \
{"get_ca_certs", _PyCFunction_CAST(_ssl__SSLContext_get_ca_certs), METH_FASTCALL|METH_KEYWORDS, _ssl__SSLContext_get_ca_certs__doc__},
@@ -2547,8 +2550,8 @@ PyDoc_STRVAR(_ssl_RAND_status__doc__,
"\n"
"Returns True if the OpenSSL PRNG has been seeded with enough data and False if not.\n"
"\n"
-"It is necessary to seed the PRNG with RAND_add() on some platforms before\n"
-"using the ssl() function.");
+"It is necessary to seed the PRNG with RAND_add() on some platforms\n"
+"before using the ssl() function.");
#define _SSL_RAND_STATUS_METHODDEF \
{"RAND_status", (PyCFunction)_ssl_RAND_status, METH_NOARGS, _ssl_RAND_status__doc__},
@@ -2714,11 +2717,11 @@ PyDoc_STRVAR(_ssl_enum_certificates__doc__,
"\n"
"Retrieve certificates from Windows\' cert store.\n"
"\n"
-"store_name may be one of \'CA\', \'ROOT\' or \'MY\'. The system may provide\n"
-"more cert storages, too. The function returns a list of (bytes,\n"
-"encoding_type, trust) tuples. The encoding_type flag can be interpreted\n"
-"with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The trust setting is either\n"
-"a set of OIDs or the boolean True.");
+"store_name may be one of \'CA\', \'ROOT\' or \'MY\'. The system may\n"
+"provide more cert storages, too. The function returns a list of\n"
+"(bytes, encoding_type, trust) tuples. The encoding_type flag can be\n"
+"interpreted with X509_ASN_ENCODING or PKCS_7_ASN_ENCODING. The\n"
+"trust setting is either a set of OIDs or the boolean True.");
#define _SSL_ENUM_CERTIFICATES_METHODDEF \
{"enum_certificates", _PyCFunction_CAST(_ssl_enum_certificates), METH_FASTCALL|METH_KEYWORDS, _ssl_enum_certificates__doc__},
@@ -2870,4 +2873,4 @@ exit:
#ifndef _SSL_ENUM_CRLS_METHODDEF
#define _SSL_ENUM_CRLS_METHODDEF
#endif /* !defined(_SSL_ENUM_CRLS_METHODDEF) */
-/*[clinic end generated code: output=6849453c6b91db74 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d6407f7dbbc5d5b7 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_testmultiphase.c.h b/contrib/tools/python3/Modules/clinic/_testmultiphase.c.h
index 452897b3fae..67a60c07fef 100644
--- a/contrib/tools/python3/Modules/clinic/_testmultiphase.c.h
+++ b/contrib/tools/python3/Modules/clinic/_testmultiphase.c.h
@@ -14,8 +14,8 @@ PyDoc_STRVAR(_testmultiphase_StateAccessType_get_defining_module__doc__,
"\n"
"Return the module of the defining class.\n"
"\n"
-"Also tests that result of PyType_GetModuleByDef matches defining_class\'s\n"
-"module.");
+"Also tests that result of PyType_GetModuleByDef matches\n"
+"defining_class\'s module.");
#define _TESTMULTIPHASE_STATEACCESSTYPE_GET_DEFINING_MODULE_METHODDEF \
{"get_defining_module", _PyCFunction_CAST(_testmultiphase_StateAccessType_get_defining_module), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _testmultiphase_StateAccessType_get_defining_module__doc__},
@@ -162,4 +162,4 @@ _testmultiphase_StateAccessType_get_count(StateAccessTypeObject *self, PyTypeObj
}
return _testmultiphase_StateAccessType_get_count_impl(self, cls);
}
-/*[clinic end generated code: output=59cb50dae2d11dc1 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fb8568dff1205ece input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/_tkinter.c.h b/contrib/tools/python3/Modules/clinic/_tkinter.c.h
index 2b1ac954b4d..6e2d8363506 100644
--- a/contrib/tools/python3/Modules/clinic/_tkinter.c.h
+++ b/contrib/tools/python3/Modules/clinic/_tkinter.c.h
@@ -829,7 +829,8 @@ PyDoc_STRVAR(_tkinter_setbusywaitinterval__doc__,
"\n"
"Set the busy-wait interval in milliseconds between successive calls to Tcl_DoOneEvent in a threaded Python interpreter.\n"
"\n"
-"It should be set to a divisor of the maximum time between frames in an animation.");
+"It should be set to a divisor of the maximum time between frames in\n"
+"an animation.");
#define _TKINTER_SETBUSYWAITINTERVAL_METHODDEF \
{"setbusywaitinterval", (PyCFunction)_tkinter_setbusywaitinterval, METH_O, _tkinter_setbusywaitinterval__doc__},
@@ -888,4 +889,4 @@ exit:
#ifndef _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#define _TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF
#endif /* !defined(_TKINTER_TKAPP_DELETEFILEHANDLER_METHODDEF) */
-/*[clinic end generated code: output=d90c1a9850c63249 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=4eca4b2509971772 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/arraymodule.c.h b/contrib/tools/python3/Modules/clinic/arraymodule.c.h
index 1046355dc38..2494356aef7 100644
--- a/contrib/tools/python3/Modules/clinic/arraymodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/arraymodule.c.h
@@ -252,8 +252,8 @@ PyDoc_STRVAR(array_array_buffer_info__doc__,
"\n"
"Return a tuple (address, length) giving the current memory address and the length in items of the buffer used to hold array\'s contents.\n"
"\n"
-"The length should be multiplied by the itemsize attribute to calculate\n"
-"the buffer length in bytes.");
+"The length should be multiplied by the itemsize attribute to\n"
+"calculate the buffer length in bytes.");
#define ARRAY_ARRAY_BUFFER_INFO_METHODDEF \
{"buffer_info", (PyCFunction)array_array_buffer_info, METH_NOARGS, array_array_buffer_info__doc__},
@@ -282,8 +282,8 @@ PyDoc_STRVAR(array_array_byteswap__doc__,
"\n"
"Byteswap all items of the array.\n"
"\n"
-"If the items in the array are not 1, 2, 4, or 8 bytes in size, RuntimeError is\n"
-"raised.");
+"If the items in the array are not 1, 2, 4, or 8 bytes in size,\n"
+"RuntimeError is raised.");
#define ARRAY_ARRAY_BYTESWAP_METHODDEF \
{"byteswap", (PyCFunction)array_array_byteswap, METH_NOARGS, array_array_byteswap__doc__},
@@ -498,9 +498,9 @@ PyDoc_STRVAR(array_array_fromunicode__doc__,
"\n"
"Extends this array with data from the unicode string ustr.\n"
"\n"
-"The array must be a unicode type array; otherwise a ValueError is raised.\n"
-"Use array.frombytes(ustr.encode(...)) to append Unicode data to an array of\n"
-"some other type.");
+"The array must be a unicode type array; otherwise a ValueError is\n"
+"raised. Use array.frombytes(ustr.encode(...)) to append Unicode\n"
+"data to an array of some other type.");
#define ARRAY_ARRAY_FROMUNICODE_METHODDEF \
{"fromunicode", (PyCFunction)array_array_fromunicode, METH_O, array_array_fromunicode__doc__},
@@ -531,9 +531,10 @@ PyDoc_STRVAR(array_array_tounicode__doc__,
"\n"
"Extends this array with data from the unicode string ustr.\n"
"\n"
-"Convert the array to a unicode string. The array must be a unicode type array;\n"
-"otherwise a ValueError is raised. Use array.tobytes().decode() to obtain a\n"
-"unicode string from an array of some other type.");
+"Convert the array to a unicode string. The array must be a unicode\n"
+"type array; otherwise a ValueError is raised. Use\n"
+"array.tobytes().decode() to obtain a unicode string from an array of\n"
+"some other type.");
#define ARRAY_ARRAY_TOUNICODE_METHODDEF \
{"tounicode", (PyCFunction)array_array_tounicode, METH_NOARGS, array_array_tounicode__doc__},
@@ -688,4 +689,4 @@ PyDoc_STRVAR(array_arrayiterator___setstate____doc__,
#define ARRAY_ARRAYITERATOR___SETSTATE___METHODDEF \
{"__setstate__", (PyCFunction)array_arrayiterator___setstate__, METH_O, array_arrayiterator___setstate____doc__},
-/*[clinic end generated code: output=f675e0d433ae34b6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=fc424975be474308 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/cmathmodule.c.h b/contrib/tools/python3/Modules/clinic/cmathmodule.c.h
index 50745fd4f40..aa1ae087f16 100644
--- a/contrib/tools/python3/Modules/clinic/cmathmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/cmathmodule.c.h
@@ -644,7 +644,8 @@ PyDoc_STRVAR(cmath_log__doc__,
"\n"
"log(z[, base]) -> the logarithm of z to the given base.\n"
"\n"
-"If the base is not specified, returns the natural logarithm (base e) of z.");
+"If the base is not specified, returns the natural logarithm (base e)\n"
+"of z.");
#define CMATH_LOG_METHODDEF \
{"log", _PyCFunction_CAST(cmath_log), METH_FASTCALL, cmath_log__doc__},
@@ -882,11 +883,12 @@ PyDoc_STRVAR(cmath_isclose__doc__,
"\n"
"Return True if a is close in value to b, and False otherwise.\n"
"\n"
-"For the values to be considered close, the difference between them must be\n"
-"smaller than at least one of the tolerances.\n"
+"For the values to be considered close, the difference between them must\n"
+"be smaller than at least one of the tolerances.\n"
"\n"
-"-inf, inf and NaN behave similarly to the IEEE 754 Standard. That is, NaN is\n"
-"not close to anything, even itself. inf and -inf are only close to themselves.");
+"-inf, inf and NaN behave similarly to the IEEE 754 Standard. That is,\n"
+"NaN is not close to anything, even itself. inf and -inf are only close\n"
+"to themselves.");
#define CMATH_ISCLOSE_METHODDEF \
{"isclose", _PyCFunction_CAST(cmath_isclose), METH_FASTCALL|METH_KEYWORDS, cmath_isclose__doc__},
@@ -982,4 +984,4 @@ skip_optional_kwonly:
exit:
return return_value;
}
-/*[clinic end generated code: output=454309b21cfa9bf6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=2e01537e62454991 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/gcmodule.c.h b/contrib/tools/python3/Modules/clinic/gcmodule.c.h
index 9fff4da616b..416b1acb044 100644
--- a/contrib/tools/python3/Modules/clinic/gcmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/gcmodule.c.h
@@ -381,8 +381,8 @@ PyDoc_STRVAR(gc_get_objects__doc__,
" generation\n"
" Generation to extract the objects from.\n"
"\n"
-"If generation is not None, return only the objects tracked by the collector\n"
-"that are in that generation.");
+"If generation is not None, return only the objects tracked by the\n"
+"collector that are in that generation.");
#define GC_GET_OBJECTS_METHODDEF \
{"get_objects", _PyCFunction_CAST(gc_get_objects), METH_FASTCALL|METH_KEYWORDS, gc_get_objects__doc__},
@@ -522,9 +522,10 @@ PyDoc_STRVAR(gc_freeze__doc__,
"\n"
"Freeze all current tracked objects and ignore them for future collections.\n"
"\n"
-"This can be used before a POSIX fork() call to make the gc copy-on-write friendly.\n"
-"Note: collection before a POSIX fork() call may free pages for future allocation\n"
-"which can cause copy-on-write.");
+"This can be used before a POSIX fork() call to make the gc copy-on-write\n"
+"friendly.\n"
+"Note: collection before a POSIX fork() call may free pages for future\n"
+"allocation which can cause copy-on-write.");
#define GC_FREEZE_METHODDEF \
{"freeze", (PyCFunction)gc_freeze, METH_NOARGS, gc_freeze__doc__},
@@ -585,4 +586,4 @@ gc_get_freeze_count(PyObject *module, PyObject *Py_UNUSED(ignored))
exit:
return return_value;
}
-/*[clinic end generated code: output=0a7e91917adcb937 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=0041275fbac029b2 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/itertoolsmodule.c.h b/contrib/tools/python3/Modules/clinic/itertoolsmodule.c.h
index 050c21460d7..234e56012b7 100644
--- a/contrib/tools/python3/Modules/clinic/itertoolsmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/itertoolsmodule.c.h
@@ -768,8 +768,8 @@ PyDoc_STRVAR(itertools_compress__doc__,
"\n"
"Return data elements corresponding to true selector elements.\n"
"\n"
-"Forms a shorter iterator from selected data elements using the selectors to\n"
-"choose the data elements.");
+"Forms a shorter iterator from selected data elements using the selectors\n"
+"to choose the data elements.");
static PyObject *
itertools_compress_impl(PyTypeObject *type, PyObject *seq1, PyObject *seq2);
@@ -928,4 +928,4 @@ skip_optional_pos:
exit:
return return_value;
}
-/*[clinic end generated code: output=7b13be3075f2d6d3 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ed9db610dde299b5 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/mathmodule.c.h b/contrib/tools/python3/Modules/clinic/mathmodule.c.h
index 99534de0df6..473efd8ef05 100644
--- a/contrib/tools/python3/Modules/clinic/mathmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/mathmodule.c.h
@@ -76,8 +76,9 @@ PyDoc_STRVAR(math_frexp__doc__,
"\n"
"Return the mantissa and exponent of x, as pair (m, e).\n"
"\n"
-"m is a float and e is an int, such that x = m * 2.**e.\n"
-"If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.");
+"If x is a finite nonzero number, then m is a float with\n"
+"0.5 <= abs(m) < 1.0 and an integer e is such that\n"
+"x == m * 2**e exactly. Else, return (x, 0).");
#define MATH_FREXP_METHODDEF \
{"frexp", (PyCFunction)math_frexp, METH_O, math_frexp__doc__},
@@ -892,8 +893,8 @@ PyDoc_STRVAR(math_nextafter__doc__,
"\n"
"If steps is not specified or is None, it defaults to 1.\n"
"\n"
-"Raises a TypeError, if x or y is not a double, or if steps is not an integer.\n"
-"Raises ValueError if steps is negative.");
+"Raises a TypeError, if x or y is not a double, or if steps is not\n"
+"an integer. Raises ValueError if steps is negative.");
#define MATH_NEXTAFTER_METHODDEF \
{"nextafter", _PyCFunction_CAST(math_nextafter), METH_FASTCALL|METH_KEYWORDS, math_nextafter__doc__},
@@ -1009,4 +1010,4 @@ math_ulp(PyObject *module, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=9fe02dc4af07c1e0 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=9ed980dea18198be input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/overlapped.c.h b/contrib/tools/python3/Modules/clinic/overlapped.c.h
index 8b285e4a8f0..f884f03da66 100644
--- a/contrib/tools/python3/Modules/clinic/overlapped.c.h
+++ b/contrib/tools/python3/Modules/clinic/overlapped.c.h
@@ -526,8 +526,9 @@ PyDoc_STRVAR(_overlapped_Overlapped_getresult__doc__,
"\n"
"Retrieve result of operation.\n"
"\n"
-"If wait is true then it blocks until the operation is finished. If wait\n"
-"is false and the operation is still pending then an error is raised.");
+"If wait is true then it blocks until the operation is finished. If\n"
+"wait is false and the operation is still pending then an error is\n"
+"raised.");
#define _OVERLAPPED_OVERLAPPED_GETRESULT_METHODDEF \
{"getresult", _PyCFunction_CAST(_overlapped_Overlapped_getresult), METH_FASTCALL, _overlapped_Overlapped_getresult__doc__},
@@ -1239,4 +1240,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=958cbddbcc355f47 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=17f830e42fc6123d input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/pyexpat.c.h b/contrib/tools/python3/Modules/clinic/pyexpat.c.h
index 9f318133d87..758ba9c3368 100644
--- a/contrib/tools/python3/Modules/clinic/pyexpat.c.h
+++ b/contrib/tools/python3/Modules/clinic/pyexpat.c.h
@@ -216,8 +216,9 @@ PyDoc_STRVAR(pyexpat_xmlparser_GetInputContext__doc__,
"\n"
"Return the untranslated text of the input that caused the current event.\n"
"\n"
-"If the event was generated by a large amount of text (such as a start tag\n"
-"for an element with many attributes), not all of the text may be available.");
+"If the event was generated by a large amount of text (such as\n"
+"a start tag for an element with many attributes), not all of the\n"
+"text may be available.");
#define PYEXPAT_XMLPARSER_GETINPUTCONTEXT_METHODDEF \
{"GetInputContext", (PyCFunction)pyexpat_xmlparser_GetInputContext, METH_NOARGS, pyexpat_xmlparser_GetInputContext__doc__},
@@ -354,9 +355,10 @@ PyDoc_STRVAR(pyexpat_xmlparser_UseForeignDTD__doc__,
"\n"
"Allows the application to provide an artificial external subset if one is not specified as part of the document instance.\n"
"\n"
-"This readily allows the use of a \'default\' document type controlled by the\n"
-"application, while still getting the advantage of providing document type\n"
-"information to the parser. \'flag\' defaults to True if not provided.");
+"This readily allows the use of a \'default\' document type controlled\n"
+"by the application, while still getting the advantage of providing\n"
+"document type information to the parser. \'flag\' defaults to True if\n"
+"not provided.");
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF \
{"UseForeignDTD", _PyCFunction_CAST(pyexpat_xmlparser_UseForeignDTD), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_UseForeignDTD__doc__},
@@ -405,6 +407,138 @@ exit:
#endif /* (XML_COMBINED_VERSION >= 19505) */
+#if (XML_COMBINED_VERSION >= 20400)
+
+PyDoc_STRVAR(pyexpat_xmlparser_SetBillionLaughsAttackProtectionActivationThreshold__doc__,
+"SetBillionLaughsAttackProtectionActivationThreshold($self, threshold, /)\n"
+"--\n"
+"\n"
+"Sets the number of output bytes needed to activate protection against billion laughs attacks.\n"
+"\n"
+"The number of output bytes includes amplification from entity expansion\n"
+"and reading DTD files.\n"
+"\n"
+"Parser objects usually have a protection activation threshold of 8 MiB,\n"
+"but the actual default value depends on the underlying Expat library.\n"
+"\n"
+"Activation thresholds below 4 MiB are known to break support for DITA 1.3\n"
+"payload and are hence not recommended.");
+
+#define PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONACTIVATIONTHRESHOLD_METHODDEF \
+ {"SetBillionLaughsAttackProtectionActivationThreshold", _PyCFunction_CAST(pyexpat_xmlparser_SetBillionLaughsAttackProtectionActivationThreshold), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_SetBillionLaughsAttackProtectionActivationThreshold__doc__},
+
+static PyObject *
+pyexpat_xmlparser_SetBillionLaughsAttackProtectionActivationThreshold_impl(xmlparseobject *self,
+ PyTypeObject *cls,
+ unsigned long long threshold);
+
+static PyObject *
+pyexpat_xmlparser_SetBillionLaughsAttackProtectionActivationThreshold(xmlparseobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+ # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
+ #else
+ # define KWTUPLE NULL
+ #endif
+
+ static const char * const _keywords[] = {"", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "SetBillionLaughsAttackProtectionActivationThreshold",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[1];
+ unsigned long long threshold;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!_PyLong_UnsignedLongLong_Converter(args[0], &threshold)) {
+ goto exit;
+ }
+ return_value = pyexpat_xmlparser_SetBillionLaughsAttackProtectionActivationThreshold_impl(self, cls, threshold);
+
+exit:
+ return return_value;
+}
+
+#endif /* (XML_COMBINED_VERSION >= 20400) */
+
+#if (XML_COMBINED_VERSION >= 20400)
+
+PyDoc_STRVAR(pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification__doc__,
+"SetBillionLaughsAttackProtectionMaximumAmplification($self, max_factor,\n"
+" /)\n"
+"--\n"
+"\n"
+"Sets the maximum tolerated amplification factor for protection against billion laughs attacks.\n"
+"\n"
+"The amplification factor is calculated as \"(direct + indirect) / direct\"\n"
+"while parsing, where \"direct\" is the number of bytes read from the primary\n"
+"document in parsing and \"indirect\" is the number of bytes added by expanding\n"
+"entities and reading external DTD files, combined.\n"
+"\n"
+"The \'max_factor\' value must be a non-NaN floating point value greater than\n"
+"or equal to 1.0. Amplification factors greater than 30,000 can be observed\n"
+"in the middle of parsing even with benign files in practice. In particular,\n"
+"the activation threshold should be carefully chosen to avoid false positives.\n"
+"\n"
+"Parser objects usually have a maximum amplification factor of 100,\n"
+"but the actual default value depends on the underlying Expat library.");
+
+#define PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONMAXIMUMAMPLIFICATION_METHODDEF \
+ {"SetBillionLaughsAttackProtectionMaximumAmplification", _PyCFunction_CAST(pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification__doc__},
+
+static PyObject *
+pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification_impl(xmlparseobject *self,
+ PyTypeObject *cls,
+ float max_factor);
+
+static PyObject *
+pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification(xmlparseobject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
+{
+ PyObject *return_value = NULL;
+ #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
+ # define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty)
+ #else
+ # define KWTUPLE NULL
+ #endif
+
+ static const char * const _keywords[] = {"", NULL};
+ static _PyArg_Parser _parser = {
+ .keywords = _keywords,
+ .fname = "SetBillionLaughsAttackProtectionMaximumAmplification",
+ .kwtuple = KWTUPLE,
+ };
+ #undef KWTUPLE
+ PyObject *argsbuf[1];
+ float max_factor;
+
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_CheckExact(args[0])) {
+ max_factor = (float) (PyFloat_AS_DOUBLE(args[0]));
+ }
+ else
+ {
+ max_factor = (float) PyFloat_AsDouble(args[0]);
+ if (max_factor == -1.0 && PyErr_Occurred()) {
+ goto exit;
+ }
+ }
+ return_value = pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification_impl(self, cls, max_factor);
+
+exit:
+ return return_value;
+}
+
+#endif /* (XML_COMBINED_VERSION >= 20400) */
+
#if (XML_COMBINED_VERSION >= 20702)
PyDoc_STRVAR(pyexpat_xmlparser_SetAllocTrackerActivationThreshold__doc__,
@@ -413,7 +547,8 @@ PyDoc_STRVAR(pyexpat_xmlparser_SetAllocTrackerActivationThreshold__doc__,
"\n"
"Sets the number of allocated bytes of dynamic memory needed to activate protection against disproportionate use of RAM.\n"
"\n"
-"By default, parser objects have an allocation activation threshold of 64 MiB.");
+"Parser objects usually have an allocation activation threshold of 64 MiB,\n"
+"but the actual default value depends on the underlying Expat library.");
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERACTIVATIONTHRESHOLD_METHODDEF \
{"SetAllocTrackerActivationThreshold", _PyCFunction_CAST(pyexpat_xmlparser_SetAllocTrackerActivationThreshold), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_SetAllocTrackerActivationThreshold__doc__},
@@ -466,17 +601,19 @@ PyDoc_STRVAR(pyexpat_xmlparser_SetAllocTrackerMaximumAmplification__doc__,
"\n"
"Sets the maximum amplification factor between direct input and bytes of dynamic memory allocated.\n"
"\n"
-"The amplification factor is calculated as \"allocated / direct\" while parsing,\n"
-"where \"direct\" is the number of bytes read from the primary document in parsing\n"
-"and \"allocated\" is the number of bytes of dynamic memory allocated in the parser\n"
-"hierarchy.\n"
+"The amplification factor is calculated as \"allocated / direct\" while\n"
+"parsing, where \"direct\" is the number of bytes read from the primary\n"
+"document in parsing and \"allocated\" is the number of bytes of\n"
+"dynamic memory allocated in the parser hierarchy.\n"
"\n"
-"The \'max_factor\' value must be a non-NaN floating point value greater than\n"
-"or equal to 1.0. Amplification factors greater than 100.0 can be observed\n"
-"near the start of parsing even with benign files in practice. In particular,\n"
-"the activation threshold should be carefully chosen to avoid false positives.\n"
+"The \'max_factor\' value must be a non-NaN floating point value\n"
+"greater than or equal to 1.0. Amplification factors greater than\n"
+"100.0 can be observed near the start of parsing even with benign\n"
+"files in practice. In particular, the activation threshold should\n"
+"be carefully chosen to avoid false positives.\n"
"\n"
-"By default, parser objects have a maximum amplification factor of 100.0.");
+"Parser objects usually have a maximum amplification factor of 100,\n"
+"but the actual default value depends on the underlying Expat library.");
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF \
{"SetAllocTrackerMaximumAmplification", _PyCFunction_CAST(pyexpat_xmlparser_SetAllocTrackerMaximumAmplification), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, pyexpat_xmlparser_SetAllocTrackerMaximumAmplification__doc__},
@@ -670,6 +807,14 @@ exit:
#define PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF) */
+#ifndef PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONACTIVATIONTHRESHOLD_METHODDEF
+ #define PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONACTIVATIONTHRESHOLD_METHODDEF
+#endif /* !defined(PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONACTIVATIONTHRESHOLD_METHODDEF) */
+
+#ifndef PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONMAXIMUMAMPLIFICATION_METHODDEF
+ #define PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONMAXIMUMAMPLIFICATION_METHODDEF
+#endif /* !defined(PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONMAXIMUMAMPLIFICATION_METHODDEF) */
+
#ifndef PYEXPAT_XMLPARSER_SETALLOCTRACKERACTIVATIONTHRESHOLD_METHODDEF
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERACTIVATIONTHRESHOLD_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_SETALLOCTRACKERACTIVATIONTHRESHOLD_METHODDEF) */
@@ -677,4 +822,4 @@ exit:
#ifndef PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF
#define PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF
#endif /* !defined(PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF) */
-/*[clinic end generated code: output=2e787fd99710eb5b input=a9049054013a1b77]*/
+/*[clinic end generated code: output=1994a20170f2325d input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/selectmodule.c.h b/contrib/tools/python3/Modules/clinic/selectmodule.c.h
index 49c0e48d2e0..2fea123785a 100644
--- a/contrib/tools/python3/Modules/clinic/selectmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/selectmodule.c.h
@@ -16,7 +16,8 @@ PyDoc_STRVAR(select_select__doc__,
"\n"
"Wait until one or more file descriptors are ready for some kind of I/O.\n"
"\n"
-"The first three arguments are iterables of file descriptors to be waited for:\n"
+"The first three arguments are iterables of file descriptors to be waited\n"
+"for:\n"
"rlist -- wait until ready for reading\n"
"wlist -- wait until ready for writing\n"
"xlist -- wait for an \"exceptional condition\"\n"
@@ -29,9 +30,9 @@ PyDoc_STRVAR(select_select__doc__,
"a floating-point number to specify fractions of seconds. If it is absent\n"
"or None, the call will never time out.\n"
"\n"
-"The return value is a tuple of three lists corresponding to the first three\n"
-"arguments; each contains the subset of the corresponding file descriptors\n"
-"that are ready.\n"
+"The return value is a tuple of three lists corresponding to the first\n"
+"three arguments; each contains the subset of the corresponding file\n"
+"descriptors that are ready.\n"
"\n"
"*** IMPORTANT NOTICE ***\n"
"On Windows, only sockets are supported; on Unix, all file\n"
@@ -214,8 +215,8 @@ PyDoc_STRVAR(select_poll_poll__doc__,
" The maximum time to wait in milliseconds, or else None (or a negative\n"
" value) to wait indefinitely.\n"
"\n"
-"Returns a list containing any descriptors that have events or errors to\n"
-"report, as a list of (fd, event) 2-tuples.");
+"Returns a list containing any descriptors that have events or errors\n"
+"to report, as a list of (fd, event) 2-tuples.");
#define SELECT_POLL_POLL_METHODDEF \
{"poll", _PyCFunction_CAST(select_poll_poll), METH_FASTCALL, select_poll_poll__doc__},
@@ -396,11 +397,11 @@ PyDoc_STRVAR(select_devpoll_poll__doc__,
"Polls the set of registered file descriptors.\n"
"\n"
" timeout\n"
-" The maximum time to wait in milliseconds, or else None (or a negative\n"
-" value) to wait indefinitely.\n"
+" The maximum time to wait in milliseconds, or else None (or\n"
+" a negative value) to wait indefinitely.\n"
"\n"
-"Returns a list containing any descriptors that have events or errors to\n"
-"report, as a list of (fd, event) 2-tuples.");
+"Returns a list containing any descriptors that have events or errors\n"
+"to report, as a list of (fd, event) 2-tuples.");
#define SELECT_DEVPOLL_POLL_METHODDEF \
{"poll", _PyCFunction_CAST(select_devpoll_poll), METH_FASTCALL, select_devpoll_poll__doc__},
@@ -498,8 +499,8 @@ PyDoc_STRVAR(select_poll__doc__,
"\n"
"Returns a polling object.\n"
"\n"
-"This object supports registering and unregistering file descriptors, and then\n"
-"polling them for I/O events.");
+"This object supports registering and unregistering file descriptors, and\n"
+"then polling them for I/O events.");
#define SELECT_POLL_METHODDEF \
{"poll", (PyCFunction)select_poll, METH_NOARGS, select_poll__doc__},
@@ -523,8 +524,8 @@ PyDoc_STRVAR(select_devpoll__doc__,
"\n"
"Returns a polling object.\n"
"\n"
-"This object supports registering and unregistering file descriptors, and then\n"
-"polling them for I/O events.");
+"This object supports registering and unregistering file descriptors, and\n"
+"then polling them for I/O events.");
#define SELECT_DEVPOLL_METHODDEF \
{"devpoll", (PyCFunction)select_devpoll, METH_NOARGS, select_devpoll__doc__},
@@ -942,8 +943,8 @@ PyDoc_STRVAR(select_epoll_poll__doc__,
" maxevents\n"
" the maximum number of events returned; -1 means no limit\n"
"\n"
-"Returns a list containing any descriptors that have events to report,\n"
-"as a list of (fd, events) 2-tuples.");
+"Returns a list containing any descriptors that have events to\n"
+"report, as a list of (fd, events) 2-tuples.");
#define SELECT_EPOLL_POLL_METHODDEF \
{"poll", _PyCFunction_CAST(select_epoll_poll), METH_FASTCALL|METH_KEYWORDS, select_epoll_poll__doc__},
@@ -1360,4 +1361,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
-/*[clinic end generated code: output=f99427b75cbe6d44 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6293bc1883273f7c input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/signalmodule.c.h b/contrib/tools/python3/Modules/clinic/signalmodule.c.h
index 986c0289f2b..dbb8e26b5be 100644
--- a/contrib/tools/python3/Modules/clinic/signalmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/signalmodule.c.h
@@ -138,11 +138,12 @@ PyDoc_STRVAR(signal_signal__doc__,
"Set the action for the given signal.\n"
"\n"
"The action can be SIG_DFL, SIG_IGN, or a callable Python object.\n"
-"The previous action is returned. See getsignal() for possible return values.\n"
+"The previous action is returned. See getsignal() for possible return\n"
+"values.\n"
"\n"
"*** IMPORTANT NOTICE ***\n"
-"A signal handler function is called with two arguments:\n"
-"the first is the signal number, the second is the interrupted stack frame.");
+"A signal handler function is called with two arguments: the first is\n"
+"the signal number, the second is the interrupted stack frame.");
#define SIGNAL_SIGNAL_METHODDEF \
{"signal", _PyCFunction_CAST(signal_signal), METH_FASTCALL, signal_signal__doc__},
@@ -359,8 +360,8 @@ PyDoc_STRVAR(signal_setitimer__doc__,
"\n"
"Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL or ITIMER_PROF).\n"
"\n"
-"The timer will fire after value seconds and after that every interval seconds.\n"
-"The itimer can be cleared by setting seconds to zero.\n"
+"The timer will fire after value seconds and after that every interval\n"
+"seconds. The itimer can be cleared by setting seconds to zero.\n"
"\n"
"Returns old values as a tuple: (delay, interval).");
@@ -505,8 +506,8 @@ PyDoc_STRVAR(signal_sigwait__doc__,
"Wait for a signal.\n"
"\n"
"Suspend execution of the calling thread until the delivery of one of the\n"
-"signals specified in the signal set sigset. The function accepts the signal\n"
-"and returns the signal number.");
+"signals specified in the signal set sigset. The function accepts the\n"
+"signal and returns the signal number.");
#define SIGNAL_SIGWAIT_METHODDEF \
{"sigwait", (PyCFunction)signal_sigwait, METH_O, signal_sigwait__doc__},
@@ -776,4 +777,4 @@ exit:
#ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
#define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
#endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */
-/*[clinic end generated code: output=c57b4b98fad6f4b8 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=496d4bc3e9ed4528 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/termios.c.h b/contrib/tools/python3/Modules/clinic/termios.c.h
index 83f5a4f6e9f..35522bef1dc 100644
--- a/contrib/tools/python3/Modules/clinic/termios.c.h
+++ b/contrib/tools/python3/Modules/clinic/termios.c.h
@@ -270,7 +270,8 @@ PyDoc_STRVAR(termios_tcsetwinsize__doc__,
"Set the tty winsize for file descriptor fd.\n"
"\n"
"The winsize to be set is taken from the winsize argument, which\n"
-"is a two-item tuple (ws_row, ws_col) like the one returned by tcgetwinsize().");
+"is a two-item tuple (ws_row, ws_col) like the one returned by\n"
+"tcgetwinsize().");
#define TERMIOS_TCSETWINSIZE_METHODDEF \
{"tcsetwinsize", (PyCFunction)(void(*)(void))termios_tcsetwinsize, METH_FASTCALL, termios_tcsetwinsize__doc__},
@@ -299,4 +300,4 @@ termios_tcsetwinsize(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
-/*[clinic end generated code: output=c6c6192583b0da36 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=d2176c4d9043d3cc input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/zlibmodule.c.h b/contrib/tools/python3/Modules/clinic/zlibmodule.c.h
index 7ff3edf5a55..0dd395fb4df 100644
--- a/contrib/tools/python3/Modules/clinic/zlibmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/zlibmodule.c.h
@@ -485,8 +485,8 @@ PyDoc_STRVAR(zlib_Decompress_decompress__doc__,
" Unconsumed input data will be stored in\n"
" the unconsumed_tail attribute.\n"
"\n"
-"After calling this function, some of the input data may still be stored in\n"
-"internal buffers for later processing.\n"
+"After calling this function, some of the input data may still be\n"
+"stored in internal buffers for later processing.\n"
"Call the flush() method to clear these buffers.");
#define ZLIB_DECOMPRESS_DECOMPRESS_METHODDEF \
@@ -884,18 +884,19 @@ PyDoc_STRVAR(zlib_ZlibDecompressor_decompress__doc__,
"\n"
"Decompress *data*, returning uncompressed data as bytes.\n"
"\n"
-"If *max_length* is nonnegative, returns at most *max_length* bytes of\n"
-"decompressed data. If this limit is reached and further output can be\n"
-"produced, *self.needs_input* will be set to ``False``. In this case, the next\n"
-"call to *decompress()* may provide *data* as b\'\' to obtain more of the output.\n"
+"If *max_length* is nonnegative, returns at most *max_length* bytes\n"
+"of decompressed data. If this limit is reached and further output\n"
+"can be produced, *self.needs_input* will be set to ``False``. In\n"
+"this case, the next call to *decompress()* may provide *data* as b\'\'\n"
+"to obtain more of the output.\n"
"\n"
-"If all of the input data was decompressed and returned (either because this\n"
-"was less than *max_length* bytes, or because *max_length* was negative),\n"
-"*self.needs_input* will be set to True.\n"
+"If all of the input data was decompressed and returned (either\n"
+"because this was less than *max_length* bytes, or because\n"
+"*max_length* was negative), *self.needs_input* will be set to True.\n"
"\n"
-"Attempting to decompress data after the end of stream is reached raises an\n"
-"EOFError. Any data found after the end of the stream is ignored and saved in\n"
-"the unused_data attribute.");
+"Attempting to decompress data after the end of stream is reached\n"
+"raises an EOFError. Any data found after the end of the stream is\n"
+"ignored and saved in the unused_data attribute.");
#define ZLIB_ZLIBDECOMPRESSOR_DECOMPRESS_METHODDEF \
{"decompress", _PyCFunction_CAST(zlib_ZlibDecompressor_decompress), METH_FASTCALL|METH_KEYWORDS, zlib_ZlibDecompressor_decompress__doc__},
@@ -1098,4 +1099,4 @@ exit:
#ifndef ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#define ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF
#endif /* !defined(ZLIB_DECOMPRESS___DEEPCOPY___METHODDEF) */
-/*[clinic end generated code: output=8bb840fb6af43dd4 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=208bbc4d3ea84ac5 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/cmathmodule.c b/contrib/tools/python3/Modules/cmathmodule.c
index d901b350bc5..affb717f31b 100644
--- a/contrib/tools/python3/Modules/cmathmodule.c
+++ b/contrib/tools/python3/Modules/cmathmodule.c
@@ -910,12 +910,13 @@ cmath.log
log(z[, base]) -> the logarithm of z to the given base.
-If the base is not specified, returns the natural logarithm (base e) of z.
+If the base is not specified, returns the natural logarithm (base e)
+of z.
[clinic start generated code]*/
static PyObject *
cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj)
-/*[clinic end generated code: output=4effdb7d258e0d94 input=e1f81d4fcfd26497]*/
+/*[clinic end generated code: output=4effdb7d258e0d94 input=eb25de0757baf4a0]*/
{
Py_complex y;
@@ -1132,17 +1133,18 @@ Determine whether two complex numbers are close in value.
Return True if a is close in value to b, and False otherwise.
-For the values to be considered close, the difference between them must be
-smaller than at least one of the tolerances.
+For the values to be considered close, the difference between them must
+be smaller than at least one of the tolerances.
--inf, inf and NaN behave similarly to the IEEE 754 Standard. That is, NaN is
-not close to anything, even itself. inf and -inf are only close to themselves.
+-inf, inf and NaN behave similarly to the IEEE 754 Standard. That is,
+NaN is not close to anything, even itself. inf and -inf are only close
+to themselves.
[clinic start generated code]*/
static int
cmath_isclose_impl(PyObject *module, Py_complex a, Py_complex b,
double rel_tol, double abs_tol)
-/*[clinic end generated code: output=8a2486cc6e0014d1 input=df9636d7de1d4ac3]*/
+/*[clinic end generated code: output=8a2486cc6e0014d1 input=301b56c90d9a79de]*/
{
double diff;
diff --git a/contrib/tools/python3/Modules/faulthandler.c b/contrib/tools/python3/Modules/faulthandler.c
index 5a4efed9946..42521e40ba7 100644
--- a/contrib/tools/python3/Modules/faulthandler.c
+++ b/contrib/tools/python3/Modules/faulthandler.c
@@ -1180,20 +1180,6 @@ faulthandler_stack_overflow(PyObject *self, PyObject *Py_UNUSED(ignored))
#endif /* defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_SIGACTION) */
-static int
-faulthandler_traverse(PyObject *module, visitproc visit, void *arg)
-{
- Py_VISIT(thread.file);
-#ifdef FAULTHANDLER_USER
- if (user_signals != NULL) {
- for (size_t signum=0; signum < Py_NSIG; signum++)
- Py_VISIT(user_signals[signum].file);
- }
-#endif
- Py_VISIT(fatal_error.file);
- return 0;
-}
-
#ifdef MS_WINDOWS
static PyObject *
faulthandler_raise_exception(PyObject *self, PyObject *args)
@@ -1322,7 +1308,6 @@ static struct PyModuleDef module_def = {
.m_name = "faulthandler",
.m_doc = module_doc,
.m_methods = module_methods,
- .m_traverse = faulthandler_traverse,
.m_slots = faulthandler_slots
};
diff --git a/contrib/tools/python3/Modules/gcmodule.c b/contrib/tools/python3/Modules/gcmodule.c
index ee24900ae88..f9a27d4b43e 100644
--- a/contrib/tools/python3/Modules/gcmodule.c
+++ b/contrib/tools/python3/Modules/gcmodule.c
@@ -305,13 +305,13 @@ gc.get_objects
Return a list of objects tracked by the collector (excluding the list returned).
-If generation is not None, return only the objects tracked by the collector
-that are in that generation.
+If generation is not None, return only the objects tracked by the
+collector that are in that generation.
[clinic start generated code]*/
static PyObject *
gc_get_objects_impl(PyObject *module, Py_ssize_t generation)
-/*[clinic end generated code: output=48b35fea4ba6cb0e input=ef7da9df9806754c]*/
+/*[clinic end generated code: output=48b35fea4ba6cb0e input=3a819826fbde5eef]*/
{
if (PySys_Audit("gc.get_objects", "n", generation) < 0) {
return NULL;
@@ -421,14 +421,15 @@ gc.freeze
Freeze all current tracked objects and ignore them for future collections.
-This can be used before a POSIX fork() call to make the gc copy-on-write friendly.
-Note: collection before a POSIX fork() call may free pages for future allocation
-which can cause copy-on-write.
+This can be used before a POSIX fork() call to make the gc copy-on-write
+friendly.
+Note: collection before a POSIX fork() call may free pages for future
+allocation which can cause copy-on-write.
[clinic start generated code]*/
static PyObject *
gc_freeze_impl(PyObject *module)
-/*[clinic end generated code: output=502159d9cdc4c139 input=b602b16ac5febbe5]*/
+/*[clinic end generated code: output=502159d9cdc4c139 input=989012d0ba5a066f]*/
{
PyInterpreterState *interp = _PyInterpreterState_GET();
_PyGC_Freeze(interp);
diff --git a/contrib/tools/python3/Modules/itertoolsmodule.c b/contrib/tools/python3/Modules/itertoolsmodule.c
index 5add3c216b3..96e8542def5 100644
--- a/contrib/tools/python3/Modules/itertoolsmodule.c
+++ b/contrib/tools/python3/Modules/itertoolsmodule.c
@@ -2229,6 +2229,10 @@ Return a chain object whose .__next__() method returns elements from the\n\
first iterable until it is exhausted, then elements from the next\n\
iterable, until all of the iterables are exhausted.");
+PyDoc_STRVAR(chain_class_getitem_doc,
+"chain is generic over the type of its contents.\n\
+This is the union of the types of the input iterable contents.");
+
static PyMethodDef chain_methods[] = {
ITERTOOLS_CHAIN_FROM_ITERABLE_METHODDEF
{"__reduce__", (PyCFunction)chain_reduce, METH_NOARGS,
@@ -2236,7 +2240,7 @@ static PyMethodDef chain_methods[] = {
{"__setstate__", (PyCFunction)chain_setstate, METH_O,
setstate_doc},
{"__class_getitem__", Py_GenericAlias,
- METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ METH_O|METH_CLASS, chain_class_getitem_doc},
{NULL, NULL} /* sentinel */
};
@@ -3769,13 +3773,13 @@ itertools.compress.__new__
selectors as seq2: object
Return data elements corresponding to true selector elements.
-Forms a shorter iterator from selected data elements using the selectors to
-choose the data elements.
+Forms a shorter iterator from selected data elements using the selectors
+to choose the data elements.
[clinic start generated code]*/
static PyObject *
itertools_compress_impl(PyTypeObject *type, PyObject *seq1, PyObject *seq2)
-/*[clinic end generated code: output=7e67157212ed09e0 input=79596d7cd20c77e5]*/
+/*[clinic end generated code: output=7e67157212ed09e0 input=32ca4347dbc46749]*/
{
PyObject *data=NULL, *selectors=NULL;
compressobject *lz;
diff --git a/contrib/tools/python3/Modules/main.c b/contrib/tools/python3/Modules/main.c
index 1f9796b356c..eaf8c471b78 100644
--- a/contrib/tools/python3/Modules/main.c
+++ b/contrib/tools/python3/Modules/main.c
@@ -512,6 +512,7 @@ pymain_run_interactive_hook(int *exitcode)
}
if (PySys_Audit("cpython.run_interactivehook", "O", hook) < 0) {
+ Py_DECREF(hook);
goto error;
}
diff --git a/contrib/tools/python3/Modules/mathmodule.c b/contrib/tools/python3/Modules/mathmodule.c
index aee1b17be9c..e0a1db0fea8 100644
--- a/contrib/tools/python3/Modules/mathmodule.c
+++ b/contrib/tools/python3/Modules/mathmodule.c
@@ -2095,13 +2095,14 @@ math.frexp
Return the mantissa and exponent of x, as pair (m, e).
-m is a float and e is an int, such that x = m * 2.**e.
-If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.
+If x is a finite nonzero number, then m is a float with
+0.5 <= abs(m) < 1.0 and an integer e is such that
+x == m * 2**e exactly. Else, return (x, 0).
[clinic start generated code]*/
static PyObject *
math_frexp_impl(PyObject *module, double x)
-/*[clinic end generated code: output=03e30d252a15ad4a input=96251c9e208bc6e9]*/
+/*[clinic end generated code: output=03e30d252a15ad4a input=215cf8ea28a0959b]*/
{
int i;
/* deal with special cases directly, to sidestep platform
@@ -3940,13 +3941,13 @@ Return the floating-point value the given number of steps after x towards y.
If steps is not specified or is None, it defaults to 1.
-Raises a TypeError, if x or y is not a double, or if steps is not an integer.
-Raises ValueError if steps is negative.
+Raises a TypeError, if x or y is not a double, or if steps is not
+an integer. Raises ValueError if steps is negative.
[clinic start generated code]*/
static PyObject *
math_nextafter_impl(PyObject *module, double x, double y, PyObject *steps)
-/*[clinic end generated code: output=cc6511f02afc099e input=7f2a5842112af2b4]*/
+/*[clinic end generated code: output=cc6511f02afc099e input=89764144d1a33160]*/
{
#if defined(_AIX)
if (x == y) {
diff --git a/contrib/tools/python3/Modules/overlapped.c b/contrib/tools/python3/Modules/overlapped.c
index 567593e05c4..fdf43d615d1 100644
--- a/contrib/tools/python3/Modules/overlapped.c
+++ b/contrib/tools/python3/Modules/overlapped.c
@@ -875,13 +875,14 @@ _overlapped.Overlapped.getresult
Retrieve result of operation.
-If wait is true then it blocks until the operation is finished. If wait
-is false and the operation is still pending then an error is raised.
+If wait is true then it blocks until the operation is finished. If
+wait is false and the operation is still pending then an error is
+raised.
[clinic start generated code]*/
static PyObject *
_overlapped_Overlapped_getresult_impl(OverlappedObject *self, BOOL wait)
-/*[clinic end generated code: output=8c9bd04d08994f6c input=aa5b03e9897ca074]*/
+/*[clinic end generated code: output=8c9bd04d08994f6c input=852fbd817cbd2b3d]*/
{
DWORD transferred = 0;
BOOL ret;
@@ -1909,6 +1910,11 @@ _overlapped_Overlapped_WSARecvFromInto_impl(OverlappedObject *self,
}
#endif
+ if (bufobj->len < (Py_ssize_t)size) {
+ PyErr_SetString(PyExc_ValueError, "nbytes is greater than the length of the buffer");
+ return NULL;
+ }
+
wsabuf.buf = bufobj->buf;
wsabuf.len = size;
diff --git a/contrib/tools/python3/Modules/posixmodule.c b/contrib/tools/python3/Modules/posixmodule.c
index 66bd5bf1efb..58f21d35224 100644
--- a/contrib/tools/python3/Modules/posixmodule.c
+++ b/contrib/tools/python3/Modules/posixmodule.c
@@ -15893,7 +15893,7 @@ static PyMethodDef DirEntry_methods[] = {
OS_DIRENTRY_INODE_METHODDEF
OS_DIRENTRY___FSPATH___METHODDEF
{"__class_getitem__", Py_GenericAlias,
- METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
+ METH_O|METH_CLASS, PyDoc_STR("DirEntry is generic over the type of the path (str or bytes)")},
{NULL}
};
diff --git a/contrib/tools/python3/Modules/pyexpat.c b/contrib/tools/python3/Modules/pyexpat.c
index 65802fca221..915d01e8bd0 100644
--- a/contrib/tools/python3/Modules/pyexpat.c
+++ b/contrib/tools/python3/Modules/pyexpat.c
@@ -994,13 +994,14 @@ pyexpat.xmlparser.GetInputContext
Return the untranslated text of the input that caused the current event.
-If the event was generated by a large amount of text (such as a start tag
-for an element with many attributes), not all of the text may be available.
+If the event was generated by a large amount of text (such as
+a start tag for an element with many attributes), not all of the
+text may be available.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_GetInputContext_impl(xmlparseobject *self)
-/*[clinic end generated code: output=a88026d683fc22cc input=034df8712db68379]*/
+/*[clinic end generated code: output=a88026d683fc22cc input=3ff7cb00783c8f98]*/
{
if (self->in_callback) {
int offset, size;
@@ -1133,15 +1134,16 @@ pyexpat.xmlparser.UseForeignDTD
Allows the application to provide an artificial external subset if one is not specified as part of the document instance.
-This readily allows the use of a 'default' document type controlled by the
-application, while still getting the advantage of providing document type
-information to the parser. 'flag' defaults to True if not provided.
+This readily allows the use of a 'default' document type controlled
+by the application, while still getting the advantage of providing
+document type information to the parser. 'flag' defaults to True if
+not provided.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
int flag)
-/*[clinic end generated code: output=d7d98252bd25a20f input=23440ecb0573fb29]*/
+/*[clinic end generated code: output=d7d98252bd25a20f input=0387bce44fd53d99]*/
{
pyexpat_state *state = PyType_GetModuleState(cls);
enum XML_Error rc;
@@ -1154,7 +1156,7 @@ pyexpat_xmlparser_UseForeignDTD_impl(xmlparseobject *self, PyTypeObject *cls,
}
#endif
-#if XML_COMBINED_VERSION >= 20702
+#if XML_COMBINED_VERSION >= 20400
static PyObject *
set_activation_threshold(xmlparseobject *self,
PyTypeObject *cls,
@@ -1198,6 +1200,76 @@ set_maximum_amplification(xmlparseobject *self,
}
#endif
+#if XML_COMBINED_VERSION >= 20400
+/*[clinic input]
+pyexpat.xmlparser.SetBillionLaughsAttackProtectionActivationThreshold
+
+ cls: defining_class
+ threshold: unsigned_long_long
+ /
+
+Sets the number of output bytes needed to activate protection against billion laughs attacks.
+
+The number of output bytes includes amplification from entity expansion
+and reading DTD files.
+
+Parser objects usually have a protection activation threshold of 8 MiB,
+but the actual default value depends on the underlying Expat library.
+
+Activation thresholds below 4 MiB are known to break support for DITA 1.3
+payload and are hence not recommended.
+[clinic start generated code]*/
+
+static PyObject *
+pyexpat_xmlparser_SetBillionLaughsAttackProtectionActivationThreshold_impl(xmlparseobject *self,
+ PyTypeObject *cls,
+ unsigned long long threshold)
+/*[clinic end generated code: output=0c082342f1c78114 input=5a51695a481def92]*/
+{
+ return set_activation_threshold(
+ self, cls, threshold,
+ XML_SetBillionLaughsAttackProtectionActivationThreshold
+ );
+}
+#endif
+
+#if XML_COMBINED_VERSION >= 20400
+/*[clinic input]
+pyexpat.xmlparser.SetBillionLaughsAttackProtectionMaximumAmplification
+
+ cls: defining_class
+ max_factor: float
+ /
+
+Sets the maximum tolerated amplification factor for protection against billion laughs attacks.
+
+The amplification factor is calculated as "(direct + indirect) / direct"
+while parsing, where "direct" is the number of bytes read from the primary
+document in parsing and "indirect" is the number of bytes added by expanding
+entities and reading external DTD files, combined.
+
+The 'max_factor' value must be a non-NaN floating point value greater than
+or equal to 1.0. Amplification factors greater than 30,000 can be observed
+in the middle of parsing even with benign files in practice. In particular,
+the activation threshold should be carefully chosen to avoid false positives.
+
+Parser objects usually have a maximum amplification factor of 100,
+but the actual default value depends on the underlying Expat library.
+[clinic start generated code]*/
+
+static PyObject *
+pyexpat_xmlparser_SetBillionLaughsAttackProtectionMaximumAmplification_impl(xmlparseobject *self,
+ PyTypeObject *cls,
+ float max_factor)
+/*[clinic end generated code: output=c590439eadf463fa input=5de7c6dd7169b3b0]*/
+{
+ return set_maximum_amplification(
+ self, cls, max_factor,
+ XML_SetBillionLaughsAttackProtectionMaximumAmplification
+ );
+}
+#endif
+
#if XML_COMBINED_VERSION >= 20702
/*[clinic input]
pyexpat.xmlparser.SetAllocTrackerActivationThreshold
@@ -1208,14 +1280,15 @@ pyexpat.xmlparser.SetAllocTrackerActivationThreshold
Sets the number of allocated bytes of dynamic memory needed to activate protection against disproportionate use of RAM.
-By default, parser objects have an allocation activation threshold of 64 MiB.
+Parser objects usually have an allocation activation threshold of 64 MiB,
+but the actual default value depends on the underlying Expat library.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_SetAllocTrackerActivationThreshold_impl(xmlparseobject *self,
PyTypeObject *cls,
unsigned long long threshold)
-/*[clinic end generated code: output=bed7e93207ba08c5 input=9c706b75c18e4ea1]*/
+/*[clinic end generated code: output=bed7e93207ba08c5 input=b74171709a77f2d9]*/
{
return set_activation_threshold(
self, cls, threshold,
@@ -1234,24 +1307,26 @@ pyexpat.xmlparser.SetAllocTrackerMaximumAmplification
Sets the maximum amplification factor between direct input and bytes of dynamic memory allocated.
-The amplification factor is calculated as "allocated / direct" while parsing,
-where "direct" is the number of bytes read from the primary document in parsing
-and "allocated" is the number of bytes of dynamic memory allocated in the parser
-hierarchy.
+The amplification factor is calculated as "allocated / direct" while
+parsing, where "direct" is the number of bytes read from the primary
+document in parsing and "allocated" is the number of bytes of
+dynamic memory allocated in the parser hierarchy.
-The 'max_factor' value must be a non-NaN floating point value greater than
-or equal to 1.0. Amplification factors greater than 100.0 can be observed
-near the start of parsing even with benign files in practice. In particular,
-the activation threshold should be carefully chosen to avoid false positives.
+The 'max_factor' value must be a non-NaN floating point value
+greater than or equal to 1.0. Amplification factors greater than
+100.0 can be observed near the start of parsing even with benign
+files in practice. In particular, the activation threshold should
+be carefully chosen to avoid false positives.
-By default, parser objects have a maximum amplification factor of 100.0.
+Parser objects usually have a maximum amplification factor of 100,
+but the actual default value depends on the underlying Expat library.
[clinic start generated code]*/
static PyObject *
pyexpat_xmlparser_SetAllocTrackerMaximumAmplification_impl(xmlparseobject *self,
PyTypeObject *cls,
float max_factor)
-/*[clinic end generated code: output=6e44bd48c9b112a0 input=918b9266b490a722]*/
+/*[clinic end generated code: output=6e44bd48c9b112a0 input=db40271991462073]*/
{
return set_maximum_amplification(
self, cls, max_factor,
@@ -1269,6 +1344,8 @@ static struct PyMethodDef xmlparse_methods[] = {
PYEXPAT_XMLPARSER_EXTERNALENTITYPARSERCREATE_METHODDEF
PYEXPAT_XMLPARSER_SETPARAMENTITYPARSING_METHODDEF
PYEXPAT_XMLPARSER_USEFOREIGNDTD_METHODDEF
+ PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONACTIVATIONTHRESHOLD_METHODDEF
+ PYEXPAT_XMLPARSER_SETBILLIONLAUGHSATTACKPROTECTIONMAXIMUMAMPLIFICATION_METHODDEF
PYEXPAT_XMLPARSER_SETALLOCTRACKERACTIVATIONTHRESHOLD_METHODDEF
PYEXPAT_XMLPARSER_SETALLOCTRACKERMAXIMUMAMPLIFICATION_METHODDEF
PYEXPAT_XMLPARSER_SETREPARSEDEFERRALENABLED_METHODDEF
@@ -1384,7 +1461,10 @@ newxmlparseobject(pyexpat_state *state, const char *encoding,
Py_DECREF(self);
return NULL;
}
-#if XML_COMBINED_VERSION >= 20100
+#if XML_COMBINED_VERSION >= 20800
+ /* This feature was added upstream in libexpat 2.8.0. */
+ XML_SetHashSalt16Bytes(self->itself, _Py_HashSecret.expat.hashsalt16);
+#elif XML_COMBINED_VERSION >= 20100
/* This feature was added upstream in libexpat 2.1.0. */
XML_SetHashSalt(self->itself,
(unsigned long)_Py_HashSecret.expat.hashsalt);
@@ -2246,6 +2326,11 @@ pyexpat_exec(PyObject *mod)
#else
capi->SetHashSalt = NULL;
#endif
+#if XML_COMBINED_VERSION >= 20800
+ capi->SetHashSalt16Bytes = XML_SetHashSalt16Bytes;
+#else
+ capi->SetHashSalt16Bytes = NULL;
+#endif
#if XML_COMBINED_VERSION >= 20600
capi->SetReparseDeferralEnabled = XML_SetReparseDeferralEnabled;
#else
@@ -2258,6 +2343,13 @@ pyexpat_exec(PyObject *mod)
capi->SetAllocTrackerActivationThreshold = NULL;
capi->SetAllocTrackerMaximumAmplification = NULL;
#endif
+#if XML_COMBINED_VERSION >= 20400
+ capi->SetBillionLaughsAttackProtectionActivationThreshold = XML_SetBillionLaughsAttackProtectionActivationThreshold;
+ capi->SetBillionLaughsAttackProtectionMaximumAmplification = XML_SetBillionLaughsAttackProtectionMaximumAmplification;
+#else
+ capi->SetBillionLaughsAttackProtectionActivationThreshold = NULL;
+ capi->SetBillionLaughsAttackProtectionMaximumAmplification = NULL;
+#endif
/* export using capsule */
PyObject *capi_object = PyCapsule_New(capi, PyExpat_CAPSULE_NAME,
diff --git a/contrib/tools/python3/Modules/selectmodule.c b/contrib/tools/python3/Modules/selectmodule.c
index 5bd9b7732a4..f69df694d44 100644
--- a/contrib/tools/python3/Modules/selectmodule.c
+++ b/contrib/tools/python3/Modules/selectmodule.c
@@ -252,7 +252,8 @@ select.select
Wait until one or more file descriptors are ready for some kind of I/O.
-The first three arguments are iterables of file descriptors to be waited for:
+The first three arguments are iterables of file descriptors to be waited
+for:
rlist -- wait until ready for reading
wlist -- wait until ready for writing
xlist -- wait for an "exceptional condition"
@@ -265,9 +266,9 @@ The optional 4th argument specifies a timeout in seconds; it may be
a floating-point number to specify fractions of seconds. If it is absent
or None, the call will never time out.
-The return value is a tuple of three lists corresponding to the first three
-arguments; each contains the subset of the corresponding file descriptors
-that are ready.
+The return value is a tuple of three lists corresponding to the first
+three arguments; each contains the subset of the corresponding file
+descriptors that are ready.
*** IMPORTANT NOTICE ***
On Windows, only sockets are supported; on Unix, all file
@@ -277,7 +278,7 @@ descriptors can be used.
static PyObject *
select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
PyObject *xlist, PyObject *timeout_obj)
-/*[clinic end generated code: output=2b3cfa824f7ae4cf input=1199d5e101abca4a]*/
+/*[clinic end generated code: output=2b3cfa824f7ae4cf input=34a2c2075ca9830e]*/
{
#ifdef SELECT_USES_HEAP
pylist *rfd2obj, *wfd2obj, *efd2obj;
@@ -612,13 +613,13 @@ select.poll.poll
Polls the set of registered file descriptors.
-Returns a list containing any descriptors that have events or errors to
-report, as a list of (fd, event) 2-tuples.
+Returns a list containing any descriptors that have events or errors
+to report, as a list of (fd, event) 2-tuples.
[clinic start generated code]*/
static PyObject *
select_poll_poll_impl(pollObject *self, PyObject *timeout_obj)
-/*[clinic end generated code: output=876e837d193ed7e4 input=54310631457efdec]*/
+/*[clinic end generated code: output=876e837d193ed7e4 input=e0a9c0aa283de8c8]*/
{
PyObject *result_list = NULL;
int poll_result, i, j;
@@ -936,19 +937,19 @@ select_devpoll_unregister_impl(devpollObject *self, int fd)
@critical_section
select.devpoll.poll
timeout as timeout_obj: object = None
- The maximum time to wait in milliseconds, or else None (or a negative
- value) to wait indefinitely.
+ The maximum time to wait in milliseconds, or else None (or
+ a negative value) to wait indefinitely.
/
Polls the set of registered file descriptors.
-Returns a list containing any descriptors that have events or errors to
-report, as a list of (fd, event) 2-tuples.
+Returns a list containing any descriptors that have events or errors
+to report, as a list of (fd, event) 2-tuples.
[clinic start generated code]*/
static PyObject *
select_devpoll_poll_impl(devpollObject *self, PyObject *timeout_obj)
-/*[clinic end generated code: output=2654e5457cca0b3c input=fe7a3f6dcbc118c5]*/
+/*[clinic end generated code: output=2654e5457cca0b3c input=9e1672658d728539]*/
{
struct dvpoll dvp;
PyObject *result_list = NULL;
@@ -1196,13 +1197,13 @@ select.poll
Returns a polling object.
-This object supports registering and unregistering file descriptors, and then
-polling them for I/O events.
+This object supports registering and unregistering file descriptors, and
+then polling them for I/O events.
[clinic start generated code]*/
static PyObject *
select_poll_impl(PyObject *module)
-/*[clinic end generated code: output=16a665a4e1d228c5 input=3f877909d5696bbf]*/
+/*[clinic end generated code: output=16a665a4e1d228c5 input=0aefd4527e99e0aa]*/
{
return (PyObject *)newPollObject(module);
}
@@ -1214,13 +1215,13 @@ select.devpoll
Returns a polling object.
-This object supports registering and unregistering file descriptors, and then
-polling them for I/O events.
+This object supports registering and unregistering file descriptors, and
+then polling them for I/O events.
[clinic start generated code]*/
static PyObject *
select_devpoll_impl(PyObject *module)
-/*[clinic end generated code: output=ea9213cc87fd9581 input=53a1af94564f00a3]*/
+/*[clinic end generated code: output=ea9213cc87fd9581 input=4c2ac27d10248526]*/
{
return (PyObject *)newDevPollObject(module);
}
@@ -1558,14 +1559,14 @@ select.epoll.poll
Wait for events on the epoll file descriptor.
-Returns a list containing any descriptors that have events to report,
-as a list of (fd, events) 2-tuples.
+Returns a list containing any descriptors that have events to
+report, as a list of (fd, events) 2-tuples.
[clinic start generated code]*/
static PyObject *
select_epoll_poll_impl(pyEpoll_Object *self, PyObject *timeout_obj,
int maxevents)
-/*[clinic end generated code: output=e02d121a20246c6c input=33d34a5ea430fd5b]*/
+/*[clinic end generated code: output=e02d121a20246c6c input=5a49d65788c70c7a]*/
{
int nfds, i;
PyObject *elist = NULL, *etuple = NULL;
diff --git a/contrib/tools/python3/Modules/signalmodule.c b/contrib/tools/python3/Modules/signalmodule.c
index 6f53dcda824..ed811b4ecdc 100644
--- a/contrib/tools/python3/Modules/signalmodule.c
+++ b/contrib/tools/python3/Modules/signalmodule.c
@@ -467,16 +467,17 @@ signal.signal
Set the action for the given signal.
The action can be SIG_DFL, SIG_IGN, or a callable Python object.
-The previous action is returned. See getsignal() for possible return values.
+The previous action is returned. See getsignal() for possible return
+values.
*** IMPORTANT NOTICE ***
-A signal handler function is called with two arguments:
-the first is the signal number, the second is the interrupted stack frame.
+A signal handler function is called with two arguments: the first is
+the signal number, the second is the interrupted stack frame.
[clinic start generated code]*/
static PyObject *
signal_signal_impl(PyObject *module, int signalnum, PyObject *handler)
-/*[clinic end generated code: output=b44cfda43780f3a1 input=deee84af5fa0432c]*/
+/*[clinic end generated code: output=b44cfda43780f3a1 input=99ce4035ec56ffc1]*/
{
_signal_module_state *modstate = get_signal_state(module);
PyObject *old_handler;
@@ -854,8 +855,8 @@ signal.setitimer
Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL or ITIMER_PROF).
-The timer will fire after value seconds and after that every interval seconds.
-The itimer can be cleared by setting seconds to zero.
+The timer will fire after value seconds and after that every interval
+seconds. The itimer can be cleared by setting seconds to zero.
Returns old values as a tuple: (delay, interval).
[clinic start generated code]*/
@@ -863,7 +864,7 @@ Returns old values as a tuple: (delay, interval).
static PyObject *
signal_setitimer_impl(PyObject *module, int which, PyObject *seconds,
PyObject *interval)
-/*[clinic end generated code: output=65f9dcbddc35527b input=de43daf194e6f66f]*/
+/*[clinic end generated code: output=65f9dcbddc35527b input=bd9f0d2ed8614193]*/
{
_signal_module_state *modstate = get_signal_state(module);
@@ -1024,13 +1025,13 @@ signal.sigwait
Wait for a signal.
Suspend execution of the calling thread until the delivery of one of the
-signals specified in the signal set sigset. The function accepts the signal
-and returns the signal number.
+signals specified in the signal set sigset. The function accepts the
+signal and returns the signal number.
[clinic start generated code]*/
static PyObject *
signal_sigwait_impl(PyObject *module, sigset_t sigset)
-/*[clinic end generated code: output=f43770699d682f96 input=a6fbd47b1086d119]*/
+/*[clinic end generated code: output=f43770699d682f96 input=91773742dd416a3e]*/
{
int err, signum;
diff --git a/contrib/tools/python3/Modules/socketmodule.c b/contrib/tools/python3/Modules/socketmodule.c
index becdf9af718..9cdf207e7a3 100644
--- a/contrib/tools/python3/Modules/socketmodule.c
+++ b/contrib/tools/python3/Modules/socketmodule.c
@@ -8939,6 +8939,9 @@ socket_exec(PyObject *m)
/* Initialize gethostbyname lock */
#if defined(USE_GETHOSTBYNAME_LOCK)
netdb_lock = PyThread_allocate_lock();
+ if (netdb_lock == NULL) {
+ goto error;
+ }
#endif
#ifdef MS_WINDOWS
diff --git a/contrib/tools/python3/Modules/termios.c b/contrib/tools/python3/Modules/termios.c
index f2c5a4bafa7..03c8e0889da 100644
--- a/contrib/tools/python3/Modules/termios.c
+++ b/contrib/tools/python3/Modules/termios.c
@@ -483,12 +483,13 @@ termios.tcsetwinsize
Set the tty winsize for file descriptor fd.
The winsize to be set is taken from the winsize argument, which
-is a two-item tuple (ws_row, ws_col) like the one returned by tcgetwinsize().
+is a two-item tuple (ws_row, ws_col) like the one returned by
+tcgetwinsize().
[clinic start generated code]*/
static PyObject *
termios_tcsetwinsize_impl(PyObject *module, int fd, PyObject *winsz)
-/*[clinic end generated code: output=2ac3c9bb6eda83e1 input=4a06424465b24aee]*/
+/*[clinic end generated code: output=2ac3c9bb6eda83e1 input=efc9beb16d06382a]*/
{
if (!PySequence_Check(winsz) || PySequence_Size(winsz) != 2) {
PyErr_SetString(PyExc_TypeError,
diff --git a/contrib/tools/python3/Modules/unicodedata.c b/contrib/tools/python3/Modules/unicodedata.c
index 2d317bd6f71..6b191c1ec62 100644
--- a/contrib/tools/python3/Modules/unicodedata.c
+++ b/contrib/tools/python3/Modules/unicodedata.c
@@ -508,19 +508,80 @@ get_decomp_record(PyObject *self, Py_UCS4 code,
(*index)++;
}
+/* Small combining runs are usually cheaper with insertion sort. */
+#define CANONICAL_ORDERING_COUNTING_SORT_THRESHOLD 20
+
+static void
+canonical_ordering_sort_insertion(int kind, void *data,
+ Py_ssize_t start, Py_ssize_t end)
+{
+ for (Py_ssize_t i = start + 1; i < end; i++) {
+ Py_UCS4 code = PyUnicode_READ(kind, data, i);
+ unsigned char combining = _getrecord_ex(code)->combining;
+ Py_ssize_t j = i;
+
+ while (j > start) {
+ Py_UCS4 previous = PyUnicode_READ(kind, data, j - 1);
+ if (_getrecord_ex(previous)->combining <= combining) {
+ break;
+ }
+ PyUnicode_WRITE(kind, data, j, previous);
+ j--;
+ }
+ if (j != i) {
+ PyUnicode_WRITE(kind, data, j, code);
+ }
+ }
+}
+
+static void
+canonical_ordering_sort_counting(int kind, void *data,
+ Py_ssize_t start, Py_ssize_t end,
+ Py_UCS4 *sortbuf)
+{
+ Py_ssize_t counts[256] = {0};
+ Py_ssize_t run_length = end - start;
+ Py_ssize_t total = 0;
+
+ for (Py_ssize_t i = start; i < end; i++) {
+ Py_UCS4 code = PyUnicode_READ(kind, data, i);
+ unsigned char combining = _getrecord_ex(code)->combining;
+ counts[combining]++;
+ }
+
+ for (size_t i = 0; i < Py_ARRAY_LENGTH(counts); i++) {
+ Py_ssize_t count = counts[i];
+ counts[i] = total;
+ total += count;
+ }
+
+ /* Reuse counts[] as the next output slot for each CCC. */
+ for (Py_ssize_t i = start; i < end; i++) {
+ Py_UCS4 code = PyUnicode_READ(kind, data, i);
+ unsigned char combining = _getrecord_ex(code)->combining;
+ sortbuf[counts[combining]++] = code;
+ }
+ for (Py_ssize_t i = 0; i < run_length; i++) {
+ PyUnicode_WRITE(kind, data, start + i, sortbuf[i]);
+ }
+}
+
static PyObject*
nfd_nfkd(PyObject *self, PyObject *input, int k)
{
PyObject *result;
Py_UCS4 *output;
Py_ssize_t i, o, osize;
- int kind;
- const void *data;
+ int input_kind, result_kind;
+ const void *input_data;
+ void *result_data;
/* Longest decomposition in Unicode 3.2: U+FDFA */
Py_UCS4 stack[20];
Py_ssize_t space, isize;
int index, prefix, count, stackptr;
unsigned char prev, cur;
+ Py_UCS4 *sortbuf = NULL;
+ Py_ssize_t sortbuflen = 0;
stackptr = 0;
isize = PyUnicode_GET_LENGTH(input);
@@ -540,11 +601,11 @@ nfd_nfkd(PyObject *self, PyObject *input, int k)
return NULL;
}
i = o = 0;
- kind = PyUnicode_KIND(input);
- data = PyUnicode_DATA(input);
+ input_kind = PyUnicode_KIND(input);
+ input_data = PyUnicode_DATA(input);
while (i < isize) {
- stack[stackptr++] = PyUnicode_READ(kind, data, i++);
+ stack[stackptr++] = PyUnicode_READ(input_kind, input_data, i++);
while(stackptr) {
Py_UCS4 code = stack[--stackptr];
/* Hangul Decomposition adds three characters in
@@ -611,35 +672,66 @@ nfd_nfkd(PyObject *self, PyObject *input, int k)
PyMem_Free(output);
if (!result)
return NULL;
+
/* result is guaranteed to be ready, as it is compact. */
- kind = PyUnicode_KIND(result);
- data = PyUnicode_DATA(result);
+ result_kind = PyUnicode_KIND(result);
+ result_data = PyUnicode_DATA(result);
- /* Sort canonically. */
+ /* Sort each consecutive combining-character run canonically. */
i = 0;
- prev = _getrecord_ex(PyUnicode_READ(kind, data, i))->combining;
- for (i++; i < PyUnicode_GET_LENGTH(result); i++) {
- cur = _getrecord_ex(PyUnicode_READ(kind, data, i))->combining;
- if (prev == 0 || cur == 0 || prev <= cur) {
- prev = cur;
+ while (i < o) {
+ Py_ssize_t run_length, run_start;
+ int needs_sort = 0;
+
+ Py_UCS4 ch = PyUnicode_READ(result_kind, result_data, i);
+ prev = _getrecord_ex(ch)->combining;
+ if (prev == 0) {
+ i++;
continue;
}
- /* Non-canonical order. Need to switch *i with previous. */
- o = i - 1;
- while (1) {
- Py_UCS4 tmp = PyUnicode_READ(kind, data, o+1);
- PyUnicode_WRITE(kind, data, o+1,
- PyUnicode_READ(kind, data, o));
- PyUnicode_WRITE(kind, data, o, tmp);
- o--;
- if (o < 0)
- break;
- prev = _getrecord_ex(PyUnicode_READ(kind, data, o))->combining;
- if (prev == 0 || prev <= cur)
+
+ run_start = i++;
+ while (i < o) {
+ Py_UCS4 ch = PyUnicode_READ(result_kind, result_data, i);
+ cur = _getrecord_ex(ch)->combining;
+ if (cur == 0) {
break;
+ }
+ if (prev > cur) {
+ needs_sort = 1;
+ }
+ prev = cur;
+ i++;
+ }
+ if (!needs_sort) {
+ continue;
+ }
+
+ run_length = i - run_start;
+ if (run_length < CANONICAL_ORDERING_COUNTING_SORT_THRESHOLD) {
+ canonical_ordering_sort_insertion(result_kind, result_data,
+ run_start, i);
+ continue;
+ }
+
+ if (run_length > sortbuflen) {
+ Py_UCS4 *new_sortbuf = PyMem_Resize(sortbuf,
+ Py_UCS4,
+ run_length);
+ if (new_sortbuf == NULL) {
+ PyErr_NoMemory();
+ PyMem_Free(sortbuf);
+ Py_DECREF(result);
+ return NULL;
+ }
+ sortbuf = new_sortbuf;
+ sortbuflen = run_length;
}
- prev = _getrecord_ex(PyUnicode_READ(kind, data, i))->combining;
+
+ canonical_ordering_sort_counting(result_kind, result_data,
+ run_start, i, sortbuf);
}
+ PyMem_Free(sortbuf);
return result;
}
@@ -1501,32 +1593,17 @@ capi_getcode(const char* name, int namelen, Py_UCS4* code,
return _check_alias_and_seq(code, with_named_seq);
}
-static void
-unicodedata_destroy_capi(PyObject *capsule)
-{
- void *capi = PyCapsule_GetPointer(capsule, PyUnicodeData_CAPSULE_NAME);
- PyMem_Free(capi);
-}
-
static PyObject *
unicodedata_create_capi(void)
{
- _PyUnicode_Name_CAPI *capi = PyMem_Malloc(sizeof(_PyUnicode_Name_CAPI));
- if (capi == NULL) {
- PyErr_NoMemory();
- return NULL;
- }
- capi->getname = capi_getucname;
- capi->getcode = capi_getcode;
-
- PyObject *capsule = PyCapsule_New(capi,
- PyUnicodeData_CAPSULE_NAME,
- unicodedata_destroy_capi);
- if (capsule == NULL) {
- PyMem_Free(capi);
- }
- return capsule;
-};
+ // Statically allocated so that any cached pointers stay valid after unicodedata
+ // is removed from sys.modules and the capsule is gc'd (gh-149449).
+ static _PyUnicode_Name_CAPI capi = {
+ .getname = capi_getucname,
+ .getcode = capi_getcode,
+ };
+ return PyCapsule_New(&capi, PyUnicodeData_CAPSULE_NAME, NULL);
+}
/* -------------------------------------------------------------------- */
diff --git a/contrib/tools/python3/Modules/zlibmodule.c b/contrib/tools/python3/Modules/zlibmodule.c
index f59f9a76abd..820bace9420 100644
--- a/contrib/tools/python3/Modules/zlibmodule.c
+++ b/contrib/tools/python3/Modules/zlibmodule.c
@@ -875,15 +875,15 @@ zlib.Decompress.decompress
Return a bytes object containing the decompressed version of the data.
-After calling this function, some of the input data may still be stored in
-internal buffers for later processing.
+After calling this function, some of the input data may still be
+stored in internal buffers for later processing.
Call the flush() method to clear these buffers.
[clinic start generated code]*/
static PyObject *
zlib_Decompress_decompress_impl(compobject *self, PyTypeObject *cls,
Py_buffer *data, Py_ssize_t max_length)
-/*[clinic end generated code: output=b024a93c2c922d57 input=bfb37b3864cfb606]*/
+/*[clinic end generated code: output=b024a93c2c922d57 input=b8c9e2d124fe4720]*/
{
int err = Z_OK;
Py_ssize_t ibuflen;
@@ -1675,6 +1675,7 @@ decompress(ZlibDecompressor *self, uint8_t *data,
return result;
error:
+ self->zst.next_in = NULL;
Py_XDECREF(result);
return NULL;
}
@@ -1687,24 +1688,25 @@ zlib.ZlibDecompressor.decompress
Decompress *data*, returning uncompressed data as bytes.
-If *max_length* is nonnegative, returns at most *max_length* bytes of
-decompressed data. If this limit is reached and further output can be
-produced, *self.needs_input* will be set to ``False``. In this case, the next
-call to *decompress()* may provide *data* as b'' to obtain more of the output.
+If *max_length* is nonnegative, returns at most *max_length* bytes
+of decompressed data. If this limit is reached and further output
+can be produced, *self.needs_input* will be set to ``False``. In
+this case, the next call to *decompress()* may provide *data* as b''
+to obtain more of the output.
-If all of the input data was decompressed and returned (either because this
-was less than *max_length* bytes, or because *max_length* was negative),
-*self.needs_input* will be set to True.
+If all of the input data was decompressed and returned (either
+because this was less than *max_length* bytes, or because
+*max_length* was negative), *self.needs_input* will be set to True.
-Attempting to decompress data after the end of stream is reached raises an
-EOFError. Any data found after the end of the stream is ignored and saved in
-the unused_data attribute.
+Attempting to decompress data after the end of stream is reached
+raises an EOFError. Any data found after the end of the stream is
+ignored and saved in the unused_data attribute.
[clinic start generated code]*/
static PyObject *
zlib_ZlibDecompressor_decompress_impl(ZlibDecompressor *self,
Py_buffer *data, Py_ssize_t max_length)
-/*[clinic end generated code: output=990d32787b775f85 input=0b29d99715250b96]*/
+/*[clinic end generated code: output=990d32787b775f85 input=6fb56d60b48cd843]*/
{
PyObject *result = NULL;