Message401248
Quoting Petr Viktorin in PR 27940, https://github.com/python/cpython/pull/27940#discussion_r703424148:
- db is not set to NULL if init fails.
- This segfaults for me:
import sqlite3
conn = sqlite3.connect(':memory:')
conn.execute('CREATE TABLE foo (bar)')
try:
conn.__init__('/bad-file/')
except sqlite3.OperationalError:
pass
conn.execute('INSERT INTO foo (bar) VALUES (1), (2), (3), (4)')
Other issues:
- reinitialisation is not handled gracefully
- __init__ is messy; members are initialised here and there
Suggested to reorder connection __init__ in logical groups to more easily handle errors:
1. handle reinit
2. open and configure database
3. create statement LRU cache and weak ref cursor list
4. initialise members in the order they're defined in connection.h
5. set isolation level, since it's a weird case anyway |
|
Date |
User |
Action |
Args |
2021-09-07 11:46:02 | erlendaasland | set | recipients:
+ erlendaasland, petr.viktorin |
2021-09-07 11:46:02 | erlendaasland | set | messageid: <1631015162.08.0.638095834379.issue45126@roundup.psfhosted.org> |
2021-09-07 11:46:02 | erlendaasland | link | issue45126 messages |
2021-09-07 11:46:01 | erlendaasland | create | |
|