bpo-43916: PyStdPrinter_Type uses Py_TPFLAGS_DISALLOW_INSTANTIATION (GH-25749)

The PyStdPrinter_Type type now uses the
Py_TPFLAGS_DISALLOW_INSTANTIATION flag to disallow instantiation,
rather than seting a tp_init method which always fail.

Write also unit tests for PyStdPrinter_Type.
This commit is contained in:
Victor Stinner 2021-04-30 14:56:27 +02:00 committed by GitHub
parent 0cad068ec1
commit 4908fae3d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 28 deletions

View file

@ -3007,7 +3007,7 @@ err_occurred:
/* Set up a preliminary stderr printer until we have enough
infrastructure for the io module in place.
Use UTF-8/surrogateescape and ignore EAGAIN errors. */
Use UTF-8/backslashreplace and ignore EAGAIN errors. */
static PyStatus
_PySys_SetPreliminaryStderr(PyObject *sysdict)
{