[Python-checkins] r46401 - in python/branches/sreifschneider-newnewexcept: Objects/exceptions.c PCbuild/pythoncore.vcproj Python/errors.c Python/pythonrun.c
tim.peters
python-checkins at python.org
Fri May 26 21:29:45 CEST 2006
Author: tim.peters
Date: Fri May 26 21:29:45 2006
New Revision: 46401
Modified:
python/branches/sreifschneider-newnewexcept/Objects/exceptions.c
python/branches/sreifschneider-newnewexcept/PCbuild/pythoncore.vcproj
python/branches/sreifschneider-newnewexcept/Python/errors.c
python/branches/sreifschneider-newnewexcept/Python/pythonrun.c
Log:
Some fixes to help this work on Windows. Not there yet.
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 21:29:45 2006
@@ -778,14 +778,14 @@
Py_VISIT(self->strerror);
Py_VISIT(self->filename);
Py_VISIT(self->winerror);
- return BaseException_traverse((BaseExceptionObject *)self, visit, arg)
+ return BaseException_traverse((BaseExceptionObject *)self, visit, arg);
}
static PyObject *
WindowsError_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *o_errcode = NULL;
- PyObject *errcode = NULL;
+ long errcode;
WindowsErrorObject *self = NULL;
long posix_errno;
@@ -808,7 +808,7 @@
self->myerrno = o_errcode;
- return self;
+ return (PyObject *)self;
failed:
/* Could not set errno. */
Py_XDECREF(o_errcode);
@@ -820,7 +820,8 @@
WindowsError_init(WindowsErrorObject *self, PyObject *args, PyObject *kwds)
{
PyObject *o_errcode = NULL;
- PyObject *errcode = NULL;
+ long errcode;
+ long posix_errno;
if (EnvironmentError_init((EnvironmentErrorObject *)self, args, kwds) == -1)
return -1;
@@ -835,20 +836,17 @@
self->winerror = self->myerrno;
o_errcode = PyInt_FromLong(posix_errno);
- if (!o_errcode) {
- Py_DECREF(errcode);
+ if (!o_errcode)
return -1;
- }
self->myerrno = o_errcode;
- Py_DECREF(errcode);
return 0;
}
static PyObject *
-WindowsError_str(PyObject *self)
+WindowsError_str(WindowsErrorObject *self)
{
PyObject *repr = NULL;
PyObject *fmt = NULL;
@@ -882,13 +880,9 @@
Py_DECREF(tuple);
}
else
- rtnval = EnvironmentError_str(self);
+ rtnval = EnvironmentError_str((EnvironmentErrorObject *)self);
finally:
- /* GB: where is filename, serrno and strerror declared? */
- Py_XDECREF(filename);
- Py_XDECREF(serrno);
- Py_XDECREF(strerror);
Py_XDECREF(repr);
Py_XDECREF(fmt);
Py_XDECREF(tuple);
@@ -909,7 +903,14 @@
{NULL} /* Sentinel */
};
-ComplexExtendsException(PyExc_OSError, WindowsError, WindowsError, EnvironmentError_dealloc, WindowsError_members, WindowsError_str, "MS-Windows OS system call failed.");
+ComplexExtendsException(PyExc_OSError,
+ WindowsError,
+ WindowsError,
+ WindowsError_dealloc,
+ WindowsError_members,
+ WindowsError_str,
+ "MS-Windows OS system call failed.",
+ 1);
#endif /* MS_WINDOWS */
Modified: python/branches/sreifschneider-newnewexcept/PCbuild/pythoncore.vcproj
==============================================================================
--- python/branches/sreifschneider-newnewexcept/PCbuild/pythoncore.vcproj (original)
+++ python/branches/sreifschneider-newnewexcept/PCbuild/pythoncore.vcproj Fri May 26 21:29:45 2006
@@ -494,7 +494,7 @@
RelativePath="..\Python\errors.c">
</File>
<File
- RelativePath="..\Python\exceptions.c">
+ RelativePath="..\Objects\exceptions.c">
</File>
<File
RelativePath="..\Objects\fileobject.c">
Modified: python/branches/sreifschneider-newnewexcept/Python/errors.c
==============================================================================
--- python/branches/sreifschneider-newnewexcept/Python/errors.c (original)
+++ python/branches/sreifschneider-newnewexcept/Python/errors.c Fri May 26 21:29:45 2006
@@ -589,11 +589,11 @@
PyFile_WriteString("Exception ", f);
if (t) {
char* className = PyExceptionClass_Name(t);
+ PyObject* moduleName;
char *dot = strrchr(className, '.');
if (dot != NULL)
className = dot+1;
- PyObject* moduleName =
- PyObject_GetAttrString(t, "__module__");
+ moduleName = PyObject_GetAttrString(t, "__module__");
if (moduleName == NULL)
PyFile_WriteString("<unknown>", f);
Modified: python/branches/sreifschneider-newnewexcept/Python/pythonrun.c
==============================================================================
--- python/branches/sreifschneider-newnewexcept/Python/pythonrun.c (original)
+++ python/branches/sreifschneider-newnewexcept/Python/pythonrun.c Fri May 26 21:29:45 2006
@@ -1134,10 +1134,10 @@
else if (PyExceptionClass_Check(exception)) {
char* className = PyExceptionClass_Name(exception);
char *dot = strrchr(className, '.');
+ PyObject* moduleName;
if (dot != NULL)
className = dot+1;
- PyObject* moduleName =
- PyObject_GetAttrString(exception, "__module__");
+ moduleName = PyObject_GetAttrString(exception, "__module__");
if (moduleName == NULL)
err = PyFile_WriteString("<unknown>", f);
More information about the Python-checkins
mailing list