Skip to content

Commit a4a04a7

Browse files
authored
Merge branch 'main' into unicode-in-Frac-fmt/135025
2 parents 64014e0 + fad0674 commit a4a04a7

21 files changed

Lines changed: 166 additions & 74 deletions

Doc/library/threading.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ since it is impossible to detect the termination of alien threads.
515515
This constructor should always be called with keyword arguments. Arguments
516516
are:
517517

518-
*group* should be ``None``; reserved for future extension when a
518+
*group* must be ``None`` as it is reserved for future extension when a
519519
:class:`!ThreadGroup` class is implemented.
520520

521521
*target* is the callable object to be invoked by the :meth:`run` method.

Include/internal/pycore_sliceobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212
/* runtime lifecycle */
1313

1414
PyAPI_FUNC(PyObject *)
15-
_PyBuildSlice_ConsumeRefs(PyObject *start, PyObject *stop);
15+
_PyBuildSlice_ConsumeRefs(PyObject *start, PyObject *stop, PyObject *step);
1616

1717
#ifdef __cplusplus
1818
}

Lib/asyncio/locks.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,7 @@ def _wake_up_first(self):
145145
"""Ensure that the first waiter will wake up."""
146146
if not self._waiters:
147147
return
148-
try:
149-
fut = next(iter(self._waiters))
150-
except StopIteration:
151-
return
148+
fut = next(iter(self._waiters))
152149

153150
# .done() means that the waiter is already set to wake up.
154151
if not fut.done():

Lib/profiling/sampling/_flamegraph_assets/flamegraph.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let invertedData = null;
77
let currentThreadFilter = 'all';
88
let isInverted = false;
99
let useModuleNames = true;
10+
let zoomedNodeValue = null;
1011

1112
// Heat colors are now defined in CSS variables (--heat-1 through --heat-8)
1213
// and automatically switch with theme changes - no JS color arrays needed!
@@ -316,6 +317,7 @@ function createPythonTooltip(data) {
316317
const selfSamples = d.data.self || 0;
317318
const selfMs = (selfSamples / 1000).toFixed(2);
318319
const percentage = ((d.data.value / data.value) * 100).toFixed(2);
320+
const relativePercentage = Math.min(100, ((d.data.value / (zoomedNodeValue ?? data.value)) * 100)).toFixed(2);
319321
const calls = d.data.calls || 0;
320322
const childCount = d.children ? d.children.length : 0;
321323
const source = d.data.source;
@@ -439,6 +441,11 @@ function createPythonTooltip(data) {
439441
<span class="tooltip-stat-label">Percentage:</span>
440442
<span class="tooltip-stat-value accent">${percentage}%</span>
441443
444+
${relativePercentage != percentage && relativePercentage != "100.00" ? `
445+
<span class="tooltip-stat-label">Relative Percentage:</span>
446+
<span class="tooltip-stat-value accent">${relativePercentage}%</span>
447+
` : ''}
448+
442449
${calls > 0 ? `
443450
<span class="tooltip-stat-label">Function Calls:</span>
444451
<span class="tooltip-stat-value">${calls.toLocaleString()}</span>
@@ -620,6 +627,9 @@ function createFlamegraph(tooltip, rootValue, data) {
620627
const percentage = d.data.value / rootValue;
621628
const level = getHeatLevel(percentage);
622629
return heatColors[level];
630+
})
631+
.onClick(function (d) {
632+
zoomedNodeValue = d.data.value;
623633
});
624634

625635
return chart;
@@ -629,6 +639,7 @@ function renderFlamegraph(chart, data) {
629639
d3.select("#chart").datum(data).call(chart);
630640
window.flamegraphChart = chart;
631641
window.flamegraphData = data;
642+
zoomedNodeValue = null;
632643
populateStats(data);
633644
}
634645

@@ -1269,6 +1280,7 @@ function filterDataByThread(data, threadId) {
12691280

12701281
function resetZoom() {
12711282
if (window.flamegraphChart) {
1283+
zoomedNodeValue = null;
12721284
window.flamegraphChart.resetZoom();
12731285
}
12741286
}

Lib/test/test_type_cache.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
""" Tests for the internal type cache in CPython. """
2+
import collections.abc
23
import dis
34
import unittest
45
import warnings
@@ -114,6 +115,25 @@ class HolderSub(Holder):
114115
Holder.set_value()
115116
HolderSub.value
116117

118+
def test_abc_register_invalidates_subclass_versions(self):
119+
class Parent:
120+
pass
121+
122+
class Child(Parent):
123+
pass
124+
125+
type_assign_version(Parent)
126+
type_assign_version(Child)
127+
parent_version = type_get_version(Parent)
128+
child_version = type_get_version(Child)
129+
if parent_version == 0 or child_version == 0:
130+
self.skipTest("Could not assign valid type versions")
131+
132+
collections.abc.Mapping.register(Parent)
133+
134+
self.assertEqual(type_get_version(Parent), 0)
135+
self.assertEqual(type_get_version(Child), 0)
136+
117137
@support.cpython_only
118138
class TypeCacheWithSpecializationTests(unittest.TestCase):
119139
def tearDown(self):

Makefile.pre.in

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3111,9 +3111,18 @@ config.status: $(srcdir)/configure
31113111

31123112
.PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre
31133113

3114-
Python/asm_trampoline.o: $(srcdir)/Python/asm_trampoline.S
3114+
Python/asm_trampoline_x86_64.o: $(srcdir)/Python/asm_trampoline_x86_64.S
31153115
$(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
31163116

3117+
Python/asm_trampoline_aarch64.o: $(srcdir)/Python/asm_trampoline_aarch64.S
3118+
$(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
3119+
3120+
Python/asm_trampoline_riscv64.o: $(srcdir)/Python/asm_trampoline_riscv64.S
3121+
$(CC) -c $(PY_CORE_CFLAGS) -o $@ $<
3122+
3123+
Python/asm_trampoline_universal2.o: Python/asm_trampoline_aarch64.o Python/asm_trampoline_x86_64.o
3124+
lipo -create -output $@ Python/asm_trampoline_aarch64.o Python/asm_trampoline_x86_64.o
3125+
31173126
Python/emscripten_trampoline_inner.wasm: $(srcdir)/Python/emscripten_trampoline_inner.c
31183127
# emcc has a path that ends with emsdk/upstream/emscripten/emcc, we're looking for emsdk/upstream/bin/clang.
31193128
$$(dirname $$(dirname $(CC)))/bin/clang -o $@ $< -mgc -O2 -Wl,--no-entry -Wl,--import-table -Wl,--import-memory -target wasm32-unknown-unknown -nostdlib
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix ``abc.register()`` so it invalidates type version tags for registered classes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the tooltip on the Tachyon flame graph to show both absolute and relative percentages.

Modules/_io/bufferedio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,7 +1509,9 @@ buffered_iternext(PyObject *op)
15091509
tp == state->PyBufferedRandom_Type)
15101510
{
15111511
/* Skip method call overhead for speed */
1512+
Py_BEGIN_CRITICAL_SECTION(self);
15121513
line = _buffered_readline(self, -1);
1514+
Py_END_CRITICAL_SECTION();
15131515
}
15141516
else {
15151517
line = PyObject_CallMethodNoArgs((PyObject *)self,

Modules/_testinternalcapi/test_cases.c.h

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

0 commit comments

Comments
 (0)