Skip to content
  • Paul Berry's avatar
    generated_tests: work around bug in Windows numpy implementation. · 363d7ce6
    Paul Berry authored
    The windows implementation of numpy seems to have multiple independent
    copies of the int32 and uint32 types, as illustrated by this
    interactive session:
    
    Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import numpy
    >>> x = numpy.int32(5)
    >>> y = numpy.abs(x)
    >>> print type(x)
    <type 'numpy.int32'>
    >>> print type(y)
    <type 'numpy.int32'>
    >>> print type(x) == type(y)
    False
    >>> exit()
    
    On Linux, the last "print" yields True, which is clearly the correct
    behavior.
    
    This duplication of int32 and uint32 classes was preventing
    builtin_function.py's glsl_type_of() function from being able to
    reliably determine the type of its argument, causing an assertion
    failure while building piglit.
    
    This patch works around the problem by creating tuples INT32_TYPES and
    UINT32_TYPES which contain the duplicate types.  These tuples are used
    instead of referring directly to numpy.int32 and numpy.uint32.
    
    On platforms that do not have this bug, the tuples are "oneples" (one
    element each) so there is no change in behavior.
    
    I've verified that on Linux, this change does not affect the generated
    tests.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=40697
    
    
    
    Tested-by: default avatarVinson Lee <vlee@vmware.com>
    363d7ce6