Mercurial > cpython-lru_cache-weakref
annotate Modules/_codecsmodule.c @ 17581:c1937faabb23 2.1
Added support for optional explanation parameter to the \versionadded
macro.
Refactored do_cmd_versionadded() and do_cmd_versionchanged() to do most
of the work in a helper function, with the do_cmd_*() wrappers just supplying
a portion of the replacement text.
| author | Fred Drake <fdrake@acm.org> |
|---|---|
| date | Wed, 18 Apr 2001 17:29:14 +0000 |
| parents | 814f421e0326 |
| children | 354a4df09e38 |
| rev | line source |
|---|---|
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 /* ------------------------------------------------------------------------ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 _codecs -- Provides access to the codec registry and the builtin |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 codecs. |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 This module should never be imported directly. The standard library |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 module "codecs" wraps this builtin module for use within Python. |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 The codec registry is accessible via: |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 register(search_function) -> None |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 lookup(encoding) -> (encoder, decoder, stream_reader, stream_writer) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 The builtin Unicode codecs use the following interface: |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 <encoding>_encode(Unicode_object[,errors='strict']) -> |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 (string object, bytes consumed) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 <encoding>_decode(char_buffer_obj[,errors='strict']) -> |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 (Unicode object, bytes consumed) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
23 <encoding>_encode() interfaces also accept non-Unicode object as |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
24 input. The objects are then converted to Unicode using |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
25 PyUnicode_FromObject() prior to applying the conversion. |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
26 |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 These <encoding>s are available: utf_8, unicode_escape, |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
28 raw_unicode_escape, unicode_internal, latin_1, ascii (7-bit), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
29 mbcs (on win32). |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
30 |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 Written by Marc-Andre Lemburg (mal@lemburg.com). |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 |
|
13828
254f8b7c4a83
Changing the CNRI copyright notice according to CNRI's instructions.
Guido van Rossum <guido@python.org>
parents:
13651
diff
changeset
|
34 Copyright (c) Corporation for National Research Initiatives. |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 ------------------------------------------------------------------------ */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 #include "Python.h" |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 /* --- Registry ----------------------------------------------------------- */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 static |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 PyObject *codecregister(PyObject *self, PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 PyObject *search_function; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 if (!PyArg_ParseTuple(args, "O:register", &search_function)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 goto onError; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 if (PyCodec_Register(search_function)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 goto onError; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 Py_INCREF(Py_None); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 return Py_None; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 onError: |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 static |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 PyObject *codeclookup(PyObject *self, PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 char *encoding; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 if (!PyArg_ParseTuple(args, "s:lookup", &encoding)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 goto onError; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 return _PyCodec_Lookup(encoding); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 onError: |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 /* --- Helpers ------------------------------------------------------------ */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 static |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 PyObject *codec_tuple(PyObject *unicode, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 int len) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 PyObject *v,*w; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 if (unicode == NULL) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 v = PyTuple_New(2); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 if (v == NULL) { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 Py_DECREF(unicode); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
89 PyTuple_SET_ITEM(v,0,unicode); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 w = PyInt_FromLong(len); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 if (w == NULL) { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 Py_DECREF(v); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
93 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 PyTuple_SET_ITEM(v,1,w); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
96 return v; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 /* --- Decoder ------------------------------------------------------------ */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
102 unicode_internal_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 { |
|
14733
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
105 PyObject *obj; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
106 const char *errors = NULL; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
108 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
109 |
|
14733
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
110 if (!PyArg_ParseTuple(args, "O|z:unicode_internal_decode", |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
111 &obj, &errors)) |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
112 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
113 |
|
14733
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
114 if (PyUnicode_Check(obj)) |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
115 return codec_tuple(obj, PyUnicode_GET_SIZE(obj)); |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
116 else { |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
117 if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
118 return NULL; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
119 return codec_tuple(PyUnicode_FromUnicode((Py_UNICODE *)data, |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
120 size / sizeof(Py_UNICODE)), |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
121 size); |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
122 } |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
123 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
124 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
126 utf_8_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
127 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
128 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
129 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
130 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
131 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
132 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
133 if (!PyArg_ParseTuple(args, "t#|z:utf_8_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
134 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
135 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 return codec_tuple(PyUnicode_DecodeUTF8(data, size, errors), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
138 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
140 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
141 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
142 utf_16_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
143 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
144 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 int byteorder = 0; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 if (!PyArg_ParseTuple(args, "t#|z:utf_16_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
151 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
152 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 return codec_tuple(PyUnicode_DecodeUTF16(data, size, errors, &byteorder), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
154 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
157 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
158 utf_16_le_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
159 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
160 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
161 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
162 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 int byteorder = -1; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
166 if (!PyArg_ParseTuple(args, "t#|z:utf_16_le_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
169 return codec_tuple(PyUnicode_DecodeUTF16(data, size, errors, &byteorder), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
170 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
171 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
172 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
173 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
174 utf_16_be_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
175 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
176 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
177 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
178 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
179 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
180 int byteorder = 1; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
181 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
182 if (!PyArg_ParseTuple(args, "t#|z:utf_16_be_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
183 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
184 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
185 return codec_tuple(PyUnicode_DecodeUTF16(data, size, errors, &byteorder), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
186 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
187 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
188 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
189 /* This non-standard version also provides access to the byteorder |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
190 parameter of the builtin UTF-16 codec. |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
191 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
192 It returns a tuple (unicode, bytesread, byteorder) with byteorder |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
193 being the value in effect at the end of data. |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
194 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
195 */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
196 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
197 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
198 utf_16_ex_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
199 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
200 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
201 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
202 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
203 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
204 int byteorder = 0; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
205 PyObject *unicode, *tuple; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
206 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
207 if (!PyArg_ParseTuple(args, "t#|zi:utf_16_ex_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
208 &data, &size, &errors, &byteorder)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
209 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
210 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
211 unicode = PyUnicode_DecodeUTF16(data, size, errors, &byteorder); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
212 if (unicode == NULL) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
213 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
214 tuple = Py_BuildValue("Oii", unicode, size, byteorder); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
215 Py_DECREF(unicode); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
216 return tuple; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
217 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
218 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
219 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
220 unicode_escape_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
221 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
222 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
223 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
224 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
225 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
226 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
227 if (!PyArg_ParseTuple(args, "t#|z:unicode_escape_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
228 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
229 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 return codec_tuple(PyUnicode_DecodeUnicodeEscape(data, size, errors), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
232 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
233 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
234 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
235 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
236 raw_unicode_escape_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
237 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
238 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
239 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
240 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
241 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
242 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
243 if (!PyArg_ParseTuple(args, "t#|z:raw_unicode_escape_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
244 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
245 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
246 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
247 return codec_tuple(PyUnicode_DecodeRawUnicodeEscape(data, size, errors), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
248 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
249 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
250 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
251 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
252 latin_1_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
253 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
254 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
255 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
256 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
257 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
258 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
259 if (!PyArg_ParseTuple(args, "t#|z:latin_1_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
260 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
261 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
262 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
263 return codec_tuple(PyUnicode_DecodeLatin1(data, size, errors), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
264 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
265 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
266 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
267 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
268 ascii_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
269 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
270 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
271 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
272 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
273 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
274 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
275 if (!PyArg_ParseTuple(args, "t#|z:ascii_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
276 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
277 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
278 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
279 return codec_tuple(PyUnicode_DecodeASCII(data, size, errors), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
280 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
281 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
282 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
283 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
284 charmap_decode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
285 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
286 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
287 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
288 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
289 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
290 PyObject *mapping = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
291 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
292 if (!PyArg_ParseTuple(args, "t#|zO:charmap_decode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
293 &data, &size, &errors, &mapping)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
294 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
295 if (mapping == Py_None) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
296 mapping = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
297 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
298 return codec_tuple(PyUnicode_DecodeCharmap(data, size, mapping, errors), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
299 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
300 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
301 |
| 12074 | 302 #ifdef MS_WIN32 |
| 303 | |
| 304 static PyObject * | |
| 305 mbcs_decode(PyObject *self, | |
| 306 PyObject *args) | |
| 307 { | |
| 308 const char *data; | |
| 309 int size; | |
| 310 const char *errors = NULL; | |
| 311 | |
| 312 if (!PyArg_ParseTuple(args, "t#|z:mbcs_decode", | |
| 313 &data, &size, &errors)) | |
| 314 return NULL; | |
| 315 | |
| 316 return codec_tuple(PyUnicode_DecodeMBCS(data, size, errors), | |
| 317 size); | |
| 318 } | |
| 319 | |
| 320 #endif /* MS_WIN32 */ | |
| 321 | |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
322 /* --- Encoder ------------------------------------------------------------ */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
323 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
324 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
325 readbuffer_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
326 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
327 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
328 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
329 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
330 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
331 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
332 if (!PyArg_ParseTuple(args, "s#|z:readbuffer_encode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
333 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
334 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
335 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
336 return codec_tuple(PyString_FromStringAndSize(data, size), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
337 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
338 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
339 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
340 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
341 charbuffer_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
342 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
343 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
344 const char *data; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
345 int size; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
346 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
347 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
348 if (!PyArg_ParseTuple(args, "t#|z:charbuffer_encode", |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
349 &data, &size, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
350 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
351 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
352 return codec_tuple(PyString_FromStringAndSize(data, size), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
353 size); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
354 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
355 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
356 static PyObject * |
|
14733
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
357 unicode_internal_encode(PyObject *self, |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
358 PyObject *args) |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
359 { |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
360 PyObject *obj; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
361 const char *errors = NULL; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
362 const char *data; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
363 int size; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
364 |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
365 if (!PyArg_ParseTuple(args, "O|z:unicode_internal_encode", |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
366 &obj, &errors)) |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
367 return NULL; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
368 |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
369 if (PyUnicode_Check(obj)) { |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
370 data = PyUnicode_AS_DATA(obj); |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
371 size = PyUnicode_GET_DATA_SIZE(obj); |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
372 return codec_tuple(PyString_FromStringAndSize(data, size), |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
373 size); |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
374 } |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
375 else { |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
376 if (PyObject_AsReadBuffer(obj, (const void **)&data, &size)) |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
377 return NULL; |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
378 return codec_tuple(PyString_FromStringAndSize(data, size), |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
379 size); |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
380 } |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
381 } |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
382 |
|
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
383 static PyObject * |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
384 utf_8_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
385 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
386 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
387 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
388 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
389 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
390 if (!PyArg_ParseTuple(args, "O|z:utf_8_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
391 &str, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
392 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
393 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
394 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
395 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
396 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
397 v = codec_tuple(PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(str), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
398 PyUnicode_GET_SIZE(str), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
399 errors), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
400 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
401 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
402 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
403 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
404 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
405 /* This version provides access to the byteorder parameter of the |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
406 builtin UTF-16 codecs as optional third argument. It defaults to 0 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
407 which means: use the native byte order and prepend the data with a |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
408 BOM mark. |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
409 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
410 */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
411 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
412 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
413 utf_16_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
414 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
415 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
416 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
417 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
418 int byteorder = 0; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
419 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
420 if (!PyArg_ParseTuple(args, "O|zi:utf_16_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
421 &str, &errors, &byteorder)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
422 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
423 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
424 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
425 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
426 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
427 v = codec_tuple(PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(str), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
428 PyUnicode_GET_SIZE(str), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
429 errors, |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
430 byteorder), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
431 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
432 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
433 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
434 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
435 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
436 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
437 utf_16_le_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
438 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
439 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
440 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
441 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
442 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
443 if (!PyArg_ParseTuple(args, "O|zi:utf_16_le_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
444 &str, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
445 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
446 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
447 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
448 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
449 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
450 v = codec_tuple(PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(str), |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
451 PyUnicode_GET_SIZE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
452 errors, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
453 -1), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
454 PyUnicode_GET_SIZE(str)); |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
455 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
456 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
457 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
458 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
459 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
460 utf_16_be_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
461 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
462 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
463 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
464 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
465 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
466 if (!PyArg_ParseTuple(args, "O|zi:utf_16_be_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
467 &str, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
468 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
469 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
470 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
471 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
472 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
473 v = codec_tuple(PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(str), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
474 PyUnicode_GET_SIZE(str), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
475 errors, |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
476 +1), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
477 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
478 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
479 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
480 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
481 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
482 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
483 unicode_escape_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
484 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
485 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
486 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
487 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
488 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
489 if (!PyArg_ParseTuple(args, "O|z:unicode_escape_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
490 &str, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
491 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
492 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
493 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
494 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
495 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
496 v = codec_tuple(PyUnicode_EncodeUnicodeEscape(PyUnicode_AS_UNICODE(str), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
497 PyUnicode_GET_SIZE(str)), |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
498 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
499 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
500 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
501 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
502 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
503 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
504 raw_unicode_escape_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
505 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
506 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
507 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
508 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
509 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
510 if (!PyArg_ParseTuple(args, "O|z:raw_unicode_escape_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
511 &str, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
512 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
513 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
514 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
515 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
516 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
517 v = codec_tuple(PyUnicode_EncodeRawUnicodeEscape( |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
518 PyUnicode_AS_UNICODE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
519 PyUnicode_GET_SIZE(str)), |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
520 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
521 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
522 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
523 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
524 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
525 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
526 latin_1_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
527 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
528 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
529 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
530 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
531 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
532 if (!PyArg_ParseTuple(args, "O|z:latin_1_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
533 &str, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
534 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
535 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
536 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
537 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
538 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
539 v = codec_tuple(PyUnicode_EncodeLatin1( |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
540 PyUnicode_AS_UNICODE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
541 PyUnicode_GET_SIZE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
542 errors), |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
543 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
544 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
545 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
546 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
547 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
548 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
549 ascii_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
550 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
551 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
552 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
553 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
554 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
555 if (!PyArg_ParseTuple(args, "O|z:ascii_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
556 &str, &errors)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
557 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
558 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
559 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
560 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
561 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
562 v = codec_tuple(PyUnicode_EncodeASCII( |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
563 PyUnicode_AS_UNICODE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
564 PyUnicode_GET_SIZE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
565 errors), |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
566 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
567 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
568 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
569 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
570 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
571 static PyObject * |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
572 charmap_encode(PyObject *self, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
573 PyObject *args) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
574 { |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
575 PyObject *str, *v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
576 const char *errors = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
577 PyObject *mapping = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
578 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
579 if (!PyArg_ParseTuple(args, "O|zO:charmap_encode", |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
580 &str, &errors, &mapping)) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
581 return NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
582 if (mapping == Py_None) |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
583 mapping = NULL; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
584 |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
585 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
586 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
587 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
588 v = codec_tuple(PyUnicode_EncodeCharmap( |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
589 PyUnicode_AS_UNICODE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
590 PyUnicode_GET_SIZE(str), |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
591 mapping, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
592 errors), |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
593 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
594 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
595 return v; |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
596 } |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
597 |
| 12074 | 598 #ifdef MS_WIN32 |
| 599 | |
| 600 static PyObject * | |
| 601 mbcs_encode(PyObject *self, | |
| 602 PyObject *args) | |
| 603 { | |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
604 PyObject *str, *v; |
| 12074 | 605 const char *errors = NULL; |
| 606 | |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
607 if (!PyArg_ParseTuple(args, "O|z:mbcs_encode", |
| 12074 | 608 &str, &errors)) |
| 609 return NULL; | |
| 610 | |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
611 str = PyUnicode_FromObject(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
612 if (str == NULL) |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
613 return NULL; |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
614 v = codec_tuple(PyUnicode_EncodeMBCS( |
| 12074 | 615 PyUnicode_AS_UNICODE(str), |
| 616 PyUnicode_GET_SIZE(str), | |
| 617 errors), | |
|
13358
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
618 PyUnicode_GET_SIZE(str)); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
619 Py_DECREF(str); |
|
c8706e5a882f
Modified the encode interfaces of all builtin codecs to accept
Marc-André Lemburg <mal@egenix.com>
parents:
12074
diff
changeset
|
620 return v; |
| 12074 | 621 } |
| 622 | |
| 623 #endif /* MS_WIN32 */ | |
| 624 | |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
625 /* --- Module API --------------------------------------------------------- */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
626 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
627 static PyMethodDef _codecs_functions[] = { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
628 {"register", codecregister, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
629 {"lookup", codeclookup, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
630 {"utf_8_encode", utf_8_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
631 {"utf_8_decode", utf_8_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
632 {"utf_16_encode", utf_16_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
633 {"utf_16_le_encode", utf_16_le_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
634 {"utf_16_be_encode", utf_16_be_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
635 {"utf_16_decode", utf_16_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
636 {"utf_16_le_decode", utf_16_le_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
637 {"utf_16_be_decode", utf_16_be_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
638 {"utf_16_ex_decode", utf_16_ex_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
639 {"unicode_escape_encode", unicode_escape_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
640 {"unicode_escape_decode", unicode_escape_decode, 1}, |
|
14733
814f421e0326
Added a true unicode_internal_encode function and fixed the
Marc-André Lemburg <mal@egenix.com>
parents:
13828
diff
changeset
|
641 {"unicode_internal_encode", unicode_internal_encode, 1}, |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
642 {"unicode_internal_decode", unicode_internal_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
643 {"raw_unicode_escape_encode", raw_unicode_escape_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
644 {"raw_unicode_escape_decode", raw_unicode_escape_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
645 {"latin_1_encode", latin_1_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
646 {"latin_1_decode", latin_1_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
647 {"ascii_encode", ascii_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
648 {"ascii_decode", ascii_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
649 {"charmap_encode", charmap_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
650 {"charmap_decode", charmap_decode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
651 {"readbuffer_encode", readbuffer_encode, 1}, |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
652 {"charbuffer_encode", charbuffer_encode, 1}, |
| 12074 | 653 #ifdef MS_WIN32 |
| 654 {"mbcs_encode", mbcs_encode, 1}, | |
| 655 {"mbcs_decode", mbcs_decode, 1}, | |
| 656 #endif | |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
657 {NULL, NULL} /* sentinel */ |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
658 }; |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
659 |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
660 DL_EXPORT(void) |
|
13651
8a063423e0b7
Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
Thomas Wouters <thomas@python.org>
parents:
13358
diff
changeset
|
661 init_codecs(void) |
|
11980
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
662 { |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
663 Py_InitModule("_codecs", _codecs_functions); |
|
a9b5a31ff8cb
Internal module _codecs -- Provides access to the codec registry and
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
664 } |
