diff options
author | Gregory P. Smith <greg@krypto.org> | 2015-02-04 01:04:31 -0800 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2015-02-04 01:04:31 -0800 |
commit | ef3e7a803f7e575ce26cb2e4e29e46da2d89c124 (patch) | |
tree | ec9df5664c8029412e3923f694c3bbbbc9434ee6 /Python/errors.c | |
parent | f97d8cc43c09116bebd4d54b7ef5baf472058de3 (diff) | |
parent | 7c584647e0c2fe3f84299cab3b7941d1595de32f (diff) | |
download | cpython-ef3e7a803f7e575ce26cb2e4e29e46da2d89c124.tar.gz |
Skip some tests that require a subinterpreter launched with -E or -I when the
interpreter under test is being run in an environment that requires the use of
environment variables such as PYTHONHOME in order to function at all.
Adds a test.script_helper.interpreter_requires_environment() function
to be used with @unittest.skipIf on stdlib test methods requiring this.
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Python/errors.c b/Python/errors.c index a980481110..940aef33a2 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -773,19 +773,11 @@ PyErr_BadInternalCall(void) #define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) - PyObject * -PyErr_Format(PyObject *exception, const char *format, ...) +PyErr_FormatV(PyObject *exception, const char *format, va_list vargs) { - va_list vargs; PyObject* string; -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - #ifdef Py_DEBUG /* in debug mode, PyEval_EvalFrameEx() fails with an assertion error if an exception is set when it is called */ @@ -795,11 +787,24 @@ PyErr_Format(PyObject *exception, const char *format, ...) string = PyUnicode_FromFormatV(format, vargs); PyErr_SetObject(exception, string); Py_XDECREF(string); - va_end(vargs); return NULL; } +PyObject * +PyErr_Format(PyObject *exception, const char *format, ...) +{ + va_list vargs; +#ifdef HAVE_STDARG_PROTOTYPES + va_start(vargs, format); +#else + va_start(vargs); +#endif + PyErr_FormatV(exception, format, vargs); + va_end(vargs); + return NULL; +} + PyObject * PyErr_NewException(const char *name, PyObject *base, PyObject *dict) |