Core and Builtins
-----------------
-- Issue #24891: Fix a race condition at Python startup if the file descriptor
- of stdin (0), stdout (1) or stderr (2) is closed while Python is creating
- sys.stdin, sys.stdout and sys.stderr objects. These attributes are now set
- to None if the creation of the object failed, instead of raising an OSError
- exception. Initial patch written by Marco Paolini.
-
-- Issue #21167: NAN operations are now handled correctly when python is
- compiled with ICC even if -fp-model strict is not specified.
-
-- Issue #4395: Better testing and documentation of binary operators.
- Patch by Martin Panter.
-
-- Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray
- object now always allocates place for trailing null byte and it's buffer now
- is always null-terminated.
-
-- Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
- PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains()
- to check for and handle errors correctly.
-
-- Issue #24257: Fixed system error in the comparison of faked
- types.SimpleNamespace.
-
-- Issue #22939: Fixed integer overflow in iterator object. Patch by
- Clement Rouault.
-
-- Issue #23985: Fix a possible buffer overrun when deleting a slice from
- the front of a bytearray and then appending some other bytes data.
-
-- Issue #24102: Fixed exception type checking in standard error handlers.
-
-- Issue #23757: PySequence_Tuple() incorrectly called the concrete list API
- when the data was a list subclass.
-
-- Issue #24407: Fix crash when dict is mutated while being updated.
-
-- Issue #24096: Make warnings.warn_explicit more robust against mutation of the
- warnings.filters list.
-
-- Issue #23996: Avoid a crash when a delegated generator raises an
- unnormalized StopIteration exception. Patch by Stefan Behnel.
-
-- Issue #24022: Fix tokenizer crash when processing undecodable source code.
-
-- Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted
- while it is holding a lock to a buffered I/O object, and the main thread
- tries to use the same I/O object (typically stdout or stderr). A fatal
- error is emitted instead.
-
-- Issue #22977: Fixed formatting Windows error messages on Wine.
- Patch by Martin Panter.
-
-- Issue #23803: Fixed str.partition() and str.rpartition() when a separator
- is wider then partitioned string.
-
-- Issue #23192: Fixed generator lambdas. Patch by Bruno Cauet.
-
-- Issue #23629: Fix the default __sizeof__ implementation for variable-sized
- objects.
-
-- Issue #24044: Fix possible null pointer dereference in list.sort in out of
- memory conditions.
+ - Issue #25182: The stdprinter (used as sys.stderr before the io module is
+ imported at startup) now uses the backslashreplace error handler.
+
+- Issue #25131: Make the line number and column offset of set/dict literals and
+ comprehensions correspond to the opening brace.
-- Issue #21354: PyCFunction_New function is exposed by python DLL again.
+- Issue #25150: Hide the private _Py_atomic_xxx symbols from the public
+ Python.h header to fix a compilation error with OpenMP. PyThreadState_GET()
+ becomes an alias to PyThreadState_Get() to avoid ABI incompatibilies.
Library
-------
Py_RETURN_NONE;
}
- /* encode Unicode to UTF-8 */
- if (!PyArg_ParseTuple(args, "s", &str))
+ if (!PyArg_ParseTuple(args, "U", &unicode))
return NULL;
- n = _Py_write(self->fd, str, strlen(str));
+ /* encode Unicode to UTF-8 */
+ str = PyUnicode_AsUTF8AndSize(unicode, &n);
+ if (str == NULL) {
+ PyErr_Clear();
+ bytes = _PyUnicode_AsUTF8String(unicode, "backslashreplace");
+ if (bytes == NULL)
+ return NULL;
+ if (PyBytes_AsStringAndSize(bytes, &str, &n) < 0) {
+ Py_DECREF(bytes);
+ return NULL;
+ }
+ }
+
- Py_BEGIN_ALLOW_THREADS
- errno = 0;
-#ifdef MS_WINDOWS
- if (n > INT_MAX)
- n = INT_MAX;
- n = write(self->fd, str, (int)n);
-#else
- n = write(self->fd, str, n);
-#endif
++ n = _Py_write(self->fd, str, n);
+ _errno = errno;
- Py_END_ALLOW_THREADS
+ Py_XDECREF(bytes);
-
- if (n < 0) {
- if (_errno == EAGAIN)
+ if (n == -1) {
- if (errno == EAGAIN) {
++ if (_errno == EAGAIN) {
+ PyErr_Clear();
Py_RETURN_NONE;
- PyErr_SetFromErrno(PyExc_IOError);
+ }
return NULL;
}