Commits

Armin Rigo committed 4606e24

Fix the demos (None => ffi.NULL)

Comments (0)

Files changed (5)

     globals().update(lib.__dict__)
     for key in range(KEY_MIN, KEY_MAX):
         key_n = keyname(key)
-        if key_n is None or str(key_n) == "UNKNOWN KEY":
+        if key_n == ffi.NULL or str(key_n) == "UNKNOWN KEY":
             continue
         key_n = str(key_n).replace('(', '').replace(')', '')
         globals()[key_n] = key

demo/bsdopendirtype.py

     if not dirname.endswith('/'):
         dirname += '/'
     dirp = lib.opendir(dir)
-    if dirp is None:
+    if dirp == ffi.NULL:
         raise _posix_error()
     try:
         while True:
             ffi.errno = 0
             dirent = lib.readdir(dirp)
-            if dirent is None:
+            if dirent == ffi.NULL:
                 if ffi.errno != 0:
                     raise _posix_error()
                 return
         if ffi.C.readdir_r(dir, dirent, result):
             # error in readdir_r()
             break
-        if result[0] is None:
+        if result[0] == ffi.NULL:
             break
         name = str(dirent.d_name)
         print '%3d %s' % (dirent.d_type, name)
         if ffi.C.readdir_r(dir, dirent, result):
             # error in readdir_r()
             break
-        if result[0] is None:
+        if result[0] == ffi.NULL:
             break
         name = str(dirent.d_name)
         print '%3d %s' % (dirent.d_type, name)
 
 def main():
     display = XOpenDisplay(None)
-    if display is None:
+    if display == ffi.NULL:
         raise XError("cannot open display")
     w = XCreateSimpleWindow(display, DefaultRootWindow(display),
                             10, 10, 500, 350, 0, 0, 0)