Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
76e69955
Commit
76e69955
authored
Oct 31, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19437: Fix show_warning() of _warnings, stop at the first error to not
call a Python function with an exception set
parent
5e126f4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
+16
-10
Python/_warnings.c
Python/_warnings.c
+16
-10
No files found.
Python/_warnings.c
View file @
76e69955
...
...
@@ -263,23 +263,28 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject
name
=
_PyObject_GetAttrId
(
category
,
&
PyId___name__
);
if
(
name
==
NULL
)
/* XXX Can an object lack a '__name__' attribute? */
return
;
goto
error
;
f_stderr
=
PySys_GetObject
(
"stderr"
);
if
(
f_stderr
==
NULL
)
{
fprintf
(
stderr
,
"lost sys.stderr
\n
"
);
Py_DECREF
(
name
);
return
;
goto
error
;
}
/* Print "filename:lineno: category: text\n" */
PyFile_WriteObject
(
filename
,
f_stderr
,
Py_PRINT_RAW
);
PyFile_WriteString
(
lineno_str
,
f_stderr
);
PyFile_WriteObject
(
name
,
f_stderr
,
Py_PRINT_RAW
);
PyFile_WriteString
(
": "
,
f_stderr
);
PyFile_WriteObject
(
text
,
f_stderr
,
Py_PRINT_RAW
);
PyFile_WriteString
(
"
\n
"
,
f_stderr
);
Py_XDECREF
(
name
);
if
(
PyFile_WriteObject
(
filename
,
f_stderr
,
Py_PRINT_RAW
)
<
0
)
goto
error
;
if
(
PyFile_WriteString
(
lineno_str
,
f_stderr
)
<
0
)
goto
error
;
if
(
PyFile_WriteObject
(
name
,
f_stderr
,
Py_PRINT_RAW
)
<
0
)
goto
error
;
if
(
PyFile_WriteString
(
": "
,
f_stderr
)
<
0
)
goto
error
;
if
(
PyFile_WriteObject
(
text
,
f_stderr
,
Py_PRINT_RAW
)
<
0
)
goto
error
;
if
(
PyFile_WriteString
(
"
\n
"
,
f_stderr
)
<
0
)
goto
error
;
Py_CLEAR
(
name
);
/* Print " source_line\n" */
if
(
sourceline
)
{
...
...
@@ -314,6 +319,7 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject
}
error:
Py_XDECREF
(
name
);
PyErr_Clear
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment