[Mesa-dev] [PATCH 01/10] glapi: use new-style Python classes.
Paul Berry
stereotype441 at gmail.com
Fri Oct 12 12:53:30 PDT 2012
An unfortunate quirk of Python 2 is that there are two types of
classes: "classic" classes (which are backward compatible with some
unfortunate design decisions made early in Python's history), and
"new-style" classes. Classic classes have a number of limitations
(for example they don't support super()) and are unavailable in Python
3. There's really no reason to use classic classes, except in
unmaintained legacy code. For more information see
http://www.python.org/download/releases/2.2.3/descrintro/.
This patch upgrades the Python code in src/mapi/glapi/gen to use
exclusively new-style classes.
---
src/mapi/glapi/gen/glX_XML.py | 2 +-
src/mapi/glapi/gen/glX_proto_size.py | 2 +-
src/mapi/glapi/gen/gl_XML.py | 10 +++++-----
src/mapi/glapi/gen/typeexpr.py | 6 +++---
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py
index 975321a..03a35b7 100644
--- a/src/mapi/glapi/gen/glX_XML.py
+++ b/src/mapi/glapi/gen/glX_XML.py
@@ -543,7 +543,7 @@ class glx_function(gl_XML.gl_function):
return not self.ignore and (self.offset != -1) and (self.glx_rop or self.glx_sop or self.glx_vendorpriv or self.vectorequiv or self.client_handcode)
-class glx_function_iterator:
+class glx_function_iterator(object):
"""Class to iterate over a list of glXFunctions"""
def __init__(self, context):
diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
index 7db816b..fdb355d 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -30,7 +30,7 @@ import license
import sys, getopt, copy, string
-class glx_enum_function:
+class glx_enum_function(object):
def __init__(self, func_name, enum_dict):
self.name = func_name
self.mode = 1
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index ce14a41..f956730 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -72,7 +72,7 @@ def is_attr_true( element, name ):
raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, name))
-class gl_print_base:
+class gl_print_base(object):
"""Base class of all API pretty-printers.
In the model-view-controller pattern, this is the view. Any derived
@@ -322,7 +322,7 @@ def create_parameter_string(parameters, include_names):
return string.join(list, ", ")
-class gl_item:
+class gl_item(object):
def __init__(self, element, context):
self.context = context
self.name = element.nsProp( "name", None )
@@ -401,7 +401,7 @@ class gl_enum( gl_item ):
-class gl_parameter:
+class gl_parameter(object):
def __init__(self, element, context):
self.name = element.nsProp( "name", None )
@@ -780,7 +780,7 @@ class gl_function( gl_item ):
return "_dispatch_stub_%u" % (self.offset)
-class gl_item_factory:
+class gl_item_factory(object):
"""Factory to create objects derived from gl_item."""
def create_item(self, item_name, element, context):
@@ -798,7 +798,7 @@ class gl_item_factory:
return None
-class gl_api:
+class gl_api(object):
def __init__(self, factory):
self.functions_by_name = {}
self.enums_by_name = {}
diff --git a/src/mapi/glapi/gen/typeexpr.py b/src/mapi/glapi/gen/typeexpr.py
index 6cc71cb..ed23d23 100644
--- a/src/mapi/glapi/gen/typeexpr.py
+++ b/src/mapi/glapi/gen/typeexpr.py
@@ -27,7 +27,7 @@
import string, copy
-class type_node:
+class type_node(object):
def __init__(self):
self.pointer = 0 # bool
self.const = 0 # bool
@@ -65,7 +65,7 @@ class type_node:
return s
-class type_table:
+class type_table(object):
def __init__(self):
self.types_by_name = {}
return
@@ -109,7 +109,7 @@ def create_initial_types():
return
-class type_expression:
+class type_expression(object):
built_in_types = None
def __init__(self, type_string, extra_types = None):
--
1.7.12.2
More information about the mesa-dev
mailing list