Skip to content

Commit bab4f8b

Browse files
committed
Merge branch 'main' into gh-129605
2 parents 720d6e5 + bb5c687 commit bab4f8b

File tree

13 files changed

+563
-175
lines changed

13 files changed

+563
-175
lines changed

Doc/library/mimetypes.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ the information :func:`init` sets up.
4747
The optional *strict* argument is a flag specifying whether the list of known MIME types
4848
is limited to only the official types `registered with IANA
4949
<https://www.iana.org/assignments/media-types/media-types.xhtml>`_.
50-
When *strict* is ``True`` (the default), only the IANA types are supported; when
51-
*strict* is ``False``, some additional non-standard but commonly used MIME types
52-
are also recognized.
50+
However, the behavior of this module also depends on the underlying operating
51+
system. Only file types recognized by the OS or explicitly registered with
52+
Python's internal database can be identified. When *strict* is ``True`` (the
53+
default), only the IANA types are supported; when *strict* is ``False``, some
54+
additional non-standard but commonly used MIME types are also recognized.
5355

5456
.. versionchanged:: 3.8
5557
Added support for *url* being a :term:`path-like object`.

Include/internal/pycore_opcode_metadata.h

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

Include/internal/pycore_uop_ids.h

Lines changed: 35 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/opcode_ids.h

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

Lib/_opcode_metadata.py

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

Python/bytecodes.c

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "ceval_macros.h"
4646

4747
/* Flow control macros */
48-
#define GO_TO_INSTRUCTION(instname) ((void)0)
4948

5049
#define inst(name, ...) case name:
5150
#define op(name, ...) /* NAME is ignored */
@@ -2019,12 +2018,10 @@ dummy_func(
20192018
ERROR_IF(err != 0, error);
20202019
}
20212020

2022-
inst(INSTRUMENTED_LOAD_SUPER_ATTR, (unused/1 -- )) {
2023-
// cancel out the decrement that will happen in LOAD_SUPER_ATTR; we
2024-
// don't want to specialize instrumented instructions
2025-
PAUSE_ADAPTIVE_COUNTER(this_instr[1].counter);
2026-
GO_TO_INSTRUCTION(LOAD_SUPER_ATTR);
2027-
}
2021+
macro(INSTRUMENTED_LOAD_SUPER_ATTR) =
2022+
counter/1 +
2023+
_LOAD_SUPER_ATTR +
2024+
_PUSH_NULL_CONDITIONAL;
20282025

20292026
family(LOAD_SUPER_ATTR, INLINE_CACHE_ENTRIES_LOAD_SUPER_ATTR) = {
20302027
LOAD_SUPER_ATTR_ATTR,
@@ -2088,7 +2085,10 @@ dummy_func(
20882085
attr = PyStackRef_FromPyObjectSteal(attr_o);
20892086
}
20902087

2091-
macro(LOAD_SUPER_ATTR) = _SPECIALIZE_LOAD_SUPER_ATTR + _LOAD_SUPER_ATTR + _PUSH_NULL_CONDITIONAL;
2088+
macro(LOAD_SUPER_ATTR) =
2089+
_SPECIALIZE_LOAD_SUPER_ATTR +
2090+
_LOAD_SUPER_ATTR +
2091+
_PUSH_NULL_CONDITIONAL;
20922092

20932093
inst(LOAD_SUPER_ATTR_ATTR, (unused/1, global_super_st, class_st, self_st -- attr_st)) {
20942094
PyObject *global_super = PyStackRef_AsPyObjectBorrow(global_super_st);
@@ -4331,18 +4331,23 @@ dummy_func(
43314331
CALL_KW_NON_PY,
43324332
};
43334333

4334-
inst(INSTRUMENTED_CALL_KW, (counter/1, version/2 -- )) {
4335-
int is_meth = !PyStackRef_IsNull(PEEK(oparg + 2));
4336-
int total_args = oparg + is_meth;
4337-
PyObject *function = PyStackRef_AsPyObjectBorrow(PEEK(oparg + 3));
4338-
PyObject *arg = total_args == 0 ? &_PyInstrumentation_MISSING
4339-
: PyStackRef_AsPyObjectBorrow(PEEK(total_args + 1));
4334+
op(_MONITOR_CALL_KW, (callable[1], self_or_null[1], args[oparg], kwnames -- callable[1], self_or_null[1], args[oparg], kwnames)) {
4335+
int is_meth = !PyStackRef_IsNull(self_or_null[0]);
4336+
PyObject *arg;
4337+
if (is_meth) {
4338+
arg = PyStackRef_AsPyObjectBorrow(self_or_null[0]);
4339+
}
4340+
else if (args) {
4341+
arg = PyStackRef_AsPyObjectBorrow(args[0]);
4342+
}
4343+
else {
4344+
arg = &_PyInstrumentation_MISSING;
4345+
}
4346+
PyObject *function = PyStackRef_AsPyObjectBorrow(callable[0]);
43404347
int err = _Py_call_instrumentation_2args(
43414348
tstate, PY_MONITORING_EVENT_CALL,
43424349
frame, this_instr, function, arg);
43434350
ERROR_IF(err, error);
4344-
PAUSE_ADAPTIVE_COUNTER(this_instr[1].counter);
4345-
GO_TO_INSTRUCTION(CALL_KW);
43464351
}
43474352

43484353
op(_MAYBE_EXPAND_METHOD_KW, (callable[1], self_or_null[1], args[oparg], kwnames_in -- func[1], maybe_self[1], args[oparg], kwnames_out)) {
@@ -4520,6 +4525,13 @@ dummy_func(
45204525
_MAYBE_EXPAND_METHOD_KW +
45214526
_DO_CALL_KW;
45224527

4528+
macro(INSTRUMENTED_CALL_KW) =
4529+
counter/1 +
4530+
unused/2 +
4531+
_MONITOR_CALL_KW +
4532+
_MAYBE_EXPAND_METHOD_KW +
4533+
_DO_CALL_KW;
4534+
45234535
op(_CHECK_IS_NOT_PY_CALLABLE_KW, (callable[1], unused[1], unused[oparg], kwnames -- callable[1], unused[1], unused[oparg], kwnames)) {
45244536
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable[0]);
45254537
EXIT_IF(PyFunction_Check(callable_o));
@@ -4566,10 +4578,6 @@ dummy_func(
45664578
_CALL_KW_NON_PY +
45674579
_CHECK_PERIODIC;
45684580

4569-
inst(INSTRUMENTED_CALL_FUNCTION_EX, ( -- )) {
4570-
GO_TO_INSTRUCTION(CALL_FUNCTION_EX);
4571-
}
4572-
45734581
op(_MAKE_CALLARGS_A_TUPLE, (func, unused, callargs, kwargs_in -- func, unused, tuple, kwargs_out)) {
45744582
PyObject *callargs_o = PyStackRef_AsPyObjectBorrow(callargs);
45754583
if (PyTuple_CheckExact(callargs_o)) {
@@ -4678,6 +4686,10 @@ dummy_func(
46784686
_DO_CALL_FUNCTION_EX +
46794687
_CHECK_PERIODIC;
46804688

4689+
macro(INSTRUMENTED_CALL_FUNCTION_EX) =
4690+
_MAKE_CALLARGS_A_TUPLE +
4691+
_DO_CALL_FUNCTION_EX +
4692+
_CHECK_PERIODIC;
46814693

46824694
inst(MAKE_FUNCTION, (codeobj_st -- func)) {
46834695
PyObject *codeobj = PyStackRef_AsPyObjectBorrow(codeobj_st);

0 commit comments

Comments
 (0)