mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)
This commit is contained in:
parent
38f44b4a4a
commit
762f93ff2e
37 changed files with 154 additions and 132 deletions
|
@ -1889,7 +1889,7 @@ builtin_print(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyObject
|
|||
if (do_flush == -1)
|
||||
return NULL;
|
||||
else if (do_flush) {
|
||||
tmp = _PyObject_CallMethodId(file, &PyId_flush, NULL);
|
||||
tmp = _PyObject_CallMethodIdNoArgs(file, &PyId_flush);
|
||||
if (tmp == NULL)
|
||||
return NULL;
|
||||
else
|
||||
|
@ -1959,7 +1959,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
|
|||
}
|
||||
|
||||
/* First of all, flush stderr */
|
||||
tmp = _PyObject_CallMethodId(ferr, &PyId_flush, NULL);
|
||||
tmp = _PyObject_CallMethodIdNoArgs(ferr, &PyId_flush);
|
||||
if (tmp == NULL)
|
||||
PyErr_Clear();
|
||||
else
|
||||
|
@ -1968,7 +1968,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
|
|||
/* We should only use (GNU) readline if Python's sys.stdin and
|
||||
sys.stdout are the same as C's stdin and stdout, because we
|
||||
need to pass it those. */
|
||||
tmp = _PyObject_CallMethodId(fin, &PyId_fileno, NULL);
|
||||
tmp = _PyObject_CallMethodIdNoArgs(fin, &PyId_fileno);
|
||||
if (tmp == NULL) {
|
||||
PyErr_Clear();
|
||||
tty = 0;
|
||||
|
@ -1981,7 +1981,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
|
|||
tty = fd == fileno(stdin) && isatty(fd);
|
||||
}
|
||||
if (tty) {
|
||||
tmp = _PyObject_CallMethodId(fout, &PyId_fileno, NULL);
|
||||
tmp = _PyObject_CallMethodIdNoArgs(fout, &PyId_fileno);
|
||||
if (tmp == NULL) {
|
||||
PyErr_Clear();
|
||||
tty = 0;
|
||||
|
@ -2019,7 +2019,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
|
|||
stdin_errors_str = PyUnicode_AsUTF8(stdin_errors);
|
||||
if (!stdin_encoding_str || !stdin_errors_str)
|
||||
goto _readline_errors;
|
||||
tmp = _PyObject_CallMethodId(fout, &PyId_flush, NULL);
|
||||
tmp = _PyObject_CallMethodIdNoArgs(fout, &PyId_flush);
|
||||
if (tmp == NULL)
|
||||
PyErr_Clear();
|
||||
else
|
||||
|
@ -2114,7 +2114,7 @@ builtin_input_impl(PyObject *module, PyObject *prompt)
|
|||
if (PyFile_WriteObject(prompt, fout, Py_PRINT_RAW) != 0)
|
||||
return NULL;
|
||||
}
|
||||
tmp = _PyObject_CallMethodId(fout, &PyId_flush, NULL);
|
||||
tmp = _PyObject_CallMethodIdNoArgs(fout, &PyId_flush);
|
||||
if (tmp == NULL)
|
||||
PyErr_Clear();
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue