mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
gh-89653: PEP 670: Convert PyUnicode_KIND() macro to function (#92705)
In the limited C API version 3.12, PyUnicode_KIND() is now implemented as a static inline function. Keep the macro for the regular C API and for the limited C API version 3.11 and older to prevent introducing new compiler warnings. Update _decimal.c and stringlib/eq.h for PyUnicode_KIND().
This commit is contained in:
parent
d81d57e959
commit
db388df1d9
3 changed files with 21 additions and 10 deletions
|
@ -1933,7 +1933,7 @@ is_space(enum PyUnicode_Kind kind, const void *data, Py_ssize_t pos)
|
|||
Return NULL if malloc fails and an empty string if invalid characters
|
||||
are found. */
|
||||
static char *
|
||||
numeric_as_ascii(const PyObject *u, int strip_ws, int ignore_underscores)
|
||||
numeric_as_ascii(PyObject *u, int strip_ws, int ignore_underscores)
|
||||
{
|
||||
enum PyUnicode_Kind kind;
|
||||
const void *data;
|
||||
|
@ -2047,7 +2047,7 @@ PyDecType_FromCStringExact(PyTypeObject *type, const char *s,
|
|||
|
||||
/* Return a new PyDecObject or a subtype from a PyUnicodeObject. */
|
||||
static PyObject *
|
||||
PyDecType_FromUnicode(PyTypeObject *type, const PyObject *u,
|
||||
PyDecType_FromUnicode(PyTypeObject *type, PyObject *u,
|
||||
PyObject *context)
|
||||
{
|
||||
PyObject *dec;
|
||||
|
@ -2067,7 +2067,7 @@ PyDecType_FromUnicode(PyTypeObject *type, const PyObject *u,
|
|||
* conversion. If the conversion is not exact, fail with InvalidOperation.
|
||||
* Allow leading and trailing whitespace in the input operand. */
|
||||
static PyObject *
|
||||
PyDecType_FromUnicodeExactWS(PyTypeObject *type, const PyObject *u,
|
||||
PyDecType_FromUnicodeExactWS(PyTypeObject *type, PyObject *u,
|
||||
PyObject *context)
|
||||
{
|
||||
PyObject *dec;
|
||||
|
@ -2150,7 +2150,7 @@ PyDecType_FromSsizeExact(PyTypeObject *type, mpd_ssize_t v, PyObject *context)
|
|||
/* Convert from a PyLongObject. The context is not modified; flags set
|
||||
during conversion are accumulated in the status parameter. */
|
||||
static PyObject *
|
||||
dec_from_long(PyTypeObject *type, const PyObject *v,
|
||||
dec_from_long(PyTypeObject *type, PyObject *v,
|
||||
const mpd_context_t *ctx, uint32_t *status)
|
||||
{
|
||||
PyObject *dec;
|
||||
|
@ -2201,7 +2201,7 @@ dec_from_long(PyTypeObject *type, const PyObject *v,
|
|||
/* Return a new PyDecObject from a PyLongObject. Use the context for
|
||||
conversion. */
|
||||
static PyObject *
|
||||
PyDecType_FromLong(PyTypeObject *type, const PyObject *v, PyObject *context)
|
||||
PyDecType_FromLong(PyTypeObject *type, PyObject *v, PyObject *context)
|
||||
{
|
||||
PyObject *dec;
|
||||
uint32_t status = 0;
|
||||
|
@ -2227,7 +2227,7 @@ PyDecType_FromLong(PyTypeObject *type, const PyObject *v, PyObject *context)
|
|||
/* Return a new PyDecObject from a PyLongObject. Use a maximum context
|
||||
for conversion. If the conversion is not exact, set InvalidOperation. */
|
||||
static PyObject *
|
||||
PyDecType_FromLongExact(PyTypeObject *type, const PyObject *v,
|
||||
PyDecType_FromLongExact(PyTypeObject *type, PyObject *v,
|
||||
PyObject *context)
|
||||
{
|
||||
PyObject *dec;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue