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:
Martin v. Löwis 2011-10-09 10:38:36 +02:00
parent 67df285a33
commit afe55bba33
50 changed files with 578 additions and 240 deletions

View file

@ -1418,10 +1418,12 @@ PyCursesWindow_PutWin(PyCursesWindowObject *self, PyObject *stream)
while (1) {
char buf[BUFSIZ];
Py_ssize_t n = fread(buf, 1, BUFSIZ, fp);
_Py_identifier(write);
if (n <= 0)
break;
Py_DECREF(res);
res = PyObject_CallMethod(stream, "write", "y#", buf, n);
res = _PyObject_CallMethodId(stream, &PyId_write, "y#", buf, n);
if (res == NULL)
break;
}
@ -1911,6 +1913,7 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
WINDOW *win;
PyCursesInitialised;
_Py_identifier(read);
strcpy(fn, "/tmp/py.curses.getwin.XXXXXX");
fd = mkstemp(fn);
@ -1922,7 +1925,7 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
remove(fn);
return PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
}
data = PyObject_CallMethod(stream, "read", "");
data = _PyObject_CallMethodId(stream, &PyId_read, "");
if (data == NULL) {
fclose(fp);
remove(fn);