Skip to content

Commit 722cc36

Browse files
committed
Successfully compiles, but crashes
1 parent 564fa12 commit 722cc36

8 files changed

Lines changed: 57 additions & 186 deletions

File tree

Include/internal/pycore_opcode_metadata.h

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

Lib/test/test_monitoring.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,8 +1139,8 @@ def func2():
11391139
('call', 'func2', sys.monitoring.MISSING),
11401140
('line', 'func2', 1),
11411141
('line', 'func2', 2),
1142-
('call', 'append', [2]),
1143-
('C return', 'append', [2]),
1142+
('call', 'append', 2),
1143+
('C return', 'append', 2),
11441144
('line', 'func2', 3),
11451145
('line', 'get_events', 11),
11461146
('call', 'set_events', 2)])
@@ -1435,8 +1435,8 @@ def func2():
14351435
self.check_events(func2, recorders = LOCAL_RECORDERS, expected = [
14361436
('line', 'func2', 1),
14371437
('line', 'func2', 2),
1438-
('call', 'append', [2]),
1439-
('C return', 'append', [2]),
1438+
('call', 'append', 2),
1439+
('C return', 'append', 2),
14401440
('line', 'func2', 3)])
14411441

14421442
def test_try_except(self):
@@ -1914,7 +1914,6 @@ def f():
19141914
""")
19151915

19161916
def get_expected(name, call_method, ns):
1917-
repr_arg = 0 if name == "int" else sys.monitoring.MISSING
19181917
return [
19191918
('line', 'get_events', 10),
19201919
('call', 'f', sys.monitoring.MISSING),
@@ -1925,8 +1924,8 @@ def get_expected(name, call_method, ns):
19251924
('C return', name, sys.monitoring.MISSING),
19261925
*(
19271926
[
1928-
('call', '__repr__', repr_arg),
1929-
('C return', '__repr__', repr_arg),
1927+
('call', '__repr__', sys.monitoring.MISSING),
1928+
('C return', '__repr__', sys.monitoring.MISSING),
19301929
] if call_method else []
19311930
),
19321931
('line', 'get_events', 11),

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
<PreprocessorDefinitions>_USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions)</PreprocessorDefinitions>
106106
<PreprocessorDefinitions Condition="$(IncludeExternals)">_Py_HAVE_ZLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
107107
<AdditionalOptions Condition="'$(UseTailCalls)' == 'true'">/std:clatest %(AdditionalOptions)</AdditionalOptions>
108+
<!-- <AdditionalOptions Condition="'$(UseTailCalls)' == 'true'">/d2DisableTailCallError %(AdditionalOptions)</AdditionalOptions> -->
108109
<PreprocessorDefinitions Condition="'$(UseTailCalls)' == 'true'">Py_TAIL_CALL_INTERP=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
109110
<PreprocessorDefinitions Condition="'$(UseJIT)' == 'true'">_Py_JIT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
110111
<PreprocessorDefinitions Condition="'$(UseTIER2)' != '' and '$(UseTIER2)' != '0'">_Py_TIER2=$(UseTIER2);%(PreprocessorDefinitions)</PreprocessorDefinitions>

Python/bytecodes.c

Lines changed: 8 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2113,19 +2113,12 @@ dummy_func(
21132113
STAT_INC(LOAD_SUPER_ATTR, hit);
21142114
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 2);
21152115
PyTypeObject *cls = (PyTypeObject *)class;
2116-
int method_found = 0;
2117-
PyObject *attr_o = _PySuper_Lookup(cls, self, name,
2118-
Py_TYPE(self)->tp_getattro == PyObject_GenericGetAttr ? &method_found : NULL);
2116+
PyObject *attr_o = _PySuper_Lookup(cls, self, name, NULL);
21192117
if (attr_o == NULL) {
21202118
ERROR_NO_POP();
21212119
}
2122-
if (method_found) {
2123-
self_or_null = self_st; // transfer ownership
2124-
DEAD(self_st);
2125-
} else {
2126-
PyStackRef_CLOSE(self_st);
2127-
self_or_null = PyStackRef_NULL;
2128-
}
2120+
PyStackRef_CLOSE(self_st);
2121+
self_or_null = PyStackRef_NULL;
21292122
DECREF_INPUTS();
21302123

21312124
attr = PyStackRef_FromPyObjectSteal(attr_o);
@@ -2160,39 +2153,13 @@ dummy_func(
21602153
#endif /* ENABLE_SPECIALIZATION_FT */
21612154
}
21622155

2163-
op(_LOAD_ATTR, (owner -- attr, self_or_null[oparg&1])) {
2156+
op(_LOAD_ATTR, (owner -- attr, self_or_null[oparg & 1])) {
21642157
PyObject *name = GETITEM(FRAME_CO_NAMES, oparg >> 1);
2165-
PyObject *attr_o;
2158+
PyObject *attr_o = PyObject_GetAttr(PyStackRef_AsPyObjectBorrow(owner), name);
2159+
PyStackRef_CLOSE(owner);
2160+
ERROR_IF(attr_o == NULL, error);
21662161
if (oparg & 1) {
2167-
/* Designed to work in tandem with CALL, pushes two values. */
2168-
attr_o = NULL;
2169-
int is_meth = _PyObject_GetMethod(PyStackRef_AsPyObjectBorrow(owner), name, &attr_o);
2170-
if (is_meth) {
2171-
/* We can bypass temporary bound method object.
2172-
meth is unbound method and obj is self.
2173-
meth | self | arg1 | ... | argN
2174-
*/
2175-
assert(attr_o != NULL); // No errors on this branch
2176-
self_or_null[0] = owner; // Transfer ownership
2177-
DEAD(owner);
2178-
}
2179-
else {
2180-
/* meth is not an unbound method (but a regular attr, or
2181-
something was returned by a descriptor protocol). Set
2182-
the second element of the stack to NULL, to signal
2183-
CALL that it's not a method call.
2184-
meth | NULL | arg1 | ... | argN
2185-
*/
2186-
PyStackRef_CLOSE(owner);
2187-
ERROR_IF(attr_o == NULL, error);
2188-
self_or_null[0] = PyStackRef_NULL;
2189-
}
2190-
}
2191-
else {
2192-
/* Classic, pushes one value. */
2193-
attr_o = PyObject_GetAttr(PyStackRef_AsPyObjectBorrow(owner), name);
2194-
PyStackRef_CLOSE(owner);
2195-
ERROR_IF(attr_o == NULL, error);
2162+
self_or_null[0] = PyStackRef_NULL;
21962163
}
21972164
attr = PyStackRef_FromPyObjectSteal(attr_o);
21982165
}

Python/ceval_macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
do { \
9999
Py_MUSTTAIL return (_TAIL_CALL_##name)(frame, stack_pointer, tstate, this_instr, oparg); \
100100
} while (0)
101-
# define LABEL(name) TARGET(name)
101+
# define LABEL(name) Py_NO_INLINE TARGET(name)
102102
#elif USE_COMPUTED_GOTOS
103103
# define TARGET(op) TARGET_##op:
104104
# define DISPATCH_GOTO() goto *opcode_targets[opcode]

Python/executor_cases.c.h

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

Python/generated_cases.c.h

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

Python/instrumentation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ _Py_call_instrumentation_2args(
12211221
return call_instrumentation_vector(instr, tstate, event, frame, instr, 4, args);
12221222
}
12231223

1224-
_Py_CODEUNIT *
1224+
Py_NO_INLINE _Py_CODEUNIT *
12251225
_Py_call_instrumentation_jump(
12261226
_Py_CODEUNIT *instr, PyThreadState *tstate, int event,
12271227
_PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNIT *dest)

0 commit comments

Comments
 (0)