mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
PEP 293 implemention (from SF patch http://www.python.org/sf/432401)
This commit is contained in:
parent
94fab762de
commit
3aeb632c31
12 changed files with 2936 additions and 563 deletions
|
@ -20,7 +20,10 @@ except ImportError, why:
|
|||
__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE",
|
||||
"BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE",
|
||||
"BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE",
|
||||
"BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE"]
|
||||
"BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE",
|
||||
"strict_errors", "ignore_errors", "replace_errors",
|
||||
"xmlcharrefreplace_errors",
|
||||
"register_error", "lookup_error"]
|
||||
|
||||
### Constants
|
||||
|
||||
|
@ -632,6 +635,14 @@ def make_encoding_map(decoding_map):
|
|||
m[v] = None
|
||||
return m
|
||||
|
||||
### error handlers
|
||||
|
||||
strict_errors = lookup_error("strict")
|
||||
ignore_errors = lookup_error("ignore")
|
||||
replace_errors = lookup_error("replace")
|
||||
xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace")
|
||||
backslashreplace_errors = lookup_error("backslashreplace")
|
||||
|
||||
# Tell modulefinder that using codecs probably needs the encodings
|
||||
# package
|
||||
_false = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue