10000 Merge branch 'main' into global-objects-use-pyid · python/cpython@1852340 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1852340

Browse files
Merge branch 'main' into global-objects-use-pyid
2 parents efe208f + aa1ccbc commit 1852340

Some content is hidden

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

63 files changed

+2180
-732
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Lib/ast.py @isidentical
136136

137137
**/*idlelib* @terryjreedy
138138

139-
**/*typing* @gvanrossum @Fidget-Spinner
139+
**/*typing* @gvanrossum @Fidget-Spinner @JelleZijlstra
140140

141141
**/*asyncore @giampaolo
142142
**/*asynchat @giampaolo

.github/workflows/build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ jobs:
100100
run: make smelly
101101
- name: Check limited ABI symbols
102102
run: make check-limited-abi
103-
- name: Check global objects
104-
run: make check-global-objects
105103

106104
build_win32:
107105
name: 'Windows (x86)'

.github/workflows/stale.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,23 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
steps:
17-
- uses: actions/stale@v4
17+
- name: "Check PRs with 'CLA signed' label"
18+
uses: actions/stale@v4
1819
with:
1920
repo-token: ${{ secrets.GITHUB_TOKEN }}
21+
only-pr-labels: 'CLA signed'
2022
stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity.'
2123
stale-pr-label: 'stale'
2224
days-before-stale: 30
2325
days-before-close: -1
26+
27+
- name: "Check PRs with 'CLA not signed' label"
28+
uses: actions/stale@v4
29+
with:
30+
repo-token: ${{ secrets.GITHUB_TOKEN }}
31+
only-pr-labels: 'CLA not signed'
32+
stale-pr-message: 'This PR is stale because it has been open for 30 days with no activity. If the CLA is not signed within 14 days, it will be closed. See also https://devguide.python.org/pullrequest/#licensing'
33+
stale-pr-label: 'stale'
34+
close-pr-message: 'Closing this stale PR because the CLA is still not signed.'
35+
days-before-stale: 30
36+
days-before-close: 14

Doc/howto/descriptor.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -991,17 +991,17 @@ here is a pure Python equivalent:
991991
if obj is None:
992992
return self
993993
if self.fget is None:
994-
raise AttributeError(f'unreadable attribute {self._name}')
994+
raise AttributeError(f"property '{self._name}' has no getter")
995995
return self.fget(obj)
996996

997997
def __set__(self, obj, value):
998998
if self.fset is None:
999-
raise AttributeError(f"can't set attribute {self._name}")
999+
raise AttributeError(f"property '{self._name}' has no setter")
10001000
self.fset(obj, value)
10011001

10021002
def __delete__(self, obj):
10031003
if self.fdel is None:
1004-
raise AttributeError(f"can't delete attribute {self._name}")
1004+
raise AttributeError(f"property '{self._name}' has no deleter")
10051005
self.fdel(obj)
10061006

10071007
def getter(self, fget):
@@ -1456,7 +1456,7 @@ attributes stored in ``__slots__``:
14561456
>>> mark.dept = 'Space Pirate'
14571457
Traceback (most recent call last):
14581458
...
1459-
AttributeError: can't set attribute
1459+
AttributeError: property 'dept' of 'Immutable' object has no setter
14601460
>>> mark.location = 'Mars'
14611461
Traceback (most recent call last):
14621462
...

Doc/library/html.parser.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`):
126126

127127
.. method:: HTMLParser.handle_starttag(tag, attrs)
128128

129-
This method is called to handle the start of a tag (e.g. ``<div id="main">``).
129+
This method is called to handle the start tag of an element (e.g. ``<div id="main">``).
130130

131131
The *tag* argument is the name of the tag converted to lower case. The *attrs*
132132
argument is a list of ``(name, value)`` pairs containing the attributes found

Doc/library/inspect.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,14 @@ attributes:
429429
Return ``True`` if the object is a built-in function or a bound built-in method.
430430

431431

432+
.. function:: ismethodwrapper(object)
433+
434+
Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`.
435+
436+
These are instances of :class:`~types.MethodWrapperType`, such as :meth:`~object().__str__`,
437+
:meth:`~object().__eq__` and :meth:`~object().__repr__`
438+
439+
432440
.. function:: isroutine(object)
433441

434442
Return ``True`` if the object is a user-defined or built-in function or method.

Doc/library/random.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ be found in any statistics text.
320320
math.gamma(alpha) * beta ** alpha
321321

322322

323-
.. function:: gauss(mu, sigma)
323+
.. function:: gauss(mu=0.0, sigma=1.0)
324324

325325
Normal distribution, also called the Gaussian distribution. *mu* is the mean,
326326
and *sigma* is the standard deviation. This is slightly faster than
@@ -333,6 +333,9 @@ be found in any statistics text.
333333
number generator. 2) Put locks around all calls. 3) Use the
334334
slower, but thread-safe :func:`normalvariate` function instead.
335335

336+
.. versionchanged:: 3.11
337+
*mu* and *sigma* now have default arguments.
338+
336339

337340
.. function:: lognormvariate(mu, sigma)
338341

@@ -342,10 +345,13 @@ be found in any statistics text.
342345
zero.
343346

344347

345-
.. function:: normalvariate(mu, sigma)
348+
.. function:: normalvariate(mu=0.0, sigma=1.0)
346349

347350
Normal distribution. *mu* is the mean, and *sigma* is the standard deviation.
348351

352+
.. versionchanged:: 3.11
353+
*mu* and *sigma* now have default arguments.
354+
349355

350356
.. function:: vonmisesvariate(mu, kappa)
351357

Doc/library/typing.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,11 +1470,20 @@ These are not used in annotations. They are building blocks for declaring types.
14701470
``Point2D.__optional_keys__``.
14711471
To allow using this feature with older versions of Python that do not
14721472
support :pep:`526`, ``TypedDict`` supports two additional equivalent
1473-
syntactic forms::
1473+
syntactic forms:
1474+
1475+
* Using a literal :class:`dict` as the second argument::
14741476

1475-
Point2D = TypedDict('Point2D', x=int, y=int, label=str)
14761477
Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
14771478

1479+
* Using keyword arguments::
1480+
1481+
Point2D = TypedDict('Point2D', x=int, y=int, label=str)
1482+
1483+
.. deprecated-removed:: 3.11 3.13
1484+
The keyword-argument syntax is deprecated in 3.11 and will be removed
1485+
in 3.13. It may also be unsupported by static type checkers.
1486+
14781487
By default, all keys must be present in a ``TypedDict``. It is possible to
14791488
override this by specifying totality.
14801489
Usage::
@@ -1483,6 +1492,9 @@ These are not used in annotations. They are building blocks for declaring types.
14831492
x: int
14841493
y: int
14851494

1495+
# Alternative syntax
1496+
Point2D = TypedDict('Point2D', {'x': int, 'y': int}, total=False)
1497+
14861498
This means that a ``Point2D`` ``TypedDict`` can have any of the keys
14871499
omitted. A type checker is only expected to support a literal ``False`` or
14881500
``True`` as the value of the ``total`` argument. ``True`` is the default,

Doc/whatsnew/3.11.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ inspect
240240
triggering dynamic lookup via the descriptor protocol. (Contributed by
241241
Weipeng Hong in :issue:`30533`.)
242242

243+
* Add :func:`inspect.ismethodwrapper` for checking if the type of an object is a
244+
:class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :issue:`29418`.)
243245

244246
math
245247
----

Include/internal/pycore_code.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ int _Py_Specialize_CallNoKw(PyObject *callable, _Py_CODEUNIT *instr, int nargs,
276276
void _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
277277
SpecializedCacheEntry *cache);
278278
void _Py_Specialize_CompareOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr, SpecializedCacheEntry *cache);
279+
void _Py_Specialize_UnpackSequence(PyObject *seq, _Py_CODEUNIT *instr,
280+
SpecializedCacheEntry *cache);
279281

280282
/* Deallocator function for static codeobjects used in deepfreeze.py */
281283
void _PyStaticCode_Dealloc(PyCodeObject *co);

0 commit comments

Comments
 (0)
0