Implement PEP 393. · pythoncapi/cpython@d63a3b8 · GitHub
Skip to content

Commit d63a3b8

Browse files
committed
Implement PEP 393.
1 parent 48d4949 commit d63a3b8

102 files changed

Lines changed: 8125 additions & 5403 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Doc/c-api/unicode.rst

Lines changed: 9 additions & 0 deletions

Include/Python.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,9 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
160160
#define PyDoc_STR(str) ""
161161
#endif
162162

163+
#define PY_ARRAY_LENGTH(array) (sizeof(array) / sizeof((array)[0]))
164+
165+
#define PY_MIN(x, y) (((x) > (y)) ? (y) : (x))
166+
#define PY_MAX(x, y) (((x) > (y)) ? (x) : (y))
167+
163168
#endif /* !Py_PYTHON_H */

Include/complexobject.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op);
6464
(Advanced String Formatting). */
6565
#ifndef Py_LIMITED_API
6666
PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj,
67-
Py_UNICODE *format_spec,
68-
Py_ssize_t format_spec_len);
67+
PyObject *format_spec,
68+
Py_ssize_t start,
69+
Py_ssize_t end);
6970
#endif
7071

7172
#ifdef __cplusplus

Include/floatobject.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ PyAPI_FUNC(int) PyFloat_ClearFreeList(void);
113113
/* Format the object based on the format_spec, as defined in PEP 3101
114114
(Advanced String Formatting). */
115115
PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj,
116-
Py_UNICODE *format_spec,
117-
Py_ssize_t format_spec_len);
116+
PyObject *format_spec,
117+
Py_ssize_t start,
118+
Py_ssize_t end);
118119
#endif /* Py_LIMITED_API */
119120

120121
#ifdef __cplusplus

Include/longobject.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *);
8080
PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int);
8181
#ifndef Py_LIMITED_API
8282
PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int);
83+
PyAPI_FUNC(PyObject *) PyLong_FromUnicodeObject(PyObject *u, int base);
8384
#endif
8485

8586
#ifndef Py_LIMITED_API
@@ -155,8 +156,9 @@ PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base);
155156
/* Format the object based on the format_spec, as defined in PEP 3101
156157
(Advanced String Formatting). */
157158
PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj,
158-
Py_UNICODE *format_spec,
159-
Py_ssize_t format_spec_len);
159+
PyObject *format_spec,
160+
Py_ssize_t start,
161+
Py_ssize_t end);
160162
#endif /* Py_LIMITED_API */
161163

162164
/* These aren't really part of the long object, but they're handy. The

Include/pyerrors.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create(
301301
Py_ssize_t end,
302302
const char *reason /* UTF-8 encoded string */
303303
);
304+
PyAPI_FUNC(PyObject *) _PyUnicodeTranslateError_Create(
305+
PyObject *object,
306+
Py_ssize_t start,
307+
Py_ssize_t end,
308+
const char *reason /* UTF-8 encoded string */
309+
);
304310
#endif
305311

306312
/* get the encoding attribute */

Include/pyport.h

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)