diff options
author | Larry Hastings <larry@hastings.org> | 2014-02-10 11:43:57 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2014-02-10 11:43:57 (GMT) |
commit | 8f9f0f12e845034080525c6a80d52215533cb2a4 (patch) | |
tree | e582640185a4d455abc59b397503d5a029d66dce /Python/errors.c | |
parent | 1c143b19c88021e323d4a88315efc8879b1c631d (diff) | |
download | cpython-8f9f0f12e845034080525c6a80d52215533cb2a4.zip cpython-8f9f0f12e845034080525c6a80d52215533cb2a4.tar.gz cpython-8f9f0f12e845034080525c6a80d52215533cb2a4.tar.bz2 |
Issue #20517: Removed unnecessary new (short-lived) functions from PyErr.
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 104 |
1 files changed, 3 insertions, 101 deletions
diff --git a/Python/errors.c b/Python/errors.c index 0057e5e..996292a 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -520,17 +520,6 @@ PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename) return result; } -PyObject * -PyErr_SetFromErrnoWithFilenames(PyObject *exc, const char *filename, const char *filename2) -{ - PyObject *name = filename ? PyUnicode_DecodeFSDefault(filename) : NULL; - PyObject *name2 = filename2 ? PyUnicode_DecodeFSDefault(filename2) : NULL; - PyObject *result = PyErr_SetFromErrnoWithFilenameObjects(exc, name, name2); - Py_XDECREF(name); - Py_XDECREF(name2); - return result; -} - #ifdef MS_WINDOWS PyObject * PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename) @@ -542,21 +531,6 @@ PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename) Py_XDECREF(name); return result; } - -PyObject * -PyErr_SetFromErrnoWithUnicodeFilenames(PyObject *exc, const Py_UNICODE *filename, const Py_UNICODE *filename2) -{ - PyObject *name = filename ? - PyUnicode_FromUnicode(filename, wcslen(filename)) : - NULL; - PyObject *name2 = filename2 ? - PyUnicode_FromUnicode(filename2, wcslen(filename2)) : - NULL; - PyObject *result = PyErr_SetFromErrnoWithFilenameObjects(exc, name, name2); - Py_XDECREF(name); - Py_XDECREF(name2); - return result; -} #endif /* MS_WINDOWS */ PyObject * @@ -654,23 +628,6 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilename( return ret; } -PyObject *PyErr_SetExcFromWindowsErrWithFilenames( - PyObject *exc, - int ierr, - const char *filename, - const char *filename2) -{ - PyObject *name = filename ? PyUnicode_DecodeFSDefault(filename) : NULL; - PyObject *name2 = filename2 ? PyUnicode_DecodeFSDefault(filename2) : NULL; - PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObjects(exc, - ierr, - name, - name2); - Py_XDECREF(name); - Py_XDECREF(name2); - return ret; -} - PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilename( PyObject *exc, int ierr, @@ -687,51 +644,15 @@ PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilename( return ret; } -PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilenames( - PyObject *exc, - int ierr, - const Py_UNICODE *filename, - const Py_UNICODE *filename2) -{ - PyObject *name = filename ? - PyUnicode_FromUnicode(filename, wcslen(filename)) : - NULL; - PyObject *name2 = filename2 ? - PyUnicode_FromUnicode(filename2, wcslen(filename2)) : - NULL; - PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObjects(exc, - ierr, - name, - name2); - Py_XDECREF(name); - Py_XDECREF(name2); - return ret; -} - PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr) { - return PyErr_SetExcFromWindowsErrWithFilenames(exc, ierr, NULL, NULL); + return PyErr_SetExcFromWindowsErrWithFilename(exc, ierr, NULL); } PyObject *PyErr_SetFromWindowsErr(int ierr) { - return PyErr_SetExcFromWindowsErrWithFilenames(PyExc_OSError, - ierr, NULL, NULL); -} - -PyObject *PyErr_SetFromWindowsErrWithFilenames( - int ierr, - const char *filename, - const char *filename2) -{ - PyObject *name = filename ? PyUnicode_DecodeFSDefault(filename) : NULL; - PyObject *name2 = filename2 ? PyUnicode_DecodeFSDefault(filename2) : NULL; - PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObjects( - PyExc_OSError, - ierr, name, name2); - Py_XDECREF(name); - Py_XDECREF(name2); - return result; + return PyErr_SetExcFromWindowsErrWithFilename(PyExc_OSError, + ierr, NULL); } PyObject *PyErr_SetFromWindowsErrWithFilename( @@ -759,25 +680,6 @@ PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename( Py_XDECREF(name); return result; } - -PyObject *PyErr_SetFromWindowsErrWithUnicodeFilenames( - int ierr, - const Py_UNICODE *filename, - const Py_UNICODE *filename2) -{ - PyObject *name = filename ? - PyUnicode_FromUnicode(filename, wcslen(filename)) : - NULL; - PyObject *name2 = filename2 ? - PyUnicode_FromUnicode(filename2, wcslen(filename2)) : - NULL; - PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObjects( - PyExc_OSError, - ierr, name, name2); - Py_XDECREF(name); - Py_XDECREF(name2); - return result; -} #endif /* MS_WINDOWS */ PyObject * |