[pypy-commit] pypy py3k: There is no such things as str.encode() and unicode.decode()!
amauryfa
noreply at buildbot.pypy.org
Thu Oct 13 22:40:17 CEST 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r48024:8c6f39bc08a4
Date: 2011-10-13 22:38 +0200
http://bitbucket.org/pypy/pypy/changeset/8c6f39bc08a4/
Log: There is no such things as str.encode() and unicode.decode()!
diff --git a/pypy/objspace/std/ropeobject.py b/pypy/objspace/std/ropeobject.py
--- a/pypy/objspace/std/ropeobject.py
+++ b/pypy/objspace/std/ropeobject.py
@@ -867,12 +867,6 @@
encoding = getdefaultencoding(space)
return decode_string(space, w_string, encoding, errors)
-def str_encode__Rope_ANY_ANY(space, w_string, w_encoding=None, w_errors=None):
- from pypy.objspace.std.unicodetype import _get_encoding_and_errors, \
- encode_object
- encoding, errors = _get_encoding_and_errors(space, w_encoding, w_errors)
- return encode_object(space, w_string, encoding, errors)
-
def buffer__Rope(space, w_string):
from pypy.interpreter.buffer import StringBuffer
value = w_string._node.flatten_string() # XXX inefficient
diff --git a/pypy/objspace/std/stringobject.py b/pypy/objspace/std/stringobject.py
--- a/pypy/objspace/std/stringobject.py
+++ b/pypy/objspace/std/stringobject.py
@@ -1000,12 +1000,6 @@
encoding, errors = _get_encoding_and_errors(space, w_encoding, w_errors)
return decode_object(space, w_string, encoding, errors)
-def str_encode__String_ANY_ANY(space, w_string, w_encoding=None, w_errors=None):
- from pypy.objspace.std.unicodetype import _get_encoding_and_errors, \
- encode_object
- encoding, errors = _get_encoding_and_errors(space, w_encoding, w_errors)
- return encode_object(space, w_string, encoding, errors)
-
# CPython's logic for deciding if ""%values is
# an error (1 value, 0 %-formatters) or not
# (values is of a mapping type)
diff --git a/pypy/objspace/std/stringtype.py b/pypy/objspace/std/stringtype.py
--- a/pypy/objspace/std/stringtype.py
+++ b/pypy/objspace/std/stringtype.py
@@ -259,18 +259,6 @@
" are 'ignore' and 'replace'\nas well as any other"
' name registerd with codecs.register_error that'
' is\nable to handle UnicodeDecodeErrors.')
-str_encode = SMM('encode', 3, defaults=(None, None),
- argnames=['encoding', 'errors'],
- doc='S.encode([encoding[,errors]]) -> object\n\nEncodes S'
- ' using the codec registered for encoding. encoding'
- ' defaults\nto the default encoding. errors may be'
- ' given to set a different error\nhandling scheme.'
- " Default is 'strict' meaning that encoding errors"
- ' raise\na UnicodeEncodeError. Other possible values'
- " are 'ignore', 'replace' and\n'xmlcharrefreplace' as"
- ' well as any other name registered'
- ' with\ncodecs.register_error that is able to handle'
- ' UnicodeEncodeErrors.')
register_all(vars(), globals())
diff --git a/pypy/objspace/std/unicodetype.py b/pypy/objspace/std/unicodetype.py
--- a/pypy/objspace/std/unicodetype.py
+++ b/pypy/objspace/std/unicodetype.py
@@ -168,7 +168,6 @@
from pypy.objspace.std.stringtype import str_strip as unicode_strip
from pypy.objspace.std.stringtype import str_rstrip as unicode_rstrip
from pypy.objspace.std.stringtype import str_lstrip as unicode_lstrip
-from pypy.objspace.std.stringtype import str_decode as unicode_decode
# ____________________________________________________________
@@ -299,11 +298,6 @@
return w_res
return unicode_from_encoded_object(space, w_res, None, "strict")
-def unicode_decode__unitypedef_ANY_ANY(space, w_unicode, w_encoding=None,
- w_errors=None):
- return space.call_method(space.str(w_unicode), 'decode',
- w_encoding, w_errors)
-
def descr_new_(space, w_unicodetype, w_string='', w_encoding=None, w_errors=None):
# NB. the default value of w_obj is really a *wrapped* empty string:
More information about the pypy-commit
mailing list