sqlite3: Modernize documentation around unicode and bytes. (GH-28652)

This commit is contained in:
Julien Palard 2021-10-01 14:37:56 +02:00 committed by GitHub
parent 833fdf126c
commit 1dac95c814
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -3,9 +3,9 @@ import sqlite3
con = sqlite3.connect(":memory:")
cur = con.cursor()
AUSTRIA = "\xd6sterreich"
AUSTRIA = "Österreich"
# by default, rows are returned as Unicode
# by default, rows are returned as str
cur.execute("select ?", (AUSTRIA,))
row = cur.fetchone()
assert row[0] == AUSTRIA

View File

@ -537,8 +537,8 @@ Connection Objects
Using this attribute you can control what objects are returned for the ``TEXT``
data type. By default, this attribute is set to :class:`str` and the
:mod:`sqlite3` module will return Unicode objects for ``TEXT``. If you want to
return bytestrings instead, you can set it to :class:`bytes`.
:mod:`sqlite3` module will return :class:`str` objects for ``TEXT``.
If you want to return :class:`bytes` instead, you can set it to :class:`bytes`.
You can also set it to any other callable that accepts a single bytestring
parameter and returns the resulting object.