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
65f64b19
Commit
65f64b19
authored
Mar 15, 2019
by
Rémi Lapeyre
Committed by
Vinay Sajip
Mar 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36272: Logging now propagates RecursionError (GH-12312)
parent
1c668d16
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
Lib/logging/__init__.py
Lib/logging/__init__.py
+4
-0
Lib/test/test_logging.py
Lib/test/test_logging.py
+16
-1
Misc/NEWS.d/next/Library/2019-03-13-14-14-36.bpo-36272.f3l2IG.rst
...S.d/next/Library/2019-03-13-14-14-36.bpo-36272.f3l2IG.rst
+2
-0
No files found.
Lib/logging/__init__.py
View file @
65f64b19
...
...
@@ -1032,6 +1032,8 @@ class Handler(Filterer):
sys
.
stderr
.
write
(
'Message: %r
\
n
'
'Arguments: %s
\
n
'
%
(
record
.
msg
,
record
.
args
))
except
RecursionError
:
# See issue 36272
raise
except
Exception
:
sys
.
stderr
.
write
(
'Unable to print the message and arguments'
' - possible formatting error.
\
n
Use the'
...
...
@@ -1094,6 +1096,8 @@ class StreamHandler(Handler):
# issue 35046: merged two stream.writes into one.
stream
.
write
(
msg
+
self
.
terminator
)
self
.
flush
()
except
RecursionError
:
# See issue 36272
raise
except
Exception
:
self
.
handleError
(
record
)
...
...
Lib/test/test_logging.py
View file @
65f64b19
...
...
@@ -41,7 +41,7 @@ import socket
import
struct
import
sys
import
tempfile
from
test.support.script_helper
import
assert_python_ok
from
test.support.script_helper
import
assert_python_ok
,
assert_python_failure
from
test
import
support
import
textwrap
import
threading
...
...
@@ -4142,6 +4142,21 @@ class ModuleLevelMiscTest(BaseTest):
self
.
assertIn
(
"exception in __del__"
,
err
)
self
.
assertIn
(
"ValueError: some error"
,
err
)
def
test_recursion_error
(
self
):
# Issue 36272
code
=
"""if 1:
import logging
def rec():
logging.error("foo")
rec()
rec()"""
rc
,
out
,
err
=
assert_python_failure
(
"-c"
,
code
)
err
=
err
.
decode
()
self
.
assertNotIn
(
"Cannot recover from stack overflow."
,
err
)
self
.
assertEqual
(
rc
,
1
)
class
LogRecordTest
(
BaseTest
):
def
test_str_rep
(
self
):
...
...
Misc/NEWS.d/next/Library/2019-03-13-14-14-36.bpo-36272.f3l2IG.rst
0 → 100644
View file @
65f64b19
:mod:`logging` does not silently ignore RecursionError anymore. Patch
contributed by Rémi Lapeyre.
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