[cx-oracle-users] Segmentation fault in Python 3 - Cursor - chained exceptions
Brought to you by:
atuining
From: Boris D. <bor...@gm...> - 2014-05-13 07:15:28
|
Hi all, The following test program gives a segmentation fault: C:\>python Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import cx_Oracle >>> c=cx_Oracle.connect(<connect string>).cursor() >>> try: ... c.execute("select") ... except: ... try: ... c.execute("select") ... except: ... pass ... C:\> Access Violation Faulting application name: python.exe Fault offset: 0x000000000000cacd Platform: 64bit, Win7, Oracle Client 11g (11.2.0.1.0), python 3.3.3, cx_Oracle 5.1.2 At a guess, the problem is because in the function Cursor_SetErrorOffset() /Cursor.c/: static void Cursor_SetErrorOffset( udt_Cursor *self) // cursor to get the error offset from { PyObject *type, *value, *traceback; udt_Error *error; PyErr_Fetch(&type, &value, &traceback); if (type == g_DatabaseErrorException) { error = (udt_Error*) value; OCIAttrGet(self->handle, OCI_HTYPE_STMT, &error->offset, 0, OCI_ATTR_PARSE_ERROR_OFFSET, self->environment->errorHandle); } PyErr_Restore(type, value, traceback); } OCIAttrGet() call attempts to write a value to the address /&error->offset/, therefore after the end of an allocated memory block of the borrowed pointer /PyObject *value/ typedef struct { PyObject_HEAD sb4 code; ub4 offset; PyObject *message; const char *context; } udt_Error; Commenting it out /* OCIAttrGet(self->handle, OCI_HTYPE_STMT, &error->offset, 0, OCI_ATTR_PARSE_ERROR_OFFSET, self->environment->errorHandle);*/ fix this crash! Regards, Boris |