@@ -4550,6 +4550,28 @@ new_hamt(PyObject *self, PyObject *args)
|
4550 | 4550 | } |
4551 | 4551 | |
4552 | 4552 | |
| 4553 | +/* def bad_get(self, obj, cls): |
| 4554 | + cls() |
| 4555 | + return repr(self) |
| 4556 | +*/ |
| 4557 | +static PyObject* |
| 4558 | +bad_get(PyObject *module, PyObject *const *args, Py_ssize_t nargs) |
| 4559 | +{ |
| 4560 | +if (nargs != 3) { |
| 4561 | +PyErr_SetString(PyExc_TypeError, "bad_get requires exactly 3 arguments"); |
| 4562 | +return NULL; |
| 4563 | + } |
| 4564 | + |
| 4565 | +PyObject *res = PyObject_CallObject(args[2], NULL); |
| 4566 | +if (res == NULL) { |
| 4567 | +return NULL; |
| 4568 | + } |
| 4569 | +Py_DECREF(res); |
| 4570 | + |
| 4571 | +return PyObject_Repr(args[0]); |
| 4572 | +} |
| 4573 | + |
| 4574 | + |
4553 | 4575 | static PyObject * |
4554 | 4576 | encode_locale_ex(PyObject *self, PyObject *args) |
4555 | 4577 | { |
@@ -5017,6 +5039,7 @@ static PyMethodDef TestMethods[] = {
|
5017 | 5039 | {"get_mapping_items", get_mapping_items, METH_O}, |
5018 | 5040 | {"test_pythread_tss_key_state", test_pythread_tss_key_state, METH_VARARGS}, |
5019 | 5041 | {"hamt", new_hamt, METH_NOARGS}, |
| 5042 | + {"bad_get", bad_get, METH_FASTCALL}, |
5020 | 5043 | {"EncodeLocaleEx", encode_locale_ex, METH_VARARGS}, |
5021 | 5044 | {"DecodeLocaleEx", decode_locale_ex, METH_VARARGS}, |
5022 | 5045 | {"get_coreconfig", get_coreconfig, METH_NOARGS}, |
|