Edgewall Software
Modify

Opened 19 months ago

Last modified 19 months ago

#13607 assigned defect

sqlite3.version_info is deprecated since Python 3.12 and will be removed in Python 3.14

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.6.1
Component: database backend Version:
Severity: normal Keywords: sqlite
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Jun Omae)

https://docs.python.org/3.12/library/sqlite3.html#sqlite3.version_info

After the following patch, it will retrieve pysqlite3.version_info only when pysqlite3 is used.

  • contrib/make_status.py

    diff --git a/contrib/make_status.py b/contrib/make_status.py
    index 65278624a..ab4962a8d 100755
    a b PACKAGES = [  
    5151    ("Jinja2",            'jinja2.__version__'),
    5252    ("multipart",         'multipart.__version__'),
    5353    ("Babel",             'babel.__version__'),
    54     ("sqlite3",           ('sqlite3.version',
    55                            'sqlite3.sqlite_version')),
     54    ("sqlite3",           'sqlite3.sqlite_version'),
    5655    ("PySqlite3",         ('__main__._pysqlite3_version()',
    5756                           'pysqlite3.dbapi2.sqlite_version')),
    5857    ("PyMySQL",           'pymysql.__version__'),
  • trac/db/sqlite_backend.py

    diff --git a/trac/db/sqlite_backend.py b/trac/db/sqlite_backend.py
    index dc0bf4ca9..8f38af387 100644
    a b try:  
    3737    import pysqlite3.dbapi2 as sqlite
    3838except ImportError:
    3939    import sqlite3 as sqlite
     40    pysqlite3_version = None
     41else:
     42    pysqlite3_version = get_pkginfo(sqlite).get('version', '%d.%d.%s' %
     43                                                           sqlite.version_info)
    4044
    4145sqlite_version = sqlite.sqlite_version_info
    4246sqlite_version_string = sqlite.sqlite_version
    43 pysqlite_version = sqlite.version_info
    44 pysqlite_version_string = get_pkginfo(sqlite).get('version',
    45                                                   '%d.%d.%s'
    46                                                   % pysqlite_version)
    4747min_sqlite_version = (3, 0, 0)
    4848
    4949
    class SQLiteConnector(Component):  
    273273
    274274    def get_system_info(self):
    275275        yield 'SQLite', sqlite_version_string
    276         yield 'pysqlite', pysqlite_version_string
     276        if pysqlite3_version:
     277            yield 'pysqlite3', pysqlite3_version
    277278
    278279    @lazy
    279280    def _extensions(self):
  • trac/tests/env.py

    diff --git a/trac/tests/env.py b/trac/tests/env.py
    index e0f949949..80a700208 100644
    a b class SystemInfoTestCase(unittest.TestCase):  
    520520            self.assertEqual(info_before, info_after)
    521521            self.assertRegex(get_info(info_before, 'SQLite'),
    522522                             r'^\d+(\.\d+)+$')
    523             self.assertRegex(get_info(info_before, 'pysqlite'),
    524                              r'^\d+(\.\d+)+$')
    525523        else:
    526524            self.fail("Unknown value for dburi %s" % self.env.dburi)
    527525

Attachments (0)

Change History (1)

comment:1 by Jun Omae, 19 months ago

Description: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as assigned The owner will remain Jun Omae.
The ticket will be disowned. Next status will be 'new'.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.