Commit Graph

46808 Commits

Author SHA1 Message Date
Miss Islington (bot) c23f74903f
[3.9] gh-97032: avoid test_squeezer crash on macOS buildbots (GH-115508) (#115655)
(cherry picked from commit 17a6533dbf)

Co-authored-by: Ned Deily <nad@python.org>
2024-02-21 12:17:44 +01:00
Serhiy Storchaka 8fc8c45b67
[3.9] gh-113659: Skip hidden .pth files (GH-113660) (GH-114146)
(cherry picked from commit 74208ed0c4)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2024-01-17 15:28:17 +01:00
Miss Islington (bot) dd068eaf48
[3.9] gh-107888: Fix test_mmap.test_access_parameter() on macOS 14 (GH-109928) (GH-114184)
(cherry picked from commit 9dbfe2dc8e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-01-17 15:10:35 +01:00
Miss Islington (bot) a2c59992e9
[3.9] gh-109858: Protect zipfile from "quoted-overlap" zipbomb (GH-110016) (GH-113915)
Raise BadZipFile when try to read an entry that overlaps with other entry or
central directory.
(cherry picked from commit 66363b9a7b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-01-17 14:48:06 +01:00
Serhiy Storchaka d54e22a669
[3.9] gh-91133: tempfile.TemporaryDirectory: fix symlink bug in cleanup (GH-99930) (GH-112842)
(cherry picked from commit 81c16cd94e)

Co-authored-by: Søren Løvborg <sorenl@unity3d.com>
2024-01-17 14:47:47 +01:00
Miss Islington (bot) a6f73f6114
[3.9] bpo-37013: Fix the error handling in socket.if_indextoname() (GH-13503) (GH-112600)
* Fix a crash when pass UINT_MAX.
* Fix an integer overflow on 64-bit non-Windows platforms.
(cherry picked from commit 0daf555c6f)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2024-01-17 14:47:26 +01:00
Łukasz Langa 08b640e157
[3.9] gh-101180: Fix a bug where iso2022_jp_3 and iso2022_jp_2004 codecs read out of bounds (gh-111695) (gh-111780)
(cherry picked from commit c8faa3568a)

Co-authored-by: Masayuki Moriyama <masayuki.moriyama@miraclelinux.com>
2023-11-06 18:44:50 +01:00
Łukasz Langa 92f9ce726b
Fix invalid string escape 2023-08-24 19:44:27 +02:00
Łukasz Langa d2cd0a3acb
[3.9] gh-108342: Make ssl TestPreHandshakeClose more reliable (GH-108370) (#108407)
* In preauth tests of test_ssl, explicitly break reference cycles
  invoving SingleConnectionTestServerThread to make sure that the
  thread is deleted. Otherwise, the test marks the environment as
  altered because the threading module sees a "dangling thread"
  (SingleConnectionTestServerThread). This test leak was introduced
  by the test added for the fix of issue gh-108310.
* Use support.SHORT_TIMEOUT instead of hardcoded 1.0 or 2.0 seconds
  timeout.
* SingleConnectionTestServerThread.run() catchs TimeoutError
* Fix a race condition (missing synchronization) in
  test_preauth_data_to_tls_client(): the server now waits until the
  client connect() completed in call_after_accept().
* test_https_client_non_tls_response_ignored() calls server.join()
  explicitly.
* Replace "localhost" with server.listener.getsockname()[0].
(cherry picked from commit 592bacb6fc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-24 12:09:11 +02:00
Miss Islington (bot) b8058b3da5
[3.9] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-108344) (#108351)
Explicitly break a reference cycle when SSLSocket._create() raises an
exception. Clear the variable storing the exception, since the
exception traceback contains the variables and so creates a reference
cycle.

This test leak was introduced by the test added for the fix of GH-108310.
(cherry picked from commit 64f9935035)

Co-authored-by: Victor Stinner <vstinner@python.org>
2023-08-23 12:10:49 +02:00
Petr Viktorin 42deeab5b2
[3.9] gh-107845: Fix symlink handling for tarfile.data_filter (GH-107846) (#108274)
(cherry picked from commit acbd3f9c5c)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Lumír 'Frenzy' Balhar <frenzy.madness@gmail.com>
2023-08-22 20:28:10 +02:00
Serhiy Storchaka 4a79328195
[3.9] gh-99612: Fix PyUnicode_DecodeUTF8Stateful() for ASCII-only data (GH-99613) (GH-107224) (#107231)
Previously *consumed was not set in this case.
(cherry picked from commit f08e52ccb0).
(cherry picked from commit b8b3e6afc0)
2023-08-22 20:25:15 +02:00
Łukasz Langa 264b1dacc6
[3.9] gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw (#108320)
gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close flaw

Instances of `ssl.SSLSocket` were vulnerable to a bypass of the TLS handshake
and included protections (like certificate verification) and treating sent
unencrypted data as if it were post-handshake TLS encrypted data.

The vulnerability is caused when a socket is connected, data is sent by the
malicious peer and stored in a buffer, and then the malicious peer closes the
socket within a small timing window before the other peers’ TLS handshake can
begin. After this sequence of events the closed socket will not immediately
attempt a TLS handshake due to not being connected but will also allow the
buffered data to be read as if a successful TLS handshake had occurred.

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
2023-08-22 19:57:10 +02:00
Miss Islington (bot) d7f8a5fe07
[3.9] gh-102153: Start stripping C0 control and space chars in `urlsplit` (GH-102508) (GH-104575) (GH-104592) (#104593)
gh-102153: Start stripping C0 control and space chars in `urlsplit` (GH-102508)

`urllib.parse.urlsplit` has already been respecting the WHATWG spec a bit GH-25595.

This adds more sanitizing to respect the "Remove any leading C0 control or space from input" [rule](https://url.spec.whatwg.org/GH-url-parsing:~:text=Remove%20any%20leading%20and%20trailing%20C0%20control%20or%20space%20from%20input.) in response to [CVE-2023-24329](https://nvd.nist.gov/vuln/detail/CVE-2023-24329).

I simplified the docs by eliding the state of the world explanatory
paragraph in this security release only backport.  (people will see
that in the mainline /3/ docs)

(cherry picked from commit 2f630e1ce1)
(cherry picked from commit 610cc0ab1b)
(cherry picked from commit f48a96a280)

Co-authored-by: Illia Volochii <illia.volochii@gmail.com>
Co-authored-by: Gregory P. Smith [Google] <greg@krypto.org>
2023-05-22 12:42:37 +02:00
Miss Islington (bot) 3d5dd1eee2
[3.9] gh-99889: Fix directory traversal security flaw in uu.decode() (GH-104096) (#104331)
(cherry picked from commit 0aeda29793)

Co-authored-by: Sam Carroll <70000253+samcarroll42@users.noreply.github.com>
2023-05-22 12:41:30 +02:00
Miss Islington (bot) b53d0ff431
[3.9] gh-104049: do not expose on-disk location from SimpleHTTPRequestHandler (GH-104067) (#104120)
Do not expose the local server's on-disk location from `SimpleHTTPRequestHandler` when generating a directory index. (unnecessary information disclosure)

(cherry picked from commit c7c3a60c88)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-22 12:40:50 +02:00
Steve Dower d1645ce4f1
[3.9] gh-103935: Use `io.open_code()` when executing code in trace and profile modules (GH-103947) (#103953)
Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
2023-05-22 12:40:30 +02:00
Petr Viktorin 98016f7c92
[3.9] gh-102950: Implement PEP 706 – Filter for tarfile.extractall (GH-102953) (#104382)
Backport of c8c3956d90
2023-05-15 18:53:58 +02:00
Pradyun Gedam b5a94301a2
[3.9] gh-101997: Update bundled pip version to 23.0.1 (GH-101998). (#102243)
(cherry picked from commit 89d9ff0f48)
2023-03-28 10:52:56 +02:00
Miss Islington (bot) 04cc427025
[3.9] gh-101283: Improved fallback logic for subprocess with shell=True on Windows (GH-101286) (#101709)
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
Co-authored-by: Steve Dower <steve.dower@microsoft.com>
2023-02-09 10:59:40 +01:00
Kumar Aditya 6954203c9f
[3.9] GH-100892: Fix race in clearing `threading.local` (GH-100922) (#100939)
[3.9] [3.10] GH-100892: Fix race in clearing `threading.local` (GH-100922).
(cherry picked from commit 762745a124)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>.
(cherry picked from commit 683e9fe30e)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
2023-01-20 23:21:40 +01:00
Miss Islington (bot) 3b81c13ac3
[3.9] gh-100001: Omit control characters in http.server stderr logs. (GH-100002) (#100032)
* gh-100001: Omit control characters in http.server stderr logs. (GH-100002)

Replace control characters in http.server.BaseHTTPRequestHandler.log_message with an escaped \xHH sequence to avoid causing problems for the terminal the output is printed to.
(cherry picked from commit d8ab0a4dfa)

Co-authored-by: Gregory P. Smith <greg@krypto.org>

* also escape \s (backport of PR #100038).

* add versionadded and remove extra 'to'

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-12-06 11:22:12 +01:00
Steve Dower 7b98207aa4
[3.9] gh-87604: Avoid publishing list of active per-interpreter audit hooks via the gc module (GH-99373) (GH-99493) 2022-11-21 19:13:33 +01:00
Miss Islington (bot) c09dba57cf
[3.9] gh-98433: Fix quadratic time idna decoding. (GH-99092) (GH-99222) (#99230)
There was an unnecessary quadratic loop in idna decoding. This restores
the behavior to linear.

(cherry picked from commit d315722564)
(cherry picked from commit a6f6c3a3d6)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-11-10 16:57:41 +01:00
Miss Islington (bot) b43496c01a
[3.9] gh-97514: Don't use Linux abstract sockets for multiprocessing (GH-98501) (#98504)
Linux abstract sockets are insecure as they lack any form of filesystem
permissions so their use allows anyone on the system to inject code into
the process.

This removes the default preference for abstract sockets in
multiprocessing introduced in Python 3.9+ via
https://github.com/python/cpython/pull/18866 while fixing
https://github.com/python/cpython/issues/84031.

Explicit use of an abstract socket by a user now generates a
RuntimeWarning.  If we choose to keep this warning, it should be
backported to the 3.7 and 3.8 branches.
(cherry picked from commit 49f61068f4)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-10-28 12:08:30 +02:00
Miss Islington (bot) 857efee6d2
[3.9] gh-98517: Fix buffer overflows in _sha3 module (GH-98519) (#98526)
This is a port of the applicable part of XKCP's fix [1] for
CVE-2022-37454 and avoids the segmentation fault and the infinite
loop in the test cases published in [2].

[1]: fdc6fef075
[2]: https://mouha.be/sha-3-buffer-overflow/

Regression test added by: Gregory P. Smith [Google LLC] <greg@krypto.org>
(cherry picked from commit 0e4e058602)

Co-authored-by: Theo Buehler <botovq@users.noreply.github.com>
2022-10-28 12:08:06 +02:00
Miss Islington (bot) 157a8b8edd
[3.9] gh-96710: Make the test timing more lenient for the int/str DoS regression test. (GH-96717) (#98196)
gh-96710: Make the test timing more lenient for the int/str DoS regression test. (GH-96717)

A regression would still absolutely fail and even a flaky pass isn't
harmful as it'd fail most of the time across our N system test runs.

Windows has a low resolution timer and CI systems are prone to odd
timing so this just gives more leeway to avoid flakiness.
(cherry picked from commit 11e3548fd1)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-10-11 23:13:54 +02:00
Miss Islington (bot) c59a16e2c7
[3.9] gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993) (#98190)
gh-68966: Make mailcap refuse to match unsafe filenames/types/params (GH-91993)
(cherry picked from commit b9509ba7a9)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2022-10-11 23:13:18 +02:00
Łukasz Langa 7e28154196
Python 3.9.15 2022-10-11 16:48:37 +02:00
Łukasz Langa da1fe3873a
[3.9] gh-94208: Add even more TLS version/protocol checks for FreeBSD (#98037)
Otherwise, buildbot builds would fail since there's no TLS 1.0/1.1 support.
2022-10-07 11:49:28 -07:00
Miss Islington (bot) 77796d058e
[3.9] gh-97897: Prevent os.mkfifo and os.mknod segfaults with macOS 13 SDK (GH-97944) (#97968)
The macOS 13 SDK includes support for the `mkfifoat` and `mknodat` system calls.
 Using the `dir_fd` option with either `os.mkfifo` or `os.mknod` could result in a
 segfault if cpython is built with the macOS 13 SDK but run on an earlier
 version of macOS. Prevent this by adding runtime support for detection of
 these system calls ("weaklinking") as is done for other newer syscalls on
 macOS.
(cherry picked from commit 6d0a0191a4)

Co-authored-by: Ned Deily <nad@python.org>
2022-10-06 12:14:32 -07:00
Miss Islington (bot) 358b7a4454
[3.9] gh-96848: Fix -X int_max_str_digits option parsing (GH-96988) (GH-97574)
gh-96848: Fix -X int_max_str_digits option parsing (GH-96988)

Fix command line parsing: reject "-X int_max_str_digits" option with
no value (invalid) when the PYTHONINTMAXSTRDIGITS environment
variable is set to a valid limit.
(cherry picked from commit 41351662bc)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-04 11:57:34 -07:00
Miss Islington (bot) f65f3a9daf
[3.9] gh-97616: list_resize() checks for integer overflow (GH-97617) (GH-97627)
gh-97616: list_resize() checks for integer overflow (GH-97617)

Fix multiplying a list by an integer (list *= int): detect the
integer overflow when the new allocated length is close to the
maximum size.  Issue reported by Jordan Limor.

list_resize() now checks for integer overflow before multiplying the
new allocated length by the list item size (sizeof(PyObject*)).
(cherry picked from commit a5f092f3c4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2022-10-04 10:01:10 -07:00
Łukasz Langa 816066f497
Python 3.9.14 2022-09-06 19:26:16 +02:00
Gregory P. Smith cec1e9dfd7
[3.9] gh-95778: CVE-2020-10735: Prevent DoS by very large int() (#96502)
* Correctly pre-check for int-to-str conversion (#96537)

Converting a large enough `int` to a decimal string raises `ValueError` as expected. However, the raise comes _after_ the quadratic-time base-conversion algorithm has run to completion. For effective DOS prevention, we need some kind of check before entering the quadratic-time loop. Oops! =)

The quick fix: essentially we catch _most_ values that exceed the threshold up front. Those that slip through will still be on the small side (read: sufficiently fast), and will get caught by the existing check so that the limit remains exact.

The justification for the current check. The C code check is:
```c
max_str_digits / (3 * PyLong_SHIFT) <= (size_a - 11) / 10
```

In GitHub markdown math-speak, writing $M$ for `max_str_digits`, $L$ for `PyLong_SHIFT` and $s$ for `size_a`, that check is:
$$\left\lfloor\frac{M}{3L}\right\rfloor \le \left\lfloor\frac{s - 11}{10}\right\rfloor$$

From this it follows that
$$\frac{M}{3L} < \frac{s-1}{10}$$
hence that
$$\frac{L(s-1)}{M} > \frac{10}{3} > \log_2(10).$$
So
$$2^{L(s-1)} > 10^M.$$
But our input integer $a$ satisfies $|a| \ge 2^{L(s-1)}$, so $|a|$ is larger than $10^M$. This shows that we don't accidentally capture anything _below_ the intended limit in the check.

<!-- gh-issue-number: gh-95778 -->
* Issue: gh-95778
<!-- /gh-issue-number -->

Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
2022-09-05 11:21:03 +02:00
Miss Islington (bot) 03dc951316
gh-95280: Fix test_get_ciphers on systems without RSA key exchange (GH-95282) (GH-95323)
(cherry picked from commit 565403038b)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-29 17:20:06 +02:00
Łukasz Langa 017080f0fa
[3.9] gh-94208: Add more TLS version/protocol checks for FreeBSD (GH-94347) (GH-95312)
Three test cases were failing on FreeBSD with latest OpenSSL.
(cherry picked from commit 1bc86c2625)

Co-authored-by: Christian Heimes <christian@python.org>
2022-07-27 23:43:02 +02:00
Miss Islington (bot) cd0a59f1fa
gh-94821: Fix autobind of empty unix domain address (GH-94826) (GH-94875)
When binding a unix socket to an empty address on Linux, the socket is
automatically bound to an available address in the abstract namespace.

    >>> s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    >>> s.bind("")
    >>> s.getsockname()
    b'\x0075499'

Since python 3.9, the socket is bound to the one address:

    >>> s.getsockname()
    b'\x00'

And trying to bind multiple sockets will fail with:

    Traceback (most recent call last):
      File "/home/nsoffer/src/cpython/Lib/test/test_socket.py", line 5553, in testAutobind
        s2.bind("")
    OSError: [Errno 98] Address already in use

Added 2 tests:
- Auto binding empty address on Linux
- Failing to bind an empty address on other platforms

Fixes f6b3a07b7d (bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866)
(cherry picked from commit c22f134211)

Co-authored-by: Nir Soffer <nsoffer@redhat.com>
2022-07-26 12:07:41 +02:00
Łukasz Langa eff4aa5409
[3.9] gh-90355: Add isolated flag if currently isolated (GH-92857) (GH-94570)
Co-authored-by: Carter Dodd <carter.dodd@gmail.com>
Co-authored-by: Éric <merwok@netwok.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit c8556bcf6c)
2022-07-05 18:06:57 +02:00
Miss Islington (bot) defaa2b19a
gh-87389: Fix an open redirection vulnerability in http.server. (GH-93879) (GH-94093)
Fix an open redirection vulnerability in the `http.server` module when
an URI path starts with `//` that could produce a 301 Location header
with a misleading target.  Vulnerability discovered, and logic fix
proposed, by Hamza Avvan (@hamzaavvan).

Test and comments authored by Gregory P. Smith [Google].
(cherry picked from commit 4abab6b603)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2022-06-22 10:42:02 +02:00
Miss Islington (bot) 893adbf001
gh-91810: Fix regression with writing an XML declaration with encoding='unicode' (GH-93426) (GH-93791)
Suppress writing an XML declaration in open files in ElementTree.write()
with encoding='unicode' and xml_declaration=None.

If file patch is passed to ElementTree.write() with encoding='unicode',
always open a new file in UTF-8.
(cherry picked from commit d7db9dc3cc)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-06-16 12:16:30 +02:00
Miss Islington (bot) 95c9c2b9cb
gh-93065: Fix HAMT to iterate correctly over 7-level deep trees (GH-93066) (#93147)
Also while there, clarify a few things about why we reduce the hash to 32 bits.

Co-authored-by: Eli Libman <eli@hyro.ai>
Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>

(cherry picked from commit c1f5c903a7)
2022-05-24 10:52:49 +02:00
Łukasz Langa 6de2ca5339
Python 3.9.13 2022-05-17 13:12:56 +02:00
Jelle Zijlstra f82b32410b
[3.9] gh-92112: Fix crash triggered by an evil custom `mro()` (GH-92113) (GH-92372)
(cherry picked from commit 85354ed78c)

Co-authored-by: Alexey Izbyshev <izbyshev@ispras.ru>
2022-05-16 18:47:35 +02:00
Marek Suscak 518b238967
[3.9] bpo-34480: fix bug where match variable is used prior to being defined (GH-17643) (GH-32256)
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-05-16 18:19:04 +02:00
Miss Islington (bot) 1699a5ee13
Check result of utc_to_seconds and skip fold probe in pure Python (GH-91582) (GH-92748)
The `utc_to_seconds` call can fail, here's a minimal reproducer on
Linux:

TZ=UTC python -c "from datetime import *; datetime.fromtimestamp(253402300799 + 1)"

The old behavior still raised an error in a similar way, but only
because subsequent calculations happened to fail as well. Better to fail
fast.

This also refactors the tests to split out the `fromtimestamp` and
`utcfromtimestamp` tests, and to get us closer to the actual desired
limits of the functions. As part of this, we also changed the way we
detect platforms where the same limits don't necessarily apply (e.g.
Windows).

As part of refactoring the tests to hit this condition explicitly (even
though the user-facing behvior doesn't change in any way we plan to
guarantee), I noticed that there was a difference in the places that
`datetime.utcfromtimestamp` fails in the C and pure Python versions, which
was fixed by skipping the "probe for fold" logic for UTC specifically —
since UTC doesn't have any folds or gaps, we were never going to find a
fold value anyway. This should prevent some failures in the pure python
`utcfromtimestamp` method on timestamps close to 0001-01-01.

There are two separate news entries for this because one is a
potentially user-facing change, the other is an internal code
correctness change that, if anything, changes some error messages. The
two happen to be coupled because of the test refactoring, but they are
probably best thought of as independent changes.

Fixes GH-91581
(cherry picked from commit 83c0247d47)

Co-authored-by: Paul Ganssle <1377457+pganssle@users.noreply.github.com>
2022-05-16 17:33:01 +02:00
Miss Islington (bot) 14d05942ea
gh-92530: Fix an issue that occurred after interrupting threading.Condition.notify (GH-92534) (GH-92831)
If Condition.notify() was interrupted just after it released the waiter lock,
but before removing it from the queue, the following calls of notify() failed
with RuntimeError: cannot release un-acquired lock.
(cherry picked from commit 70af994fee)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-05-16 17:25:31 +02:00
Dennis Sweeney 801f77119d
[3.9] gh-92311: Let frame_setlineno jump over listcomps (#92740) 2022-05-12 17:41:34 -04:00
Miss Islington (bot) 65d2dfd5c2
bpo-42627: Fix incorrect parsing of Windows registry proxy settings (GH-26307)
(cherry picked from commit b69297ea23)

Co-authored-by: 狂男风 <CrazyBoyFeng@Live.com>
2022-05-11 11:42:10 -07:00
Miss Islington (bot) bfc88d3418
[3.9] gh-91810: ElementTree: Use text file's encoding by default in XML declaration (GH-91903) (GH-92665)
ElementTree method write() and function tostring() now use the text file's
encoding ("UTF-8" if not available) instead of locale encoding in XML
declaration when encoding="unicode" is specified.
(cherry picked from commit 707839b0fe)


Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>

Automerge-Triggered-By: GH:serhiy-storchaka
2022-05-11 10:40:05 -07:00