[Python-checkins] r46419 - python/branches/sreifschneider-newnewexcept/Objects/exceptions.c

tim.peters python-checkins at python.org
Fri May 26 23:26:10 CEST 2006


Author: tim.peters
Date: Fri May 26 23:26:09 2006
New Revision: 46419

Modified:
   python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
Log:
WindowsError_new():  Removed needless initializations.

Richard & Georg:  this is in fact where the

     "an integer is required"

error is coming from, via the WindowsError_new line:

    errcode = PyInt_AsLong(self->myerrno);

self->myerrno is Py_None at this point, so
PyInt_AsLong() complains.

It looks like the function being called at the time
was ntpath.isfile.  Knowing that, I can reproduce it
easily:

>>> import os.path
[27025 refs]
>>> os.path.isfile('abc')
False
XXX undetected error
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: an integer is required

Note the "XXX undetected error"!  That comes out of
ceval.c.  Your turn ;-)


Modified: python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
==============================================================================
--- python/branches/sreifschneider-newnewexcept/Objects/exceptions.c	(original)
+++ python/branches/sreifschneider-newnewexcept/Objects/exceptions.c	Fri May 26 23:26:09 2006
@@ -759,9 +759,9 @@
 static PyObject *
 WindowsError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
 {
-    PyObject *o_errcode = NULL;
+    PyObject *o_errcode;
     long errcode;
-    PyWindowsErrorObject *self = NULL;
+    PyWindowsErrorObject *self;
     long posix_errno;
 
     self = (PyWindowsErrorObject *)EnvironmentError_new(type, args, kwds);


More information about the Python-checkins mailing list