Skip to content

Commit 64da49f

Browse files
committed
Merge branch 'main' into superopt
* main: pythongh-103532: Remove TKINTER_PROTECT_LOADTK code (pythonGH-103535) pythongh-103180: Add CI timeouts to all GitHub Actions jobs (python#103437) Remove double space in import error message (python#103458) ipaddress: Remove non-existent ip_str param from docstring (python#103461) Fix syntax typo in isolating extensions doc (python#103516) pythongh-103406: Modernize pos-only arguments usage in `test_signature` (python#103407) Proofread howto/perf_profiling.rst (python#103530) Fix unused functions warnings in instrumentation.c (pythonGH-103515)
2 parents 2077f1a + 69e2c42 commit 64da49f

17 files changed

+46
-119
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
check_source:
3434
name: 'Check for source changes'
3535
runs-on: ubuntu-latest
36+
timeout-minutes: 10
3637
outputs:
3738
run_tests: ${{ steps.check.outputs.run_tests }}
3839
steps:
@@ -63,6 +64,7 @@ jobs:
6364
check_generated_files:
6465
name: 'Check if generated files are up to date'
6566
runs-on: ubuntu-latest
67+
timeout-minutes: 60
6668
needs: check_source
6769
if: needs.check_source.outputs.run_tests == 'true'
6870
steps:
@@ -118,6 +120,7 @@ jobs:
118120
build_win32:
119121
name: 'Windows (x86)'
120122
runs-on: windows-latest
123+
timeout-minutes: 60
121124
needs: check_source
122125
if: needs.check_source.outputs.run_tests == 'true'
123126
env:
@@ -126,7 +129,6 @@ jobs:
126129
- uses: actions/checkout@v3
127130
- name: Build CPython
128131
run: .\PCbuild\build.bat -e -d -p Win32
129-
timeout-minutes: 30
130132
- name: Display build info
131133
run: .\python.bat -m test.pythoninfo
132134
- name: Tests
@@ -135,6 +137,7 @@ jobs:
135137
build_win_amd64:
136138
name: 'Windows (x64)'
137139
runs-on: windows-latest
140+
timeout-minutes: 60
138141
needs: check_source
139142
if: needs.check_source.outputs.run_tests == 'true'
140143
env:
@@ -145,7 +148,6 @@ jobs:
145148
run: echo "::add-matcher::.github/problem-matchers/msvc.json"
146149
- name: Build CPython
147150
run: .\PCbuild\build.bat -e -d -p x64
148-
timeout-minutes: 30
149151
- name: Display build info
150152
run: .\python.bat -m test.pythoninfo
151153
- name: Tests
@@ -154,6 +156,7 @@ jobs:
154156
build_macos:
155157
name: 'macOS'
156158
runs-on: macos-latest
159+
timeout-minutes: 60
157160
needs: check_source
158161
if: needs.check_source.outputs.run_tests == 'true'
159162
env:
@@ -184,6 +187,7 @@ jobs:
184187
build_ubuntu:
185188
name: 'Ubuntu'
186189
runs-on: ubuntu-20.04
190+
timeout-minutes: 60
187191
needs: check_source
188192
if: needs.check_source.outputs.run_tests == 'true'
189193
env:
@@ -241,6 +245,7 @@ jobs:
241245
build_ubuntu_ssltests:
242246
name: 'Ubuntu SSL tests with OpenSSL'
243247
runs-on: ubuntu-20.04
248+
timeout-minutes: 60
244249
needs: check_source
245250
if: needs.check_source.outputs.run_tests == 'true'
246251
strategy:
@@ -290,6 +295,7 @@ jobs:
290295
build_asan:
291296
name: 'Address sanitizer'
292297
runs-on: ubuntu-20.04
298+
timeout-minutes: 60
293299
needs: check_source
294300
if: needs.check_source.outputs.run_tests == 'true'
295301
env:

.github/workflows/build_msi.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
build:
2727
name: Windows Installer
2828
runs-on: windows-latest
29+
timeout-minutes: 60
2930
strategy:
3031
matrix:
3132
type: [x86, x64, arm64]

.github/workflows/doc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
build_doc:
3737
name: 'Docs'
3838
runs-on: ubuntu-latest
39+
timeout-minutes: 60
3940
steps:
4041
- uses: actions/checkout@v3
4142
- name: Register Sphinx problem matcher
@@ -80,6 +81,7 @@ jobs:
8081
doctest:
8182
name: 'Doctest'
8283
runs-on: ubuntu-latest
84+
timeout-minutes: 60
8385
steps:
8486
- uses: actions/checkout@v3
8587
- name: Register Sphinx problem matcher

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ permissions:
1111
jobs:
1212
notify-new-bugs-announce:
1313
runs-on: ubuntu-latest
14+
timeout-minutes: 10
1415
steps:
1516
- uses: actions/setup-node@v3
1617
with:

.github/workflows/project-updater.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
add-to-project:
1414
name: Add issues to projects
1515
runs-on: ubuntu-latest
16+
timeout-minutes: 10
1617
strategy:
1718
matrix:
1819
include:
@@ -22,7 +23,7 @@ jobs:
2223
- { project: 3, label: expert-subinterpreters }
2324
- { project: 29, label: expert-asyncio }
2425
- { project: 32, label: sprint }
25-
26+
2627
steps:
2728
- uses: actions/[email protected]
2829
with:

.github/workflows/require-pr-label.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
label:
99
name: DO-NOT-MERGE
1010
runs-on: ubuntu-latest
11+
timeout-minutes: 10
1112

1213
steps:
1314
- uses: mheap/github-action-required-labels@v4

.github/workflows/stale.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
if: github.repository_owner == 'python'
1313

1414
runs-on: ubuntu-latest
15+
timeout-minutes: 10
1516

1617
steps:
1718
- name: "Check PRs"

.github/workflows/verify-ensurepip-wheels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ concurrency:
2323
jobs:
2424
verify:
2525
runs-on: ubuntu-latest
26+
timeout-minutes: 10
2627
steps:
2728
- uses: actions/checkout@v3
2829
- uses: actions/setup-python@v4

Doc/howto/isolating-extensions.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ To save a some tedious error-handling boilerplate code, you can combine
372372
these two steps with :c:func:`PyType_GetModuleState`, resulting in::
373373

374374
my_struct *state = (my_struct*)PyType_GetModuleState(type);
375-
if (state === NULL) {
375+
if (state == NULL) {
376376
return NULL;
377377
}
378378

@@ -435,7 +435,7 @@ For example::
435435
PyObject *kwnames)
436436
{
437437
my_struct *state = (my_struct*)PyType_GetModuleState(defining_class);
438-
if (state === NULL) {
438+
if (state == NULL) {
439439
return NULL;
440440
}
441441
... // rest of logic
@@ -479,7 +479,7 @@ to get the state::
479479

480480
PyObject *module = PyType_GetModuleByDef(Py_TYPE(self), &module_def);
481481
my_struct *state = (my_struct*)PyModule_GetState(module);
482-
if (state === NULL) {
482+
if (state == NULL) {
483483
return NULL;
484484
}
485485

Doc/howto/perf_profiling.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ information about the performance of your application.
1515
that aid with the analysis of the data that it produces.
1616

1717
The main problem with using the ``perf`` profiler with Python applications is that
18-
``perf`` only allows to get information about native symbols, this is, the names of
19-
the functions and procedures written in C. This means that the names and file names
20-
of the Python functions in your code will not appear in the output of the ``perf``.
18+
``perf`` only gets information about native symbols, that is, the names of
19+
functions and procedures written in C. This means that the names and file names
20+
of Python functions in your code will not appear in the output of ``perf``.
2121

2222
Since Python 3.12, the interpreter can run in a special mode that allows Python
2323
functions to appear in the output of the ``perf`` profiler. When this mode is
@@ -28,8 +28,8 @@ relationship between this piece of code and the associated Python function using
2828

2929
.. note::
3030

31-
Support for the ``perf`` profiler is only currently available for Linux on
32-
selected architectures. Check the output of the configure build step or
31+
Support for the ``perf`` profiler is currently only available for Linux on
32+
select architectures. Check the output of the ``configure`` build step or
3333
check the output of ``python -m sysconfig | grep HAVE_PERF_TRAMPOLINE``
3434
to see if your system is supported.
3535

@@ -52,11 +52,11 @@ For example, consider the following script:
5252
if __name__ == "__main__":
5353
baz(1000000)
5454
55-
We can run ``perf`` to sample CPU stack traces at 9999 Hertz::
55+
We can run ``perf`` to sample CPU stack traces at 9999 hertz::
5656

5757
$ perf record -F 9999 -g -o perf.data python my_script.py
5858

59-
Then we can use ``perf`` report to analyze the data:
59+
Then we can use ``perf report`` to analyze the data:
6060

6161
.. code-block:: shell-session
6262
@@ -97,7 +97,7 @@ Then we can use ``perf`` report to analyze the data:
9797
| | | | | |--2.97%--_PyObject_Malloc
9898
...
9999
100-
As you can see here, the Python functions are not shown in the output, only ``_Py_Eval_EvalFrameDefault`` appears
100+
As you can see, the Python functions are not shown in the output, only ``_Py_Eval_EvalFrameDefault``
101101
(the function that evaluates the Python bytecode) shows up. Unfortunately that's not very useful because all Python
102102
functions use the same C function to evaluate bytecode so we cannot know which Python function corresponds to which
103103
bytecode-evaluating function.
@@ -151,7 +151,7 @@ Instead, if we run the same experiment with ``perf`` support enabled we get:
151151
How to enable ``perf`` profiling support
152152
----------------------------------------
153153

154-
``perf`` profiling support can either be enabled from the start using
154+
``perf`` profiling support can be enabled either from the start using
155155
the environment variable :envvar:`PYTHONPERFSUPPORT` or the
156156
:option:`-X perf <-X>` option,
157157
or dynamically using :func:`sys.activate_stack_trampoline` and
@@ -192,7 +192,7 @@ Example, using the :mod:`sys` APIs in file :file:`example.py`:
192192
How to obtain the best results
193193
------------------------------
194194

195-
For the best results, Python should be compiled with
195+
For best results, Python should be compiled with
196196
``CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"`` as this allows
197197
profilers to unwind using only the frame pointer and not on DWARF debug
198198
information. This is because as the code that is interposed to allow ``perf``

Lib/importlib/_bootstrap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ def _find_and_load_unlocked(name, import_):
12601260
try:
12611261
path = parent_module.__path__
12621262
except AttributeError:
1263-
msg = f'{_ERR_MSG_PREFIX} {name!r}; {parent!r} is not a package'
1263+
msg = f'{_ERR_MSG_PREFIX}{name!r}; {parent!r} is not a package'
12641264
raise ModuleNotFoundError(msg, name=name) from None
12651265
parent_spec = parent_module.__spec__
12661266
child = name.rpartition('.')[2]

Lib/ipaddress.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,9 +1821,6 @@ def _string_from_ip_int(cls, ip_int=None):
18211821
def _explode_shorthand_ip_string(self):
18221822
"""Expand a shortened IPv6 address.
18231823
1824-
Args:
1825-
ip_str: A string, the IPv6 address.
1826-
18271824
Returns:
18281825
A string, the expanded IPv6 address.
18291826

Lib/test/test_inspect.py

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,14 +3044,9 @@ def foo(a=1, b=2, c=3):
30443044
self.assertEqual(_foo(*ba.args, **ba.kwargs), (12, 10, 20))
30453045

30463046

3047-
def foo(a, b, c, d, **kwargs):
3047+
def foo(a, b, /, c, d, **kwargs):
30483048
pass
30493049
sig = inspect.signature(foo)
3050-
params = sig.parameters.copy()
3051-
params['a'] = params['a'].replace(kind=Parameter.POSITIONAL_ONLY)
3052-
params['b'] = params['b'].replace(kind=Parameter.POSITIONAL_ONLY)
3053-
foo.__signature__ = inspect.Signature(params.values())
3054-
sig = inspect.signature(foo)
30553050
self.assertEqual(str(sig), '(a, b, /, c, d, **kwargs)')
30563051

30573052
self.assertEqual(self.signature(partial(foo, 1)),
@@ -3556,14 +3551,9 @@ def test_signature_str_positional_only(self):
35563551
P = inspect.Parameter
35573552
S = inspect.Signature
35583553

3559-
def test(a_po, *, b, **kwargs):
3554+
def test(a_po, /, *, b, **kwargs):
35603555
return a_po, kwargs
35613556

3562-
sig = inspect.signature(test)
3563-
new_params = list(sig.parameters.values())
3564-
new_params[0] = new_params[0].replace(kind=P.POSITIONAL_ONLY)
3565-
test.__signature__ = sig.replace(parameters=new_params)
3566-
35673557
self.assertEqual(str(inspect.signature(test)),
35683558
'(a_po, /, *, b, **kwargs)')
35693559

@@ -3593,6 +3583,14 @@ def test() -> 42:
35933583
self.assertEqual(sig.return_annotation, 42)
35943584
self.assertEqual(sig, inspect.signature(test))
35953585

3586+
def test_signature_replaced(self):
3587+
def test():
3588+
pass
3589+
3590+
spam_param = inspect.Parameter('spam', inspect.Parameter.POSITIONAL_ONLY)
3591+
sig = test.__signature__ = inspect.Signature(parameters=(spam_param,))
3592+
self.assertEqual(sig, inspect.signature(test))
3593+
35963594
def test_signature_on_mangled_parameters(self):
35973595
class Spam:
35983596
def foo(self, __p1:1=2, *, __p2:2=3):
@@ -4157,16 +4155,9 @@ def test(a, *args, b, z=100, **kwargs):
41574155
def test_signature_bind_positional_only(self):
41584156
P = inspect.Parameter
41594157

4160-
def test(a_po, b_po, c_po=3, foo=42, *, bar=50, **kwargs):
4158+
def test(a_po, b_po, c_po=3, /, foo=42, *, bar=50, **kwargs):
41614159
return a_po, b_po, c_po, foo, bar, kwargs
41624160

4163-
sig = inspect.signature(test)
4164-
new_params = collections.OrderedDict(tuple(sig.parameters.items()))
4165-
for name in ('a_po', 'b_po', 'c_po'):
4166-
new_params[name] = new_params[name].replace(kind=P.POSITIONAL_ONLY)
4167-
new_sig = sig.replace(parameters=new_params.values())
4168-
test.__signature__ = new_sig
4169-
41704161
self.assertEqual(self.call(test, 1, 2, 4, 5, bar=6),
41714162
(1, 2, 4, 5, 6, {}))
41724163

0 commit comments

Comments
 (0)