Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r75771:191745efb9be
Date: 2015-02-08 21:57 +0200
http://bitbucket.org/pypy/pypy/changeset/191745efb9be/
Log: don't use a standard exception here
diff --git a/pypy/interpreter/unicodehelper.py
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -16,12 +16,20 @@
space.wrap(msg)]))
return raise_unicode_exception_decode
+class AppUnicodeEncodeError(Exception):
+ def __init__(self, encoding, object, start, end, reason):
+ self.encoding = encoding
+ self.object = object
+ self.start = start
+ self.end = end
+ self.reason = reason
+
@specialize.memo()
def encode_error_handler(space):
# Fast version of the "strict" errors handler.
def raise_unicode_exception_encode(errors, encoding, msg, u,
startingpos, endingpos):
- raise UnicodeEncodeError(encoding, u, startingpos, endingpos, msg)
+ raise AppUnicodeEncodeError(encoding, u, startingpos, endingpos, msg)
return raise_unicode_exception_encode
# ____________________________________________________________
diff --git a/pypy/objspace/std/unicodeobject.py
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -448,7 +448,7 @@
return space.wrap(unicode_encode_utf_8(
u, len(u), None, errorhandler=eh,
allow_surrogates=True))
- except UnicodeEncodeError, ue:
+ except unicodehelper.AppUnicodeEncodeError, ue:
raise OperationError(space.w_UnicodeEncodeError,
space.newtuple([
space.wrap(ue.encoding),
diff --git a/rpython/annotator/classdef.py b/rpython/annotator/classdef.py
--- a/rpython/annotator/classdef.py
+++ b/rpython/annotator/classdef.py
@@ -3,7 +3,7 @@
"""
from rpython.annotator.model import (
SomePBC, s_ImpossibleValue, unionof, s_None, SomeInteger,
- SomeTuple, SomeString, AnnotatorError)
+ SomeTuple, SomeString, AnnotatorError, SomeUnicodeString)
from rpython.annotator import description
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit