Author erlendaasland
Recipients berker.peksag, erlendaasland, serhiy.storchaka
Date 2021-03-04.10:54:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
If the connection factory __init__ method fails, we hit a seg. fault when pysqlite_do_all_statements() is called to clean up the defect connection: PyList_Size received a NULL pointer.

Suggested fix:
Split pysqlite_do_all_statements() in two: one function for resetting cursors, and one for resetting/finalising statements. In each function, check if the respective lists are NULL pointers before iterating. See attached proposed patch.

    def test_invalid_connection_factory(self):
        class DefectFactory(sqlite.Connection):
            def __init__(self, *args, **kwargs):
                return None
        self.con = sqlite.connect(":memory:", factory=DefectFactory)
Date User Action Args
2021-03-04 10:54:37erlendaaslandsetrecipients: + erlendaasland, berker.peksag, serhiy.storchaka
2021-03-04 10:54:37erlendaaslandsetmessageid: <>
2021-03-04 10:54:37erlendaaslandlinkissue43398 messages
2021-03-04 10:54:36erlendaaslandcreate