[issue15801] Weird string interpolation behaviour

2012-08-28 Thread Erik Allik
New submission from Erik Allik: >>> class Foo(object): ... pass ... >>> "asdads" % Foo() 'asdads' Doesn't look like it's supposed to be this way. As per the documentation: "If format requires a single argument, values may be a single non-tuple object. [5] Otherwise, values must be a tup

[issue15801] Weird string interpolation behaviour

2012-08-28 Thread Alex Gaynor
Alex Gaynor added the comment: Additional detail, if and only if Foo defines an __str__ method, this raises an exception. -- nosy: +alex ___ Python tracker ___ _

[issue15801] Weird string interpolation behaviour

2012-08-28 Thread R. David Murray
R. David Murray added the comment: That doesn't appear to be true in 3.2. I happened to test this on email.message.Message, and it also did not raise an error, but it defines an __str__. I suspect this is some oddball result of the coercion rules. -- nosy: +r.david.murray __

[issue15801] Weird string interpolation behaviour

2012-08-28 Thread R. David Murray
R. David Murray added the comment: Didn't get an error in 2.7, either, with Message(). -- ___ Python tracker ___ ___ Python-bugs-list

[issue15801] Weird string interpolation behaviour

2012-08-28 Thread Mike Graham
Mike Graham added the comment: Line 13464 of unicodeobject.c is if (Py_TYPE(args)->tp_as_mapping && !PyTuple_Check(args) && !PyUnicode_Check(args)) Too lazy to check, but don't user-created types have a tp_as_mapping? If so, I think it mistakes Foo() for a dict. -- nosy: +

[issue15801] Weird string interpolation behaviour

2012-08-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 2801bf875a24 by Benjamin Peterson in branch '2.7': use the stricter PyMapping_Check (closes #15801) http://hg.python.org/cpython/rev/2801bf875a24 New changeset 4d431e719646 by Benjamin Peterson in branch '3.2': use the stricter PyMapping_Check (clos

[issue15801] Weird string interpolation behaviour

2012-08-28 Thread Erik Allik
Erik Allik added the comment: Respectable reaction time. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue15801] Weird string interpolation behaviour

2012-09-30 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8f07ab82de92 by Ezio Melotti in branch '2.7': #15923: fix a mistake in asdl_c.py that resulted in a TypeError after 2801bf875a24 (see #15801). http://hg.python.org/cpython/rev/8f07ab82de92 New changeset cb988d601803 by Ezio Melotti in branch '3.2':

[issue15801] Weird string interpolation behaviour

2013-03-23 Thread Thomas Waldmann
Thomas Waldmann added the comment: gave 2.7.4rc1 a try and was seeing a failing unit test that does not fail with 2.7.3. see the attached file for some minimal code that succeeds on 2.7.3, but not on 2.7.4rc1. it seems to have to do with being a subclass of Exception, it doesn't happen for s

[issue15801] Weird string interpolation behaviour

2013-03-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 391e3a7db1a3 by Benjamin Peterson in branch '2.7': allow any type with __getitem__ to be a mapping for the purposes of % (#15801) http://hg.python.org/cpython/rev/391e3a7db1a3 -- ___ Python tracker

[issue15801] Weird string interpolation behaviour

2013-03-23 Thread Benjamin Peterson
Benjamin Peterson added the comment: Thanks for the report. Will be fixed in 2.7.4. -- nosy: +benjamin.peterson ___ Python tracker ___ ___