Skip to content

Commit b8d6799

Browse files
committed
Merge branch 'main' into instrument-all-possible-lines
2 parents e76f241 + 19ee53d commit b8d6799

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

+1063
-742
lines changed

Doc/howto/clinic.rst

+3
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,9 @@ All Argument Clinic converters accept the following arguments:
775775
because :pep:`8` mandates that the Python library may not use
776776
annotations.
777777

778+
``unused``
779+
Wrap the argument with :c:macro:`Py_UNUSED` in the impl function signature.
780+
778781
In addition, some converters accept additional arguments. Here is a list
779782
of these arguments, along with their meanings:
780783

Doc/library/pdb.rst

+11-3
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,17 @@ can be overridden by the local file.
602602

603603
Execute the (one-line) *statement* in the context of the current stack frame.
604604
The exclamation point can be omitted unless the first word of the statement
605-
resembles a debugger command. To set a global variable, you can prefix the
606-
assignment command with a :keyword:`global` statement on the same line,
607-
e.g.::
605+
resembles a debugger command, e.g.:
606+
607+
.. code-block:: none
608+
609+
(Pdb) ! n=42
610+
(Pdb)
611+
612+
To set a global variable, you can prefix the assignment command with a
613+
:keyword:`global` statement on the same line, e.g.:
614+
615+
.. code-block:: none
608616
609617
(Pdb) global list_options; list_options = ['-l']
610618
(Pdb)

Include/internal/pycore_code.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ typedef struct {
5353

5454
typedef struct {
5555
uint16_t counter;
56-
uint16_t class_version[2];
57-
uint16_t self_type_version[2];
58-
uint16_t method[4];
5956
} _PySuperAttrCache;
6057

6158
#define INLINE_CACHE_ENTRIES_LOAD_SUPER_ATTR CACHE_ENTRIES(_PySuperAttrCache)
@@ -227,8 +224,8 @@ extern int _PyLineTable_PreviousAddressRange(PyCodeAddressRange *range);
227224

228225
/* Specialization functions */
229226

230-
extern void _Py_Specialize_LoadSuperAttr(PyObject *global_super, PyObject *cls, PyObject *self,
231-
_Py_CODEUNIT *instr, PyObject *name, int load_method);
227+
extern void _Py_Specialize_LoadSuperAttr(PyObject *global_super, PyObject *cls,
228+
_Py_CODEUNIT *instr, int load_method);
232229
extern void _Py_Specialize_LoadAttr(PyObject *owner, _Py_CODEUNIT *instr,
233230
PyObject *name);
234231
extern void _Py_Specialize_StoreAttr(PyObject *owner, _Py_CODEUNIT *instr,

Include/internal/pycore_opcode.h

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_typeobject.h

-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,6 @@ PyAPI_DATA(PyTypeObject) _PyBufferWrapper_Type;
142142

143143
PyObject *
144144
_PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name, int *meth_found);
145-
PyObject *
146-
_PySuper_LookupDescr(PyTypeObject *su_type, PyObject *su_obj, PyObject *name);
147145

148146
#ifdef __cplusplus
149147
}

Include/opcode.h

+28-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/collections/abc.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
from _collections_abc import *
22
from _collections_abc import __all__
33
from _collections_abc import _CallableGenericAlias
4+
5+
_deprecated_ByteString = globals().pop("ByteString")
6+
7+
def __getattr__(attr):
8+
if attr == "ByteString":
9+
import warnings
10+
warnings._deprecated("collections.abc.ByteString", remove=(3, 14))
11+
return _deprecated_ByteString
12+
raise AttributeError(f"module 'collections.abc' has no attribute {attr!r}")

Lib/importlib/_bootstrap_external.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def _write_atomic(path, data, mode=0o666):
443443
# Python 3.12b1 3527 (Add LOAD_SUPER_ATTR)
444444
# Python 3.12b1 3528 (Add LOAD_SUPER_ATTR_METHOD specialization)
445445
# Python 3.12b1 3529 (Inline list/dict/set comprehensions)
446+
# Python 3.12b1 3530 (Shrink the LOAD_SUPER_ATTR caches)
446447

447448
# Python 3.13 will start with 3550
448449

@@ -459,7 +460,7 @@ def _write_atomic(path, data, mode=0o666):
459460
# Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array
460461
# in PC/launcher.c must also be updated.
461462

462-
MAGIC_NUMBER = (3529).to_bytes(2, 'little') + b'\r\n'
463+
MAGIC_NUMBER = (3530).to_bytes(2, 'little') + b'\r\n'
463464

464465
_RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c
465466

Lib/opcode.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ def pseudo_op(name, op, real_ops):
373373
"FOR_ITER_GEN",
374374
],
375375
"LOAD_SUPER_ATTR": [
376+
"LOAD_SUPER_ATTR_ATTR",
376377
"LOAD_SUPER_ATTR_METHOD",
377378
],
378379
"LOAD_ATTR": [
@@ -450,9 +451,6 @@ def pseudo_op(name, op, real_ops):
450451
},
451452
"LOAD_SUPER_ATTR": {
452453
"counter": 1,
453-
"class_version": 2,
454-
"self_type_version": 2,
455-
"method": 4,
456454
},
457455
"LOAD_ATTR": {
458456
"counter": 1,

Lib/pdb.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ def displayhook(self, obj):
440440
self.message(repr(obj))
441441

442442
def default(self, line):
443-
if line[:1] == '!': line = line[1:]
443+
if line[:1] == '!': line = line[1:].strip()
444444
locals = self.curframe_locals
445445
globals = self.curframe.f_globals
446446
try:
@@ -1642,9 +1642,12 @@ def help_exec(self):
16421642
16431643
Execute the (one-line) statement in the context of the current
16441644
stack frame. The exclamation point can be omitted unless the
1645-
first word of the statement resembles a debugger command. To
1646-
assign to a global variable you must always prefix the command
1647-
with a 'global' command, e.g.:
1645+
first word of the statement resembles a debugger command, e.g.:
1646+
(Pdb) ! n=42
1647+
(Pdb)
1648+
1649+
To assign to a global variable you must always prefix the command with
1650+
a 'global' command, e.g.:
16481651
(Pdb) global list_options; list_options = ['-l']
16491652
(Pdb)
16501653
"""

Lib/pydoc_data/topics.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -5283,11 +5283,14 @@
52835283
'current\n'
52845284
' stack frame. The exclamation point can be omitted unless the '
52855285
'first\n'
5286-
' word of the statement resembles a debugger command. To set '
5287-
'a\n'
5288-
' global variable, you can prefix the assignment command with '
5289-
'a\n'
5290-
' "global" statement on the same line, e.g.:\n'
5286+
' word of the statement resembles a debugger command, e.g.:'
5287+
'\n'
5288+
' (Pdb) ! n=42\n'
5289+
' (Pdb)\n'
5290+
'\n'
5291+
' To set a global variable, you can prefix the assignment command '
5292+
' with \n'
5293+
' a "global" statement on the same line, e.g.:\n'
52915294
'\n'
52925295
" (Pdb) global list_options; list_options = ['-l']\n"
52935296
' (Pdb)\n'

Lib/test/libregrtest/refleak.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,13 @@ def dash_R(ns, test_name, test_func):
4848
else:
4949
zdc = zipimport._zip_directory_cache.copy()
5050
abcs = {}
51-
for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
52-
if not isabstract(abc):
53-
continue
54-
for obj in abc.__subclasses__() + [abc]:
55-
abcs[obj] = _get_dump(obj)[0]
51+
# catch and ignore collections.abc.ByteString deprecation
52+
with warnings.catch_warnings(action='ignore', category=DeprecationWarning):
53+
for abc in [getattr(collections.abc, a) for a in collections.abc.__all__]:
54+
if not isabstract(abc):
55+
continue
56+
for obj in abc.__subclasses__() + [abc]:
57+
abcs[obj] = _get_dump(obj)[0]
5658

5759
# bpo-31217: Integer pool to get a single integer object for the same
5860
# value. The pool is used to prevent false alarm when checking for memory
@@ -173,7 +175,9 @@ def dash_R_cleanup(fs, ps, pic, zdc, abcs):
173175
zipimport._zip_directory_cache.update(zdc)
174176

175177
# Clear ABC registries, restoring previously saved ABC registries.
176-
abs_classes = [getattr(collections.abc, a) for a in collections.abc.__all__]
178+
# ignore deprecation warning for collections.abc.ByteString
179+
with warnings.catch_warnings(action='ignore', category=DeprecationWarning):
180+
abs_classes = [getattr(collections.abc, a) for a in collections.abc.__all__]
177181
abs_classes = filter(isabstract, abs_classes)
178182
for abc in abs_classes:
179183
for obj in abc.__subclasses__() + [abc]:

Lib/test/test_buffer.py

+13
Original file line numberDiff line numberDiff line change
@@ -4749,6 +4749,19 @@ def __buffer__(self, flags):
47494749
c.clear()
47504750
self.assertIs(c.buffer, None)
47514751

4752+
def test_release_buffer_with_exception_set(self):
4753+
class A:
4754+
def __buffer__(self, flags):
4755+
return memoryview(bytes(8))
4756+
def __release_buffer__(self, view):
4757+
pass
4758+
4759+
b = bytearray(8)
4760+
with memoryview(b):
4761+
# now b.extend will raise an exception due to exports
4762+
with self.assertRaises(BufferError):
4763+
b.extend(A())
4764+
47524765

47534766
if __name__ == "__main__":
47544767
unittest.main()

0 commit comments

Comments
 (0)