Title: Incorrect padding for hex format strings
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.7
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.

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
msg8082 (view) Author: David Coles (dcoles) Date: 2013-08-21.02:42:43

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

Expected behavior:

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

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

$ jython2.7 -c 'print("%#018x"%14)'
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/
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 .
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