[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 subclass of object.

--
nosy: +Thomas.Waldmann
Added file: http://bugs.python.org/file29558/py274_str_mod_bug.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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':
#15923: fix a mistake in asdl_c.py that resulted in a TypeError after 
2801bf875a24 (see #15801).
http://hg.python.org/cpython/rev/cb988d601803

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 tuple with exactly the number of items 
specified by the format string, or a single mapping object (for example, a 
dictionary).

Tested and confirmed on 2.5, 2.6, 2.7 (both old and new style classes) and 3.2.

--
messages: 169300
nosy: eallik
priority: normal
severity: normal
status: open
title: Weird string interpolation behaviour
type: behavior
versions: Python 2.6, Python 2.7, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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: +Mike.Graham

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 (closes #15801)
http://hg.python.org/cpython/rev/4d431e719646

New changeset 263d09ce3e9e by Benjamin Peterson in branch 'default':
merge 3.2 (#15801)
http://hg.python.org/cpython/rev/263d09ce3e9e

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15801] Weird string interpolation behaviour

2012-08-28 Thread Erik Allik

Erik Allik added the comment:

Respectable reaction time.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com