Commits

Armin Rigo committed 58f2cb2

Fix demos

  • Participants
  • Parent commits 6b8dd58

Comments (0)

Files changed (6)

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

demo/bsdopendirtype.py

                 if ffi.errno != 0:
                     raise _posix_error()
                 return
-            name = str(dirent.d_name)
+            name = ffi.string(dirent.d_name)
             if name == '.' or name == '..':
                 continue
             name = dirname + name
 lib.mpz_add(a, a, b)			# a=a+b
 
 s = lib.mpz_get_str(ffi.NULL, 10, a)
-print str(s)
+print ffi.string(s)
 #include <sys/types.h>
 #include <pwd.h>
 """)
-print str(C.getpwuid(0).pw_name)
+print ffi.string(C.getpwuid(0).pw_name)
             break
         if result[0] == ffi.NULL:
             break
-        name = str(dirent.d_name)
+        name = ffi.string(dirent.d_name)
         print '%3d %s' % (dirent.d_type, name)
         if dirent.d_type == 4 and name != '.' and name != '..':
             walk(dirfd, name)
             break
         if result[0] == ffi.NULL:
             break
-        name = str(dirent.d_name)
+        name = ffi.string(dirent.d_name)
         print '%3d %s' % (dirent.d_type, name)
         if dirent.d_type == ffi.C.DT_DIR and name != '.' and name != '..':
             walk(dirfd, name)