shithub: aubio

Download patch

ref: 8b8a0203cfe66c34655acc40fa147e6e8e3fe09b
parent: a49a3f066e686b97eadaeb0d2e6aa8eb2d8d8a21
author: Nils Philippsen <nils@tiptoe.de>
date: Wed Nov 25 19:09:08 EST 2015

Python 3: coerce iterators into lists where necessary

--- a/python/lib/gen_pyobject.py
+++ b/python/lib/gen_pyobject.py
@@ -70,7 +70,7 @@
     example: proto = "int main (int argc, char ** argv)"
     returns: [['int', 'argc'], ['char **','argv']]
     """
-    return map(split_type, get_params(proto)) 
+    return list(map(split_type, get_params(proto)))
 
 def get_return_type(proto):
     import re
--- a/python/lib/generator.py
+++ b/python/lib/generator.py
@@ -11,6 +11,7 @@
 
   cpp_output = filter(lambda y: len(y) > 1, cpp_output)
   cpp_output = filter(lambda y: not y.startswith('#'), cpp_output)
+  cpp_output = list(cpp_output)
 
   i = 1
   while 1:
@@ -85,9 +86,11 @@
       object_methods = filter(lambda x: this_object in x, cpp_output)
       object_methods = [a.strip() for a in object_methods]
       object_methods = filter(lambda x: not x.startswith('typedef'), object_methods)
+      object_methods = list(object_methods)
       #for method in object_methods:
       #    write_msg(method)
-      new_methods = filter(lambda x: 'new_'+object_name in x, object_methods)
+      new_methods = list(filter(
+          lambda x: 'new_'+object_name in x, object_methods))
       if len(new_methods) > 1:
           write_msg("-- WARNING: more than one new method for", object_name)
           for method in new_methods:
@@ -98,7 +101,8 @@
           for method in new_methods:
               write_msg(method)
 
-      del_methods = filter(lambda x: 'del_'+object_name in x, object_methods)
+      del_methods = list(filter(
+          lambda x: 'del_'+object_name in x, object_methods))
       if len(del_methods) > 1:
           write_msg("-- WARNING: more than one del method for", object_name)
           for method in del_methods:
@@ -106,7 +110,8 @@
       elif len(del_methods) < 1:
           write_msg("-- WARNING: no del method for", object_name)
 
-      do_methods = filter(lambda x: object_name+'_do' in x, object_methods)
+      do_methods = list(filter(
+          lambda x: object_name+'_do' in x, object_methods))
       if len(do_methods) > 1:
           pass
           #write_msg("-- WARNING: more than one do method for", object_name)
@@ -135,6 +140,7 @@
       other_methods = filter(lambda x: x not in    do_methods, other_methods)
       other_methods = filter(lambda x: x not in get_methods, other_methods)
       other_methods = filter(lambda x: x not in set_methods, other_methods)
+      other_methods = list(other_methods)
 
       if len(other_methods) > 0:
           write_msg("-- WARNING: some methods for", object_name, "were unidentified")