[Piglit] [PATCH 23/34] registry/gl.py: Don't try to compare None and not-None

Dylan Baker baker.dylan.c at gmail.com
Fri Feb 20 18:18:10 PST 2015

Python2 allows the comparison of completely unlike types always. Often
the rules for these comparisons are surprising. None is one of the most
surprising comparisons you can make.

In python3 a much more sensible approach was taken, only related types
can be compared. So int and float can be compared, but int and None

The solution here is to fail if the value is None, since the comparison
expects None to be less than the other value.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
 registry/gl.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/registry/gl.py b/registry/gl.py
index 43093a7..288a4fc 100644
--- a/registry/gl.py
+++ b/registry/gl.py
@@ -100,9 +100,9 @@ def _repair_xml(xml_registry):
         if ('gles2_GL_ACTIVE_PROGRAM_EXT' in fixes
-            and enums.get('vendor') == 'ARB'
-            and enums.get('start') <= '0x8259'
-            and enums.get('end') >= '0x8259'):
+            and enums.get('vendor') is not None and enums.get('vendor') == 'ARB'
+            and enums.get('start') is not None and enums.get('start') <= '0x8259'
+            and enums.get('end') is not None and enums.get('end') >= '0x8259'):
                 # GL_ACTIVE_PROGRAM_EXT has different numerical values in GL
                 # (0x8B8D) and in GLES (0x8259). Remove the GLES value to avoid
                 # redefinition collisions.

More information about the Piglit mailing list