List:MaxDB« Previous MessageNext Message »
From:Christian Ullrich Date:June 29 2007 5:58pm
Subject:Re: Python 2.5
View as plain text  
* Christian Ullrich wrote on Wednesday, 2007-06-20:

> Back in March, someone reported that the python interface didn't work
> correctly with python 2.5, in that raised exceptions were missing all
> information about the actual error (error codes, messages).

I think I may just have fixed it myself. Could someone with more
knowledge about Python's C API please have a look at this patch against
the 7.6.0.37 sources? At first glance, it works fine. The attributes are
back, and it works in Python 1.5, 2.1, 2.4, and 2.5, which are all the
releases I tested.

--- MaxDB_ORG/sys/src/SAPDB/Scripting/Script_sqlPython.c	2007-04-19 11:03:24.000000000
+0200
+++ MaxDB_DEV/sys/src/SAPDB/Scripting/Script_sqlPython.c	2007-06-29 17:47:03.085021000
+0200
@@ -1595,7 +1595,7 @@
     const char * msg)
 {
     ROUTINE_DBG_MSP00 ("raiseCommunicationError");
-    PyObject * exception = PyInstance_New (CommunicationErrorType, NULL, NULL);
+    PyObject * exception = PyObject_CallObject(CommunicationErrorType, NULL);
     PyObject * pycode = NULL;
     PyObject * pymsg = NULL;
 
@@ -1626,7 +1626,7 @@
     int          tracebackLen)
 {
     ROUTINE_DBG_MSP00 ("raiseSQLError");
-    PyObject * exception = PyInstance_New (SQLErrorType, NULL, NULL);
+    PyObject * exception = PyObject_CallObject(SQLErrorType, NULL);
     PyObject * errorCode = NULL;
     PyObject * message = NULL;
     PyObject * errorPos = NULL;

-- 
Christian Ullrich

Thread
Python 2.5Christian Ullrich20 Jun
  • Re: Python 2.5Christian Ullrich29 Jun