Issue2075

classification
Title: Incorrect padding for hex format strings
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jeff.allen Nosy List: dcoles, jeff.allen, santa4nt
Priority: Keywords: patch

Created on 2013-08-21.02:42:44 by dcoles, last changed 2013-12-22.17:59:41 by jeff.allen.

Files
File name Uploaded Description Edit Remove
issue2075.patch santa4nt, 2013-08-21.21:03:43 A simple special case for "alternate" types and sign inclusion. Not too elegant, I'm afraid.
issue2075.patch santa4nt, 2013-08-23.19:48:17 Moving the padding decision to the caller.
issue2075_and_2013.patch santa4nt, 2013-12-19.22:26:20
Messages
msg8082 (view) Author: David Coles (dcoles) Date: 2013-08-21.02:42:43
Output:

$ jython2.7 -c 'print("{:#018x}".format(14))'
0000000000000000xe


Expected behavior:

$ python -c 'print("{:#018x}".format(14))'
0x000000000000000e


Notice that this does not appear to be an issue with '%' formatting strings:

$ jython2.7 -c 'print("%#018x"%14)'
0x000000000000000e
msg8083 (view) Author: Santoso Wijaya (santa4nt) Date: 2013-08-21.20:28:11
This is because of an improper implementation of the method InternalFormatSpec#pad() in org/python/core/stringlib/InternalFormatSpec.java
msg8084 (view) Author: Santoso Wijaya (santa4nt) Date: 2013-08-21.21:03:43
Attaching a simple fix and unittest.
msg8086 (view) Author: Santoso Wijaya (santa4nt) Date: 2013-08-23.19:48:16
Moving the padding decision to the caller, as to leave #pad() alone.

Merged with fix for issue 2013.
msg8207 (view) Author: Santoso Wijaya (santa4nt) Date: 2013-12-19.22:26:20
Update patch with new bugs squashed.
msg8209 (view) Author: Jeff Allen (jeff.allen) Date: 2013-12-22.14:40:39
This saves us a handful of FIXMEs in test_types too, where tests of alternate formatting stand disaabled at present. I'll remove them as part of a changeset based on this patch. Thanks!
msg8211 (view) Author: Jeff Allen (jeff.allen) Date: 2013-12-22.17:59:41
This and #2013 resolved by http://hg.python.org/jython/rev/3bfef9e72808 .
History
Date User Action Args
2013-12-22 17:59:41jeff.allensetstatus: open -> closed
resolution: fixed
messages: + msg8211
2013-12-22 14:40:40jeff.allensetassignee: jeff.allen
messages: + msg8209
nosy: + jeff.allen
2013-12-19 22:26:21santa4ntsetfiles: + issue2075_and_2013.patch
messages: + msg8207
2013-08-23 19:48:17santa4ntsetfiles: + issue2075.patch
messages: + msg8086
2013-08-21 21:03:44santa4ntsetfiles: + issue2075.patch
keywords: + patch
messages: + msg8084
2013-08-21 20:28:11santa4ntsetnosy: + santa4nt
messages: + msg8083
2013-08-21 02:42:44dcolescreate