shedskin-packaging

Annotated python25print.diff

49:bf409fe38c5c
2011-09-06 Paul Boddie Minor release-related changes.
paul@22 1
--- shedskin/lib/builtin.py	(revision 1507)
paul@22 2
+++ shedskin/lib/builtin.py	(working copy)
paul@22 3
@@ -1,5 +1,3 @@
paul@22 4
-from __future__ import print_function
paul@22 5
-
paul@22 6
 class class_:
paul@22 7
     def __repr__(self):
paul@22 8
         return self.__name__
paul@22 9
@@ -848,5 +846,5 @@
paul@22 10
     return iter1.next()
paul@22 11
     return fillvalue
paul@22 12
 
paul@22 13
-def print(__kw_sep=0, __kw_end=0, __kw_file=0, *value):
paul@22 14
+def __print(__kw_sep=0, __kw_end=0, __kw_file=0, *value):
paul@22 15
     value.__str__()
paul@22 16
--- shedskin/graph.py	(revision 1507)
paul@22 17
+++ shedskin/graph.py	(working copy)
paul@22 18
@@ -1200,6 +1200,8 @@
paul@22 19
         elif isinstance(node.node, Name):
paul@22 20
             # direct call
paul@22 21
             ident = node.node.name
paul@22 22
+            if ident == 'print':
paul@22 23
+                ident = node.node.name = '__print' # XXX
paul@22 24
 
paul@22 25
             if ident in ['getattr', 'setattr', 'slice', 'type']:
paul@22 26
                 error("'%s' function is not supported" % ident, node.node)
paul@22 27
--- shedskin/cpp.py	(revision 1507)
paul@22 28
+++ shedskin/cpp.py	(working copy)
paul@22 29
@@ -1656,6 +1656,8 @@
paul@22 30
                 return
paul@22 31
             elif ident == 'hash':
paul@22 32
                 self.append('hasher(') # XXX cleanup
paul@22 33
+            elif ident == '__print': # XXX
paul@22 34
+                self.append('print(')
paul@22 35
             elif ident == 'isinstance' and isinstance(node.args[1], Name) and node.args[1].name in ['float','int']:
paul@22 36
                 error("'isinstance' cannot be used with ints or floats; assuming always true", node, warning=True)
paul@22 37
                 self.append('1')
paul@22 38
@@ -1716,7 +1718,7 @@
paul@22 39
         objexpr, ident, direct_call, method_call, constructor, parent_constr = analyze_callfunc(node)
paul@22 40
         target = funcs[0] # XXX
paul@22 41
 
paul@22 42
-        print_function = self.library_func(funcs, 'builtin', None, 'print')
paul@22 43
+        print_function = self.library_func(funcs, 'builtin', None, '__print')
paul@22 44
 
paul@22 45
         castnull = False # XXX
paul@22 46
         if (self.library_func(funcs, 'random', None, 'seed') or \
paul@22 47
--- shedskin/shared.py	(revision 1507)
paul@22 48
+++ shedskin/shared.py	(working copy)
paul@22 49
@@ -764,7 +764,7 @@
paul@22 50
         missing = formals[len(actuals):-len(func.defaults)]
paul@22 51
 
paul@22 52
     skip_defaults = True # XXX
paul@22 53
-    if not func.mv.module.builtin or func.mv.module.ident in ['random', 'itertools', 'datetime', 'ConfigParser', 'csv'] or (func.ident in ('sort','sorted', 'min', 'max', 'print')):
paul@22 54
+    if not func.mv.module.builtin or func.mv.module.ident in ['random', 'itertools', 'datetime', 'ConfigParser', 'csv'] or (func.ident in ('sort','sorted', 'min', 'max', '__print')):
paul@22 55
         if not (func.mv.module.builtin and func.ident == 'randrange'):
paul@22 56
             skip_defaults = False
paul@22 57