aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Modules
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.com>2024-08-17 21:51:59 +0300
committershadchin <shadchin@yandex-team.com>2024-08-17 22:04:51 +0300
commitee9edbd8878888bafcd0eeb3b528f3ec4311560b (patch)
treed54d8138e50a446904f10a2092719be86af011b7 /contrib/tools/python3/Modules
parent72cbe4bad58add0912623ba51351ff1db8587249 (diff)
downloadydb-ee9edbd8878888bafcd0eeb3b528f3ec4311560b.tar.gz
Update Python 3 to 3.12.5
https://docs.python.org/release/3.12.5/whatsnew/changelog.html#python-3-12-5-final de86cdeacd3a8653b9ec36e87975886fafcf6dc2
Diffstat (limited to 'contrib/tools/python3/Modules')
-rw-r--r--contrib/tools/python3/Modules/_asynciomodule.c6
-rw-r--r--contrib/tools/python3/Modules/_datetimemodule.c14
-rw-r--r--contrib/tools/python3/Modules/_elementtree.c2
-rw-r--r--contrib/tools/python3/Modules/_localemodule.c2
-rw-r--r--contrib/tools/python3/Modules/_lsprof.c21
-rw-r--r--contrib/tools/python3/Modules/_pickle.c62
-rw-r--r--contrib/tools/python3/Modules/_sqlite/ya.make4
-rw-r--r--contrib/tools/python3/Modules/_sre/sre.c3
-rw-r--r--contrib/tools/python3/Modules/_struct.c2
-rw-r--r--contrib/tools/python3/Modules/_zoneinfo.c2
-rw-r--r--contrib/tools/python3/Modules/arraymodule.c6
-rw-r--r--contrib/tools/python3/Modules/clinic/mathmodule.c.h8
-rw-r--r--contrib/tools/python3/Modules/clinic/posixmodule.c.h4
-rw-r--r--contrib/tools/python3/Modules/clinic/selectmodule.c.h4
-rw-r--r--contrib/tools/python3/Modules/clinic/signalmodule.c.h4
-rw-r--r--contrib/tools/python3/Modules/faulthandler.c2
-rw-r--r--contrib/tools/python3/Modules/main.c4
-rw-r--r--contrib/tools/python3/Modules/mathmodule.c14
-rw-r--r--contrib/tools/python3/Modules/posixmodule.c8
-rw-r--r--contrib/tools/python3/Modules/selectmodule.c4
-rw-r--r--contrib/tools/python3/Modules/signalmodule.c6
-rw-r--r--contrib/tools/python3/Modules/timemodule.c10
22 files changed, 123 insertions, 69 deletions
diff --git a/contrib/tools/python3/Modules/_asynciomodule.c b/contrib/tools/python3/Modules/_asynciomodule.c
index 05e79915ba..6b969edca2 100644
--- a/contrib/tools/python3/Modules/_asynciomodule.c
+++ b/contrib/tools/python3/Modules/_asynciomodule.c
@@ -2509,7 +2509,11 @@ static PyObject *
_asyncio_Task_get_coro_impl(TaskObj *self)
/*[clinic end generated code: output=bcac27c8cc6c8073 input=d2e8606c42a7b403]*/
{
- return Py_NewRef(self->task_coro);
+ if (self->task_coro) {
+ return Py_NewRef(self->task_coro);
+ }
+
+ Py_RETURN_NONE;
}
/*[clinic input]
diff --git a/contrib/tools/python3/Modules/_datetimemodule.c b/contrib/tools/python3/Modules/_datetimemodule.c
index 8552e42d8b..5a062b9c8c 100644
--- a/contrib/tools/python3/Modules/_datetimemodule.c
+++ b/contrib/tools/python3/Modules/_datetimemodule.c
@@ -5209,19 +5209,19 @@ datetime_utcfromtimestamp(PyObject *cls, PyObject *args)
static PyObject *
datetime_strptime(PyObject *cls, PyObject *args)
{
- static PyObject *module = NULL;
- PyObject *string, *format;
+ PyObject *string, *format, *result;
if (!PyArg_ParseTuple(args, "UU:strptime", &string, &format))
return NULL;
+ PyObject *module = PyImport_ImportModule("_strptime");
if (module == NULL) {
- module = PyImport_ImportModule("_strptime");
- if (module == NULL)
- return NULL;
+ return NULL;
}
- return PyObject_CallMethodObjArgs(module, &_Py_ID(_strptime_datetime),
- cls, string, format, NULL);
+ result = PyObject_CallMethodObjArgs(module, &_Py_ID(_strptime_datetime),
+ cls, string, format, NULL);
+ Py_DECREF(module);
+ return result;
}
/* Return new datetime from date/datetime and time arguments. */
diff --git a/contrib/tools/python3/Modules/_elementtree.c b/contrib/tools/python3/Modules/_elementtree.c
index fcd4be9338..d511429a75 100644
--- a/contrib/tools/python3/Modules/_elementtree.c
+++ b/contrib/tools/python3/Modules/_elementtree.c
@@ -1504,7 +1504,7 @@ element_bool(PyObject* self_)
{
ElementObject* self = (ElementObject*) self_;
if (PyErr_WarnEx(PyExc_DeprecationWarning,
- "Testing an element's truth value will raise an exception "
+ "Testing an element's truth value will always return True "
"in future versions. Use specific 'len(elem)' or "
"'elem is not None' test instead.",
1) < 0) {
diff --git a/contrib/tools/python3/Modules/_localemodule.c b/contrib/tools/python3/Modules/_localemodule.c
index cbd036fdf2..f080b97034 100644
--- a/contrib/tools/python3/Modules/_localemodule.c
+++ b/contrib/tools/python3/Modules/_localemodule.c
@@ -62,7 +62,7 @@ module _locale
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=ed98569b726feada]*/
-/* support functions for formatting floating point numbers */
+/* support functions for formatting floating-point numbers */
/* the grouping is terminated by either 0 or CHAR_MAX */
static PyObject*
diff --git a/contrib/tools/python3/Modules/_lsprof.c b/contrib/tools/python3/Modules/_lsprof.c
index 257de4387c..2c82b18c0e 100644
--- a/contrib/tools/python3/Modules/_lsprof.c
+++ b/contrib/tools/python3/Modules/_lsprof.c
@@ -56,6 +56,7 @@ typedef struct {
#define POF_ENABLED 0x001
#define POF_SUBCALLS 0x002
#define POF_BUILTINS 0x004
+#define POF_EXT_TIMER 0x008
#define POF_NOMEMORY 0x100
/*[clinic input]
@@ -84,7 +85,14 @@ _lsprof_get_state(PyObject *module)
static _PyTime_t CallExternalTimer(ProfilerObject *pObj)
{
- PyObject *o = _PyObject_CallNoArgs(pObj->externalTimer);
+ PyObject *o = NULL;
+
+ // External timer can do arbitrary things so we need a flag to prevent
+ // horrible things to happen
+ pObj->flags |= POF_EXT_TIMER;
+ o = _PyObject_CallNoArgs(pObj->externalTimer);
+ pObj->flags &= ~POF_EXT_TIMER;
+
if (o == NULL) {
PyErr_WriteUnraisable(pObj->externalTimer);
return 0;
@@ -773,6 +781,11 @@ Stop collecting profiling information.\n\
static PyObject*
profiler_disable(ProfilerObject *self, PyObject* noarg)
{
+ if (self->flags & POF_EXT_TIMER) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "cannot disable profiler in external timer");
+ return NULL;
+ }
if (self->flags & POF_ENABLED) {
PyObject* result = NULL;
PyObject* monitoring = _PyImport_GetModuleAttrString("sys", "monitoring");
@@ -826,6 +839,11 @@ Clear all profiling information collected so far.\n\
static PyObject*
profiler_clear(ProfilerObject *pObj, PyObject* noarg)
{
+ if (pObj->flags & POF_EXT_TIMER) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "cannot clear profiler in external timer");
+ return NULL;
+ }
clearEntries(pObj);
Py_RETURN_NONE;
}
@@ -834,6 +852,7 @@ static int
profiler_traverse(ProfilerObject *op, visitproc visit, void *arg)
{
Py_VISIT(Py_TYPE(op));
+ Py_VISIT(op->externalTimer);
return 0;
}
diff --git a/contrib/tools/python3/Modules/_pickle.c b/contrib/tools/python3/Modules/_pickle.c
index 2bf9977f0b..96534a565b 100644
--- a/contrib/tools/python3/Modules/_pickle.c
+++ b/contrib/tools/python3/Modules/_pickle.c
@@ -1876,10 +1876,10 @@ get_dotted_path(PyObject *obj, PyObject *name)
if (_PyUnicode_EqualToASCIIString(subpath, "<locals>")) {
if (obj == NULL)
PyErr_Format(PyExc_AttributeError,
- "Can't pickle local object %R", name);
+ "Can't get local object %R", name);
else
PyErr_Format(PyExc_AttributeError,
- "Can't pickle local attribute %R on %R", name, obj);
+ "Can't get local attribute %R on %R", name, obj);
Py_DECREF(dotted_path);
return NULL;
}
@@ -2566,7 +2566,7 @@ save_picklebuffer(PickleState *st, PicklerObject *self, PyObject *obj)
{
if (self->proto < 5) {
PyErr_SetString(st->PicklingError,
- "PickleBuffer can only pickled with protocol >= 5");
+ "PickleBuffer can only be pickled with protocol >= 5");
return -1;
}
const Py_buffer* view = PyPickleBuffer_GetBuffer(obj);
@@ -3188,6 +3188,7 @@ batch_dict(PickleState *state, PicklerObject *self, PyObject *iter)
if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 2) {
PyErr_SetString(PyExc_TypeError, "dict items "
"iterator must return 2-tuples");
+ Py_DECREF(obj);
return -1;
}
i = save(state, self, PyTuple_GET_ITEM(obj, 0), 0);
@@ -3651,7 +3652,6 @@ save_global(PickleState *st, PicklerObject *self, PyObject *obj,
PyObject *module = NULL;
PyObject *parent = NULL;
PyObject *dotted_path = NULL;
- PyObject *lastname = NULL;
PyObject *cls;
int status = 0;
@@ -3692,10 +3692,7 @@ save_global(PickleState *st, PicklerObject *self, PyObject *obj,
obj, module_name);
goto error;
}
- lastname = Py_NewRef(PyList_GET_ITEM(dotted_path,
- PyList_GET_SIZE(dotted_path) - 1));
cls = get_deep_attribute(module, dotted_path, &parent);
- Py_CLEAR(dotted_path);
if (cls == NULL) {
PyErr_Format(st->PicklingError,
"Can't pickle %R: attribute lookup %S on %S failed",
@@ -3783,7 +3780,10 @@ save_global(PickleState *st, PicklerObject *self, PyObject *obj,
else {
gen_global:
if (parent == module) {
- Py_SETREF(global_name, Py_NewRef(lastname));
+ Py_SETREF(global_name,
+ Py_NewRef(PyList_GET_ITEM(dotted_path,
+ PyList_GET_SIZE(dotted_path) - 1)));
+ Py_CLEAR(dotted_path);
}
if (self->proto >= 4) {
const char stack_global_op = STACK_GLOBAL;
@@ -3796,20 +3796,30 @@ save_global(PickleState *st, PicklerObject *self, PyObject *obj,
if (_Pickler_Write(self, &stack_global_op, 1) < 0)
goto error;
}
- else if (parent != module) {
- PyObject *reduce_value = Py_BuildValue("(O(OO))",
- st->getattr, parent, lastname);
- if (reduce_value == NULL)
- goto error;
- status = save_reduce(st, self, reduce_value, NULL);
- Py_DECREF(reduce_value);
- if (status < 0)
- goto error;
- }
else {
/* Generate a normal global opcode if we are using a pickle
protocol < 4, or if the object is not registered in the
- extension registry. */
+ extension registry.
+
+ Objects with multi-part __qualname__ are represented as
+ getattr(getattr(..., attrname1), attrname2). */
+ const char mark_op = MARK;
+ const char tupletwo_op = (self->proto < 2) ? TUPLE : TUPLE2;
+ const char reduce_op = REDUCE;
+ Py_ssize_t i;
+ if (dotted_path) {
+ if (PyList_GET_SIZE(dotted_path) > 1) {
+ Py_SETREF(global_name, Py_NewRef(PyList_GET_ITEM(dotted_path, 0)));
+ }
+ for (i = 1; i < PyList_GET_SIZE(dotted_path); i++) {
+ if (save(st, self, st->getattr, 0) < 0 ||
+ (self->proto < 2 && _Pickler_Write(self, &mark_op, 1) < 0))
+ {
+ goto error;
+ }
+ }
+ }
+
PyObject *encoded;
PyObject *(*unicode_encoder)(PyObject *);
@@ -3871,6 +3881,17 @@ save_global(PickleState *st, PicklerObject *self, PyObject *obj,
Py_DECREF(encoded);
if (_Pickler_Write(self, "\n", 1) < 0)
goto error;
+
+ if (dotted_path) {
+ for (i = 1; i < PyList_GET_SIZE(dotted_path); i++) {
+ if (save(st, self, PyList_GET_ITEM(dotted_path, i), 0) < 0 ||
+ _Pickler_Write(self, &tupletwo_op, 1) < 0 ||
+ _Pickler_Write(self, &reduce_op, 1) < 0)
+ {
+ goto error;
+ }
+ }
+ }
}
/* Memoize the object. */
if (memo_put(st, self, obj) < 0)
@@ -3886,7 +3907,6 @@ save_global(PickleState *st, PicklerObject *self, PyObject *obj,
Py_XDECREF(module);
Py_XDECREF(parent);
Py_XDECREF(dotted_path);
- Py_XDECREF(lastname);
return status;
}
@@ -6623,11 +6643,13 @@ load_additems(PickleState *state, UnpicklerObject *self)
if (result == NULL) {
Pdata_clear(self->stack, i + 1);
Py_SET_SIZE(self->stack, mark);
+ Py_DECREF(add_func);
return -1;
}
Py_DECREF(result);
}
Py_SET_SIZE(self->stack, mark);
+ Py_DECREF(add_func);
}
return 0;
diff --git a/contrib/tools/python3/Modules/_sqlite/ya.make b/contrib/tools/python3/Modules/_sqlite/ya.make
index ed262f6959..eca2571733 100644
--- a/contrib/tools/python3/Modules/_sqlite/ya.make
+++ b/contrib/tools/python3/Modules/_sqlite/ya.make
@@ -2,9 +2,9 @@
LIBRARY()
-VERSION(3.12.4)
+VERSION(3.12.5)
-ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.12.4.tar.gz)
+ORIGINAL_SOURCE(https://github.com/python/cpython/archive/v3.12.5.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 0547390454..6d9843bb76 100644
--- a/contrib/tools/python3/Modules/_sre/sre.c
+++ b/contrib/tools/python3/Modules/_sre/sre.c
@@ -1572,6 +1572,7 @@ _sre_template_impl(PyObject *module, PyObject *pattern, PyObject *template)
}
self->items[i].literal = Py_XNewRef(literal);
}
+ PyObject_GC_Track(self);
return (PyObject*) self;
bad_template:
@@ -2166,6 +2167,8 @@ match_getindex(MatchObject* self, PyObject* index)
return -1;
}
+ // Check that i*2 cannot overflow to make static analyzers happy
+ assert(i <= SRE_MAXGROUPS);
return i;
}
diff --git a/contrib/tools/python3/Modules/_struct.c b/contrib/tools/python3/Modules/_struct.c
index 55efc0c6cf..e8d9f86e19 100644
--- a/contrib/tools/python3/Modules/_struct.c
+++ b/contrib/tools/python3/Modules/_struct.c
@@ -278,7 +278,7 @@ get_size_t(_structmodulestate *state, PyObject *v, size_t *p)
#define RANGE_ERROR(state, f, flag) return _range_error(state, f, flag)
-/* Floating point helpers */
+/* Floating-point helpers */
static PyObject *
unpack_halffloat(const char *p, /* start of 2-byte string */
diff --git a/contrib/tools/python3/Modules/_zoneinfo.c b/contrib/tools/python3/Modules/_zoneinfo.c
index 8fc8616241..47e40125cf 100644
--- a/contrib/tools/python3/Modules/_zoneinfo.c
+++ b/contrib/tools/python3/Modules/_zoneinfo.c
@@ -954,6 +954,7 @@ end:
static int
load_data(zoneinfo_state *state, PyZoneInfo_ZoneInfo *self, PyObject *file_obj)
{
+ int rv = 0;
PyObject *data_tuple = NULL;
long *utcoff = NULL;
@@ -1230,7 +1231,6 @@ load_data(zoneinfo_state *state, PyZoneInfo_ZoneInfo *self, PyObject *file_obj)
}
}
- int rv = 0;
goto cleanup;
error:
// These resources only need to be freed if we have failed, if we succeed
diff --git a/contrib/tools/python3/Modules/arraymodule.c b/contrib/tools/python3/Modules/arraymodule.c
index 19ee83d24c..d24c5989af 100644
--- a/contrib/tools/python3/Modules/arraymodule.c
+++ b/contrib/tools/python3/Modules/arraymodule.c
@@ -2739,7 +2739,7 @@ array_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyDoc_STRVAR(module_doc,
"This module defines an object type which can efficiently represent\n\
-an array of basic values: characters, integers, floating point\n\
+an array of basic values: characters, integers, floating-point\n\
numbers. Arrays are sequence types and behave very much like lists,\n\
except that the type of objects stored in them is constrained.\n");
@@ -2767,8 +2767,8 @@ The following type codes are defined:\n\
'L' unsigned integer 4\n\
'q' signed integer 8 (see note)\n\
'Q' unsigned integer 8 (see note)\n\
- 'f' floating point 4\n\
- 'd' floating point 8\n\
+ 'f' floating-point 4\n\
+ 'd' floating-point 8\n\
\n\
NOTE: The 'u' typecode corresponds to Python's unicode character. On\n\
narrow builds this is 2-bytes on wide builds this is 4-bytes.\n\
diff --git a/contrib/tools/python3/Modules/clinic/mathmodule.c.h b/contrib/tools/python3/Modules/clinic/mathmodule.c.h
index c16c1b0839..a2754639d9 100644
--- a/contrib/tools/python3/Modules/clinic/mathmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/mathmodule.c.h
@@ -34,9 +34,9 @@ PyDoc_STRVAR(math_fsum__doc__,
"fsum($module, seq, /)\n"
"--\n"
"\n"
-"Return an accurate floating point sum of values in the iterable seq.\n"
+"Return an accurate floating-point sum of values in the iterable seq.\n"
"\n"
-"Assumes IEEE-754 floating point arithmetic.");
+"Assumes IEEE-754 floating-point arithmetic.");
#define MATH_FSUM_METHODDEF \
{"fsum", (PyCFunction)math_fsum, METH_O, math_fsum__doc__},
@@ -549,7 +549,7 @@ PyDoc_STRVAR(math_isclose__doc__,
"isclose($module, /, a, b, *, rel_tol=1e-09, abs_tol=0.0)\n"
"--\n"
"\n"
-"Determine whether two floating point numbers are close in value.\n"
+"Determine whether two floating-point numbers are close in value.\n"
"\n"
" rel_tol\n"
" maximum difference for being considered \"close\", relative to the\n"
@@ -950,4 +950,4 @@ math_ulp(PyObject *module, PyObject *arg)
exit:
return return_value;
}
-/*[clinic end generated code: output=91a0357265a2a553 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=bd6c271030b9698b input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/posixmodule.c.h b/contrib/tools/python3/Modules/clinic/posixmodule.c.h
index 02cb95a6c5..066c2f8de1 100644
--- a/contrib/tools/python3/Modules/clinic/posixmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/posixmodule.c.h
@@ -5985,7 +5985,7 @@ PyDoc_STRVAR(os_times__doc__,
"\n"
"The object returned behaves like a named tuple with these fields:\n"
" (utime, stime, cutime, cstime, elapsed_time)\n"
-"All fields are floating point numbers.");
+"All fields are floating-point numbers.");
#define OS_TIMES_METHODDEF \
{"times", (PyCFunction)os_times, METH_NOARGS, os_times__doc__},
@@ -12002,4 +12002,4 @@ exit:
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
-/*[clinic end generated code: output=e2cf3ab750346780 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=6f0c08f692891c72 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/selectmodule.c.h b/contrib/tools/python3/Modules/clinic/selectmodule.c.h
index f44ca1d70a..086fab5ba8 100644
--- a/contrib/tools/python3/Modules/clinic/selectmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/selectmodule.c.h
@@ -24,7 +24,7 @@ PyDoc_STRVAR(select_select__doc__,
"gotten from a fileno() method call on one of those.\n"
"\n"
"The optional 4th argument specifies a timeout in seconds; it may be\n"
-"a floating point number to specify fractions of seconds. If it is absent\n"
+"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"
@@ -1309,4 +1309,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
-/*[clinic end generated code: output=64516114287e894d input=a9049054013a1b77]*/
+/*[clinic end generated code: output=4d031b2402ee40e7 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/clinic/signalmodule.c.h b/contrib/tools/python3/Modules/clinic/signalmodule.c.h
index 3b3c6ba150..7206298cc6 100644
--- a/contrib/tools/python3/Modules/clinic/signalmodule.c.h
+++ b/contrib/tools/python3/Modules/clinic/signalmodule.c.h
@@ -526,7 +526,7 @@ PyDoc_STRVAR(signal_sigtimedwait__doc__,
"\n"
"Like sigwaitinfo(), but with a timeout.\n"
"\n"
-"The timeout is specified in seconds, with floating point numbers allowed.");
+"The timeout is specified in seconds, with floating-point numbers allowed.");
#define SIGNAL_SIGTIMEDWAIT_METHODDEF \
{"sigtimedwait", _PyCFunction_CAST(signal_sigtimedwait), METH_FASTCALL, signal_sigtimedwait__doc__},
@@ -705,4 +705,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=2b54dc607f6e3146 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=29cc8fb029d04c97 input=a9049054013a1b77]*/
diff --git a/contrib/tools/python3/Modules/faulthandler.c b/contrib/tools/python3/Modules/faulthandler.c
index da26b7bcf4..96cc6d8ca1 100644
--- a/contrib/tools/python3/Modules/faulthandler.c
+++ b/contrib/tools/python3/Modules/faulthandler.c
@@ -70,7 +70,7 @@ static fault_handler_t faulthandler_handlers[] = {
#ifdef SIGILL
{SIGILL, 0, "Illegal instruction", },
#endif
- {SIGFPE, 0, "Floating point exception", },
+ {SIGFPE, 0, "Floating-point exception", },
{SIGABRT, 0, "Aborted", },
/* define SIGSEGV at the end to make it the default choice if searching the
handler fails in faulthandler_fatal_error() */
diff --git a/contrib/tools/python3/Modules/main.c b/contrib/tools/python3/Modules/main.c
index 40dafa2c7b..5c60878626 100644
--- a/contrib/tools/python3/Modules/main.c
+++ b/contrib/tools/python3/Modules/main.c
@@ -541,6 +541,10 @@ pymain_repl(PyConfig *config, int *exitcode)
return;
}
+ if (PySys_Audit("cpython.run_stdin", NULL) < 0) {
+ return;
+ }
+
PyCompilerFlags cf = _PyCompilerFlags_INIT;
int res = PyRun_AnyFileFlags(stdin, "<stdin>", &cf);
*exitcode = (res != 0);
diff --git a/contrib/tools/python3/Modules/mathmodule.c b/contrib/tools/python3/Modules/mathmodule.c
index bbd6bd010e..000803981e 100644
--- a/contrib/tools/python3/Modules/mathmodule.c
+++ b/contrib/tools/python3/Modules/mathmodule.c
@@ -106,7 +106,7 @@ typedef struct{ double hi; double lo; } DoubleLength;
static DoubleLength
dl_fast_sum(double a, double b)
{
- /* Algorithm 1.1. Compensated summation of two floating point numbers. */
+ /* Algorithm 1.1. Compensated summation of two floating-point numbers. */
assert(fabs(a) >= fabs(b));
double x = a + b;
double y = (a - x) + b;
@@ -1347,14 +1347,14 @@ math.fsum
seq: object
/
-Return an accurate floating point sum of values in the iterable seq.
+Return an accurate floating-point sum of values in the iterable seq.
-Assumes IEEE-754 floating point arithmetic.
+Assumes IEEE-754 floating-point arithmetic.
[clinic start generated code]*/
static PyObject *
math_fsum(PyObject *module, PyObject *seq)
-/*[clinic end generated code: output=ba5c672b87fe34fc input=c51b7d8caf6f6e82]*/
+/*[clinic end generated code: output=ba5c672b87fe34fc input=4506244ded6057dc]*/
{
PyObject *item, *iter, *sum = NULL;
Py_ssize_t i, j, n = 0, m = NUM_PARTIALS;
@@ -2411,7 +2411,7 @@ Since lo**2 is less than 1/2 ulp(csum), we have csum+lo*lo == csum.
To minimize loss of information during the accumulation of fractional
values, each term has a separate accumulator. This also breaks up
sequential dependencies in the inner loop so the CPU can maximize
-floating point throughput. [4] On an Apple M1 Max, hypot(*vec)
+floating-point throughput. [4] On an Apple M1 Max, hypot(*vec)
takes only 3.33 µsec when len(vec) == 1000.
The square root differential correction is needed because a
@@ -3093,7 +3093,7 @@ math.isclose -> bool
maximum difference for being considered "close", regardless of the
magnitude of the input values
-Determine whether two floating point numbers are close in value.
+Determine whether two floating-point numbers are close in value.
Return True if a is close in value to b, and False otherwise.
@@ -3108,7 +3108,7 @@ only close to themselves.
static int
math_isclose_impl(PyObject *module, double a, double b, double rel_tol,
double abs_tol)
-/*[clinic end generated code: output=b73070207511952d input=f28671871ea5bfba]*/
+/*[clinic end generated code: output=b73070207511952d input=12d41764468bfdb8]*/
{
double diff = 0.0;
diff --git a/contrib/tools/python3/Modules/posixmodule.c b/contrib/tools/python3/Modules/posixmodule.c
index 166a15f512..f366f1ce5d 100644
--- a/contrib/tools/python3/Modules/posixmodule.c
+++ b/contrib/tools/python3/Modules/posixmodule.c
@@ -7580,6 +7580,7 @@ os_register_at_fork_impl(PyObject *module, PyObject *before,
}
#endif /* HAVE_FORK */
+#if defined(HAVE_FORK1) || defined(HAVE_FORKPTY) || defined(HAVE_FORK)
// Common code to raise a warning if we detect there is more than one thread
// running in the process. Best effort, silent if unable to count threads.
// Constraint: Quick. Never overcounts. Never leaves an error set.
@@ -7678,6 +7679,7 @@ static void warn_about_fork_with_threads(const char* name) {
PyErr_Clear();
}
}
+#endif // HAVE_FORK1 || HAVE_FORKPTY || HAVE_FORK
#ifdef HAVE_FORK1
/*[clinic input]
@@ -10058,12 +10060,12 @@ Return a collection containing process timing information.
The object returned behaves like a named tuple with these fields:
(utime, stime, cutime, cstime, elapsed_time)
-All fields are floating point numbers.
+All fields are floating-point numbers.
[clinic start generated code]*/
static PyObject *
os_times_impl(PyObject *module)
-/*[clinic end generated code: output=35f640503557d32a input=2bf9df3d6ab2e48b]*/
+/*[clinic end generated code: output=35f640503557d32a input=8dbfe33a2dcc3df3]*/
#ifdef MS_WINDOWS
{
FILETIME create, exit, kernel, user;
@@ -11787,6 +11789,7 @@ os_mknod_impl(PyObject *module, path_t *path, int mode, dev_t device,
#endif /* defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) */
+#ifdef HAVE_DEVICE_MACROS
static PyObject *
major_minor_conv(unsigned int value)
{
@@ -11809,7 +11812,6 @@ major_minor_check(dev_t value)
return (dev_t)(unsigned int)value == value;
}
-#ifdef HAVE_DEVICE_MACROS
/*[clinic input]
os.major
diff --git a/contrib/tools/python3/Modules/selectmodule.c b/contrib/tools/python3/Modules/selectmodule.c
index 97f1db20f6..50788e5344 100644
--- a/contrib/tools/python3/Modules/selectmodule.c
+++ b/contrib/tools/python3/Modules/selectmodule.c
@@ -263,7 +263,7 @@ A file descriptor is either a socket or file object, or a small integer
gotten from a fileno() method call on one of those.
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
+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
@@ -278,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=e467f5d68033de00]*/
+/*[clinic end generated code: output=2b3cfa824f7ae4cf input=1199d5e101abca4a]*/
{
#ifdef SELECT_USES_HEAP
pylist *rfd2obj, *wfd2obj, *efd2obj;
diff --git a/contrib/tools/python3/Modules/signalmodule.c b/contrib/tools/python3/Modules/signalmodule.c
index 00ea434373..4f4e6a3968 100644
--- a/contrib/tools/python3/Modules/signalmodule.c
+++ b/contrib/tools/python3/Modules/signalmodule.c
@@ -637,7 +637,7 @@ signal_strsignal_impl(PyObject *module, int signalnum)
res = "Aborted";
break;
case SIGFPE:
- res = "Floating point exception";
+ res = "Floating-point exception";
break;
case SIGSEGV:
res = "Segmentation fault";
@@ -1199,13 +1199,13 @@ signal.sigtimedwait
Like sigwaitinfo(), but with a timeout.
-The timeout is specified in seconds, with floating point numbers allowed.
+The timeout is specified in seconds, with floating-point numbers allowed.
[clinic start generated code]*/
static PyObject *
signal_sigtimedwait_impl(PyObject *module, sigset_t sigset,
PyObject *timeout_obj)
-/*[clinic end generated code: output=59c8971e8ae18a64 input=87fd39237cf0b7ba]*/
+/*[clinic end generated code: output=59c8971e8ae18a64 input=955773219c1596cd]*/
{
_PyTime_t timeout;
if (_PyTime_FromSecondsObject(&timeout,
diff --git a/contrib/tools/python3/Modules/timemodule.c b/contrib/tools/python3/Modules/timemodule.c
index 9038c37281..8613fccfe0 100644
--- a/contrib/tools/python3/Modules/timemodule.c
+++ b/contrib/tools/python3/Modules/timemodule.c
@@ -159,7 +159,7 @@ time_time(PyObject *self, PyObject *unused)
PyDoc_STRVAR(time_doc,
-"time() -> floating point number\n\
+"time() -> floating-point number\n\
\n\
Return the current time in seconds since the Epoch.\n\
Fractions of a second may be present if the system clock provides them.");
@@ -373,7 +373,7 @@ time_clock_getres(PyObject *self, PyObject *args)
}
PyDoc_STRVAR(clock_getres_doc,
-"clock_getres(clk_id) -> floating point number\n\
+"clock_getres(clk_id) -> floating-point number\n\
\n\
Return the resolution (precision) of the specified clock clk_id.");
@@ -432,7 +432,7 @@ PyDoc_STRVAR(sleep_doc,
"sleep(seconds)\n\
\n\
Delay execution for a given number of seconds. The argument may be\n\
-a floating point number for subsecond precision.");
+a floating-point number for subsecond precision.");
static PyStructSequence_Field struct_time_type_fields[] = {
{"tm_year", "year, for example, 1993"},
@@ -1123,7 +1123,7 @@ time_mktime(PyObject *module, PyObject *tm_tuple)
}
PyDoc_STRVAR(mktime_doc,
-"mktime(tuple) -> floating point number\n\
+"mktime(tuple) -> floating-point number\n\
\n\
Convert a time tuple in local time to seconds since the Epoch.\n\
Note that mktime(gmtime(0)) will not generally return zero for most\n\
@@ -1913,7 +1913,7 @@ PyDoc_STRVAR(module_doc,
\n\
There are two standard representations of time. One is the number\n\
of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer\n\
-or a floating point number (to represent fractions of seconds).\n\
+or a floating-point number (to represent fractions of seconds).\n\
The epoch is the point where the time starts, the return value of time.gmtime(0).\n\
It is January 1, 1970, 00:00:00 (UTC) on all platforms.\n\
\n\