1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/python25print.diff Tue Jul 13 17:40:01 2010 +0200
1.3 @@ -0,0 +1,57 @@
1.4 +--- shedskin/lib/builtin.py (revision 1507)
1.5 ++++ shedskin/lib/builtin.py (working copy)
1.6 +@@ -1,5 +1,3 @@
1.7 +-from __future__ import print_function
1.8 +-
1.9 + class class_:
1.10 + def __repr__(self):
1.11 + return self.__name__
1.12 +@@ -848,5 +846,5 @@
1.13 + return iter1.next()
1.14 + return fillvalue
1.15 +
1.16 +-def print(__kw_sep=0, __kw_end=0, __kw_file=0, *value):
1.17 ++def __print(__kw_sep=0, __kw_end=0, __kw_file=0, *value):
1.18 + value.__str__()
1.19 +--- shedskin/graph.py (revision 1507)
1.20 ++++ shedskin/graph.py (working copy)
1.21 +@@ -1200,6 +1200,8 @@
1.22 + elif isinstance(node.node, Name):
1.23 + # direct call
1.24 + ident = node.node.name
1.25 ++ if ident == 'print':
1.26 ++ ident = node.node.name = '__print' # XXX
1.27 +
1.28 + if ident in ['getattr', 'setattr', 'slice', 'type']:
1.29 + error("'%s' function is not supported" % ident, node.node)
1.30 +--- shedskin/cpp.py (revision 1507)
1.31 ++++ shedskin/cpp.py (working copy)
1.32 +@@ -1656,6 +1656,8 @@
1.33 + return
1.34 + elif ident == 'hash':
1.35 + self.append('hasher(') # XXX cleanup
1.36 ++ elif ident == '__print': # XXX
1.37 ++ self.append('print(')
1.38 + elif ident == 'isinstance' and isinstance(node.args[1], Name) and node.args[1].name in ['float','int']:
1.39 + error("'isinstance' cannot be used with ints or floats; assuming always true", node, warning=True)
1.40 + self.append('1')
1.41 +@@ -1716,7 +1718,7 @@
1.42 + objexpr, ident, direct_call, method_call, constructor, parent_constr = analyze_callfunc(node)
1.43 + target = funcs[0] # XXX
1.44 +
1.45 +- print_function = self.library_func(funcs, 'builtin', None, 'print')
1.46 ++ print_function = self.library_func(funcs, 'builtin', None, '__print')
1.47 +
1.48 + castnull = False # XXX
1.49 + if (self.library_func(funcs, 'random', None, 'seed') or \
1.50 +--- shedskin/shared.py (revision 1507)
1.51 ++++ shedskin/shared.py (working copy)
1.52 +@@ -764,7 +764,7 @@
1.53 + missing = formals[len(actuals):-len(func.defaults)]
1.54 +
1.55 + skip_defaults = True # XXX
1.56 +- 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')):
1.57 ++ 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')):
1.58 + if not (func.mv.module.builtin and func.ident == 'randrange'):
1.59 + skip_defaults = False
1.60 +