Skip to content

Commit 24d59b9

Browse files
authored
Merge branch 'main' into fix-decimal-optparse
2 parents 156c126 + 63cc125 commit 24d59b9

File tree

20 files changed

+518
-318
lines changed

20 files changed

+518
-318
lines changed

Doc/c-api/descriptor.rst

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ found in the dictionary of type objects.
1010

1111
.. XXX document these!
1212
13-
.. c:var:: PyTypeObject PyProperty_Type
14-
15-
The type object for the built-in descriptor types.
16-
17-
1813
.. c:function:: PyObject* PyDescr_NewGetSet(PyTypeObject *type, struct PyGetSetDef *getset)
1914
2015
@@ -74,9 +69,26 @@ found in the dictionary of type objects.
7469
.. c:function:: PyObject* PyWrapper_New(PyObject *, PyObject *)
7570
7671
72+
.. c:macro:: PyDescr_COMMON
73+
74+
This is a :term:`soft deprecated` macro including the common fields for a
75+
descriptor object.
76+
77+
This was included in Python's C API by mistake; do not use it in extensions.
78+
For creating custom descriptor objects, create a class implementing the
79+
descriptor protocol (:c:member:`~PyTypeObject.tp_descr_get` and
80+
:c:member:`~PyTypeObject.tp_descr_set`).
81+
82+
7783
Built-in descriptors
7884
^^^^^^^^^^^^^^^^^^^^
7985
86+
.. c:var:: PyTypeObject PyProperty_Type
87+
88+
The type object for property objects. This is the same object as
89+
:class:`property` in the Python layer.
90+
91+
8092
.. c:var:: PyTypeObject PySuper_Type
8193
8294
The type object for super objects. This is the same object as

Doc/c-api/exceptions.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,17 @@ Exception Classes
793793
Return :c:member:`~PyTypeObject.tp_name` of the exception class *ob*.
794794
795795
796+
.. c:macro:: PyException_HEAD
797+
798+
This is a :term:`soft deprecated` macro including the base fields for an
799+
exception object.
800+
801+
This was included in Python's C API by mistake and is not designed for use
802+
in extensions. For creating custom exception objects, use
803+
:c:func:`PyErr_NewException` or otherwise create a class inheriting from
804+
:c:data:`PyExc_BaseException`.
805+
806+
796807
Exception Objects
797808
=================
798809

Include/internal/pycore_optimizer.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,10 @@ static inline uint16_t uop_get_error_target(const _PyUOpInstruction *inst)
115115

116116

117117
#define REF_IS_BORROWED 1
118+
#define REF_IS_INVALID 2
119+
#define REF_TAG_BITS 3
118120

119-
#define JIT_BITS_TO_PTR_MASKED(REF) ((JitOptSymbol *)(((REF).bits) & (~REF_IS_BORROWED)))
121+
#define JIT_BITS_TO_PTR_MASKED(REF) ((JitOptSymbol *)(((REF).bits) & (~REF_TAG_BITS)))
120122

121123
static inline JitOptSymbol *
122124
PyJitRef_Unwrap(JitOptRef ref)
@@ -133,6 +135,18 @@ PyJitRef_Wrap(JitOptSymbol *sym)
133135
return (JitOptRef){.bits=(uintptr_t)sym};
134136
}
135137

138+
static inline JitOptRef
139+
PyJitRef_WrapInvalid(void *ptr)
140+
{
141+
return (JitOptRef){.bits=(uintptr_t)ptr | REF_IS_INVALID};
142+
}
143+
144+
static inline bool
145+
PyJitRef_IsInvalid(JitOptRef ref)
146+
{
147+
return (ref.bits & REF_IS_INVALID) == REF_IS_INVALID;
148+
}
149+
136150
static inline JitOptRef
137151
PyJitRef_StripReferenceInfo(JitOptRef ref)
138152
{

Include/internal/pycore_optimizer_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ typedef struct _JitOptContext {
129129
JitOptRef *n_consumed;
130130
JitOptRef *limit;
131131
JitOptRef locals_and_stack[MAX_ABSTRACT_INTERP_SIZE];
132+
_PyUOpInstruction *out_buffer;
133+
int out_len;
132134
} JitOptContext;
133135

134136

Include/internal/pycore_tstate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ typedef struct _PyJitTracerState {
6060
_PyJitTracerTranslatorState translator_state;
6161
JitOptContext opt_context;
6262
_PyUOpInstruction code_buffer[UOP_MAX_TRACE_LENGTH];
63+
_PyUOpInstruction out_buffer[UOP_MAX_TRACE_LENGTH];
6364
} _PyJitTracerState;
6465

6566
#endif

Lib/asyncio/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def __init__(
2727
# ─── indexing helpers ───────────────────────────────────────────
2828
def _format_stack_entry(elem: str|FrameInfo) -> str:
2929
if not isinstance(elem, str):
30-
if elem.lineno == 0 and elem.filename == "":
30+
if elem.location.lineno == 0 and elem.filename == "":
3131
return f"{elem.funcname}"
3232
else:
33-
return f"{elem.funcname} {elem.filename}:{elem.lineno}"
33+
return f"{elem.funcname} {elem.filename}:{elem.location.lineno}"
3434
return elem
3535

3636

Lib/test/support/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3303,3 +3303,10 @@ def linked_to_musl():
33033303
return _linked_to_musl
33043304
_linked_to_musl = tuple(map(int, version.split('.')))
33053305
return _linked_to_musl
3306+
3307+
3308+
def control_characters_c0() -> list[str]:
3309+
"""Returns a list of C0 control characters as strings.
3310+
C0 control characters defined as the byte range 0x00-0x1F, and 0x7F.
3311+
"""
3312+
return [chr(c) for c in range(0x00, 0x20)] + ["\x7F"]

0 commit comments

Comments
 (0)