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
5aad46e5
Commit
5aad46e5
authored
Apr 10, 2014
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21172: isinstance check relaxed from dict to collections.Mapping.
parent
00109c9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
Lib/logging/__init__.py
Lib/logging/__init__.py
+8
-2
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/logging/__init__.py
View file @
5aad46e5
...
...
@@ -23,7 +23,7 @@ Copyright (C) 2001-2014 Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
import
sys
,
os
,
time
,
cStringIO
,
traceback
,
warnings
,
weakref
import
sys
,
os
,
time
,
cStringIO
,
traceback
,
warnings
,
weakref
,
collections
__all__
=
[
'BASIC_FORMAT'
,
'BufferingFormatter'
,
'CRITICAL'
,
'DEBUG'
,
'ERROR'
,
'FATAL'
,
'FileHandler'
,
'Filter'
,
'Formatter'
,
'Handler'
,
'INFO'
,
...
...
@@ -261,7 +261,13 @@ class LogRecord(object):
# 'Value is %d' instead of 'Value is 0'.
# For the use case of passing a dictionary, this should not be a
# problem.
if
args
and
len
(
args
)
==
1
and
isinstance
(
args
[
0
],
dict
)
and
args
[
0
]:
# Issue #21172: a request was made to relax the isinstance check
# to hasattr(args[0], '__getitem__'). However, the docs on string
# formatting still seem to suggest a mapping object is required.
# Thus, while not removing the isinstance check, it does now look
# for collections.Mapping rather than, as before, dict.
if
(
args
and
len
(
args
)
==
1
and
isinstance
(
args
[
0
],
collections
.
Mapping
)
and
args
[
0
]):
args
=
args
[
0
]
self
.
args
=
args
self
.
levelname
=
getLevelName
(
level
)
...
...
Misc/NEWS
View file @
5aad46e5
...
...
@@ -43,6 +43,8 @@ Core and Builtins
Library
-------
-
Issue
#
21172
:
isinstance
check
relaxed
from
dict
to
collections
.
Mapping
.
-
Issue
#
21191
:
In
os
.
fdopen
,
alwyas
close
the
file
descriptor
when
an
exception
happens
.
...
...
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