8000 bpo-42264: Deprecate sqlite3.OptimizedUnicode by erlend-aasland · Pull Request #23163 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-42264: Deprecate sqlite3.OptimizedUnicode #23163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 17, 2020
Prev Previous commit
Next Next commit
Address review comment: Refer to caller when warning, and verify this
  • Loading branch information
Erlend E. Aasland committed Nov 5, 2020
commit a9e959f63bfc2d5aec21ca57e713dd549411a139
2 changes: 1 addition & 1 deletion Lib/sqlite3/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def __getattr__(name):
OptimizedUnicode is obsolete. You can safely remove it from your
code, as it defaults to 'str' anyway.
""")
warnings.warn(msg, DeprecationWarning)
warnings.warn(msg, DeprecationWarning, stacklevel=2)
return str
raise AttributeError(f"module 'sqlite3' has no attribute '{name}'")
3 changes: 2 additions & 1 deletion Lib/sqlite3/test/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ def CheckCustom(self):

def CheckOptimizedUnicode(self):
# OptimizedUnicode is deprecated as of Python 3.10
with self.assertWarns(DeprecationWarning):
with self.assertWarns(DeprecationWarning) as cm:
self.con.text_factory = sqlite.OptimizedUnicode
self.assertIn("factory.py", cm.filename)
austria = "�sterreich"
germany = "Deutchland"
a_row = self.con.execute("select ?", (austria,)).fetchone()
Expand Down
0