Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2863c10

Browse files
committed
Use Py_FatalError instead of abort.
1 parent 2f7f8c4 commit 2863c10

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Parser/tokenizer.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ fp_readl(char *s, int size, struct tok_state *tok)
326326
{
327327
#ifndef Py_USING_UNICODE
328328
/* In a non-Unicode built, this should never be called. */
329-
abort();
329+
Py_FatalError("fp_readl should not be called in this build.");
330+
return NULL;
330331
#else
331332
PyObject* utf8;
332333
PyObject* buf = tok->decoding_buffer;
@@ -403,7 +404,7 @@ static void fp_ungetc(int c, struct tok_state *tok) {
403404
static char *
404405
decoding_fgets(char *s, int size, struct tok_state *tok)
405406
{
406-
char *line;
407+
char *line = NULL;
407408
int warn = 0, badchar = 0;
408409
for (;;) {
409410
if (tok->decoding_state < 0) {

Python/compile.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,8 @@ static PyObject *
11861186
decode_utf8(char **sPtr, char *end, char* encoding)
11871187
{
11881188
#ifndef Py_USING_UNICODE
1189-
abort();
1189+
Py_FatalError("decode_utf8 should not be called in this build.");
1190+
return NULL;
11901191
#else
11911192
PyObject *u, *v;
11921193
char *s, *t;
@@ -1319,7 +1320,7 @@ parsestr(struct compiling *com, char *s)
13191320
#ifndef Py_USING_UNICODE
13201321
/* This should not happen - we never see any other
13211322
encoding. */
1322-
abort();
1323+
Py_FatalError("cannot deal with encodings in this build.");
13231324
#else
13241325
PyObject* u = PyUnicode_DecodeUTF8(s, len, NULL);
13251326
if (u == NULL)

0 commit comments

Comments
 (0)