[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2014-02-11 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f56b98143792 by R David Murray in branch 'default':
whatsnew: object.__format__ raises TypeError on non-empty string.
http://hg.python.org/cpython/rev/f56b98143792

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-12-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps the versionchanged tag for format() is more suitable than versionadded.

--
nosy: +serhiy.storchaka

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-19 Thread R. David Murray

R. David Murray added the comment:

Since Eric indicated he'd close this unless someone felt strongly that the 
status quo should be changed, and the arguments are in favor of *maintaining* 
the status quo, I'm going to close this for him :)

--
nosy: +r.david.murray
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-13 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

+1 to Terry for If its class does not override .__format__, then it seems that 
it should act the same as a direct object instance

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

@Eric:
when you say: If the type of the object really is object, then it can use 
string formatting. It's only for non-objects that I want to add the error.. 

I am confused. Let me demonstrate what I'm thinking according to the statement 
above. 

First let us take a 'non-object':
 integer=1
 type(integer) != object
True
As of now it returns the following:
 integer.__format__(s)
'1'
Which seems natural.
But after this patch should it return an error

Also now consider an object:
 f = object()
 type(f)
class 'object'
This will return the following after the patch as it does now which is:
 f.__format__('')
'object object at 0xb75b7b48'


Does this mean that 'integer' should give an error, however, 'f' should give 
something that appears messy?

I may be mistaken in my interpretation of the statement, so kindly let me know 
if there is something else that I am not clearly understanding.

--
nosy: +Yogesh.Chaudhari

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

Please replace 
integer.__format__(s)
with 
integer.__format__('')

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-12 Thread Eric V. Smith

Eric V. Smith added the comment:

But int has its own __format__ method, so this does not apply. Per the title of 
this issue, this only refers to object.__format__.

For example:

This works now, and will continue working:
 format(2, '1')
'2'

This is currently an error, and will remain an error:
 class C: pass
...
 format(C(), '1')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: non-empty format string passed to object.__format__

It's this case that is currently an error, but it need not be:
 format(object(), '1')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: non-empty format string passed to object.__format__

The more I think about it, the more I think it would be too confusing to make 
object.__format__ behave differently if self is of type object, versus another 
type. So I'll probably just close this as fixed unless someone feels strongly 
about it.

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-05-12 Thread Yogesh Chaudhari

Yogesh Chaudhari added the comment:

It's this case that is currently an error, but it need not be:
 format(object(), '1')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: non-empty format string passed to object.__format__

I believe that should continue to remain an error. Please note that this works
 format(object(), '')
'object object at 0xb74fd688'

From what I can tell, specifying '1' or '2' or '100' makes no sense because 
unlike string or int (and like list or tuple ) this 'number' does not 
represent anything sensible.

This works fine as it should:
 format('q', '5')
'q'
 format(1, '5')
'1'
 format(1, '05')
'1'
 

But this does not and IMHO *should* not 'work'
 format([1,2,3], '5')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: non-empty format string passed to object.__format__
 format((1,2,3), '5')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: non-empty format string passed to object.__format__


an object() CANNOT have specific behavior like str or int. You can of-course 
argue as to what kind of error/exception/warning this may raise, but it does 
not make any sense (AFAIK) to 'fix' this.

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2013-02-15 Thread Ankur Ankan

Changes by Ankur Ankan ankuran...@gmail.com:


--
nosy: +Ankur.Ankan

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-12-23 Thread Viktor Ershov

Viktor Ershov added the comment:

As I can see this is already implemented in 3.4

--
nosy: +asvetlov, krinart

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-12-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d91c14788729 by Andrew Svetlov in branch 'default':
Issue #9856: Replace deprecation warinigs to raising TypeError in 
object.__format__
http://hg.python.org/cpython/rev/d91c14788729

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-12-23 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Committed. Thanks.

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-12-23 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2f6ec67636b8 by Andrew Svetlov in branch 'default':
Add NEWS and docs for #9856
http://hg.python.org/cpython/rev/2f6ec67636b8

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-12-23 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Updated NEWS and docs

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-12-23 Thread Eric V. Smith

Eric V. Smith added the comment:

The more I think about this, the more overly restrictive I realize it is. If 
the type of the object really is object, then it can use string formatting. 
It's only for non-objects that I want to add the error.

I'll re-open it and give it some more thought.

--
resolution: fixed - 
stage: committed/rejected - 
status: closed - open

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-12-23 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Ok

--

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-10-26 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy:  -berker.peksag

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2012-02-14 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2011-12-12 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berkerpeksag

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2011-12-12 Thread Florent Xicluna

Florent Xicluna florent.xicl...@gmail.com added the comment:

Patch is ready for python 3.4

:-)

--
keywords: +patch
nosy: +flox
Added file: http://bugs.python.org/file23936/issue9856_python-3.4.diff

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2011-03-13 Thread Eric Smith

Changes by Eric Smith e...@trueblade.com:


--
priority: release blocker - deferred blocker

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



[issue9856] Change object.__format__(s) where s is non-empty to a TypeError

2011-03-12 Thread Eric Smith

Eric Smith e...@trueblade.com added the comment:

Next step is to make it a TypeError in 3.4.

--
priority: normal - release blocker
title: Change object.__format__(s) where s is non-empty to a DeprecationWarning 
- Change object.__format__(s) where s is non-empty to a TypeError
versions: +Python 3.4 -Python 3.3

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