[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset d08e3586dde3 by Vinay Sajip in branch '2.7': Issue #21172: isinstance check relaxed from dict to collections.Mapping. http://hg.python.org/cpython/rev/d08e3586dde3 New changeset 5e303360db14 by Vinay Sajip in branch '3.4': Issue #21172: isinstance c

[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip
Vinay Sajip added the comment: Thanks for pinpointing what the issue is. > checking for isinstance(..., dict) is still wrong - it should at least > be collections.Mapping to give users a chance to emulate the correct > interface. That seems reasonable. -- resolution: invalid -> _

[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Alan Briolat
Alan Briolat added the comment: Because the object in question is not actually a dict, LogRecord is attempting, in this example, "%(bar)s" % (f,) instead of "%(bar)s" % f. In unicodeobject.c this causes the PyMapping_Check in PyUnicode_Format to fail because it's a tuple (note that PyMapping_C

[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip
Vinay Sajip added the comment: Looking into it further, I see no incidence in logging code of the string "format requires a mapping" or of raising a TypeError with such a message. Can you provide more information? Otherwise I will have to close this issue as invalid. -- resolution: -

[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip
Changes by Vinay Sajip : -- type: behavior -> enhancement ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https

[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-08 Thread Vinay Sajip
Vinay Sajip added the comment: I wouldn't say it is a bug, as it is working as documented - though you might say it is a request for enhancement. The documentation for string formatting at https://docs.python.org/2/library/stdtypes.html#string-formatting-operations says that the argument shoul

[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-07 Thread Benjamin Peterson
Changes by Benjamin Peterson : -- assignee: -> vinay.sajip nosy: +vinay.sajip ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue21172] Unexpected behaviour with logging.LogRecord "first arg is dict" case

2014-04-07 Thread Alan Briolat
New submission from Alan Briolat: The logging.LogRecord class is more restrictive with its "first arg is dict" case than the formatting operator it uses requires. As far as I can tell, for "%(foo)s" % bar, the minimum contract is that bar.__getitem__("foo") succeeds, not that bar is an instan