Staging
v0.5.1
https://github.com/python/cpython
Revision 4594565b56e9c99d2d3fb7549041bbca5ecba8e2 authored by Miss Islington (bot) on 09 December 2019, 06:59:04 UTC, committed by Chris Withers on 09 December 2019, 06:59:04 UTC
This means a clearer message is now shown when patch.object is called with two string arguments, rather than a class and a string argument.
(cherry picked from commit cd90a52983db34896a6335a572d55bdda274778f)

Co-authored-by: Elena Oat <oat.elena@gmail.com>
1 parent 184a381
Raw File
Tip revision: 4594565b56e9c99d2d3fb7549041bbca5ecba8e2 authored by Miss Islington (bot) on 09 December 2019, 06:59:04 UTC
bpo-38669: patch.object now raises a helpful error (GH17510)
Tip revision: 4594565
_testinternalcapi.c
/*
 * C Extension module to test Python internal C APIs (Include/internal).
 */

#if !defined(Py_BUILD_CORE_BUILTIN) && !defined(Py_BUILD_CORE_MODULE)
#  error "Py_BUILD_CORE_BUILTIN or Py_BUILD_CORE_MODULE must be defined"
#endif

#define PY_SSIZE_T_CLEAN

#include "Python.h"
#include "pycore_initconfig.h"


static PyObject *
get_configs(PyObject *self, PyObject *Py_UNUSED(args))
{
    return _Py_GetConfigsAsDict();
}


static PyMethodDef TestMethods[] = {
    {"get_configs", get_configs, METH_NOARGS},
    {NULL, NULL} /* sentinel */
};


static struct PyModuleDef _testcapimodule = {
    PyModuleDef_HEAD_INIT,
    "_testinternalcapi",
    NULL,
    -1,
    TestMethods,
    NULL,
    NULL,
    NULL,
    NULL
};


PyMODINIT_FUNC
PyInit__testinternalcapi(void)
{
    return PyModule_Create(&_testcapimodule);
}
back to top