| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9640213 commit 9ce2a4b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -177,7 +177,7 @@ def surrogateescape_handler(exc): | |||
| 177 | 177 | # exception anyway after this function is called, even though I think | |
| 178 | 178 | # it's doing what it should. It seems that the strict encoder is called | |
| 179 | 179 | # to encode the unicode string that this function returns ... | |
| 180 | - decoded = replace_surrogate_encode(mystring) | ||
| 180 | + decoded = replace_surrogate_encode(mystring, exc) | ||
| 181 | 181 | else: | |
| 182 | 182 | raise exc | |
| 183 | 183 | except NotASurrogateError: | |
@@ -189,7 +189,7 @@ class NotASurrogateError(Exception): | |||
| 189 | 189 | pass | |
| 190 | 190 | ||
| 191 | 191 | ||
| 192 | - def replace_surrogate_encode(mystring): | ||
| 192 | + def replace_surrogate_encode(mystring, exc): | ||
| 193 | 193 | """ | |
| 194 | 194 | Returns a (unicode) string, not the more logical bytes, because the codecs | |
| 195 | 195 | register_error functionality expects this. | |
@@ -204,7 +204,7 @@ def replace_surrogate_encode(mystring): | |||
| 204 | 204 | # The following magic comes from Py3.3's Python/codecs.c file: | |
| 205 | 205 | if not 0xD800 <= code <= 0xDCFF: | |
| 206 | 206 | # Not a surrogate. Fail with the original exception. | |
| 207 | - raise NotASurrogateError | ||
| 207 | + raise exc | ||
| 208 | 208 | # mybytes = [0xe0 | (code >> 12), | |
| 209 | 209 | # 0x80 | ((code >> 6) & 0x3f), | |
| 210 | 210 | # 0x80 | (code & 0x3f)] | |
| Back | FazBrowse Home | New Git URL |
0 commit comments