Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ce2a4b

Browse files
yarikopticByron
authored andcommitted
BF: pass original exception into replace_surrogate_encode
Fixes my incorrect fix ingitpython-developers#598
1 parent9640213 commit9ce2a4b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎git/compat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def surrogateescape_handler(exc):
177177
# exception anyway after this function is called, even though I think
178178
# it's doing what it should. It seems that the strict encoder is called
179179
# to encode the unicode string that this function returns ...
180-
decoded=replace_surrogate_encode(mystring)
180+
decoded=replace_surrogate_encode(mystring,exc)
181181
else:
182182
raiseexc
183183
exceptNotASurrogateError:
@@ -189,7 +189,7 @@ class NotASurrogateError(Exception):
189189
pass
190190

191191

192-
defreplace_surrogate_encode(mystring):
192+
defreplace_surrogate_encode(mystring,exc):
193193
"""
194194
Returns a (unicode) string, not the more logical bytes, because the codecs
195195
register_error functionality expects this.
@@ -204,7 +204,7 @@ def replace_surrogate_encode(mystring):
204204
# The following magic comes from Py3.3's Python/codecs.c file:
205205
ifnot0xD800<=code<=0xDCFF:
206206
# Not a surrogate. Fail with the original exception.
207-
raiseNotASurrogateError
207+
raiseexc
208208
# mybytes = [0xe0 | (code >> 12),
209209
# 0x80 | ((code >> 6) & 0x3f),
210210
# 0x80 | (code & 0x3f)]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp