Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7f060a

Browse files
Pull in main
2 parents 760c6cb + e205c5c commit d7f060a

6 files changed

Lines changed: 15 additions & 31 deletions

File tree

Doc/library/pprint.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Functions
5959
The configuration parameters *stream*, *indent*, *width*, *depth*,
6060
*compact*, *sort_dicts* and *underscore_numbers* are passed to the
6161
:class:`PrettyPrinter` constructor and their meanings are as
62-
described in its documentation above.
62+
described in its documentation below.
6363

6464
>>> import pprint
6565
>>> stuff = ['spam', 'eggs', 'lumberjack', 'knights', 'ni']
@@ -78,7 +78,7 @@ Functions
7878
Return the formatted representation of *object* as a string. *indent*,
7979
*width*, *depth*, *compact*, *sort_dicts* and *underscore_numbers* are
8080
passed to the :class:`PrettyPrinter` constructor as formatting parameters
81-
and their meanings are as described in its documentation above.
81+
and their meanings are as described in its documentation below.
8282

8383

8484
.. function:: isreadable(object)

Include/internal/pycore_mimalloc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ typedef enum {
2727
# define MI_DEBUG_FREED PYMEM_DEADBYTE
2828
# define MI_DEBUG_PADDING PYMEM_FORBIDDENBYTE
2929
#ifdef Py_DEBUG
30-
# define MI_DEBUG 1
30+
# define MI_DEBUG 2
3131
#else
3232
# define MI_DEBUG 0
3333
#endif

Lib/dataclasses.py

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
import types
55
import inspect
66
import keyword
7-
import functools
87
import itertools
98
import abc
10-
import _thread
9+
from reprlib import recursive_repr
1110
from types import FunctionType, GenericAlias
1211

1312

@@ -245,25 +244,6 @@ def __repr__(self):
245244
property,
246245
})
247246

248-
# This function's logic is copied from "recursive_repr" function in
249-
# reprlib module to avoid dependency.
250-
def _recursive_repr(user_function):
251-
# Decorator to make a repr function return "..." for a recursive
252-
# call.
253-
repr_running = set()
254-
255-
@functools.wraps(user_function)
256-
def wrapper(self):
257-
key = id(self), _thread.get_ident()
258-
if key in repr_running:
259-
return '...'
260-
repr_running.add(key)
261-
try:
262-
result = user_function(self)
263-
finally:
264-
repr_running.discard(key)
265-
return result
266-
return wrapper
267247

268248
class InitVar:
269249
__slots__ = ('type', )
@@ -322,7 +302,7 @@ def __init__(self, default, default_factory, init, repr, hash, compare,
322302
self.kw_only = kw_only
323303
self._field_type = None
324304

325-
@_recursive_repr
305+
@recursive_repr()
326306
def __repr__(self):
327307
return ('Field('
328308
f'name={self.name!r},'
@@ -632,7 +612,7 @@ def _repr_fn(fields, globals):
632612
for f in fields]) +
633613
')"'],
634614
globals=globals)
635-
return _recursive_repr(fn)
615+
return recursive_repr()(fn)
636616

637617

638618
def _frozen_get_del_attr(cls, fields, globals):

Modules/_xxinterpqueuesmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,15 +750,15 @@ _queuerefs_clear(_queueref *head)
750750

751751
#ifdef Py_DEBUG
752752
int64_t qid = ref->qid;
753-
fprintf(stderr, "queue %ld still exists\n", qid);
753+
fprintf(stderr, "queue %" PRId64 " still exists\n", qid);
754754
#endif
755755
_queue *queue = ref->queue;
756756
GLOBAL_FREE(ref);
757757

758758
_queue_kill_and_wait(queue);
759759
#ifdef Py_DEBUG
760760
if (queue->items.count > 0) {
761-
fprintf(stderr, "queue %ld still holds %ld items\n",
761+
fprintf(stderr, "queue %" PRId64 " still holds %" PRId64 " items\n",
762762
qid, queue->items.count);
763763
}
764764
#endif

Objects/mimalloc/alloc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,10 @@ bool _mi_free_delayed_block(mi_block_t* block) {
609609
// get segment and page
610610
const mi_segment_t* const segment = _mi_ptr_segment(block);
611611
mi_assert_internal(_mi_ptr_cookie(segment) == segment->cookie);
612+
#ifndef Py_GIL_DISABLED
613+
// The GC traverses heaps of other threads, which can trigger this assert.
612614
mi_assert_internal(_mi_thread_id() == segment->thread_id);
615+
#endif
613616
mi_page_t* const page = _mi_segment_page_of(segment, block);
614617

615618
// Clear the no-delayed flag so delayed freeing is used again for this page.

Python/optimizer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ make_executor_from_uops(_PyUOpInstruction *buffer, const _PyBloomFilter *depende
899899
uint32_t used[(UOP_MAX_TRACE_LENGTH + 31)/32] = { 0 };
900900
int exit_count;
901901
int length = compute_used(buffer, used, &exit_count);
902-
_PyExecutorObject *executor = allocate_executor(exit_count, length+1);
902+
length += 1; // For _START_EXECUTOR
903+
_PyExecutorObject *executor = allocate_executor(exit_count, length);
903904
if (executor == NULL) {
904905
return NULL;
905906
}
@@ -909,7 +910,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, const _PyBloomFilter *depende
909910
executor->exits[i].temperature = 0;
910911
}
911912
int next_exit = exit_count-1;
912-
_PyUOpInstruction *dest = (_PyUOpInstruction *)&executor->trace[length];
913+
_PyUOpInstruction *dest = (_PyUOpInstruction *)&executor->trace[length-1];
913914
/* Scan backwards, so that we see the destinations of jumps before the jumps themselves. */
914915
for (int i = UOP_MAX_TRACE_LENGTH-1; i >= 0; i--) {
915916
if (!BIT_IS_SET(used, i)) {
@@ -957,7 +958,7 @@ make_executor_from_uops(_PyUOpInstruction *buffer, const _PyBloomFilter *depende
957958
#ifdef _Py_JIT
958959
executor->jit_code = NULL;
959960
executor->jit_size = 0;
960-
if (_PyJIT_Compile(executor, executor->trace, length+1)) {
961+
if (_PyJIT_Compile(executor, executor->trace, length)) {
961962
Py_DECREF(executor);
962963
return NULL;
963964
}

0 commit comments

Comments
 (0)