Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/import.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,4 @@ Importing Modules

On error, return NULL with an exception set.

.. versionadded:: next
.. versionadded:: 3.15
4 changes: 2 additions & 2 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1390,7 +1390,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.

See :c:func:`PyUnstable_ThreadState_ResetStackProtection` for undoing this operation.

.. versionadded:: next
.. versionadded:: 3.15


.. c:function:: void PyUnstable_ThreadState_ResetStackProtection(PyThreadState *tstate)
Expand All @@ -1400,7 +1400,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.

See :c:func:`PyUnstable_ThreadState_SetStackProtection` for an explanation.

.. versionadded:: next
.. versionadded:: 3.15


.. c:function:: PyInterpreterState* PyInterpreterState_Get(void)
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2261,7 +2261,7 @@ and classes for traversing abstract syntax trees:
The minimum supported version for ``feature_version`` is now ``(3, 7)``.
The ``optimize`` argument was added.

.. versionadded:: next
.. versionadded:: 3.15
Added the *module* parameter.


Expand Down
2 changes: 1 addition & 1 deletion Doc/library/decimal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ Constants
Specification that this implementation complies with.
See https://speleotrove.com/decimal/decarith.html for the specification.

.. versionadded:: next
.. versionadded:: 3.15


The following constants are only relevant for the C module. They
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ are always available. They are listed here in alphabetical order.
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
support for top-level ``await``, ``async for``, and ``async with``.

.. versionadded:: next
.. versionadded:: 3.15
Added the *module* parameter.


Expand Down
2 changes: 1 addition & 1 deletion Doc/library/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ The :mod:`functools` module defines the following functions:

.. versionadded:: 3.8

.. versionchanged:: next
.. versionchanged:: 3.15
Added support of non-:term:`descriptor` callables.


Expand Down
4 changes: 2 additions & 2 deletions Doc/library/importlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ ABC hierarchy::
.. versionchanged:: 3.5
Made the method static.

.. versionadded:: next
.. versionadded:: 3.15
Added the *fullname* parameter.


Expand Down Expand Up @@ -1048,7 +1048,7 @@ find and load modules.
:meth:`PathFinder.invalidate_caches` invalidates :class:`NamespacePath`,
forcing the path value to be recomputed next time it is accessed.

.. versionadded:: next
.. versionadded:: 3.15


.. class:: SourceFileLoader(fullname, path)
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ Retrieving source code
.. versionchanged:: 3.5
Documentation strings are now inherited if not overridden.

.. versionchanged:: next
.. versionchanged:: 3.15
Added parameters *inherit_class_doc* and *fallback_to_class_doc*.

Documentation strings on :class:`~functools.cached_property`
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/math.integer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.. module:: math.integer
:synopsis: Integer-specific mathematics functions.

.. versionadded:: next
.. versionadded:: 3.15

--------------

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/math.rst
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ the following functions from the :mod:`math.integer` module:
Floats with integral values (like ``5.0``) are no longer accepted in the
:func:`factorial` function.

.. deprecated:: next
.. deprecated:: 3.15
These aliases are :term:`soft deprecated` in favor of the
:mod:`math.integer` functions.

Expand Down
14 changes: 7 additions & 7 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3404,7 +3404,7 @@ features:

.. availability:: Linux >= 4.11 with glibc >= 2.28.

.. versionadded:: next
.. versionadded:: 3.15


.. class:: statx_result
Expand Down Expand Up @@ -3661,7 +3661,7 @@ features:

.. availability:: Linux >= 4.11 with glibc >= 2.28.

.. versionadded:: next
.. versionadded:: 3.15


.. data:: STATX_TYPE
Expand Down Expand Up @@ -3690,7 +3690,7 @@ features:

.. availability:: Linux >= 4.11 with glibc >= 2.28.

.. versionadded:: next
.. versionadded:: 3.15

.. data:: AT_STATX_FORCE_SYNC

Expand All @@ -3700,7 +3700,7 @@ features:

.. availability:: Linux >= 4.11 with glibc >= 2.28.

.. versionadded:: next
.. versionadded:: 3.15

.. data:: AT_STATX_DONT_SYNC

Expand All @@ -3709,7 +3709,7 @@ features:

.. availability:: Linux >= 4.11 with glibc >= 2.28.

.. versionadded:: next
.. versionadded:: 3.15

.. data:: AT_STATX_SYNC_AS_STAT

Expand All @@ -3721,7 +3721,7 @@ features:

.. availability:: Linux >= 4.11 with glibc >= 2.28.

.. versionadded:: next
.. versionadded:: 3.15


.. data:: AT_NO_AUTOMOUNT
Expand All @@ -3733,7 +3733,7 @@ features:

.. availability:: Linux.

.. versionadded:: next
.. versionadded:: 3.15


.. function:: statvfs(path)
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,4 +511,4 @@ meaning of these constants.
STATX_ATTR_DAX
STATX_ATTR_WRITE_ATOMIC

.. versionadded:: next
.. versionadded:: 3.15
2 changes: 1 addition & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3191,7 +3191,7 @@ objects.

Taking all bytes is a zero-copy operation.

.. versionadded:: next
.. versionadded:: 3.15

See the :ref:`What's New <whatsnew315-bytearray-take-bytes>` entry for
common code patterns which can be optimized with
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/symtable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Generating Symbol Tables
It is needed to unambiguous :ref:`filter <warning-filter>` syntax warnings
by module name.

.. versionadded:: next
.. versionadded:: 3.15
Added the *module* parameter.


Expand Down
4 changes: 2 additions & 2 deletions Doc/library/unicodedata.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ following functions:
>>> unicodedata.isxidstart('0')
False

.. versionadded:: next
.. versionadded:: 3.15


.. function:: isxidcontinue(chr, /)
Expand All @@ -171,7 +171,7 @@ following functions:
>>> unicodedata.isxidcontinue(' ')
False

.. versionadded:: next
.. versionadded:: 3.15


.. function:: decomposition(chr, /)
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ Available Functions
.. versionchanged:: 3.6
Add the *source* parameter.

.. versionchanged:: next
.. versionchanged:: 3.15
If no module is passed, test the filter regular expression against
module names created from the path, not only the path itself.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/winreg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,6 @@ integer handle, and also disconnect the Windows handle from the handle object.
will automatically close *key* when control leaves the :keyword:`with` block.


.. versionchanged:: next
.. versionchanged:: 3.15
Handle objects are now compared by their underlying Windows handle value
instead of object identity for equality comparisons.
2 changes: 1 addition & 1 deletion Doc/library/xml.dom.pulldom.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ given point) or to make use of the :func:`DOMEventStream.expandNode` method
and switch to DOM-related processing.


.. class:: PullDom(documentFactory=None)
.. class:: PullDOM(documentFactory=None)

Subclass of :class:`xml.sax.handler.ContentHandler`.

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/xml.etree.elementtree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ Functions
.. versionchanged:: 3.13
Added the :meth:`!close` method.

.. versionchanged:: next
.. versionchanged:: 3.15
A :exc:`ResourceWarning` is now emitted if the iterator opened a file
and is not explicitly closed.

Expand Down
7 changes: 5 additions & 2 deletions Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,13 @@ extern void _PyEval_DeactivateOpCache(void);
static inline int _Py_MakeRecCheck(PyThreadState *tstate) {
uintptr_t here_addr = _Py_get_machine_stack_pointer();
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
// Overflow if stack pointer is between soft limit and the base of the hardware stack.
// If it is below the hardware stack base, assume that we have the wrong stack limits, and do nothing.
// We could have the wrong stack limits because of limited platform support, or user-space threads.
#if _Py_STACK_GROWS_DOWN
return here_addr < _tstate->c_stack_soft_limit;
return here_addr < _tstate->c_stack_soft_limit && here_addr >= _tstate->c_stack_soft_limit - 2 * _PyOS_STACK_MARGIN_BYTES;
#else
return here_addr > _tstate->c_stack_soft_limit;
return here_addr > _tstate->c_stack_soft_limit && here_addr <= _tstate->c_stack_soft_limit + 2 * _PyOS_STACK_MARGIN_BYTES;
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions Include/patchlevel.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#define PY_MINOR_VERSION 15
#define PY_MICRO_VERSION 0
#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
#define PY_RELEASE_SERIAL 1
#define PY_RELEASE_SERIAL 2

/* Version as a string */
#define PY_VERSION "3.15.0a1+"
#define PY_VERSION "3.15.0a2+"
/*--end constants--*/


Expand Down
9 changes: 8 additions & 1 deletion InternalDocs/stack_protection.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,19 @@ Recursion checks are performed by `_Py_EnterRecursiveCall()` or `_Py_EnterRecurs

```python
kb_used = (stack_top - stack_pointer)>>10
if stack_pointer < hard_limit:
if stack_pointer < bottom_of_machine_stack:
pass # Our stack limits could be wrong so it is safest to do nothing.
elif stack_pointer < hard_limit:
FatalError(f"Unrecoverable stack overflow (used {kb_used} kB)")
elif stack_pointer < soft_limit:
raise RecursionError(f"Stack overflow (used {kb_used} kB)")
```

### User space threads and other oddities

Some libraries provide user-space threads. These will change the C stack at runtime.
To guard against this we only raise if the stack pointer is in the window between the expected stack base and the soft limit.

### Diagnosing and fixing stack overflows

For stack protection to work correctly the amount of stack consumed between calls to `_Py_EnterRecursiveCall()` must be less than `_PyOS_STACK_MARGIN_BYTES`.
Expand Down
Loading
Loading