GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — "z" format specifier is treated differently in unicode and bytes · Issue #104018 · python/cpython Closed Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionHello up there. I've hit a discrepancy in how
kirr@deca:~$ python3 Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> '%zf' % 1 <-- unicode Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: unsupported format character 'z' (0x7a) at index 1 >>> b'%zf' % 1 <-- bytes b'1.000000' >>> b'%zf' % 0.0 <-- +0 -> 0 b'0.000000' >>> b'%zf' % -0.0 <-- -0 -> 0 b'0.000000' >>> b'%f' % -0.0 <-- -0 -> -0 if run without 'z' b'-0.000000' In other words there is inconsistency in how 'z' is handled by '%' for unicode and bytes, and there is also inconsistency in how 'z' was supposed to be handled by 'z' handling was implemented in #30049 and indeed there I see b'%z' being fully handled: b0b836b20cb5#diff-f6d440aad34e1c4535c0d898c0197a95490766c745991caace6f64b5dd1ece51 but u'%z' being only partly handled internally without corresponding frontend parsing that bytes has: b0b836b20cb5#diff-34c966e7876d6f8bf801dd51896327e4f68bba02cddb95fbf3963f0b2e39c38a In my view the fix should be either a) to add '%z' handling to unicode, or b) to remove '%z' handling from bytes. Thanks beforehand,
/cc @belm0, @mdickinson Linked PRs
Reacted by John Belmonte Activity
MetadataMetadataAssigneesLabelsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |