bpo-25750: Fix a compiler warning introduced in GH-9084. (GH-10234) · python/cpython@b1dede3 (original) (raw)

`@@ -4586,18 +4586,18 @@ new_hamt(PyObject *self, PyObject *args)

`

4586

4586

`static PyObject*

`

4587

4587

`bad_get(PyObject *module, PyObject *const *args, Py_ssize_t nargs)

`

4588

4588

`{

`

4589

``

`-

if (nargs != 3) {

`

4590

``

`-

PyErr_SetString(PyExc_TypeError, "bad_get requires exactly 3 arguments");

`

``

4589

`+

PyObject *self, *obj, *cls;

`

``

4590

`+

if (!_PyArg_UnpackStack(args, nargs, "bad_get", 3, 3, &self, &obj, &cls)) {

`

4591

4591

`return NULL;

`

4592

4592

` }

`

4593

4593

``

4594

``

`-

PyObject *res = PyObject_CallObject(args[2], NULL);

`

``

4594

`+

PyObject *res = PyObject_CallObject(cls, NULL);

`

4595

4595

`if (res == NULL) {

`

4596

4596

`return NULL;

`

4597

4597

` }

`

4598

4598

`Py_DECREF(res);

`

4599

4599

``

4600

``

`-

return PyObject_Repr(args[0]);

`

``

4600

`+

return PyObject_Repr(self);

`

4601

4601

`}

`

4602

4602

``

4603

4603

``

`@@ -4960,7 +4960,7 @@ static PyMethodDef TestMethods[] = {

`

4960

4960

` {"get_mapping_items", get_mapping_items, METH_O},

`

4961

4961

` {"test_pythread_tss_key_state", test_pythread_tss_key_state, METH_VARARGS},

`

4962

4962

` {"hamt", new_hamt, METH_NOARGS},

`

4963

``

`-

{"bad_get", bad_get, METH_FASTCALL},

`

``

4963

`+

{"bad_get", (PyCFunction)bad_get, METH_FASTCALL},

`

4964

4964

` {"EncodeLocaleEx", encode_locale_ex, METH_VARARGS},

`

4965

4965

` {"DecodeLocaleEx", decode_locale_ex, METH_VARARGS},

`

4966

4966

` {"get_global_config", get_global_config, METH_NOARGS},

`