This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove precision restriction for integer formatting.
Type: enhancement Stage:
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: eric.smith, mark.dickinson
Priority: normal Keywords: easy

Created on 2010-02-07 13:20 by mark.dickinson, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg98998 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-02-07 13:20
Currently, in trunk:

>>> '%0.116x' % 1
'00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'
>>> '%0.117x' % 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

This is intentional, and presumably due to use of a fixed-length buffer somewhere in the formatting internals.  It would be nice (and probably not very hard) to remove this precision restriction.
msg98999 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-02-07 13:21
Looks like I accidentally truncated that traceback.  Here's the full version:

Python 2.7a2+ (trunk:78008M, Feb  5 2010, 23:39:39) 
[GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> '%0.116x' % 1
'00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'
[34971 refs]
>>> '%0.117x' % 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: formatted integer is too long (precision too large?)
[35003 refs]
msg99000 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-02-07 14:04
Removing 3.2 from the versions:  the OverflowError appears to be specific to 2.x ints:

>>> '%0.117x' % 1L
'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001'
msg103027 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-04-13 09:20
Closing:  it's too late for 2.x.
History
Date User Action Args
2022-04-11 14:56:57adminsetgithub: 52121
2010-04-13 09:20:57mark.dickinsonsetstatus: open -> closed
resolution: out of date
messages: + msg103027
2010-02-07 14:04:07mark.dickinsonsetmessages: + msg99000
versions: - Python 3.2
2010-02-07 13:21:24mark.dickinsonsetmessages: + msg98999
2010-02-07 13:20:17mark.dickinsoncreate