diff --git a/Doc/whatsnew/3.16.rst b/Doc/whatsnew/3.16.rst index 210bcafe65f5e9..9edbccf3adef9e 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/test/support/__init__.py b/Lib/test/support/__init__.py index 74d3794289bf69..897c210f4767e1 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. diff --git a/Lib/test/test_mmap.py b/Lib/test/test_mmap.py index 55c6ad04d44d82..053a4ca4db53a5 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/Lib/turtle.py b/Lib/turtle.py index af2c7448a0af17..b49df26bd07bc5 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/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index 53727d7940b3f2..7708d38b7759cb 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/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 00000000000000..c59f6fed93fd63 --- /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. 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 00000000000000..31a39e50c72dd5 --- /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. 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 00000000000000..12b5067ba934ec --- /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 e521e95d4ded73..58f1e3b2ddcca7 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);