Clean up a few tabs that went in with PEP393.
This commit is contained in:
parent
48a2f8fd97
commit
2aa2b3b4d5
|
@ -141,7 +141,7 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
|
|||
#endif
|
||||
|
||||
/* Argument must be a char or an int in [-128, 127] or [0, 255]. */
|
||||
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
|
||||
#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff))
|
||||
|
||||
#include "pyfpe.h"
|
||||
|
||||
|
|
|
@ -27,12 +27,12 @@ PyAPI_DATA(PyTypeObject) PyFloat_Type;
|
|||
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
|
||||
#endif
|
||||
|
||||
#define Py_RETURN_INF(sign) do \
|
||||
if (copysign(1., sign) == 1.) { \
|
||||
return PyFloat_FromDouble(Py_HUGE_VAL); \
|
||||
} else { \
|
||||
return PyFloat_FromDouble(-Py_HUGE_VAL); \
|
||||
} while(0)
|
||||
#define Py_RETURN_INF(sign) do \
|
||||
if (copysign(1., sign) == 1.) { \
|
||||
return PyFloat_FromDouble(Py_HUGE_VAL); \
|
||||
} else { \
|
||||
return PyFloat_FromDouble(-Py_HUGE_VAL); \
|
||||
} while(0)
|
||||
|
||||
PyAPI_FUNC(double) PyFloat_GetMax(void);
|
||||
PyAPI_FUNC(double) PyFloat_GetMin(void);
|
||||
|
@ -113,9 +113,9 @@ PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
|
|||
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||
(Advanced String Formatting). */
|
||||
PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
|
||||
PyObject *format_spec,
|
||||
Py_ssize_t start,
|
||||
Py_ssize_t end);
|
||||
PyObject *format_spec,
|
||||
Py_ssize_t start,
|
||||
Py_ssize_t end);
|
||||
#endif /* Py_LIMITED_API */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */
|
|||
PyAPI_DATA(PyTypeObject) PyLong_Type;
|
||||
|
||||
#define PyLong_Check(op) \
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
|
||||
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
|
||||
#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
|
||||
|
||||
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
|
||||
|
@ -122,8 +122,8 @@ PyAPI_FUNC(PyObject *) _PyLong_DivmodNear(PyObject *, PyObject *);
|
|||
enough memory to create the Python long.
|
||||
*/
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
|
||||
const unsigned char* bytes, size_t n,
|
||||
int little_endian, int is_signed);
|
||||
const unsigned char* bytes, size_t n,
|
||||
int little_endian, int is_signed);
|
||||
|
||||
/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
|
||||
v to a base-256 integer, stored in array bytes. Normally return 0,
|
||||
|
@ -145,8 +145,8 @@ PyAPI_FUNC(PyObject *) _PyLong_FromByteArray(
|
|||
case, but bytes holds the least-signficant n bytes of the true value.
|
||||
*/
|
||||
PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v,
|
||||
unsigned char* bytes, size_t n,
|
||||
int little_endian, int is_signed);
|
||||
unsigned char* bytes, size_t n,
|
||||
int little_endian, int is_signed);
|
||||
|
||||
|
||||
/* _PyLong_Format: Convert the long to a string object with given base,
|
||||
|
@ -156,9 +156,9 @@ PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base);
|
|||
/* Format the object based on the format_spec, as defined in PEP 3101
|
||||
(Advanced String Formatting). */
|
||||
PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj,
|
||||
PyObject *format_spec,
|
||||
Py_ssize_t start,
|
||||
Py_ssize_t end);
|
||||
PyObject *format_spec,
|
||||
Py_ssize_t start,
|
||||
Py_ssize_t end);
|
||||
#endif /* Py_LIMITED_API */
|
||||
|
||||
/* These aren't really part of the long object, but they're handy. The
|
||||
|
|
226
Modules/_sre.c
226
Modules/_sre.c
|
@ -1739,16 +1739,16 @@ state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string,
|
|||
if (!ptr)
|
||||
return NULL;
|
||||
|
||||
if (logical_charsize == 1 && pattern->logical_charsize > 1) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"can't use a string pattern on a bytes-like object");
|
||||
return NULL;
|
||||
}
|
||||
if (logical_charsize > 1 && pattern->logical_charsize == 1) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"can't use a bytes pattern on a string-like object");
|
||||
return NULL;
|
||||
}
|
||||
if (logical_charsize == 1 && pattern->logical_charsize > 1) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"can't use a string pattern on a bytes-like object");
|
||||
return NULL;
|
||||
}
|
||||
if (logical_charsize > 1 && pattern->logical_charsize == 1) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"can't use a bytes pattern on a string-like object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* adjust boundaries */
|
||||
if (start < 0)
|
||||
|
@ -2062,8 +2062,8 @@ pattern_findall(PatternObject* self, PyObject* args, PyObject* kw)
|
|||
status = sre_usearch(&state, PatternObject_GetCode(self));
|
||||
}
|
||||
|
||||
if (PyErr_Occurred())
|
||||
goto error;
|
||||
if (PyErr_Occurred())
|
||||
goto error;
|
||||
|
||||
if (status <= 0) {
|
||||
if (status == 0)
|
||||
|
@ -2190,8 +2190,8 @@ pattern_split(PatternObject* self, PyObject* args, PyObject* kw)
|
|||
status = sre_usearch(&state, PatternObject_GetCode(self));
|
||||
}
|
||||
|
||||
if (PyErr_Occurred())
|
||||
goto error;
|
||||
if (PyErr_Occurred())
|
||||
goto error;
|
||||
|
||||
if (status <= 0) {
|
||||
if (status == 0)
|
||||
|
@ -2334,8 +2334,8 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
|
|||
status = sre_usearch(&state, PatternObject_GetCode(self));
|
||||
}
|
||||
|
||||
if (PyErr_Occurred())
|
||||
goto error;
|
||||
if (PyErr_Occurred())
|
||||
goto error;
|
||||
|
||||
if (status <= 0) {
|
||||
if (status == 0)
|
||||
|
@ -2553,20 +2553,20 @@ PyDoc_STRVAR(pattern_doc, "Compiled regular expression objects");
|
|||
|
||||
static PyMethodDef pattern_methods[] = {
|
||||
{"match", (PyCFunction) pattern_match, METH_VARARGS|METH_KEYWORDS,
|
||||
pattern_match_doc},
|
||||
pattern_match_doc},
|
||||
{"search", (PyCFunction) pattern_search, METH_VARARGS|METH_KEYWORDS,
|
||||
pattern_search_doc},
|
||||
pattern_search_doc},
|
||||
{"sub", (PyCFunction) pattern_sub, METH_VARARGS|METH_KEYWORDS,
|
||||
pattern_sub_doc},
|
||||
pattern_sub_doc},
|
||||
{"subn", (PyCFunction) pattern_subn, METH_VARARGS|METH_KEYWORDS,
|
||||
pattern_subn_doc},
|
||||
pattern_subn_doc},
|
||||
{"split", (PyCFunction) pattern_split, METH_VARARGS|METH_KEYWORDS,
|
||||
pattern_split_doc},
|
||||
pattern_split_doc},
|
||||
{"findall", (PyCFunction) pattern_findall, METH_VARARGS|METH_KEYWORDS,
|
||||
pattern_findall_doc},
|
||||
pattern_findall_doc},
|
||||
#if PY_VERSION_HEX >= 0x02020000
|
||||
{"finditer", (PyCFunction) pattern_finditer, METH_VARARGS,
|
||||
pattern_finditer_doc},
|
||||
pattern_finditer_doc},
|
||||
#endif
|
||||
{"scanner", (PyCFunction) pattern_scanner, METH_VARARGS},
|
||||
{"__copy__", (PyCFunction) pattern_copy, METH_NOARGS},
|
||||
|
@ -2587,31 +2587,31 @@ static PyTypeObject Pattern_Type = {
|
|||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"_" SRE_MODULE ".SRE_Pattern",
|
||||
sizeof(PatternObject), sizeof(SRE_CODE),
|
||||
(destructor)pattern_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
pattern_doc, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
pattern_methods, /* tp_methods */
|
||||
pattern_members, /* tp_members */
|
||||
(destructor)pattern_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
pattern_doc, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
pattern_methods, /* tp_methods */
|
||||
pattern_members, /* tp_members */
|
||||
};
|
||||
|
||||
static int _validate(PatternObject *self); /* Forward */
|
||||
|
@ -3210,8 +3210,8 @@ match_getindex(MatchObject* self, PyObject* index)
|
|||
Py_ssize_t i;
|
||||
|
||||
if (index == NULL)
|
||||
/* Default value */
|
||||
return 0;
|
||||
/* Default value */
|
||||
return 0;
|
||||
|
||||
if (PyLong_Check(index))
|
||||
return PyLong_AsSsize_t(index);
|
||||
|
@ -3551,7 +3551,7 @@ static PyObject *
|
|||
match_lastindex_get(MatchObject *self)
|
||||
{
|
||||
if (self->lastindex >= 0)
|
||||
return Py_BuildValue("i", self->lastindex);
|
||||
return Py_BuildValue("i", self->lastindex);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
@ -3604,32 +3604,32 @@ static PyTypeObject Match_Type = {
|
|||
PyVarObject_HEAD_INIT(NULL,0)
|
||||
"_" SRE_MODULE ".SRE_Match",
|
||||
sizeof(MatchObject), sizeof(Py_ssize_t),
|
||||
(destructor)match_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
match_methods, /* tp_methods */
|
||||
match_members, /* tp_members */
|
||||
match_getset, /* tp_getset */
|
||||
(destructor)match_dealloc, /* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
match_methods, /* tp_methods */
|
||||
match_members, /* tp_members */
|
||||
match_getset, /* tp_getset */
|
||||
};
|
||||
|
||||
static PyObject*
|
||||
|
@ -3776,7 +3776,7 @@ static PyMethodDef scanner_methods[] = {
|
|||
|
||||
#define SCAN_OFF(x) offsetof(ScannerObject, x)
|
||||
static PyMemberDef scanner_members[] = {
|
||||
{"pattern", T_OBJECT, SCAN_OFF(pattern), READONLY},
|
||||
{"pattern", T_OBJECT, SCAN_OFF(pattern), READONLY},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
|
@ -3785,31 +3785,31 @@ static PyTypeObject Scanner_Type = {
|
|||
"_" SRE_MODULE ".SRE_Scanner",
|
||||
sizeof(ScannerObject), 0,
|
||||
(destructor)scanner_dealloc,/* tp_dealloc */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
scanner_methods, /* tp_methods */
|
||||
scanner_members, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
0, /* tp_print */
|
||||
0, /* tp_getattr */
|
||||
0, /* tp_setattr */
|
||||
0, /* tp_reserved */
|
||||
0, /* tp_repr */
|
||||
0, /* tp_as_number */
|
||||
0, /* tp_as_sequence */
|
||||
0, /* tp_as_mapping */
|
||||
0, /* tp_hash */
|
||||
0, /* tp_call */
|
||||
0, /* tp_str */
|
||||
0, /* tp_getattro */
|
||||
0, /* tp_setattro */
|
||||
0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||||
0, /* tp_doc */
|
||||
0, /* tp_traverse */
|
||||
0, /* tp_clear */
|
||||
0, /* tp_richcompare */
|
||||
0, /* tp_weaklistoffset */
|
||||
0, /* tp_iter */
|
||||
0, /* tp_iternext */
|
||||
scanner_methods, /* tp_methods */
|
||||
scanner_members, /* tp_members */
|
||||
0, /* tp_getset */
|
||||
};
|
||||
|
||||
static PyObject*
|
||||
|
@ -3851,15 +3851,15 @@ static PyMethodDef _functions[] = {
|
|||
};
|
||||
|
||||
static struct PyModuleDef sremodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"_" SRE_MODULE,
|
||||
NULL,
|
||||
-1,
|
||||
_functions,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"_" SRE_MODULE,
|
||||
NULL,
|
||||
-1,
|
||||
_functions,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC PyInit__sre(void)
|
||||
|
@ -3875,7 +3875,7 @@ PyMODINIT_FUNC PyInit__sre(void)
|
|||
|
||||
m = PyModule_Create(&sremodule);
|
||||
if (m == NULL)
|
||||
return NULL;
|
||||
return NULL;
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
x = PyLong_FromLong(SRE_MAGIC);
|
||||
|
|
|
@ -2345,21 +2345,21 @@ PyObject* PyType_FromSpec(PyType_Spec *spec)
|
|||
return NULL;
|
||||
res->ht_name = PyUnicode_FromString(spec->name);
|
||||
if (!res->ht_name)
|
||||
goto fail;
|
||||
goto fail;
|
||||
res->ht_type.tp_name = _PyUnicode_AsString(res->ht_name);
|
||||
if (!res->ht_type.tp_name)
|
||||
goto fail;
|
||||
goto fail;
|
||||
|
||||
res->ht_type.tp_basicsize = spec->basicsize;
|
||||
res->ht_type.tp_itemsize = spec->itemsize;
|
||||
res->ht_type.tp_flags = spec->flags | Py_TPFLAGS_HEAPTYPE;
|
||||
|
||||
for (slot = spec->slots; slot->slot; slot++) {
|
||||
if (slot->slot >= sizeof(slotoffsets)/sizeof(slotoffsets[0])) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "invalid slot offset");
|
||||
goto fail;
|
||||
}
|
||||
*(void**)(res_start + slotoffsets[slot->slot]) = slot->pfunc;
|
||||
if (slot->slot >= sizeof(slotoffsets)/sizeof(slotoffsets[0])) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "invalid slot offset");
|
||||
goto fail;
|
||||
}
|
||||
*(void**)(res_start + slotoffsets[slot->slot]) = slot->pfunc;
|
||||
|
||||
/* need to make a copy of the docstring slot, which usually
|
||||
points to a static string literal */
|
||||
|
@ -2367,7 +2367,7 @@ PyObject* PyType_FromSpec(PyType_Spec *spec)
|
|||
ssize_t len = strlen(slot->pfunc)+1;
|
||||
char *tp_doc = PyObject_MALLOC(len);
|
||||
if (tp_doc == NULL)
|
||||
goto fail;
|
||||
goto fail;
|
||||
memcpy(tp_doc, slot->pfunc, len);
|
||||
res->ht_type.tp_doc = tp_doc;
|
||||
}
|
||||
|
|
|
@ -174,10 +174,10 @@ unicode_encode_call_errorhandler(const char *errors,
|
|||
|
||||
static void
|
||||
raise_encode_exception(PyObject **exceptionObject,
|
||||
const char *encoding,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
const char *reason);
|
||||
const char *encoding,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
const char *reason);
|
||||
|
||||
/* Same for linebreaks */
|
||||
static unsigned char ascii_linebreak[] = {
|
||||
|
@ -2035,8 +2035,8 @@ PyUnicode_FromObject(register PyObject *obj)
|
|||
|
||||
PyObject *
|
||||
PyUnicode_FromEncodedObject(register PyObject *obj,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
Py_buffer buffer;
|
||||
PyObject *v;
|
||||
|
@ -2121,9 +2121,9 @@ normalize_encoding(const char *encoding,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_Decode(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *buffer = NULL, *unicode;
|
||||
Py_buffer info;
|
||||
|
@ -2184,8 +2184,8 @@ PyUnicode_Decode(const char *s,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_AsDecodedObject(PyObject *unicode,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *v;
|
||||
|
||||
|
@ -2209,8 +2209,8 @@ PyUnicode_AsDecodedObject(PyObject *unicode,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_AsDecodedUnicode(PyObject *unicode,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *v;
|
||||
|
||||
|
@ -2241,9 +2241,9 @@ PyUnicode_AsDecodedUnicode(PyObject *unicode,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_Encode(const Py_UNICODE *s,
|
||||
Py_ssize_t size,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *v, *unicode;
|
||||
|
||||
|
@ -2257,8 +2257,8 @@ PyUnicode_Encode(const Py_UNICODE *s,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_AsEncodedObject(PyObject *unicode,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *v;
|
||||
|
||||
|
@ -2345,8 +2345,8 @@ PyUnicode_EncodeFSDefault(PyObject *unicode)
|
|||
|
||||
PyObject *
|
||||
PyUnicode_AsEncodedString(PyObject *unicode,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *v;
|
||||
char lower[11]; /* Enough for any encoding shortcut */
|
||||
|
@ -2423,8 +2423,8 @@ PyUnicode_AsEncodedString(PyObject *unicode,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_AsEncodedUnicode(PyObject *unicode,
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
const char *encoding,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *v;
|
||||
|
||||
|
@ -2841,10 +2841,10 @@ onError:
|
|||
|
||||
static int
|
||||
unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler,
|
||||
const char *encoding, const char *reason,
|
||||
const char **input, const char **inend, Py_ssize_t *startinpos,
|
||||
Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr,
|
||||
PyUnicodeObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr)
|
||||
const char *encoding, const char *reason,
|
||||
const char **input, const char **inend, Py_ssize_t *startinpos,
|
||||
Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr,
|
||||
PyUnicodeObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr)
|
||||
{
|
||||
static char *argparse = "O!n;decoding error handler must return (str, int) tuple";
|
||||
|
||||
|
@ -3016,8 +3016,8 @@ char utf7_category[128] = {
|
|||
|
||||
PyObject *
|
||||
PyUnicode_DecodeUTF7(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
{
|
||||
return PyUnicode_DecodeUTF7Stateful(s, size, errors, NULL);
|
||||
}
|
||||
|
@ -3031,9 +3031,9 @@ PyUnicode_DecodeUTF7(const char *s,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_DecodeUTF7Stateful(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *errors,
|
||||
Py_ssize_t *consumed)
|
||||
Py_ssize_t size,
|
||||
const char *errors,
|
||||
Py_ssize_t *consumed)
|
||||
{
|
||||
const char *starts = s;
|
||||
Py_ssize_t startinpos;
|
||||
|
@ -3226,10 +3226,10 @@ utf7Error:
|
|||
|
||||
PyObject *
|
||||
PyUnicode_EncodeUTF7(const Py_UNICODE *s,
|
||||
Py_ssize_t size,
|
||||
int base64SetO,
|
||||
int base64WhiteSpace,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
int base64SetO,
|
||||
int base64WhiteSpace,
|
||||
const char *errors)
|
||||
{
|
||||
PyObject *v;
|
||||
/* It might be possible to tighten this worst case */
|
||||
|
@ -3352,8 +3352,8 @@ char utf8_code_length[256] = {
|
|||
|
||||
PyObject *
|
||||
PyUnicode_DecodeUTF8(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
{
|
||||
return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL);
|
||||
}
|
||||
|
@ -4868,8 +4868,8 @@ static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL;
|
|||
|
||||
PyObject *
|
||||
PyUnicode_DecodeUnicodeEscape(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
{
|
||||
const char *starts = s;
|
||||
Py_ssize_t startinpos;
|
||||
|
@ -5172,7 +5172,7 @@ static const char *hexdigits = "0123456789abcdef";
|
|||
|
||||
PyObject *
|
||||
PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s,
|
||||
Py_ssize_t size)
|
||||
Py_ssize_t size)
|
||||
{
|
||||
PyObject *repr;
|
||||
char *p;
|
||||
|
@ -5329,8 +5329,8 @@ PyUnicode_AsUnicodeEscapeString(PyObject *unicode)
|
|||
|
||||
PyObject *
|
||||
PyUnicode_DecodeRawUnicodeEscape(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
{
|
||||
const char *starts = s;
|
||||
Py_ssize_t startinpos;
|
||||
|
@ -5451,7 +5451,7 @@ PyUnicode_DecodeRawUnicodeEscape(const char *s,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s,
|
||||
Py_ssize_t size)
|
||||
Py_ssize_t size)
|
||||
{
|
||||
PyObject *repr;
|
||||
char *p;
|
||||
|
@ -5556,8 +5556,8 @@ PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode)
|
|||
|
||||
PyObject *
|
||||
_PyUnicode_DecodeUnicodeInternal(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
{
|
||||
const char *starts = s;
|
||||
Py_ssize_t startinpos;
|
||||
|
@ -5641,8 +5641,8 @@ _PyUnicode_DecodeUnicodeInternal(const char *s,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_DecodeLatin1(const char *s,
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
{
|
||||
/* Latin-1 is equivalent to the first 256 ordinals in Unicode. */
|
||||
return _PyUnicode_FromUCS1((unsigned char*)s, size);
|
||||
|
@ -5651,10 +5651,10 @@ PyUnicode_DecodeLatin1(const char *s,
|
|||
/* create or adjust a UnicodeEncodeError */
|
||||
static void
|
||||
make_encode_exception(PyObject **exceptionObject,
|
||||
const char *encoding,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
const char *reason)
|
||||
const char *encoding,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
const char *reason)
|
||||
{
|
||||
if (*exceptionObject == NULL) {
|
||||
*exceptionObject = PyUnicodeEncodeError_Create(
|
||||
|
@ -5677,10 +5677,10 @@ make_encode_exception(PyObject **exceptionObject,
|
|||
/* raises a UnicodeEncodeError */
|
||||
static void
|
||||
raise_encode_exception(PyObject **exceptionObject,
|
||||
const char *encoding,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
const char *reason)
|
||||
const char *encoding,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
const char *reason)
|
||||
{
|
||||
make_encode_exception(exceptionObject,
|
||||
encoding, unicode, size, startpos, endpos, reason);
|
||||
|
@ -5694,11 +5694,11 @@ raise_encode_exception(PyObject **exceptionObject,
|
|||
has to be freed by the caller */
|
||||
static PyObject *
|
||||
unicode_encode_call_errorhandler(const char *errors,
|
||||
PyObject **errorHandler,
|
||||
const char *encoding, const char *reason,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
Py_ssize_t *newpos)
|
||||
PyObject **errorHandler,
|
||||
const char *encoding, const char *reason,
|
||||
const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject,
|
||||
Py_ssize_t startpos, Py_ssize_t endpos,
|
||||
Py_ssize_t *newpos)
|
||||
{
|
||||
static char *argparse = "On;encoding error handler must return (str/bytes, int) tuple";
|
||||
|
||||
|
@ -5749,9 +5749,9 @@ unicode_encode_call_errorhandler(const char *errors,
|
|||
|
||||
static PyObject *
|
||||
unicode_encode_ucs1(const Py_UNICODE *p,
|
||||
Py_ssize_t size,
|
||||
const char *errors,
|
||||
int limit)
|
||||
Py_ssize_t size,
|
||||
const char *errors,
|
||||
int limit)
|
||||
{
|
||||
/* output object */
|
||||
PyObject *res;
|
||||
|
@ -5946,8 +5946,8 @@ unicode_encode_ucs1(const Py_UNICODE *p,
|
|||
|
||||
PyObject *
|
||||
PyUnicode_EncodeLatin1(const Py_UNICODE *p,
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
Py_ssize_t size,
|
||||
const char *errors)
|
||||
{
|
||||
return unicode_encode_ucs1(p, size, errors, 256);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue