Skip to content

Commit d86cd72

Browse files
fix refleak problems
1 parent 760a9c2 commit d86cd72

File tree

6 files changed

+38
-47
lines changed

6 files changed

+38
-47
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4170,7 +4170,7 @@ dummy_func(
41704170
_CALL_BUILTIN_CLASS +
41714171
_CHECK_PERIODIC_AT_END;
41724172

4173-
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res, c, s, a)) {
4173+
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res, c, s)) {
41744174
/* Builtin METH_O functions */
41754175
PyObject *callable_o = PyStackRef_AsPyObjectBorrow(callable);
41764176

@@ -4194,8 +4194,7 @@ dummy_func(
41944194
ERROR_NO_POP();
41954195
}
41964196
c = callable;
4197-
s = self_or_null;
4198-
a = args[0];
4197+
s = args[0];
41994198
INPUTS_DEAD();
42004199
res = PyStackRef_FromPyObjectSteal(res_o);
42014200
}
@@ -4206,7 +4205,6 @@ dummy_func(
42064205
_CALL_BUILTIN_O +
42074206
POP_TOP +
42084207
POP_TOP +
4209-
POP_TOP +
42104208
_CHECK_PERIODIC_AT_END;
42114209

42124210
op(_CALL_BUILTIN_FAST, (callable, self_or_null, args[oparg] -- res)) {
@@ -4396,8 +4394,8 @@ dummy_func(
43964394
ERROR_NO_POP();
43974395
}
43984396
c = callable;
4399-
s = self_or_null;
4400-
a = args[0];
4397+
s = arguments[0];
4398+
a = arguments[1];
44014399
INPUTS_DEAD();
44024400
res = PyStackRef_FromPyObjectSteal(res_o);
44034401
}

Python/executor_cases.c.h

Lines changed: 7 additions & 10 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: 5 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_bytecodes.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,18 +1064,23 @@ dummy_func(void) {
10641064
none = sym_new_const(ctx, Py_None);
10651065
}
10661066

1067-
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res, c, s, a)) {
1067+
op(_CALL_BUILTIN_O, (callable, self_or_null, args[oparg] -- res, c, s)) {
10681068
res = sym_new_not_null(ctx);
10691069
c = callable;
1070-
s = self_or_null;
1071-
a = args[0];
1070+
if (sym_is_not_null(self_or_null)) {
1071+
args--;
1072+
}
1073+
s = args[0];
10721074
}
10731075

10741076
op(_CALL_METHOD_DESCRIPTOR_O, (callable, self_or_null, args[oparg] -- res, c, s, a)) {
10751077
res = sym_new_not_null(ctx);
10761078
c = callable;
1077-
s = self_or_null;
1078-
a = args[0];
1079+
if (sym_is_not_null(self_or_null)) {
1080+
args--;
1081+
}
1082+
s = args[0];
1083+
a = args[1];
10791084
}
10801085

10811086
op(_GUARD_IS_FALSE_POP, (flag -- )) {

Python/optimizer_cases.c.h

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

0 commit comments

Comments
 (0)