rtutil: Explicit fspath cast to avoid a Py3.6 typecheck issue.
On Py3.6, either sqlite3.connect() doesn't take a path-like object, or the type stubs don't know that.
This commit is contained in:
parent
e1c507c025
commit
cbd50af302
1 changed files with 2 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import urllib.parse as urlparse
|
import urllib.parse as urlparse
|
||||||
|
@ -73,7 +74,7 @@ class RTLinkCache(_LinkCache):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup(cls, cache_path: Path) -> Optional[sqlite3.Connection]:
|
def setup(cls, cache_path: Path) -> Optional[sqlite3.Connection]:
|
||||||
try:
|
try:
|
||||||
db = sqlite3.connect(cache_path, isolation_level=None)
|
db = sqlite3.connect(os.fspath(cache_path), isolation_level=None)
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(cls.CREATE_TABLE_SQL)
|
cursor.execute(cls.CREATE_TABLE_SQL)
|
||||||
cursor.execute('SELECT url FROM RTLinkCache LIMIT 1')
|
cursor.execute('SELECT url FROM RTLinkCache LIMIT 1')
|
||||||
|
|
Loading…
Reference in a new issue