gh-153731: Handle NUL and lone surrogate in sqlite3 CLI REPL - #153732
gh-153731: Handle NUL and lone surrogate in sqlite3 CLI REPL#153732tonghuaroot wants to merge 4 commits into
Conversation
|
But the main question is that We can also use a similar approach to check whether a lone surrogate is in the input, but I'm not an expert on Unicode, and |
|
Done in ab23364: pre-check |
| try: | ||
| if args.sql: | ||
| # SQL statement provided on the command-line; execute it directly. | ||
| execute(con, args.sql, suppress_errors=False, theme=theme) |
There was a problem hiding this comment.
In this code path, passing an SQL statement on the command line without using the REPL may cause the same error. Maybe we should check it here too.
|
Good catch. Done in 49a5763: |
In the
python -m sqlite3REPL,complete_statement()raisesValueError(embedded NUL) or
UnicodeEncodeError(lone surrogate), neither of which is asqlite3.Error, so a single such input line crashed the shell. Catch these twoand print an error, keeping the REPL running like the other error paths.