mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-28 00:16:15 +01:00
Merge branch 'python-none-equality' into 'master'
python: avoid equality check for None See merge request GNOME/glib!179
This commit is contained in:
commit
24c5f98c91
@ -1068,7 +1068,7 @@ class CodeGenerator:
|
||||
'\n')
|
||||
|
||||
def generate_annotations(self, prefix, annotations):
|
||||
if annotations == None:
|
||||
if annotations is None:
|
||||
return
|
||||
|
||||
n = 0
|
||||
|
@ -63,38 +63,38 @@ def apply_annotation(iface_list, iface, method, signal, prop, arg, key, value):
|
||||
iface_obj = i
|
||||
break
|
||||
|
||||
if iface_obj == None:
|
||||
if iface_obj is None:
|
||||
print_error('No interface "{}"'.format(iface))
|
||||
|
||||
target_obj = None
|
||||
|
||||
if method:
|
||||
method_obj = find_method(iface_obj, method)
|
||||
if method_obj == None:
|
||||
if method_obj is None:
|
||||
print_error('No method "{}" on interface "{}"'.format(method, iface))
|
||||
if arg:
|
||||
arg_obj = find_arg(method_obj.in_args, arg)
|
||||
if (arg_obj == None):
|
||||
if (arg_obj is None):
|
||||
arg_obj = find_arg(method_obj.out_args, arg)
|
||||
if (arg_obj == None):
|
||||
if (arg_obj is None):
|
||||
print_error('No arg "{}" on method "{}" on interface "{}"'.format(arg, method, iface))
|
||||
target_obj = arg_obj
|
||||
else:
|
||||
target_obj = method_obj
|
||||
elif signal:
|
||||
signal_obj = find_signal(iface_obj, signal)
|
||||
if signal_obj == None:
|
||||
if signal_obj is None:
|
||||
print_error('No signal "{}" on interface "{}"'.format(signal, iface))
|
||||
if arg:
|
||||
arg_obj = find_arg(signal_obj.args, arg)
|
||||
if (arg_obj == None):
|
||||
if (arg_obj is None):
|
||||
print_error('No arg "{}" on signal "{}" on interface "{}"'.format(arg, signal, iface))
|
||||
target_obj = arg_obj
|
||||
else:
|
||||
target_obj = signal_obj
|
||||
elif prop:
|
||||
prop_obj = find_prop(iface_obj, prop)
|
||||
if prop_obj == None:
|
||||
if prop_obj is None:
|
||||
print_error('No property "{}" on interface "{}"'.format(prop, iface))
|
||||
target_obj = prop_obj
|
||||
else:
|
||||
|
@ -61,7 +61,7 @@ class Arg:
|
||||
if len(self.since) == 0:
|
||||
self.since = utils.lookup_since(self.annotations)
|
||||
|
||||
if self.name == None:
|
||||
if self.name is None:
|
||||
self.name = 'unnamed_arg%d'%arg_number
|
||||
# default to GVariant
|
||||
self.ctype_in_g = 'GVariant *'
|
||||
|
@ -116,21 +116,21 @@ def lookup_annotation(annotations, key):
|
||||
|
||||
def lookup_docs(annotations):
|
||||
s = lookup_annotation(annotations, 'org.gtk.GDBus.DocString')
|
||||
if s == None:
|
||||
if s is None:
|
||||
return ''
|
||||
else:
|
||||
return s
|
||||
|
||||
def lookup_since(annotations):
|
||||
s = lookup_annotation(annotations, 'org.gtk.GDBus.Since')
|
||||
if s == None:
|
||||
if s is None:
|
||||
return ''
|
||||
else:
|
||||
return s
|
||||
|
||||
def lookup_brief_docs(annotations):
|
||||
s = lookup_annotation(annotations, 'org.gtk.GDBus.DocString.Short')
|
||||
if s == None:
|
||||
if s is None:
|
||||
return ''
|
||||
else:
|
||||
return s
|
||||
|
@ -9,7 +9,7 @@ def read_global_var (symname):
|
||||
return gdb.selected_frame().read_var(symname)
|
||||
|
||||
def g_quark_to_string (quark):
|
||||
if quark == None:
|
||||
if quark is None:
|
||||
return None
|
||||
quark = long(quark)
|
||||
if quark == 0:
|
||||
@ -171,7 +171,7 @@ def pretty_printer_lookup (val):
|
||||
return None
|
||||
|
||||
def register (obj):
|
||||
if obj == None:
|
||||
if obj is None:
|
||||
obj = gdb
|
||||
|
||||
obj.pretty_printers.append(pretty_printer_lookup)
|
||||
|
@ -104,7 +104,7 @@ class Mapping:
|
||||
return [self]
|
||||
|
||||
def serialise(self, serialiser):
|
||||
if self.serialised == None:
|
||||
if self.serialised is None:
|
||||
self.serialised = serialiser.add_mapping(self.mapping)
|
||||
|
||||
return self.serialised
|
||||
@ -193,7 +193,7 @@ class Chain:
|
||||
return [self]
|
||||
|
||||
def serialise(self, serialiser):
|
||||
if self.serialised == None:
|
||||
if self.serialised is None:
|
||||
# Before we serialise, see if we can optimise a bit
|
||||
self.chain = sum((item.get_flattened() for item in self.chain), [])
|
||||
|
||||
|
@ -26,7 +26,7 @@ def g_type_to_typenode (gtype):
|
||||
if typenode == 0:
|
||||
return None
|
||||
val = read_global_var ("static_fundamental_type_nodes")
|
||||
if val == None:
|
||||
if val is None:
|
||||
return None
|
||||
return val[typenode >> 2].address
|
||||
|
||||
@ -132,7 +132,7 @@ def pretty_printer_lookup (val):
|
||||
return None
|
||||
|
||||
def get_signal_name (id):
|
||||
if id == None:
|
||||
if id is None:
|
||||
return None
|
||||
id = long(id)
|
||||
if id == 0:
|
||||
@ -163,7 +163,7 @@ class SignalFrame(FrameDecorator):
|
||||
def read_var (self, frame, name, array = None):
|
||||
try:
|
||||
v = frame_var (frame, name)
|
||||
if v == None or v.is_optimized_out:
|
||||
if v is None or v.is_optimized_out:
|
||||
return None
|
||||
if array != None:
|
||||
array.append (v)
|
||||
@ -174,7 +174,7 @@ class SignalFrame(FrameDecorator):
|
||||
def read_object (self, frame, name, array = None):
|
||||
try:
|
||||
v = frame_var (frame, name)
|
||||
if v == None or v.is_optimized_out:
|
||||
if v is None or v.is_optimized_out:
|
||||
return None
|
||||
v = v.cast (gdb.lookup_type("GObject").pointer())
|
||||
# Ensure this is a somewhat correct object pointer
|
||||
@ -323,7 +323,7 @@ class GFrameFilter(object):
|
||||
return GFrameDecorator(iterator)
|
||||
|
||||
def register (obj):
|
||||
if obj == None:
|
||||
if obj is None:
|
||||
obj = gdb
|
||||
|
||||
if HAVE_GDB_FRAMEDECORATOR:
|
||||
|
Loading…
Reference in New Issue
Block a user