Skip to content

Commit acc74ae

Browse files
authored
Merge branch 'main' into lint-github-actions
2 parents d755170 + ced2691 commit acc74ae

Some content is hidden

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

48 files changed

+704
-92
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Makefile.pre.in @erlend-aasland
1717
Modules/Setup* @erlend-aasland
1818

1919
# asyncio
20-
**/*asyncio* @1st1 @asvetlov @gvanrossum @kumaraditya303 @willingc
20+
**/*asyncio* @1st1 @asvetlov @kumaraditya303 @willingc
2121

2222
# Core
2323
**/*context* @1st1
@@ -281,4 +281,4 @@ Lib/test/test_configparser.py @jaraco
281281
# Doc sections
282282
Doc/reference/ @willingc
283283

284-
**/*weakref* @kumaraditya303
284+
**/*weakref* @kumaraditya303

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
4747
runs-on: ubuntu-24.04
4848
container:
49-
image: ghcr.io/python/autoconf:2024.10.11.11293396815
49+
image: ghcr.io/python/autoconf:2024.10.16.11360930377
5050
timeout-minutes: 60
5151
needs: check_source
5252
if: needs.check_source.outputs.run_tests == 'true'

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

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,53 @@ permissions:
99
pull-requests: write
1010

1111
jobs:
12-
label:
13-
name: DO-NOT-MERGE / unresolved review
12+
label-dnm:
13+
name: DO-NOT-MERGE
1414
if: github.repository_owner == 'python'
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 10
1717

1818
steps:
19-
- uses: mheap/github-action-required-labels@v5
19+
- name: Check there's no DO-NOT-MERGE
20+
uses: mheap/github-action-required-labels@v5
2021
with:
2122
mode: exactly
2223
count: 0
23-
labels: "DO-NOT-MERGE, awaiting changes, awaiting change review"
24+
labels: |
25+
DO-NOT-MERGE
26+
27+
label-reviews:
28+
name: Unresolved review
29+
if: github.repository_owner == 'python'
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 10
32+
33+
steps:
34+
# Check that the PR is not awaiting changes from the author due to previous review.
35+
- name: Check there's no required changes
36+
uses: mheap/github-action-required-labels@v5
37+
with:
38+
mode: exactly
39+
count: 0
40+
labels: |
41+
awaiting changes
42+
awaiting change review
43+
- id: is-feature
44+
name: Check whether this PR is a feature (contains a "type-feature" label)
45+
uses: mheap/github-action-required-labels@v5
46+
with:
47+
mode: exactly
48+
count: 1
49+
labels: |
50+
type-feature
51+
exit_type: success # don't fail the check if the PR is not a feature, just record the result
52+
# In case of a feature PR, check for a complete review (contains an "awaiting merge" label).
53+
- id: awaiting-merge
54+
if: steps.is-feature.outputs.status == 'success'
55+
name: Check for complete review
56+
uses: mheap/github-action-required-labels@v5
57+
with:
58+
mode: exactly
59+
count: 1
60+
labels: |
61+
awaiting merge

Doc/library/inspect.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,13 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
374374
Return ``True`` if the object is a bound method written in Python.
375375

376376

377+
.. function:: ispackage(object)
378+
379+
Return ``True`` if the object is a :term:`package`.
380+
381+
.. versionadded:: 3.14
382+
383+
377384
.. function:: isfunction(object)
378385

379386
Return ``True`` if the object is a Python function, which includes functions

Doc/library/stdtypes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3889,6 +3889,9 @@ copying.
38893889
.. versionchanged:: 3.5
38903890
memoryviews can now be indexed with tuple of integers.
38913891

3892+
.. versionchanged:: next
3893+
memoryview is now a :term:`generic type`.
3894+
38923895
:class:`memoryview` has several methods:
38933896

38943897
.. method:: __eq__(exporter)

Doc/tutorial/errors.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ A more complicated example::
464464
executing finally clause
465465
Traceback (most recent call last):
466466
File "<stdin>", line 1, in <module>
467-
divide("2", "0")
467+
divide("2", "1")
468468
~~~~~~^^^^^^^^^^
469469
File "<stdin>", line 3, in divide
470470
result = x / y

Doc/whatsnew/3.14.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ Other language changes
194194
:mod:`copyable <copy>`.
195195
(Contributed by Serhiy Storchaka in :gh:`125767`.)
196196

197+
* The :class:`memoryview` type now supports subscription,
198+
making it a :term:`generic type`.
199+
(Contributed by Brian Schubert in :gh:`126012`.)
200+
197201

198202
New modules
199203
===========
@@ -326,6 +330,10 @@ inspect
326330
If true, string :term:`annotations <annotation>` are displayed without surrounding quotes.
327331
(Contributed by Jelle Zijlstra in :gh:`101552`.)
328332

333+
* Add function :func:`inspect.ispackage` to determine whether an object is a
334+
:term:`package` or not.
335+
(Contributed by Zhikang Yan in :gh:`125634`.)
336+
329337

330338
json
331339
----

Include/internal/pycore_opcode_metadata.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/code.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ def _showtraceback(self, typ, value, tb, source):
136136
# Set the line of text that the exception refers to
137137
lines = source.splitlines()
138138
if (source and typ is SyntaxError
139-
and not value.text and len(lines) >= value.lineno):
139+
and not value.text and value.lineno is not None
140+
and len(lines) >= value.lineno):
140141
value.text = lines[value.lineno - 1]
141142
sys.last_exc = sys.last_value = value
142143
if sys.excepthook is sys.__excepthook__:

Lib/inspect.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
77
Here are some of the useful functions provided by this module:
88
9-
ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(),
10-
isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(),
11-
isroutine() - check object types
9+
ismodule(), isclass(), ismethod(), ispackage(), isfunction(),
10+
isgeneratorfunction(), isgenerator(), istraceback(), isframe(),
11+
iscode(), isbuiltin(), isroutine() - check object types
1212
getmembers() - get members of an object that satisfy a given condition
1313
1414
getfile(), getsourcefile(), getsource() - find an object's source code
@@ -128,6 +128,7 @@
128128
"ismethoddescriptor",
129129
"ismethodwrapper",
130130
"ismodule",
131+
"ispackage",
131132
"isroutine",
132133
"istraceback",
133134
"markcoroutinefunction",
@@ -186,6 +187,10 @@ def ismethod(object):
186187
"""Return true if the object is an instance method."""
187188
return isinstance(object, types.MethodType)
188189

190+
def ispackage(object):
191+
"""Return true if the object is a package."""
192+
return ismodule(object) and hasattr(object, "__path__")
193+
189194
def ismethoddescriptor(object):
190195
"""Return true if the object is a method descriptor.
191196

0 commit comments

Comments
 (0)