[Python-checkins] r46446 - python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
georg.brandl
python-checkins at python.org
Sat May 27 13:35:35 CEST 2006
Author: georg.brandl
Date: Sat May 27 13:35:35 2006
New Revision: 46446
Modified:
python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
Log:
Prettier error for errno not being an integer.
Modified: python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
==============================================================================
--- python/branches/sreifschneider-newnewexcept/Objects/exceptions.c (original)
+++ python/branches/sreifschneider-newnewexcept/Objects/exceptions.c Sat May 27 13:35:35 2006
@@ -771,8 +771,12 @@
/* Set errno to the POSIX errno, and winerror to the Win32
error code. */
errcode = PyInt_AsLong(self->myerrno);
- if (errcode == -1 && PyErr_Occurred())
+ if (errcode == -1 && PyErr_Occurred()) {
+ if (PyErr_ExceptionMatches(PyExc_TypeError)
+ /* give a clearer error message */
+ PyErr_SetString(PyExc_TypeError, "errno has to be an integer");
goto failed;
+ }
posix_errno = winerror_to_errno(errcode);
self->winerror = self->myerrno;
More information about the Python-checkins
mailing list