diff options
author | Victor Stinner <vstinner@python.org> | 2024-10-09 15:15:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-09 15:15:23 (GMT) |
commit | b9a8ca0a6aa9251cb798f34f0c9d2cc95107eec6 (patch) | |
tree | 570ffb9eae19501a3a173fab2dbf56490d1f83db /Doc | |
parent | 6a39e96ab8ebc1144f713988ac6fe439e4476488 (diff) | |
download | cpython-b9a8ca0a6aa9251cb798f34f0c9d2cc95107eec6.zip cpython-b9a8ca0a6aa9251cb798f34f0c9d2cc95107eec6.tar.gz cpython-b9a8ca0a6aa9251cb798f34f0c9d2cc95107eec6.tar.bz2 |
gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) (#125194)
Replace PyUnicode_New(0, 0), PyUnicode_FromString("")
and PyUnicode_FromStringAndSize("", 0)
with Py_GetConstant(Py_CONSTANT_EMPTY_STR).
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/includes/newtypes/custom2.c | 4 | ||||
-rw-r--r-- | Doc/includes/newtypes/custom3.c | 4 | ||||
-rw-r--r-- | Doc/includes/newtypes/custom4.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/Doc/includes/newtypes/custom2.c b/Doc/includes/newtypes/custom2.c index a0222b1..768ce29 100644 --- a/Doc/includes/newtypes/custom2.c +++ b/Doc/includes/newtypes/custom2.c @@ -23,12 +23,12 @@ Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds) CustomObject *self; self = (CustomObject *) type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyUnicode_FromString(""); + self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyUnicode_FromString(""); + self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR); if (self->last == NULL) { Py_DECREF(self); return NULL; diff --git a/Doc/includes/newtypes/custom3.c b/Doc/includes/newtypes/custom3.c index 4aeebe0..7d969ad 100644 --- a/Doc/includes/newtypes/custom3.c +++ b/Doc/includes/newtypes/custom3.c @@ -23,12 +23,12 @@ Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds) CustomObject *self; self = (CustomObject *) type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyUnicode_FromString(""); + self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyUnicode_FromString(""); + self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR); if (self->last == NULL) { Py_DECREF(self); return NULL; diff --git a/Doc/includes/newtypes/custom4.c b/Doc/includes/newtypes/custom4.c index 3998918..a7b8de4 100644 --- a/Doc/includes/newtypes/custom4.c +++ b/Doc/includes/newtypes/custom4.c @@ -39,12 +39,12 @@ Custom_new(PyTypeObject *type, PyObject *args, PyObject *kwds) CustomObject *self; self = (CustomObject *) type->tp_alloc(type, 0); if (self != NULL) { - self->first = PyUnicode_FromString(""); + self->first = Py_GetConstant(Py_CONSTANT_EMPTY_STR); if (self->first == NULL) { Py_DECREF(self); return NULL; } - self->last = PyUnicode_FromString(""); + self->last = Py_GetConstant(Py_CONSTANT_EMPTY_STR); if (self->last == NULL) { Py_DECREF(self); return NULL; |