mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
bpo-46765: Replace Locally Cached Strings with Statically Initialized Objects (gh-31366)
https://bugs.python.org/issue46765
This commit is contained in:
parent
cff4d5c5d2
commit
1f455361ec
22 changed files with 192 additions and 526 deletions
|
|
@ -192,7 +192,7 @@ write_str(stringio *self, PyObject *obj)
|
|||
}
|
||||
if (self->writenl) {
|
||||
PyObject *translated = PyUnicode_Replace(
|
||||
decoded, _PyIO_str_nl, self->writenl, -1);
|
||||
decoded, &_Py_STR(newline), self->writenl, -1);
|
||||
Py_DECREF(decoded);
|
||||
decoded = translated;
|
||||
}
|
||||
|
|
@ -409,7 +409,7 @@ stringio_iternext(stringio *self)
|
|||
else {
|
||||
/* XXX is subclassing StringIO really supported? */
|
||||
line = PyObject_CallMethodNoArgs((PyObject *)self,
|
||||
_PyIO_str_readline);
|
||||
&_Py_ID(readline));
|
||||
if (line && !PyUnicode_Check(line)) {
|
||||
PyErr_Format(PyExc_OSError,
|
||||
"readline() should have returned a str object, "
|
||||
|
|
@ -964,7 +964,7 @@ stringio_newlines(stringio *self, void *context)
|
|||
CHECK_CLOSED(self);
|
||||
if (self->decoder == NULL)
|
||||
Py_RETURN_NONE;
|
||||
return PyObject_GetAttr(self->decoder, _PyIO_str_newlines);
|
||||
return PyObject_GetAttr(self->decoder, &_Py_ID(newlines));
|
||||
}
|
||||
|
||||
#include "clinic/stringio.c.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue