You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File
"/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_float.py",
line 451, in test_invalid_inputs
self.assertRaises(ValueError, fromHex, x)
AssertionError: ValueError not raised by fromhex
Here's a patch for the test-suite to get more information about where
float.fromhex is failing. Could someone else please review this quickly
so that I can check it in? It shouldn't take more than a few minutes to
review.
The problem appears to be that on Solaris, the isxdigit function (which
is supposed to check whether a character is a valid hex digit) returns
true for Unicode fullwidth digits. On other systems I have access to,
isxdigit just returns true for the ASCII hex digits, and you use the C99
iswxdigit function if you want to allow other Unicode digits.
One could argue that these fullwidth digits should be permitted, but I
don't know any quick way to convert a unicode digit to its value. For
now, it just seems simplest to replace the isxdigit call with an
explicit check for the ASCII 7-bit characters '0' through '9', 'a'
through 'f'.
Le jeudi 21 août 2008 à 21:12 +0000, Mark Dickinson a écrit :
For now, it just seems simplest to replace the isxdigit call with an
explicit check for the ASCII 7-bit characters '0' through '9', 'a'
through 'f'.
+1
I don't think it makes a lot of sense to support full width unicode
digits. Hex representation is quite specialized, it won't be produced by
casual users.
A postscript: looking back at this from afar, the original error was
almost certainly due to a missing Py_CHARMASK around the arguments
to isdigit and isxdigit, and nothing to do with Unicode fullwidth digits
at all.
Activity
pitrou commentedon Aug 21, 2008
This is a failure that seems to occur quite often (always?) on the
Solaris buildbot:
======================================================================
FAIL: test_invalid_inputs (test.test_float.HexFloatTestCase)
----------------------------------------------------------------------
Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_float.py", line 451, in test_invalid_inputs self.assertRaises(ValueError, fromHex, x) AssertionError: ValueError not raised by fromhexbenjaminp commentedon Aug 21, 2008
This probably has been happening for quite a while. We just didn't
notice because that bot was busy hanging on test_nis.
The failure is in test_math. Mark, do you know anything?
mdickinson commentedon Aug 21, 2008
I'll take a look, though if anyone has some time to spare and access to a
Solaris machine then they can probably figure this out more quickly.
The first step would be to fix the test so that it at least shows which
input the failure occurs for.
mdickinson commentedon Aug 21, 2008
Here's a patch for the test-suite to get more information about where
float.fromhex is failing. Could someone else please review this quickly
so that I can check it in? It shouldn't take more than a few minutes to
review.
benjaminp commentedon Aug 21, 2008
That looks fine.
mdickinson commentedon Aug 21, 2008
Thanks, Benjamin! Change to test committed in r65958, merged to py3k in
r65959. Time to watch the py3k solaris buildbot.
mdickinson commentedon Aug 21, 2008
The problem appears to be that on Solaris, the isxdigit function (which
is supposed to check whether a character is a valid hex digit) returns
true for Unicode fullwidth digits. On other systems I have access to,
isxdigit just returns true for the ASCII hex digits, and you use the C99
iswxdigit function if you want to allow other Unicode digits.
One could argue that these fullwidth digits should be permitted, but I
don't know any quick way to convert a unicode digit to its value. For
now, it just seems simplest to replace the isxdigit call with an
explicit check for the ASCII 7-bit characters '0' through '9', 'a'
through 'f'.
pitrou commentedon Aug 21, 2008
Le jeudi 21 août 2008 à 21:12 +0000, Mark Dickinson a écrit :
+1
I don't think it makes a lot of sense to support full width unicode
digits. Hex representation is quite specialized, it won't be produced by
casual users.
mdickinson commentedon Aug 21, 2008
Here's a patch. I'm reasonably confident that this should fix the
problem, but I don't have a Solaris machine to test it on.
If anyone can check this on Solaris that would be fantastic, but I'll
settle for a 'looks okay to me' from another core developer.
mdickinson commentedon Aug 21, 2008
...and here's the actual patch!
pitrou commentedon Aug 21, 2008
Le jeudi 21 août 2008 à 21:26 +0000, Mark Dickinson a écrit :
Looks okay to me.
mdickinson commentedon Aug 21, 2008
Thanks, Antoine. Committed, r65964 (2.6) and r65965 (3.0). Setting
status to pending; will close if/when the Solaris buildbot goes green.
benjaminp commentedon Aug 22, 2008
The buildbot is still failing, but not on test_math.
mdickinson commentedon Apr 18, 2009
A postscript: looking back at this from afar, the original error was
almost certainly due to a missing Py_CHARMASK around the arguments
to isdigit and isxdigit, and nothing to do with Unicode fullwidth digits
at all.