On Tue, Apr 5, 2011 at 7:21 PM, Christoph Gohlke <cgohlke@uci.edu> wrote:


On 4/5/2011 6:46 PM, Mark Wiebe wrote:
> On Tue, Apr 5, 2011 at 5:07 PM, Christoph Gohlke <cgohlke@uci.edu
> <mailto:cgohlke@uci.edu>> wrote:
>
>
>
>     On 4/5/2011 4:05 PM, Mark Wiebe wrote:
>     >  On Mon, Apr 4, 2011 at 9:10 PM, Christoph Gohlke <cgohlke@uci.edu
>     <mailto:cgohlke@uci.edu>
>     >  <mailto:cgohlke@uci.edu <mailto:cgohlke@uci.edu>>> wrote:
>     >
>     >
>     >  <snip>
>     >
>     >      A few numpy tests fail on win-amd64:
>     >
>     >  <snip>
>     >
>     >
>     ======================================================================
>     >      FAIL: test_iterator.test_iter_broadcasting_errors
>     >
>     ----------------------------------------------------------------------
>     >      Traceback (most recent call last):
>     >         File "X:\Python26-x64\lib\site-packages\nose\case.py", line
>     187, in
>     >      runTest
>     >           self.test(*self.arg)
>     >         File
>     >  "X:\Python26-x64\lib\site-packages\numpy\core\tests\test_iterator.py",
>     >      line 639, in test_iter_broadcasting_errors
>     >  'Message "%s" doesn\'t contain operand shape (2,3)' % msg)
>     >         File
>     "X:\Python26-x64\lib\site-packages\numpy\testing\utils.py", line
>     >      34, in assert_
>     >           raise AssertionError(msg)
>     >      AssertionError: Message "non-broadcastable output operand with
>     shape
>     >      (%lld,%lld)
>     >        doesn't match the broadcast shape (%lld,%lld,%lld)" doesn't
>     contain
>     >      operand shape (2,3)
>     >
>     >
>     >  I've pushed a fix for this to the 1.6.x branch, can you confirm
>     that it
>     >  works on win-amd64?
>     >
>     >  Thanks,
>     >  Mark
>     >
>     >  <snip>
>     >
>
>     Sorry, I forgot to mention that this test failed on 64-bit Python 2.6
>     only. I now recognize it is due to a known issue with Python's
>     PyErr_Format function <http://bugs.python.org/issue7228>. Unfortunately
>     the fix will not be backported to Python 2.6. Maybe this test could be
>     marked as known failure on win-amd64-py2.6?
>
>     Could you please revert your changes or set the format specifier to
>     "%lld"? "%I64d" is not supported by PyErr_Format.
>
>
> I've committed an attempted workaround using the %zd formatter, can you
> check whether it works on 64-bit Windows Python 2.6 now?
>
> Thanks,
> Mark
>

I have not tried but I do not expect it to work. According to
<http://docs.python.org/c-api/string.html> the "%zd" format is 'exactly
equivalent to printf("%zd")'. The 'z' prefix character is C99 AFAIK and
not supported by Visual Studio compilers
<http://msdn.microsoft.com/en-us/library/xdb9w69d%28v=VS.90%29.aspx>.

I think there's a good chance it will work, since the CPython code is re-interpreting the format codes itself. In the Python 2.6 code, it looks like it will become %Id on Windows, which would be correct.

-Mark