Commits

Joongi Kim committed d8ea331

Initial version tested on Python 3.2. Passes all tests provided by the original author.

  • Participants
  • Parent commits b7aff6a

Comments (0)

Files changed (1)

File recordtype.py

 
     _check_name(typename, is_type_name=True)
 
-    if isinstance(field_names, basestring):
+    if isinstance(field_names, str):
         # No per-field defaults. So it's like a namedtuple, but with
         #  a possible default value.
         field_names = field_names.replace(',', ' ').split()
 
     seen_names = set()
     for idx, field_name in enumerate(field_names):
-        if isinstance(field_name, basestring):
+        if isinstance(field_name, str):
             field_name = _check_field_name(field_name, seen_names, rename,
                                            idx)
             fields.add_without_default(field_name)
         namespace[_default_name(name)] = default
 
     try:
-        exec template in namespace
+        exec(template, namespace)
     except SyntaxError as e:
         raise SyntaxError(e.message + ':\n' + template)
 
 
 if __name__ == '__main__':
     import unittest
-    import pickle, cPickle
+    import pickle
 
     # types used for pickle tests
     TestRT0 = recordtype('TestRT0', '')
 
         def test_pickle(self):
             for p in (TestRT0(), TestRT(x=10, y=20, z=30)):
-                for module in (pickle, cPickle):
+                for module in (pickle,):
                     loads = getattr(module, 'loads')
                     dumps = getattr(module, 'dumps')
                     for protocol in -1, 0, 1, 2: