FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Rework _Py_DumpASCII() to make Coverity happy · python-emscripten/cpython@1c3069a · GitHub

Repository navigation

Commit 1c3069a

Browse files
committed
Rework _Py_DumpASCII() to make Coverity happy
1 parent 928ad28 commit 1c3069a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎Python/traceback.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,23 +545,23 @@ _Py_DumpASCII(int fd, PyObject *text)
545545

546546
size = ascii->length;
547547
kind = ascii->state.kind;
548-
if (ascii->state.compact) {
548+
if (kind == PyUnicode_WCHAR_KIND) {
549+
wstr = ((PyASCIIObject *)text)->wstr;
550+
if (wstr == NULL)
551+
return;
552+
size = ((PyCompactUnicodeObject *)text)->wstr_length;
553+
}
554+
else if (ascii->state.compact) {
549555
if (ascii->state.ascii)
550556
data = ((PyASCIIObject*)text) + 1;
551557
else
552558
data = ((PyCompactUnicodeObject*)text) + 1;
553559
}
554-
else if (kind != PyUnicode_WCHAR_KIND) {
560+
else {
555561
data = ((PyUnicodeObject *)text)->data.any;
556562
if (data == NULL)
557563
return;
558564
}
559-
else {
560-
wstr = ((PyASCIIObject *)text)->wstr;
561-
if (wstr == NULL)
562-
return;
563-
size = ((PyCompactUnicodeObject *)text)->wstr_length;
564-
}
565565

566566
if (MAX_STRING_LENGTH < size) {
567567
size = MAX_STRING_LENGTH;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL