[pypy-commit] pypy py3k: update builtins: 'str' is the unicode type, 'bytes' is the 8bit string
amauryfa
noreply at buildbot.pypy.org
Thu Oct 13 00:01:36 CEST 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r48002:435fe1660753
Date: 2011-10-12 23:58 +0200
http://bitbucket.org/pypy/pypy/changeset/435fe1660753/
Log: update builtins: 'str' is the unicode type, 'bytes' is the 8bit
string
diff --git a/pypy/module/__builtin__/__init__.py b/pypy/module/__builtin__/__init__.py
--- a/pypy/module/__builtin__/__init__.py
+++ b/pypy/module/__builtin__/__init__.py
@@ -37,8 +37,6 @@
'__debug__' : '(space.w_True)', # XXX
'type' : '(space.w_type)',
'object' : '(space.w_object)',
- 'bytes' : '(space.w_str)',
- 'unicode' : '(space.w_unicode)',
'buffer' : 'interp_memoryview.W_Buffer',
'memoryview' : 'interp_memoryview.W_MemoryView',
diff --git a/pypy/module/__builtin__/app_io.py b/pypy/module/__builtin__/app_io.py
--- a/pypy/module/__builtin__/app_io.py
+++ b/pypy/module/__builtin__/app_io.py
@@ -76,39 +76,23 @@
if fp is None:
return
def write(data):
- if not isinstance(data, basestring):
+ if not isinstance(data, str):
data = str(data)
fp.write(data)
- want_unicode = False
sep = kwargs.pop("sep", None)
if sep is not None:
- if isinstance(sep, unicode):
- want_unicode = True
- elif not isinstance(sep, str):
+ if not isinstance(sep, str):
raise TypeError("sep must be None or a string")
end = kwargs.pop("end", None)
if end is not None:
- if isinstance(end, unicode):
- want_unicode = True
- elif not isinstance(end, str):
+ if not isinstance(end, str):
raise TypeError("end must be None or a string")
if kwargs:
raise TypeError("invalid keyword arguments to print()")
- if not want_unicode:
- for arg in args:
- if isinstance(arg, unicode):
- want_unicode = True
- break
- if want_unicode:
- newline = u"\n"
- space = u" "
- else:
- newline = "\n"
- space = " "
if sep is None:
- sep = space
+ sep = " "
if end is None:
- end = newline
+ end = "\n"
for i, arg in enumerate(args):
if i:
write(sep)
diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py
--- a/pypy/objspace/std/objspace.py
+++ b/pypy/objspace/std/objspace.py
@@ -68,6 +68,9 @@
w_type = self.gettypeobject(typedef)
self.builtin_types[typedef.name] = w_type
setattr(self, 'w_' + typedef.name, w_type)
+ del self.builtin_types['unicode']
+ self.builtin_types['str'] = self.w_unicode
+ self.builtin_types['bytes'] = self.w_str
self.w_text = self.w_unicode
self.builtin_types["NotImplemented"] = self.w_NotImplemented
self.builtin_types["Ellipsis"] = self.w_Ellipsis
More information about the pypy-commit
mailing list