Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a0ecb7

Browse files
committed
simplify the intrinsic
1 parent 3b6098d commit 8a0ecb7

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

Objects/funcobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ _Py_set_function_type_params(PyThreadState *unused, PyObject *func,
676676
return NULL;
677677
}
678678
Py_XSETREF(f->func_typeparams, Py_NewRef(type_params));
679-
Py_RETURN_NONE;
679+
return Py_NewRef(func);
680680
}
681681

682682

Python/compile.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2284,10 +2284,8 @@ compiler_function(struct compiler *c, stmt_ty s, int is_async)
22842284
}
22852285
Py_DECREF(co);
22862286
if (asdl_seq_LEN(typeparams) > 0) {
2287-
ADDOP_I(c, loc, COPY, 1);
22882287
RETURN_IF_ERROR(compiler_nameop(c, loc, &_Py_STR(type_params), Load));
22892288
ADDOP_I(c, loc, CALL_INTRINSIC_2, INTRINSIC_SET_FUNCTION_TYPE_PARAMS);
2290-
ADDOP(c, loc, POP_TOP);
22912289

22922290
if (is_typeparams_in_class) {
22932291
c->u->u_metadata.u_argcount += 1;

0 commit comments

Comments
 (0)