summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-02-18 17:19:08 (GMT)
committerGitHub <noreply@github.com>2022-02-18 17:19:08 (GMT)
commitcf345e945f48f54785799390c2e92c5310847bd4 (patch)
treeaf28be223953ba50ff6d0c5110af7a8c2a6c4f84 /Python/ceval.c
parente2c28616ce6c3cdb1013c415125220a0b86b86a1 (diff)
downloadcpython-cf345e945f48f54785799390c2e92c5310847bd4.zip
cpython-cf345e945f48f54785799390c2e92c5310847bd4.tar.gz
cpython-cf345e945f48f54785799390c2e92c5310847bd4.tar.bz2
bpo-46329: Change calling sequence (again) (GH-31373)
* Change calling sequence: Add PUSH_NULL. Merge PRECALL_FUNCTION and PRECALL_METHOD into PRECALL.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 5a6de5b..471bbde 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1584,7 +1584,7 @@ pop_frame(PyThreadState *tstate, InterpreterFrame *frame)
return prev_frame;
}
-/* It is only between a PRECALL_METHOD/FUNCTION instruction and the following CALL,
+/* It is only between the PRECALL instruction and the following CALL,
* that these values have any meaning.
*/
typedef struct {
@@ -1872,6 +1872,12 @@ handle_eval_breaker:
DISPATCH();
}
+ TARGET(PUSH_NULL) {
+ /* Use BASIC_PUSH as NULL is not a valid object pointer */
+ BASIC_PUSH(NULL);
+ DISPATCH();
+ }
+
TARGET(UNARY_POSITIVE) {
PyObject *value = TOP();
PyObject *res = PyNumber_Positive(value);
@@ -4476,25 +4482,7 @@ handle_eval_breaker:
NOTRACE_DISPATCH();
}
- TARGET(PRECALL_FUNCTION) {
- /* Move ownership of reference from stack to call_shape */
- call_shape.callable = PEEK(oparg + 1);
- call_shape.postcall_shrink = 1;
-
- call_shape.total_args = oparg;
- assert(call_shape.kwnames == NULL);
-#ifdef Py_STATS
- extern int _PySpecialization_ClassifyCallable(PyObject *);
- SpecializationStats *stats =
- &_py_stats.opcode_stats[PRECALL_FUNCTION].specialization;
- stats->failure++;
- int kind = _PySpecialization_ClassifyCallable(call_shape.callable);
- stats->failure_kinds[kind]++;
-#endif
- DISPATCH();
- }
-
- TARGET(PRECALL_METHOD) {
+ TARGET(PRECALL) {
/* Designed to work in tamdem with LOAD_METHOD. */
/* `meth` is NULL when LOAD_METHOD thinks that it's not
a method call.
@@ -4533,7 +4521,7 @@ handle_eval_breaker:
#ifdef Py_STATS
extern int _PySpecialization_ClassifyCallable(PyObject *);
SpecializationStats *stats =
- &_py_stats.opcode_stats[PRECALL_METHOD].specialization;
+ &_py_stats.opcode_stats[PRECALL].specialization;
stats->failure++;
int kind = _PySpecialization_ClassifyCallable(call_shape.callable);
stats->failure_kinds[kind]++;
@@ -5118,6 +5106,8 @@ handle_eval_breaker:
Py_DECREF(callargs);
Py_XDECREF(kwargs);
+ STACK_SHRINK(1);
+ assert(TOP() == NULL);
SET_TOP(result);
if (result == NULL) {
goto error;