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
21 changes: 21 additions & 0 deletions Doc/c-api/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,27 @@ these are the C equivalent to :func:`reprlib.recursive_repr`.
Ends a :c:func:`Py_ReprEnter`. Must be called once for each
invocation of :c:func:`Py_ReprEnter` that returns zero.

.. c:function:: int Py_GetRecursionLimit(void)

Get the recursion limit for the current interpreter. It can be set with
:c:func:`Py_SetRecursionLimit`. The recursion limit prevents the
Python interpreter stack from growing infinitely.

This function cannot fail, and the caller must hold an
:term:`attached thread state`.

.. seealso::
:py:func:`sys.getrecursionlimit`

.. c:function:: void Py_SetRecursionLimit(int new_limit)

Set the recursion limit for the current interpreter.

This function cannot fail, and the caller must hold an
:term:`attached thread state`.

.. seealso::
:py:func:`sys.setrecursionlimit`

.. _standardexceptions:

Expand Down
6 changes: 3 additions & 3 deletions Doc/library/concurrent.interpreters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ Actual concurrency is available separately through
.. seealso::

:class:`~concurrent.futures.InterpreterPoolExecutor`
combines threads with interpreters in a familiar interface.
Combines threads with interpreters in a familiar interface.

.. XXX Add references to the upcoming HOWTO docs in the seealso block.
.. XXX Add references to the upcoming HOWTO docs in the seealso block.

:ref:`isolating-extensions-howto`
how to update an extension module to support multiple interpreters
How to update an extension module to support multiple interpreters.

:pep:`554`

Expand Down
10 changes: 5 additions & 5 deletions Doc/library/heapq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ functions, respectively.
The following functions are provided for min-heaps:


.. function:: heapify(x)

Transform list *x* into a min-heap, in-place, in linear time.


.. function:: heappush(heap, item)

Push the value *item* onto the *heap*, maintaining the min-heap invariant.
Expand All @@ -77,11 +82,6 @@ The following functions are provided for min-heaps:
followed by a separate call to :func:`heappop`.


.. function:: heapify(x)

Transform list *x* into a min-heap, in-place, in linear time.


.. function:: heapreplace(heap, item)

Pop and return the smallest item from the *heap*, and also push the new *item*.
Expand Down
4 changes: 0 additions & 4 deletions Lib/test/test_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,6 @@ def test_b32decode_casefold(self):
self.assertRaises(binascii.Error, base64.b32decode, b'me======')
self.assertRaises(binascii.Error, base64.b32decode, 'me======')

# Mapping zero and one
eq(base64.b32decode(b'MLO23456'), b'b\xdd\xad\xf3\xbe')
eq(base64.b32decode('MLO23456'), b'b\xdd\xad\xf3\xbe')

def test_b32decode_map01(self):
# Mapping zero and one
eq = self.assertEqual
Expand Down
37 changes: 20 additions & 17 deletions PCbuild/get_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import argparse
import os
import pathlib
import shutil
import sys
import tarfile
import time
import urllib.error
import urllib.request
Expand Down Expand Up @@ -56,7 +56,8 @@ def fetch_release(tag, tarball_dir, *, org='python', verbose=False):

def extract_tarball(externals_dir, tarball_path, tag):
output_path = externals_dir / tag
shutil.unpack_archive(os.fspath(tarball_path), os.fspath(output_path))
with tarfile.open(tarball_path) as tf:
tf.extractall(os.fspath(externals_dir))
return output_path


Expand Down Expand Up @@ -115,21 +116,23 @@ def main():
verbose=args.verbose,
)
extracted = extract_zip(args.externals_dir, zip_path)
for wait in [1, 2, 3, 5, 8, 0]:
try:
extracted.replace(final_name)
break
except PermissionError as ex:
retry = f" Retrying in {wait}s..." if wait else ""
print(f"Encountered permission error '{ex}'.{retry}", file=sys.stderr)
time.sleep(wait)
else:
print(
f"ERROR: Failed to extract {final_name}.",
"You may need to restart your build",
file=sys.stderr,
)
sys.exit(1)

if extracted != final_name:
for wait in [1, 2, 3, 5, 8, 0]:
try:
extracted.replace(final_name)
break
except PermissionError as ex:
retry = f" Retrying in {wait}s..." if wait else ""
print(f"Encountered permission error '{ex}'.{retry}", file=sys.stderr)
time.sleep(wait)
else:
print(
f"ERROR: Failed to rename {extracted} to {final_name}.",
"You may need to restart your build",
file=sys.stderr,
)
sys.exit(1)


if __name__ == '__main__':
Expand Down
5 changes: 5 additions & 0 deletions Tools/jit/_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ async def _find_tool(tool: str, llvm_version: str, *, echo: bool = False) -> str
# PCbuild externals:
externals = os.environ.get("EXTERNALS_DIR", _targets.EXTERNALS)
path = os.path.join(externals, _EXTERNALS_LLVM_TAG, "bin", tool)
# On Windows, executables need .exe extension
if os.name == "nt" and not path.endswith(".exe"):
path_with_exe = path + ".exe"
if os.path.exists(path_with_exe):
path = path_with_exe
if await _check_tool_version(path, llvm_version, echo=echo):
return path
# Homebrew-installed executables:
Expand Down
Loading