[issue1679] tokenizer permits invalid hex integer

2008-01-22 Thread Martin Rinehart
Martin Rinehart added the comment: re 0x == 0 Thanks! Added file: http://bugs.python.org/file9268/unnamed __ Tracker <[EMAIL PROTECTED]> __re 0x == 0Thanks! _

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Georg Brandl
Changes by Georg Brandl: -- resolution: -> fixed status: open -> closed __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Un

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Georg Brandl
Georg Brandl added the comment: Committed patches 1, 2a and 3, and test suite updates, in r60092. This won't be backported to 2.5, and no doc changes are necessary. Thanks for your work! -- nosy: +georg.brandl __ Tracker <[EMAIL PROTECTED]>

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Malte Helmert
Malte Helmert added the comment: Added tests to test_grammar, test_builtin and test_tokenize. Added file: http://bugs.python.org/file9229/PATCH-TESTS.diff __ Tracker <[EMAIL PROTECTED]> __ ___

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Malte Helmert
Malte Helmert added the comment: This is a cleaner version of PATCH-2a.diff in the sense that the resulting code contains less duplication. The disadvantage is that it applies more structural changes to PyOS_strtoul, so may be harder to merge with other changes. Added file: http://bugs.python.or

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Malte Helmert
Malte Helmert added the comment: And here's a patch for case 2 (int) conversion. There is still a slight inconsistency in error reporting (base 0 vs. base 16) between int and long, but I'd see this as long's fault: >>> int("0x", 0) Traceback (most recent call last): File "", line 1, in ValueE

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Malte Helmert
Malte Helmert added the comment: And here's a patch that fixes case 3. Added file: http://bugs.python.org/file9222/PATCH-3.diff __ Tracker <[EMAIL PROTECTED]> __ __

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Malte Helmert
Malte Helmert added the comment: Here's a patch that fixes case 1: >>> 0x File "", line 1 0x ^ SyntaxError: invalid token >>> 0xL File "", line 1 0xL ^ SyntaxError: invalid token Added file: http://bugs.python.org/file9221/PATCH-1.diff __ T

[issue1679] tokenizer permits invalid hex integer

2008-01-19 Thread Malte Helmert
Malte Helmert added the comment: I can find three places where "0x" is accepted, but probably shouldn't: 1. Python's tokenizer: >>> 0x 0 >>> 0xL ValueError: invalid literal for long() with base 16: '0xL' => I think these should both be syntax errors. 2. int builtin: >>> int("0x", 0) == int("0x"

[issue1679] tokenizer permits invalid hex integer

2008-01-11 Thread A.M. Kuchling
Changes by A.M. Kuchling: -- keywords: +easy __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue1679] tokenizer permits invalid hex integer

2007-12-21 Thread Guido van Rossum
Changes by Guido van Rossum: -- assignee: -> gvanrossum nosy: +gvanrossum priority: -> normal __ Tracker <[EMAIL PROTECTED]> __ ___ Python-bug

[issue1679] tokenizer permits invalid hex integer

2007-12-21 Thread Martin Rinehart
New submission from Martin Rinehart: The tokenizer accepts '0x' as an integer zero. The documentation says: hexinteger ::= 0x|Xhexdigit+ Stumbled on this testing a tokenizer I wrote in Python for another language. Expected an Error on "int( '0x', 16 )", but didn't get one. -- compone