From b5c74a6fb790010e720a0b62c2721cc0f9bbffe9 Mon Sep 17 00:00:00 2001 From: eklopfer Date: Sun, 9 Aug 2026 13:31:05 -0400 Subject: [PATCH 1/4] GH-85118: Add SEM_FAILCRITICALERRORS to SuppressCrashReport call to SetErrorMode (GH-103697) Co-authored-by: Oleg Iarygin --- Lib/test/support/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 74d3794289bf69f..897c210f4767e1d 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1940,7 +1940,8 @@ def __enter__(self): self.old_value = msvcrt.GetErrorMode() - msvcrt.SetErrorMode(self.old_value | msvcrt.SEM_NOGPFAULTERRORBOX) + msvcrt.SetErrorMode(self.old_value | msvcrt.SEM_NOGPFAULTERRORBOX + | msvcrt.SEM_FAILCRITICALERRORS) # bpo-23314: Suppress assert dialogs in debug builds. # CrtSetReportMode() is only available in debug build. From 5107fd700d70abf62762d09f766200532866e823 Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Sun, 9 Aug 2026 11:10:29 -0700 Subject: [PATCH 2/4] gh-68048: Remove unneeded lseek() call in mmap.mmap on Windows (GH-7017) fseek() was necessary for FILE streams on Windows 9x systems for its side effect (flush). lseek() which replaced it in 2003 was never needed. Co-authored-by: Serhiy Storchaka --- Lib/test/test_mmap.py | 1 + .../next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst | 2 ++ Modules/mmapmodule.c | 3 --- 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 55c6ad04d44d828..053a4ca4db53a57 100644 --- a/Lib/test/test_mmap.py +++ b/Lib/test/test_mmap.py @@ -59,6 +59,7 @@ def test_basic(self): f.flush() m = mmap.mmap(f.fileno(), 2 * PAGESIZE) self.addCleanup(m.close) + self.assertEqual(f.tell(), 2 * PAGESIZE) finally: f.close() diff --git a/Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst b/Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst new file mode 100644 index 000000000000000..12b5067ba934ec2 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2026-08-09-17-30-00.gh-issue-68048.Mq8Vd4.rst @@ -0,0 +1,2 @@ +Creating a :class:`mmap.mmap` object on Windows no longer resets the position +of the underlying file to zero, as on other platforms. diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index e521e95d4ded73f..58f1e3b2ddcca70 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -2084,9 +2084,6 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict) fh = _Py_get_osfhandle(fileno); if (fh == INVALID_HANDLE_VALUE) return NULL; - - /* Win9x appears to need us seeked to zero */ - lseek(fileno, 0, SEEK_SET); } m_obj = (mmap_object *)type->tp_alloc(type, 0); From 1286d4398e505f70f97e50edda6b0341f16ca267 Mon Sep 17 00:00:00 2001 From: williamnavaraj Date: Sun, 9 Aug 2026 23:01:24 +0200 Subject: [PATCH 3/4] gh-70758: Fix creating a turtle screen after closing one (GH-30355) Creating a new turtle screen after the previous one was closed no longer raises turtle.Terminator on the first turtle command. Co-authored-by: Serhiy Storchaka --- Lib/turtle.py | 3 +++ .../next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst diff --git a/Lib/turtle.py b/Lib/turtle.py index af2c7448a0af17f..b49df26bd07bc5a 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -1002,6 +1002,9 @@ def __init__(self, cv, mode=_CFG["mode"], rootwindow.wm_attributes(topmost=True) rootwindow.wm_attributes(topmost=False) + # A new screen means that turtle graphics is running again. + TurtleScreen._RUNNING = True + def clear(self): """Delete all drawings and all turtles from the TurtleScreen. diff --git a/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst b/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst new file mode 100644 index 000000000000000..c59f6fed93fd630 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst @@ -0,0 +1,2 @@ +Creating a new :mod:`turtle` screen after the previous one was closed no +longer raises ``turtle.Terminator`` on the first turtle command. From 87b120fdb58afd8f7cb79daa87122334e295b70c Mon Sep 17 00:00:00 2001 From: Daniel Hillier Date: Mon, 10 Aug 2026 07:06:42 +1000 Subject: [PATCH 4/4] gh-118318: Remove outdated c14n references from ElementTree (GH-118319) Some references to a removed `c14n` serialization method remained in ElementTree.py. Attempting to use `method='c14n'` in the `write()` method would result in `ValueError: unknown method 'c14n'`. Removes the `write_c14n()` method that uses `method='c14n'` and also raises the same error. --- Doc/whatsnew/3.16.rst | 11 +++++++++++ Lib/xml/etree/ElementTree.py | 15 +++------------ ...2026-08-09-21-30-00.gh-issue-118318.Xr4Kd8.rst | 5 +++++ 3 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2026-08-09-21-30-00.gh-issue-118318.Xr4Kd8.rst diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index 210bcafe65f5e9c..9edbccf3adef9e5 100644 --- a/Doc/whatsnew/3.16.rst +++ b/Doc/whatsnew/3.16.rst @@ -727,6 +727,17 @@ tarfile * The undocumented and unused :attr:`!tarfile.TarFile.tarfile` attribute has been deprecated since Python 3.13. +xml.etree.ElementTree +--------------------- + +* The undocumented :meth:`!xml.etree.ElementTree.ElementTree.write_c14n` method + and the support of ``method="c14n"`` in + :meth:`~xml.etree.ElementTree.ElementTree.write` and + :func:`~xml.etree.ElementTree.tostring`. + They never worked and always raised :exc:`ValueError`. + Use :func:`xml.etree.ElementTree.canonicalize` instead. + (Contributed by Daniel Hillier in :gh:`118318`.) + .. Add removals above alphabetically, not here at the end. diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index 53727d7940b3f2a..7708d38b7759cb1 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -714,7 +714,7 @@ def write(self, file_or_filename, *default_namespace* -- sets the default XML namespace (for "xmlns") - *method* -- either "xml" (default), "html, "text", or "c14n" + *method* -- either "xml" (default), "html" or "text" *short_empty_elements* -- controls the formatting of elements that contain no content. If True @@ -730,10 +730,7 @@ def write(self, file_or_filename, elif method not in _serialize: raise ValueError("unknown method %r" % method) if not encoding: - if method == "c14n": - encoding = "utf-8" - else: - encoding = "us-ascii" + encoding = "us-ascii" with _get_writer(file_or_filename, encoding) as (write, declared_encoding): if method == "xml" and (xml_declaration or (xml_declaration is None and @@ -749,10 +746,6 @@ def write(self, file_or_filename, serialize(write, self._root, qnames, namespaces, short_empty_elements=short_empty_elements) - def write_c14n(self, file): - # lxml.etree compatibility. use output method instead - return self.write(file, method="c14n") - # -------------------------------------------------------------------- # serialization support @@ -987,8 +980,6 @@ def _serialize_text(write, elem): "xml": _serialize_xml, "html": _serialize_html, "text": _serialize_text, -# this optional method is imported at the end of the module -# "c14n": _serialize_c14n, } @@ -1100,7 +1091,7 @@ def tostring(element, encoding=None, method=None, *, *element* is an Element instance, *encoding* is an optional output encoding defaulting to US-ASCII, *method* is an optional output which - can be one of "xml" (default), "html", "text" or "c14n", + can be one of "xml" (default), "html" or "text", *default_namespace* sets the default XML namespace (for "xmlns"). Returns an (optionally) encoded string containing the XML data. diff --git a/Misc/NEWS.d/next/Library/2026-08-09-21-30-00.gh-issue-118318.Xr4Kd8.rst b/Misc/NEWS.d/next/Library/2026-08-09-21-30-00.gh-issue-118318.Xr4Kd8.rst new file mode 100644 index 000000000000000..31a39e50c72dd5f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-08-09-21-30-00.gh-issue-118318.Xr4Kd8.rst @@ -0,0 +1,5 @@ +Remove the ``write_c14n()`` method of :class:`xml.etree.ElementTree.ElementTree` +and the support of ``method="c14n"`` in :meth:`~xml.etree.ElementTree.ElementTree.write` +and :func:`~xml.etree.ElementTree.tostring`. They never worked and always +raised :exc:`ValueError`. Use :func:`xml.etree.ElementTree.canonicalize` +instead.