Skip to content

Commit 963fd40

Browse files
committed
Add test for happy path
1 parent 45f4ddb commit 963fd40

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Lib/test/test_call.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,9 @@ def static_no_args():
910910
def positional_only(arg, /):
911911
pass
912912

913+
def method_with_self(self, arg, kwarg=1):
914+
pass
915+
913916
def missing_self(another_arg):
914917
pass
915918

@@ -925,6 +928,9 @@ def check_raises_type_error(self, message):
925928
yield
926929
self.assertEqual(str(cm.exception), message)
927930

931+
def test_happy_path(self):
932+
self.assertIs(None, A().method_with_self(1, kwarg=2))
933+
928934
def test_too_many_positional_but_missing_self(self):
929935
msg = "A.missing_self() takes 1 positional argument but 2 were given. Did you forget to declare 'self' as the first parameter?"
930936
with self.check_raises_type_error(msg):

Python/ceval.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,8 +1623,6 @@ too_many_positional(PyThreadState *tstate, PyCodeObject *co,
16231623
". Did you forget the 'self' parameter in the function definition?");
16241624
if (self_hint == NULL) {
16251625
self_hint = Py_GetConstant(Py_CONSTANT_EMPTY_STR)
1626-
Py_DECREF(sig);
1627-
Py_DECREF(kwonly_sig);
16281626
}
16291627
}
16301628
_PyErr_Format(tstate, PyExc_TypeError,

0 commit comments

Comments
 (0)