Skip to content

Commit ed3209b

Browse files
committed
Merge branch 'main' into inlinecomp2
* main: pythongh-101440: fix json snippet error in logging-cookbook.rst (python#101439) pythongh-99276 - Updated Doc/faq/general.rst (python#101396) Add JOBS parameter to docs Makefile (python#101395) pythongh-98831: rewrite GET_LEN, GET_ITER, BEFORE_WITH and a few simple opcodes in the instruction definition DSL (python#101443) pythongh-77607: Improve accuracy of os.path.join docs (python#101406) Fixes typo in asyncio.TaskGroup context manager code example (python#101449) pythongh-98831: Clean up and add cache size static_assert to macro (python#101442) pythongh-99955: use SUCCESS/ERROR return values in optimizer and assembler. Use RETURN_IF_ERROR where appropriate. Fix a couple of bugs. (python#101412)
2 parents 43db9b8 + 20c11f2 commit ed3209b

File tree

11 files changed

+236
-272
lines changed

11 files changed

+236
-272
lines changed

Doc/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ VENVDIR = ./venv
99
SPHINXBUILD = PATH=$(VENVDIR)/bin:$$PATH sphinx-build
1010
SPHINXLINT = PATH=$(VENVDIR)/bin:$$PATH sphinx-lint
1111
BLURB = PATH=$(VENVDIR)/bin:$$PATH blurb
12+
JOBS = auto
1213
PAPER =
1314
SOURCES =
1415
DISTVERSION = $(shell $(PYTHON) tools/extensions/patchlevel.py)
@@ -18,7 +19,7 @@ SPHINXERRORHANDLING = -W
1819
PAPEROPT_a4 = -D latex_elements.papersize=a4paper
1920
PAPEROPT_letter = -D latex_elements.papersize=letterpaper
2021

21-
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j auto \
22+
ALLSPHINXOPTS = -b $(BUILDER) -d build/doctrees $(PAPEROPT_$(PAPER)) -j $(JOBS) \
2223
$(SPHINXOPTS) $(SPHINXERRORHANDLING) . build/$(BUILDER) $(SOURCES)
2324

2425
.PHONY: help

Doc/faq/general.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ Are there any published articles about Python that I can reference?
248248

249249
It's probably best to cite your favorite book about Python.
250250

251-
The very first article about Python was written in 1991 and is now quite
252-
outdated.
251+
The `very first article <https://ir.cwi.nl/pub/18204>`_ about Python was
252+
written in 1991 and is now quite outdated.
253253

254254
Guido van Rossum and Jelke de Boer, "Interactively Testing Remote Servers
255255
Using the Python Programming Language", CWI Quarterly, Volume 4, Issue 4

Doc/howto/logging-cookbook.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ Suppose you configure logging with the following JSON:
307307
"class": "logging.StreamHandler",
308308
"level": "INFO",
309309
"formatter": "simple",
310-
"stream": "ext://sys.stdout",
310+
"stream": "ext://sys.stdout"
311311
},
312312
"stderr": {
313313
"class": "logging.StreamHandler",

Doc/library/asyncio-task.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ To actually run a coroutine, asyncio provides the following mechanisms:
121121

122122
print(f"started at {time.strftime('%X')}")
123123

124-
# The wait is implicit when the context manager exits.
124+
# The await is implicit when the context manager exits.
125125

126126
print(f"finished at {time.strftime('%X')}")
127127

Doc/library/os.path.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,11 @@ the :mod:`glob` module.)
308308

309309
Join one or more path segments intelligently. The return value is the
310310
concatenation of *path* and all members of *\*paths*, with exactly one
311-
directory separator following each non-empty part except the last. That is,
312-
if the last part is empty, the result will end in a separator. If
313-
a segment is an absolute path (which on Windows requires both a drive and a
314-
root), then all previous segments are ignored and joining continues from the
315-
absolute path segment.
311+
directory separator following each non-empty part, except the last. That is,
312+
the result will only end in a separator if the last part is either empty or
313+
ends in a separator. If a segment is an absolute path (which on Windows
314+
requires both a drive and a root), then all previous segments are ignored and
315+
joining continues from the absolute path segment.
316316

317317
On Windows, the drive is not reset when a rooted path segment (e.g.,
318318
``r'\foo'``) is encountered. If a segment is on a different drive or is an

Python/bytecodes.c

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,8 +2058,7 @@ dummy_func(
20582058
}
20592059
}
20602060

2061-
// stack effect: ( -- )
2062-
inst(JUMP_BACKWARD_NO_INTERRUPT) {
2061+
inst(JUMP_BACKWARD_NO_INTERRUPT, (--)) {
20632062
/* This bytecode is used in the `yield from` or `await` loop.
20642063
* If there is an interrupt, we want it handled in the innermost
20652064
* generator or coroutine, so we deliberately do not check it here.
@@ -2068,18 +2067,12 @@ dummy_func(
20682067
JUMPBY(-oparg);
20692068
}
20702069

2071-
// stack effect: ( -- __0)
2072-
inst(GET_LEN) {
2070+
inst(GET_LEN, (obj -- obj, len_o)) {
20732071
// PUSH(len(TOS))
2074-
Py_ssize_t len_i = PyObject_Length(TOP());
2075-
if (len_i < 0) {
2076-
goto error;
2077-
}
2078-
PyObject *len_o = PyLong_FromSsize_t(len_i);
2079-
if (len_o == NULL) {
2080-
goto error;
2081-
}
2082-
PUSH(len_o);
2072+
Py_ssize_t len_i = PyObject_Length(obj);
2073+
ERROR_IF(len_i < 0, error);
2074+
len_o = PyLong_FromSsize_t(len_i);
2075+
ERROR_IF(len_o == NULL, error);
20832076
}
20842077

20852078
inst(MATCH_CLASS, (subject, type, names -- attrs)) {
@@ -2115,15 +2108,11 @@ dummy_func(
21152108
ERROR_IF(values_or_none == NULL, error);
21162109
}
21172110

2118-
// stack effect: ( -- )
2119-
inst(GET_ITER) {
2111+
inst(GET_ITER, (iterable -- iter)) {
21202112
/* before: [obj]; after [getiter(obj)] */
2121-
PyObject *iterable = TOP();
2122-
PyObject *iter = PyObject_GetIter(iterable);
2123-
Py_DECREF(iterable);
2124-
SET_TOP(iter);
2125-
if (iter == NULL)
2126-
goto error;
2113+
iter = PyObject_GetIter(iterable);
2114+
DECREF_INPUTS();
2115+
ERROR_IF(iter == NULL, error);
21272116
}
21282117

21292118
// stack effect: ( -- )
@@ -2318,10 +2307,10 @@ dummy_func(
23182307
PREDICT(GET_AWAITABLE);
23192308
}
23202309

2321-
// stack effect: ( -- __0)
2322-
inst(BEFORE_WITH) {
2323-
PyObject *mgr = TOP();
2324-
PyObject *res;
2310+
inst(BEFORE_WITH, (mgr -- exit, res)) {
2311+
/* pop the context manager, push its __exit__ and the
2312+
* value returned from calling its __enter__
2313+
*/
23252314
PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__enter__));
23262315
if (enter == NULL) {
23272316
if (!_PyErr_Occurred(tstate)) {
@@ -2332,7 +2321,7 @@ dummy_func(
23322321
}
23332322
goto error;
23342323
}
2335-
PyObject *exit = _PyObject_LookupSpecial(mgr, &_Py_ID(__exit__));
2324+
exit = _PyObject_LookupSpecial(mgr, &_Py_ID(__exit__));
23362325
if (exit == NULL) {
23372326
if (!_PyErr_Occurred(tstate)) {
23382327
_PyErr_Format(tstate, PyExc_TypeError,
@@ -2344,14 +2333,13 @@ dummy_func(
23442333
Py_DECREF(enter);
23452334
goto error;
23462335
}
2347-
SET_TOP(exit);
2348-
Py_DECREF(mgr);
2336+
DECREF_INPUTS();
23492337
res = _PyObject_CallNoArgs(enter);
23502338
Py_DECREF(enter);
23512339
if (res == NULL) {
2352-
goto error;
2340+
Py_DECREF(exit);
2341+
ERROR_IF(true, error);
23532342
}
2354-
PUSH(res);
23552343
}
23562344

23572345
inst(WITH_EXCEPT_START, (exit_func, lasti, unused, val -- exit_func, lasti, unused, val, res)) {
@@ -2474,8 +2462,7 @@ dummy_func(
24742462
GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS);
24752463
}
24762464

2477-
// stack effect: ( -- )
2478-
inst(KW_NAMES) {
2465+
inst(KW_NAMES, (--)) {
24792466
assert(kwnames == NULL);
24802467
assert(oparg < PyTuple_GET_SIZE(consts));
24812468
kwnames = GETITEM(consts, oparg);
@@ -3257,8 +3244,7 @@ dummy_func(
32573244
PEEK(oparg) = top;
32583245
}
32593246

3260-
// stack effect: ( -- )
3261-
inst(EXTENDED_ARG) {
3247+
inst(EXTENDED_ARG, (--)) {
32623248
assert(oparg);
32633249
assert(cframe.use_tracing == 0);
32643250
opcode = _Py_OPCODE(*next_instr);
@@ -3267,8 +3253,7 @@ dummy_func(
32673253
DISPATCH_GOTO();
32683254
}
32693255

3270-
// stack effect: ( -- )
3271-
inst(CACHE) {
3256+
inst(CACHE, (--)) {
32723257
Py_UNREACHABLE();
32733258
}
32743259

0 commit comments

Comments
 (0)