bpo-31746: Fixed Segfaults in the sqlite module when uninitialized. by lielfr · Pull Request #3946 · python/cpython
Oh, i was in the middle of writing my patch, but i guess you beat me to it :)
Anyway, IMHO we should add tests to verify that the crashes we know about don't happen anymore. (i am not sure, but Lib/sqlite3/test/regression.py looks like the right place.)
Also, i think that setting self->initialized to 1 in the beginning of pysqlite_connection_init() is something that could causes more problems when pysqlite_connection_init() fails in the middle, and leaves the Connection object partially initialized but marked as initialized.
BTW, i applied your patch, and calling close() on an uninitialized Connection object still crashes on my Windows 10.