Skip to content

Commit

Permalink
test_config: get the last PyConfig member (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner authored Jan 26, 2025
1 parent 4c53701 commit 81eefa7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test_pythoncapi_compat_cext.c
Original file line number Diff line number Diff line change
Expand Up @@ -2148,6 +2148,15 @@ test_config(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
assert(PyLong_Check(obj));
Py_DECREF(obj);

// Get the last member
#if 0x030A0000 <= PY_VERSION_HEX
obj = PyConfig_Get("warn_default_encoding");
#else
obj = PyConfig_Get("user_site_directory");
#endif
assert(PyLong_Check(obj));
Py_DECREF(obj);

assert(PyConfig_Get("nonexistent") == NULL);
assert(PyErr_ExceptionMatches(PyExc_ValueError));
PyErr_Clear();
Expand Down

0 comments on commit 81eefa7

Please sign in to comment.