[issue2337] Backport oct() and hex() to use __index__

2008-05-17 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

The warning message for oct() should include that the output will be
different too. Else this is fine with me.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-05-17 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Done in r63425.

--
resolution:  - fixed
status: open - closed

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-05-17 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

I have reverted this. See
mail.python.org/pipermail/python-checkins/2008-May/069843.html.

--
resolution: fixed - 
status: closed - pending

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-05-17 Thread Eric Smith

Changes by Eric Smith [EMAIL PROTECTED]:


--
nosy: +eric.smith

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-04-27 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

I don't assume there are too many people using oct() and hex() with
custom types anyway :)

Since PyNumber_ToBase and the new oct() format octal numbers with 0o
instead of 0, I still think it's better if you need to import the new
oct() from future_builtins. For hex(), I have no preference.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-04-27 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

Here's a patch for that. It warns for hex() when __hex__ is used,
otherwise it uses __index__. (This doesn't work for old style classes
because ob_tp-tp_as_number-tp_hex is filled.) Use of oct() just gets a
warning. The __hex__ and __oct__ methods of builtin number objects
should probably be removed.

--
keywords: +patch
Added file: http://bugs.python.org/file10125/oct_and_hex_py3k.patch

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-04-26 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

This is what I'd like to do: In builtin oct/hex check if the special
method is declared. If it is, Py3k warn and use it. If not, check if we
can do it the Py3k way (with PyNumber_ToBase). Sound good?

--
nosy: +benjamin.peterson

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-04-26 Thread Brett Cannon

Brett Cannon [EMAIL PROTECTED] added the comment:

@Georg:

That is a possibility. Would need to add the proper Py3K warning to the 
current builtins, though.

@Benjamin:

You don't want to warn if it will work for Py3K, so don't warn if 
__index__ is used.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-04-26 Thread Benjamin Peterson

Benjamin Peterson [EMAIL PROTECTED] added the comment:

I meant not to. Sorry, that wasn't clear.

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-03-21 Thread Georg Brandl

Georg Brandl [EMAIL PROTECTED] added the comment:

Shouldn't we leave alone oct() and hex() (there is another issue for
deprecation warning for __oct__ and __hex__), and let people use the
versions from future_builtins?

--
nosy: +georg.brandl

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-03-17 Thread Brett Cannon

New submission from Brett Cannon [EMAIL PROTECTED]:

oct() and hex() need to use __index__ when available and then emit a
Py3K warning when they fall back on __oct__ and __hex__.

--
components: Interpreter Core
keywords: 26backport
messages: 63695
nosy: brett.cannon
priority: immediate
severity: normal
status: open
title: Backport oct() and hex() to use __index__
versions: Python 2.6

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2337] Backport oct() and hex() to use __index__

2008-03-17 Thread Brett Cannon

Changes by Brett Cannon [EMAIL PROTECTED]:


--
priority: immediate - urgent

__
Tracker [EMAIL PROTECTED]
http://bugs.python.org/issue2337
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com