You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A search of this repo shows cases where an exception like the following is thrown by PyODBC (We got one of these recently on 5.2.0):
<class 'pyodbc.Error'> returned a result with an exception set
As opposed to a normal pyodbc exception, which is something like
(pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Parse error at line: 1, column: 38: Incorrect syntax near ':'. (103010) (SQLExecDirectW)")
It looks like a base pyodbc.Error is being thrown somewhere in C (on some non-mapped error code, maybe?), but isn't handled properly. I don't understand the C layer of Python, but this is discussed a few places on StackOverflow:
In general:
"[R]eturned a result with an error set" is something that can only be done at the C level. In general, the Python/C API expects most C functions to do one of two things:
Set an exception using one of these functions and return NULL (corresponds to throwing an exception).
Don't set an exception and return a "real" value, usually a PyObject* (corresponds to returning a value, including returning None).
These two cases are normally incorrect:
Set an exception (or fail to clear one that already exists), but then return some value other than NULL.
Is the current behavior by design, or could the screws be tightened somewhere?
The text was updated successfully, but these errors were encountered:
Arithmomaniac
changed the title
Better handling of "Error: <class 'pyodbc.Error'> returned a result"... messages
Better handling of "<class 'pyodbc.Error'> returned a result" errors
Apr 6, 2025
A search of this repo shows cases where an exception like the following is thrown by PyODBC (We got one of these recently on 5.2.0):
As opposed to a normal pyodbc exception, which is something like
It looks like a base
pyodbc.Error
is being thrown somewhere in C (on some non-mapped error code, maybe?), but isn't handled properly. I don't understand the C layer of Python, but this is discussed a few places on StackOverflow:https://stackoverflow.com/a/53796516:
Is the current behavior by design, or could the screws be tightened somewhere?
The text was updated successfully, but these errors were encountered: