8000 Merge branch 'main' into fetch-restore-objects · python/cpython@e11d73e · GitHub
[go: up one dir, main page]

Skip to content

Commit e11d73e

authored
Merge branch 'main' into fetch-restore-objects
2 parents 6378d56 + bb0cf8f commit e11d73e

17 files changed

+987
-314
lines changed

Doc/bugs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Click on the "New issue" button in the top bar to report a new issue.
7070
The submission form has two fields, "Title" and "Comment".
7171

7272
For the "Title" field, enter a *very* short description of the problem;
73-
less than ten words is good.
73+
fewer than ten words is good.
7474

7575
In the "Comment" field, describe the problem in detail, including what you
7676
expected to happen and what did happen. Be sure to include whether any

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2538,7 +2538,7 @@ should be logged, or the ``extra`` keyword parameter to indicate additional
25382538
contextual information to be added to the log). So you cannot directly make
25392539
logging calls using :meth:`str.format` or :class:`string.Template` syntax,
25402540
because internally the logging package uses %-formatting to merge the format
2541-
string and the variable arguments. There would no changing this while preserving
2541+
string and the variable arguments. There would be no changing this while preserving
25422542
backward compatibility, since all logging calls which are out there in existing
25432543
code will be using %-format strings.
25442544

Doc/library/inspect.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,9 @@ function.
802802

803803
.. attribute:: Parameter.kind
804804

805-
Describes how argument values are bound to the parameter. Possible values
806-
(accessible via :class:`Parameter`, like ``Parameter.KEYWORD_ONLY``):
805+
Describes how argument values are bound to the parameter. The possible
806+
values are accessible via :class:`Parameter` (like ``Parameter.KEYWORD_ONLY``),
807+
and support comparison and ordering, in the following order:
807808

808809
.. tabularcolumns:: |l|L|
809810

Doc/library/platform.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Cross Platform
6363
string is returned if the value cannot be determined.
6464

6565

66-
.. function:: platform(aliased=0, terse=0)
66+
.. function:: platform(aliased=False, terse=False)
6767

6868
Returns a single string identifying the underlying platform with as much useful
6969
information as possible.

Doc/library/re.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ The special characters are:
271271

272272
* To match a literal ``']'`` inside a set, precede it with a backslash, or
273273
place it at the beginning of the set. For example, both ``[()[\]{}]`` and
274-
``[]()[{}]`` will both match a parenthesis.
274+
``[]()[{}]`` will match a right bracket, as well as left bracket, braces,
275+
and parentheses.
275276

276277
.. .. index:: single: --; in regular expressions
277278
.. .. index:: single: &&; in regular expressions

Doc/library/types.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ Coroutine Utility Functions
486486
The generator-based coroutine is still a :term:`generator iterator`,
487487
but is also considered to be a :term:`coroutine` object and is
488488
:term:`awaitable`. However, it may not necessarily implement
489-
the :meth:`__await__` method.
489+
the :meth:`~object.__await__` method.
490490

491491
If *gen_func* is a generator function, it will be modified in-place.
492492

Lib/imp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ def load_dynamic(name, path, file=None):
338338

339339
# Issue #24748: Skip the sys.modules check in _load_module_shim;
340340
# always load new extension
341-
spec = importlib.machinery.ModuleSpec(
342-
name=name, loader=loader, origin=path)
341+
spec = importlib.util.spec_from_file_location(
342+
name, path, loader=loader)
343343
return _load(spec)
344344

345345
else:

Lib/platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,7 +1246,7 @@ def python_compiler():
12461246

12471247
_platform_cache = {}
12481248

1249-
def platform(aliased=0, terse=0):
1249+
def platform(aliased=False, terse=False):
12501250

12511251
""" Returns a single string identifying the underlying platform
12521252
with as much useful information as possible (but no more :).

Lib/test/test_bool.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 CBBA +319,26 @@ def __len__(self):
319319
return -1
320320
self.assertRaises(ValueError, bool, Eggs())
321321

322+
def test_interpreter_convert_to_bool_raises(self):
323+
class SymbolicBool:
324+
def __bool__(self):
325+
raise TypeError
326+
327+
class Symbol:
328+
def __gt__(self, other):
329+
return SymbolicBool()
330+
331+
x = Symbol()
332+
333+
with self.assertRaises(TypeError):
334+
if x > 0:
335+
msg = "x > 0 was true"
336+
else:
337+
msg = "x > 0 was false"
338+
339+
# This used to create negative refcounts, see gh-102250
340+
del x
341+
322342
def test_from_bytes(self):
323343
self.assertIs(bool.from_bytes(b'\x00'*8, 'big'), False)
324344
self.assertIs(bool.from_bytes(b'abcd', 'little'), True)

0 commit comments

Comments
 (0)
0