-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Here is a test that crashes the interpreter on my x86 Linux machine:
def test_cursor_rownumber_fetchmany_fetchone_interleave(cursor):
cursor.execute("select 1 union select 2")
((val,),) = cursor.fetchmany(1)
assert val == 1
(val,) = cursor.fetchone()
assert val == 2Probably the issue has something to do with the fact that fetchmany is fetching data using bound columns but fetchone wants to use SQLGetData.
From a quick analysis it looks like SQLGetData is returning SQL_ERROR, which makes sense if the columns are bound. Then the error value is propagated back to fetchone, which seems to be missing an error check. Because of that fetchone then returns the tuple, but since the function had an error, the value inside the tuple is still a null pointer, which then causes the crash when destructuring with (val,)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels