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
15 changes: 3 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,15 @@ jobs:
strategy:
fail-fast: false
matrix:
# Cirrus and macos-14 are M1, macos-15-intel is default GHA Intel.
# macOS 13 only runs tests against the GIL-enabled CPython.
# Cirrus used for upstream, macos-14 for forks.
# macos-14 is M1, macos-15-intel is Intel.
# macos-15-intel only runs tests against the GIL-enabled CPython.
os:
- ghcr.io/cirruslabs/macos-runner:sonoma
- macos-14
- macos-15-intel
is-fork: # only used for the exclusion trick
- ${{ github.repository_owner != 'python' }}
free-threading:
- false
- true
exclude:
- os: ghcr.io/cirruslabs/macos-runner:sonoma
is-fork: true
- os: macos-14
is-fork: false
- os: macos-15-intel
free-threading: true
uses: ./.github/workflows/reusable-macos.yml
Expand Down Expand Up @@ -409,9 +401,8 @@ jobs:
fail-fast: false
matrix:
include:
# Use the same runs-on configuration as build-macos and build-ubuntu.
- arch: aarch64
runs-on: ${{ github.repository_owner == 'python' && 'ghcr.io/cirruslabs/macos-runner:sonoma' || 'macos-14' }}
runs-on: macos-14
- arch: x86_64
runs-on: ubuntu-24.04

Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ repos:
name: Run Ruff (lint) on Tools/peg_generator/
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
files: ^Tools/peg_generator/
- id: ruff-check
name: Run Ruff (lint) on Tools/wasm/
args: [--exit-non-zero-on-fix, --config=Tools/wasm/.ruff.toml]
files: ^Tools/wasm/
- id: ruff-format
name: Run Ruff (format) on Doc/
args: [--check]
Expand Down
28 changes: 14 additions & 14 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ process and user.

You can delete items in this mapping to unset environment variables.
:func:`unsetenv` will be called automatically when an item is deleted from
:data:`os.environ`, and when one of the :meth:`pop` or :meth:`clear` methods is
called.
:data:`os.environ`, and when one of the :meth:`~dict.pop` or
:meth:`~dict.clear` methods is called.

.. seealso::

Expand Down Expand Up @@ -430,8 +430,8 @@ process and user.
associated with the effective user id of the process; the group access
list may change over the lifetime of the process, it is not affected by
calls to :func:`setgroups`, and its length is not limited to 16. The
deployment target value, :const:`MACOSX_DEPLOYMENT_TARGET`, can be
obtained with :func:`sysconfig.get_config_var`.
deployment target value can be obtained with
:func:`sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') <sysconfig.get_config_var>`.


.. function:: getlogin()
Expand Down Expand Up @@ -2606,10 +2606,10 @@ features:

Create a filesystem node (file, device special file or named pipe) named
*path*. *mode* specifies both the permissions to use and the type of node
to be created, being combined (bitwise OR) with one of ``stat.S_IFREG``,
``stat.S_IFCHR``, ``stat.S_IFBLK``, and ``stat.S_IFIFO`` (those constants are
available in :mod:`stat`). For ``stat.S_IFCHR`` and ``stat.S_IFBLK``,
*device* defines the newly created device special file (probably using
to be created, being combined (bitwise OR) with one of :const:`stat.S_IFREG`,
:const:`stat.S_IFCHR`, :const:`stat.S_IFBLK`, and :const:`stat.S_IFIFO`.
For :const:`stat.S_IFCHR` and :const:`stat.S_IFBLK`, *device* defines the
newly created device special file (probably using
:func:`os.makedev`), otherwise it is ignored.

This function can also support :ref:`paths relative to directory descriptors
Expand All @@ -2627,13 +2627,13 @@ features:
.. function:: major(device, /)

Extract the device major number from a raw device number (usually the
:attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`).
:attr:`~stat_result.st_dev` or :attr:`~stat_result.st_rdev` field from :c:struct:`stat`).


.. function:: minor(device, /)

Extract the device minor number from a raw device number (usually the
:attr:`st_dev` or :attr:`st_rdev` field from :c:struct:`stat`).
:attr:`~stat_result.st_dev` or :attr:`~stat_result.st_rdev` field from :c:struct:`stat`).


.. function:: makedev(major, minor, /)
Expand Down Expand Up @@ -3364,8 +3364,8 @@ features:

.. versionchanged:: 3.8
On Windows, the :attr:`st_mode` member now identifies special
files as :const:`S_IFCHR`, :const:`S_IFIFO` or :const:`S_IFBLK`
as appropriate.
files as :const:`~stat.S_IFCHR`, :const:`~stat.S_IFIFO` or
:const:`~stat.S_IFBLK` as appropriate.

.. versionchanged:: 3.12
On Windows, :attr:`st_ctime` is deprecated. Eventually, it will
Expand Down Expand Up @@ -4285,10 +4285,10 @@ to be ignored.

.. function:: abort()

Generate a :const:`SIGABRT` signal to the current process. On Unix, the default
Generate a :const:`~signal.SIGABRT` signal to the current process. On Unix, the default
behavior is to produce a core dump; on Windows, the process immediately returns
an exit code of ``3``. Be aware that calling this function will not call the
Python signal handler registered for :const:`SIGABRT` with
Python signal handler registered for :const:`~signal.SIGABRT` with
:func:`signal.signal`.


Expand Down
9 changes: 0 additions & 9 deletions Include/cpython/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,6 @@ typedef struct _line_offsets {
*/
PyAPI_FUNC(int) _PyCode_CheckLineNumber(int lasti, PyCodeAddressRange *bounds);

/* Create a comparable key used to compare constants taking in account the
* object type. It is used to make sure types are not coerced (e.g., float and
* complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms
*
* Return (type(obj), obj, ...): a tuple with variable size (at least 2 items)
* depending on the type and the value. The type is the first item to not
* compare bytes and str which can raise a BytesWarning exception. */
PyAPI_FUNC(PyObject*) _PyCode_ConstantKey(PyObject *obj);

PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts,
PyObject *names, PyObject *lnotab);

Expand Down
9 changes: 9 additions & 0 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,15 @@ PyAPI_FUNC(int) _PyCode_VerifyStateless(
PyAPI_FUNC(int) _PyCode_CheckPureFunction(PyCodeObject *, const char **);
PyAPI_FUNC(int) _PyCode_ReturnsOnlyNone(PyCodeObject *);

/* Create a comparable key used to compare constants taking in account the
* object type. It is used to make sure types are not coerced (e.g., float and
* complex) _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms
*
* Return (type(obj), obj, ...): a tuple with variable size (at least 2 items)
* depending on the type and the value. The type is the first item to not
* compare bytes and str which can raise a BytesWarning exception. */
extern PyObject* _PyCode_ConstantKey(PyObject *obj);


#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_pyrepl/test_unix_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def test_repl_eio(self):

os.kill(proc.pid, signal.SIGUSR1)
# sleep for pty to settle
_, err = proc.communicate(timeout=support.SHORT_TIMEOUT)
_, err = proc.communicate(timeout=support.LONG_TIMEOUT)
self.assertEqual(
proc.returncode,
1,
Expand Down
3 changes: 0 additions & 3 deletions Tools/wasm/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,4 @@ select = [
]
ignore = [
"E501", # Line too long
"F541", # f-string without any placeholders
"PYI024", # Use `typing.NamedTuple` instead of `collections.namedtuple`
"PYI025", # Use `from collections.abc import Set as AbstractSet`
]
9 changes: 4 additions & 5 deletions Tools/wasm/emscripten/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
import argparse
import contextlib
import functools
import hashlib
import os
import shutil
import subprocess
import sys
import sysconfig
import hashlib
import tempfile
from urllib.request import urlopen
from pathlib import Path
from textwrap import dedent
from urllib.request import urlopen

try:
from os import process_cpu_count as cpu_count
Expand All @@ -33,9 +33,7 @@
PREFIX_DIR = CROSS_BUILD_DIR / HOST_TRIPLE / "prefix"

LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local"
LOCAL_SETUP_MARKER = "# Generated by Tools/wasm/emscripten.py\n".encode(
"utf-8"
)
LOCAL_SETUP_MARKER = b"# Generated by Tools/wasm/emscripten.py\n"


def updated_env(updates={}):
Expand Down Expand Up @@ -432,6 +430,7 @@ def main():
make_build,
configure_host,
make_host,
clean,
):
subcommand.add_argument(
"--quiet",
Expand Down
5 changes: 2 additions & 3 deletions Tools/wasm/emscripten/wasm_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import sys
import sysconfig
import zipfile
from typing import Dict

# source directory
SRCDIR = pathlib.Path(__file__).parents[3].absolute()
Expand Down Expand Up @@ -134,7 +133,7 @@ def filterfunc(filename: str) -> bool:
pzf.writepy(entry, filterfunc=filterfunc)


def detect_extension_modules(args: argparse.Namespace) -> Dict[str, bool]:
def detect_extension_modules(args: argparse.Namespace) -> dict[str, bool]:
modules = {}

# disabled by Modules/Setup.local ?
Expand All @@ -149,7 +148,7 @@ def detect_extension_modules(args: argparse.Namespace) -> Dict[str, bool]:
# disabled by configure?
with open(args.sysconfig_data) as f:
data = f.read()
loc: Dict[str, Dict[str, str]] = {}
loc: dict[str, dict[str, str]] = {}
exec(data, globals(), loc)

for key, value in loc["build_time_vars"].items():
Expand Down
10 changes: 4 additions & 6 deletions Tools/wasm/wasi/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import sysconfig
import tempfile


CHECKOUT = pathlib.Path(__file__).parent.parent.parent.parent
assert (CHECKOUT / "configure").is_file(), (
"Please update the location of the file"
Expand All @@ -28,9 +27,9 @@

LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local"
LOCAL_SETUP_MARKER = (
"# Generated by Tools/wasm/wasi .\n"
"# Required to statically build extension modules."
).encode("utf-8")
b"# Generated by Tools/wasm/wasi .\n"
b"# Required to statically build extension modules."
)

WASI_SDK_VERSION = 24

Expand Down Expand Up @@ -154,8 +153,7 @@ def build_python_is_pydebug():
test = "import sys, test.support; sys.exit(test.support.Py_DEBUG)"
result = subprocess.run(
[build_python_path(), "-c", test],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
capture_output=True,
)
return bool(result.returncode)

Expand Down
Loading