mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
This commit is contained in:
parent
67df285a33
commit
afe55bba33
50 changed files with 578 additions and 240 deletions
|
@ -1579,12 +1579,13 @@ mbstreamwriter_iwrite(MultibyteStreamWriterObject *self,
|
|||
PyObject *unistr)
|
||||
{
|
||||
PyObject *str, *wr;
|
||||
_Py_identifier(write);
|
||||
|
||||
str = encoder_encode_stateful(STATEFUL_ECTX(self), unistr, 0);
|
||||
if (str == NULL)
|
||||
return -1;
|
||||
|
||||
wr = PyObject_CallMethod(self->stream, "write", "O", str);
|
||||
wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", str);
|
||||
Py_DECREF(str);
|
||||
if (wr == NULL)
|
||||
return -1;
|
||||
|
@ -1650,7 +1651,9 @@ mbstreamwriter_reset(MultibyteStreamWriterObject *self)
|
|||
assert(PyBytes_Check(pwrt));
|
||||
if (PyBytes_Size(pwrt) > 0) {
|
||||
PyObject *wr;
|
||||
wr = PyObject_CallMethod(self->stream, "write", "O", pwrt);
|
||||
_Py_identifier(write);
|
||||
|
||||
wr = _PyObject_CallMethodId(self->stream, &PyId_write, "O", pwrt);
|
||||
if (wr == NULL) {
|
||||
Py_DECREF(pwrt);
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue