Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit571ec56

Browse files
[3.11]gh-105375: Improve error handling in sqlite3 collation callback (GH-105412) (#105441)
Check for error after each call to PyUnicode_FromStringAndSize().(cherry picked from commita24a780)Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
1 parent18e9fd8 commit571ec56

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix a bug in:mod:`sqlite3` where an exception could be overwritten in the
2+
:meth:`collation <sqlite3.Connection.create_collation>` callback.

‎Modules/_sqlite/connection.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,10 +1792,12 @@ collation_callback(void *context, int text1_length, const void *text1_data,
17921792
}
17931793

17941794
string1=PyUnicode_FromStringAndSize((constchar*)text1_data,text1_length);
1795+
if (string1==NULL) {
1796+
gotofinally;
1797+
}
17951798
string2=PyUnicode_FromStringAndSize((constchar*)text2_data,text2_length);
1796-
1797-
if (!string1|| !string2) {
1798-
gotofinally;/* failed to allocate strings */
1799+
if (string2==NULL) {
1800+
gotofinally;
17991801
}
18001802

18011803
callback_context*ctx= (callback_context*)context;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp