Skip to content

Commit 1f74471

Browse files
authored
Merge branch 'main' into optparse-positionals
2 parents 2798c79 + 11a14db commit 1f74471

646 files changed

Lines changed: 19748 additions & 7352 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/actions.lock‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ workflows:
1919
'.github/workflows/mypy.yml':
2020
- 'actions/checkout@v7.0.1'
2121
- 'astral-sh/setup-uv@v10.2.0'
22-
'.github/workflows/new-bugs-announce-notifier.yml':
23-
- 'actions/github-script@v9.0.0'
24-
- 'actions/setup-node@v7.0.0'
22+
'.github/workflows/new-bugs-announce-notifier.yml': []
2523
'.github/workflows/require-pr-label.yml':
2624
- 'mheap/github-action-required-labels@v5.6.0'
2725
'.github/workflows/reusable-check-c-api-docs.yml':
@@ -94,11 +92,6 @@ dependencies:
9492
commit: 'sha1-3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c'
9593
owner_id: 44036562
9694
repo_id: 192626254
97-
'actions/github-script@v9.0.0':
98-
ref: 'v9.0.0'
99-
commit: 'sha1-3a2844b7e9c422d3c10d287c895573f7108da1b3'
100-
owner_id: 44036562
101-
repo_id: 205262760
10295
'actions/setup-node@v7.0.0':
10396
ref: 'v7.0.0'
10497
commit: 'sha1-820762786026740c76f36085b0efc47a31fe5020'

‎.github/workflows/build.yml‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,12 @@ jobs:
167167
- true
168168
interpreter:
169169
- switch-case
170+
- tail-call
170171
exclude:
171172
# Skip Win32 on free-threaded builds
172173
- { arch: Win32, free-threading: true }
173-
include:
174-
# msvc::musttail is currently only supported on x64,
175-
# and only supported on 3.15+.
176-
- { arch: x64, free-threading: false, interpreter: tail-call }
177-
- { arch: x64, free-threading: true, interpreter: tail-call }
174+
# Skip Win32 on tail-call interpreter builds
175+
- { arch: Win32, interpreter: tail-call }
178176
uses: $/.github/workflows/reusable-windows.yml
179177
with:
180178
arch: ${{ matrix.arch }}
@@ -268,12 +266,10 @@ jobs:
268266
# unsupported as it most resembles other 1.1.1-work-a-like ssl APIs
269267
# supported by important vendors such as AWS-LC.
270268
- { name: openssl, version: 1.1.1w }
271-
- { name: openssl, version: 3.4.8 }
272-
- { name: openssl, version: 3.5.9 }
273-
- { name: openssl, version: 3.6.5 }
274-
- { name: openssl, version: 4.0.3 }
269+
- { name: openssl, version: 3.5.10 }
270+
- { name: openssl, version: 4.0.4 }
275271
## AWS-LC
276-
- { name: aws-lc, version: 5.10.0 }
272+
- { name: aws-lc, version: 5.15.0 }
277273
env:
278274
SSLLIB_VER: ${{ matrix.ssllib.version }}
279275
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -388,7 +384,7 @@ jobs:
388384
needs: build-context
389385
if: needs.build-context.outputs.run-ubuntu == 'true'
390386
env:
391-
OPENSSL_VER: 3.5.9
387+
OPENSSL_VER: 3.5.10
392388
PYTHONSTRICTEXTENSIONBUILD: 1
393389
steps:
394390
- uses: actions/checkout@v7.0.1
@@ -549,9 +545,17 @@ jobs:
549545
run: |
550546
"$BUILD_DIR/host-python/bin/python3" -m test test_sysconfig test_site test_embed
551547
- name: Configure cross build
552-
run: ./configure --prefix="$BUILD_DIR/cross-python" --with-build-python="$BUILD_DIR/host-python/bin/python3"
548+
run: |
549+
# Exercise a native build whose builtin modules differ from the build Python.
550+
echo '_bisect _bisectmodule.c' > Modules/Setup.local
551+
./configure --prefix="$BUILD_DIR/cross-python" --with-build-python="$BUILD_DIR/host-python/bin/python3"
553552
- name: Install cross Python
554553
run: make -j8 install
554+
- name: Check native extension modules with a build Python
555+
run: |
556+
"$BUILD_DIR/host-python/bin/python3" -c "import sys; assert '_bisect' not in sys.builtin_module_names"
557+
"$BUILD_DIR/cross-python/bin/python3" -c "import _bisect, sys; assert '_bisect' in sys.builtin_module_names"
558+
PYTHONSTRICTEXTENSIONBUILD=1 make checksharedmods
555559
- name: Display build info
556560
run: |
557561
"$BUILD_DIR/cross-python/bin/python3" -m test.pythoninfo

‎.github/workflows/new-bugs-announce-notifier.yml‎

Lines changed: 52 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,60 +5,64 @@ on:
55
types:
66
- opened
77

8-
permissions:
9-
contents: read
8+
permissions: {}
109

1110
jobs:
1211
notify-new-bugs-announce:
13-
runs-on: ubuntu-slim
14-
permissions:
15-
issues: read
12+
runs-on: ubuntu-latest
1613
timeout-minutes: 10
1714
steps:
18-
- uses: actions/setup-node@v7.0.0
19-
with:
20-
node-version: 20
21-
# TODO: Replace with a committed lockfile and `npm ci`, or drop npm
22-
# and call the Mailgun REST API from the standard library.
23-
- run: npm install mailgun.js form-data # zizmor: ignore[adhoc-packages]
2415
- name: Send notification
25-
uses: actions/github-script@v9.0.0
2616
env:
2717
MAILGUN_API_KEY: ${{ secrets.MAILGUN_PYTHON_ORG_MAILGUN_KEY }}
28-
with:
29-
script: |
30-
const Mailgun = require("mailgun.js");
31-
const formData = require('form-data');
32-
const mailgun = new Mailgun(formData);
33-
const DOMAIN = "mailgun.python.org";
34-
const mg = mailgun.client({username: 'api', key: process.env.MAILGUN_API_KEY});
35-
github.rest.issues.get({
36-
issue_number: context.issue.number,
37-
owner: context.repo.owner,
38-
repo: context.repo.repo,
39-
})
40-
.then(function(issue) {
41-
const payload = {
42-
author : issue.data.user.login,
43-
issue : issue.data.number,
44-
title : issue.data.title,
45-
url : issue.data.html_url,
46-
labels : issue.data.labels.map(label => { return label.name }).join(", "),
47-
assignee : issue.data.assignees.map(assignee => { return assignee.login }),
48-
// We need to truncate the body size, because the max size for
49-
// the whole payload is 16kb. We want to be safe and assume that
50-
// body can take up to ~8kb of space.
51-
body : (issue.data.body || "").substring(0, 8000)
52-
};
18+
shell: python
19+
run: |
20+
import base64
21+
import json
22+
import os
23+
import urllib.error
24+
import urllib.parse
25+
import urllib.request
5326
54-
const data = {
55-
from: "CPython Issues <github@mailgun.python.org>",
56-
to: "new-bugs-announce@python.org",
57-
subject: `[Issue ${issue.data.number}] ${issue.data.title}`,
58-
template: "new-github-issue",
59-
'o:tracking-clicks': 'no',
60-
'h:X-Mailgun-Variables': JSON.stringify(payload)
61-
};
62-
return mg.messages.create(DOMAIN, data)
63-
})
64-
.then(msg => console.log(msg));
27+
with open(os.environ["GITHUB_EVENT_PATH"], encoding="utf-8") as f:
28+
issue = json.load(f)["issue"]
29+
30+
payload = {
31+
"author": issue["user"]["login"],
32+
"issue": issue["number"],
33+
"title": issue["title"],
34+
"url": issue["html_url"],
35+
"labels": ", ".join(label["name"] for label in issue["labels"]),
36+
"assignee": [assignee["login"] for assignee in issue["assignees"]],
37+
# We need to truncate the body size, because the max size for
38+
# the whole payload is 16 kB. We want to be safe and assume that
39+
# body can take up to ~8 kB of space. Truncate by bytes, not
40+
# characters, so non-ASCII text can't exceed that.
41+
"body": (issue["body"] or "").encode()[:8000].decode(errors="ignore"),
42+
}
43+
44+
data = urllib.parse.urlencode(
45+
{
46+
"from": "CPython Issues <github@mailgun.python.org>",
47+
"to": "new-bugs-announce@python.org",
48+
"subject": f"[Issue {issue['number']}] {issue['title']}",
49+
"template": "new-github-issue",
50+
"o:tracking-clicks": "no",
51+
"h:X-Mailgun-Variables": json.dumps(payload, ensure_ascii=False),
52+
}
53+
).encode()
54+
55+
credentials = b"api:" + os.environ["MAILGUN_API_KEY"].encode()
56+
request = urllib.request.Request(
57+
"https://api.mailgun.net/v3/mailgun.python.org/messages",
58+
data=data,
59+
headers={
60+
"Authorization": "Basic " + base64.b64encode(credentials).decode(),
61+
},
62+
)
63+
try:
64+
with urllib.request.urlopen(request) as response:
65+
print(response.read().decode())
66+
except urllib.error.HTTPError as e:
67+
print(f"Mailgun returned HTTP {e.code}: {e.read().decode()}")
68+
raise SystemExit(1)

‎.github/workflows/reusable-san.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717

1818
env:
1919
FORCE_COLOR: 1
20-
OPENSSL_VER: 3.5.9
20+
OPENSSL_VER: 3.5.10
2121

2222
jobs:
2323
build-san-reusable:

‎.github/workflows/reusable-ubuntu.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ${{ inputs.os }}
3636
timeout-minutes: 60
3737
env:
38-
OPENSSL_VER: 3.5.9
38+
OPENSSL_VER: 3.5.10
3939
PYTHONSTRICTEXTENSIONBUILD: 1
4040
TERM: linux
4141
steps:

‎.github/zizmor.yml‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*.orig
1818
*.pyc
1919
*.pyd
20-
*.pyo
2120
*.rej
2221
*.swp
2322
*.pickle

‎Doc/builtins/functions.rst‎

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,11 @@ are always available. They are listed here in alphabetical order.
11811181
a :exc:`TypeError` exception is raised. :exc:`TypeError` may not be
11821182
raised for an invalid type if an earlier check succeeds.
11831183

1184+
If *object* has a ``__class__`` attribute that differs from
1185+
:func:`type(object) <type>` (for example a proxy, or a :mod:`unittest.mock`
1186+
object created with a *spec*), ``True`` is also returned when that class
1187+
is a subclass of *classinfo*.
1188+
11841189
.. versionchanged:: 3.10
11851190
*classinfo* can be a :ref:`types-union`.
11861191

@@ -2411,14 +2416,17 @@ are always available. They are listed here in alphabetical order.
24112416
This is an advanced function that is not needed in everyday Python
24122417
programming, unlike :func:`importlib.import_module`.
24132418

2414-
This function is invoked by the :keyword:`import` statement. It can be
2415-
replaced (by importing the :mod:`builtins` module and assigning to
2416-
``builtins.__import__``) in order to change semantics of the
2417-
:keyword:`!import` statement, but doing so is **strongly** discouraged as it
2418-
is usually simpler to use import hooks (see :pep:`302`) to attain the same
2419-
goals and does not cause issues with code which assumes the default import
2420-
implementation is in use. Direct use of :func:`__import__` is also
2421-
discouraged in favor of :func:`importlib.import_module`.
2419+
Eager :keyword:`import` statements call this function.
2420+
For :ref:`lazy imports <lazy-imports>`, Python calls this function at
2421+
resolution.
2422+
2423+
You can replace :func:`__import__` through an assignment to
2424+
``builtins.__import__``. :ref:`Import hooks <import-hooks>` usually provide a
2425+
simpler way to customize imports. A replacement can cause problems for code
2426+
that expects the default import implementation.
2427+
Do not replace :func:`__import__` unless import hooks cannot supply the
2428+
required behavior.
2429+
To import a module by name, use :func:`importlib.import_module`.
24222430

24232431
The function imports the module *name*, potentially using the given *globals*
24242432
and *locals* to determine how to interpret the name in a package context.

‎Doc/builtins/stdtypes.rst‎

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,23 @@ expression support in the :mod:`re` module).
25082508
Return ``True`` if all cased characters [4]_ in the string are lowercase and
25092509
there is at least one cased character, ``False`` otherwise.
25102510

2511+
For example:
2512+
2513+
.. doctest::
2514+
2515+
>>> 'banana'.islower()
2516+
True
2517+
>>> 'BANANA'.islower()
2518+
False
2519+
>>> 'baNana'.islower()
2520+
False
2521+
>>> ' '.islower()
2522+
False
2523+
>>> ''.islower()
2524+
False
2525+
2526+
See also :meth:`isupper` and :meth:`lower`.
2527+
25112528

25122529
.. method:: str.isnumeric()
25132530

@@ -2612,6 +2629,10 @@ expression support in the :mod:`re` module).
26122629
Return ``True`` if all cased characters [4]_ in the string are uppercase and
26132630
there is at least one cased character, ``False`` otherwise.
26142631

2632+
For example:
2633+
2634+
.. doctest::
2635+
26152636
>>> 'BANANA'.isupper()
26162637
True
26172638
>>> 'banana'.isupper()
@@ -2620,7 +2641,10 @@ expression support in the :mod:`re` module).
26202641
False
26212642
>>> ' '.isupper()
26222643
False
2644+
>>> ''.isupper()
2645+
False
26232646

2647+
See also :meth:`islower` and :meth:`upper`.
26242648

26252649

26262650
.. _meth-str-join:
@@ -2672,10 +2696,25 @@ expression support in the :mod:`re` module).
26722696
>>> 'Lower Method Example'.lower()
26732697
'lower method example'
26742698

2699+
Note that ``s.lower().islower()`` might be ``False`` if ``s``
2700+
contains uncased characters or if the Unicode category of the resulting
2701+
character(s) is not "Lu" (Letter, uppercase), but for instance "Lt" (Letter,
2702+
titlecase).
2703+
2704+
For example, see the word "Python" written in Punjabi:
2705+
2706+
.. doctest::
2707+
2708+
>>> 'ازگر'.lower().islower()
2709+
False
2710+
2711+
26752712
The lowercasing algorithm used is `described in section 3.13.2 'Default Case
26762713
Conversion' of the Unicode Standard
26772714
<https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-3/#G34078>`__.
26782715

2716+
See also :meth:`islower` and :meth:`upper`.
2717+
26792718

26802719
.. method:: str.lstrip(chars=None, /)
26812720

@@ -3179,15 +3218,33 @@ expression support in the :mod:`re` module).
31793218
.. method:: str.upper()
31803219

31813220
Return a copy of the string with all the cased characters [4]_ converted to
3182-
uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s``
3221+
uppercase.
3222+
3223+
For example:
3224+
3225+
.. doctest::
3226+
3227+
>>> 'Upper Method Example'.upper()
3228+
'UPPER METHOD EXAMPLE'
3229+
3230+
Note that ``s.upper().isupper()`` might be ``False`` if ``s``
31833231
contains no cased characters or if the Unicode category of the resulting
3184-
character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter,
3232+
character(s) is not "Lu" (Letter, uppercase), but for instance "Lt" (Letter,
31853233
titlecase).
31863234

3235+
For example, see the word "Python" written in Punjabi:
3236+
3237+
.. doctest::
3238+
3239+
>>> 'ازگر'.upper().isupper()
3240+
False
3241+
31873242
The uppercasing algorithm used is `described in section 3.13.2 'Default Case
31883243
Conversion' of the Unicode Standard
31893244
<https://www.unicode.org/versions/Unicode18.0.0/core-spec/chapter-3/#G34078>`__.
31903245

3246+
See also :meth:`isupper` and :meth:`lower`.
3247+
31913248

31923249
.. method:: str.zfill(width, /)
31933250

0 commit comments

Comments
 (0)