Commit graph

51570 commits

Author SHA1 Message Date
Miss Islington (bot)
b49e902b81
[3.12] gh-126876: Fix socket internal_select() for large timeout (GH-126968) (#127003)
gh-126876: Fix socket internal_select() for large timeout (GH-126968)

If the timeout is larger than INT_MAX, replace it with INT_MAX, in
the poll() code path.

Add an unit test.
(cherry picked from commit b3687ad454)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-12-03 14:12:59 +00:00
Miss Islington (bot)
af2d24b5ad
gh-119826: Improved fallback for ntpath.abspath() on Windows (GH-119938)
(cherry picked from commit 4b00aba42e)

Co-authored-by: Nice Zombies <nineteendo19d0@gmail.com>
2024-12-02 20:03:44 +00:00
Miss Islington (bot)
8fffbb0982
[3.12] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (GH-127216) (GH-127530)
[3.13] gh-113841: fix possible undefined division by 0 in _Py_c_pow() (GH-127211) (GH-127216)

Note, that transformed expression is not an equivalent for original one (1/exp(-x) != exp(x) in general for floating-point numbers). Though, the difference seems to be ~1ULP for good libm implementations.

It's more interesting why division was used from beginning. Closest algorithm I've found (no error checks, of course;)) - it's Algorithm 190 from ACM: https://dl.acm.org/doi/10.1145/366663.366679. It uses subtraction in the exponent.

(cherry picked from commit f7bb658124)

(cherry picked from commit f41d8d89e7)

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
2024-12-02 19:47:42 +00:00
Sergey B Kirpichev
34fe4af8a2
[3.12] gh-126618: fix repr(itertools.count(sys.maxsize)) (GH-127048) (#127510)
(cherry picked from commit 930ba0ce60)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-12-02 15:19:59 +01:00
Miss Islington (bot)
34137cbd23
[3.12] gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702) (#126761)
gh-126699: allow AsyncIterator to be used as a base for Protocols (GH-126702)
(cherry picked from commit feb3e0b19c)

Co-authored-by: Stephen Morton <github@tungol.org>
2024-12-02 14:18:53 +00:00
Miss Islington (bot)
97fd09fba1
[3.12] add missing gc_collect() calls in sqlite3 tests (GH-127446) (#127501)
add missing gc_collect() calls in sqlite3 tests (GH-127446)
(cherry picked from commit 2a373da770)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
2024-12-02 14:57:51 +01:00
Miss Islington (bot)
f08c82ecad
[3.12] Add the missing f on an f-string error message in multiprocessing. (GH-127462) (#127465)
Add the missing `f` on an f-string error message in multiprocessing. (GH-127462)
(cherry picked from commit 11c01092d5)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2024-11-30 23:50:33 -08:00
Miss Islington (bot)
7c7ed49b51
[3.12] gh-88110: Clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threads (GH-126098) (GH-127164)
Threads are gone after fork, so clear the queues too. Otherwise the
child process (here created via multiprocessing.Process) crashes on
interpreter exit.

(cherry picked from commit 1848ce61f3)

Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-30 09:05:46 +00:00
Victor Stinner
e7ab97862d
[3.12] gh-127208: Reject null character in _imp.create_dynamic() (#127400) (#127419)
gh-127208: Reject null character in _imp.create_dynamic() (#127400)

_imp.create_dynamic() now rejects embedded null characters in the
path and in the module name.

Backport also the _PyUnicode_AsUTF8NoNUL() function.

(cherry picked from commit b14fdadc6c)
2024-11-29 17:03:24 +01:00
Miss Islington (bot)
fc6c2de6de
[3.12] gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358) (#127402)
gh-127258: Fix asyncio test_staggered_race_with_eager_tasks() (GH-127358)

Replace the sleep(2) with a task which is blocked forever.
(cherry picked from commit bfabf96b50)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-29 10:59:22 +00:00
Miss Islington (bot)
91399c3984
[3.12] gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304) (#127391)
gh-127303: Add docs for token.EXACT_TOKEN_TYPES (GH-127304)

---------

(cherry picked from commit dd3a87d2a8)

Co-authored-by: Илья Любавский <100635212+lubaskinc0de@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-29 09:22:27 +00:00
Miss Islington (bot)
7d175caf21
[3.12] gh-127190: Fix local_setattro() error handling (GH-127366) (#127368)
gh-127190: Fix local_setattro() error handling (GH-127366)

Don't make the assumption that the 'name' argument is a string. Use
repr() to format the 'name' argument instead.
(cherry picked from commit 20657fbdb1)

Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-28 17:32:50 +00:00
Miss Islington (bot)
c3bb32de9d
[3.12] gh-124008: Fix calculation of the number of written bytes for the Windows console (GH-124059) (GH-127326)
Since MultiByteToWideChar()/WideCharToMultiByte() is not reversible if
the data contains invalid UTF-8 sequences, use binary search to
calculate the number of written bytes from the number of written
characters.

Also fix writing incomplete UTF-8 sequences.

Also fix handling of memory allocation failures.
(cherry picked from commit 3cf83d91a5)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-27 16:00:30 +02:00
Miss Islington (bot)
97ed21636c
[3.12] gh-109746: Fix race condition in test_start_new_thread_failed (GH-127299) (GH-127324)
(cherry picked from commit 83926d3b4c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-27 12:22:32 +00:00
Miss Islington (bot)
08531ac83f
[3.12] gh-127183: Add _ctypes.CopyComPointer tests (GH-127184) (GH-127252)
gh-127183: Add `_ctypes.CopyComPointer` tests (GH-127184)

* Make `create_shelllink_persist` top level function.

* Add `CopyComPointerTests`.

* Add more tests.

* Update tests.

* Add assertions for `Release`'s return value.
(cherry picked from commit c7f1e3e150)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-11-26 11:13:29 +01:00
Miss Islington (bot)
a4d6b905dd
[3.12] gh-127182: Fix io.StringIO.__setstate__ crash when None is the first value (GH-127219) (#127263)
gh-127182: Fix `io.StringIO.__setstate__` crash when `None` is the first value (GH-127219)
(cherry picked from commit a2ee899682)

Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-11-25 17:51:21 +00:00
Miss Islington (bot)
f7e587d15c
[3.12] gh-126384: Add tests to verify the behavior of basic COM methods. (GH-126610) (GH-127160)
(cherry picked from commit 7725c0371a)

Co-authored-by: Jun Komoda <45822440+junkmd@users.noreply.github.com>
2024-11-25 13:18:35 +01:00
Miss Islington (bot)
5bfacd26e8
[3.12] gh-127217: Fix pathname2url() for paths starting with multiple slashes on Posix (GH-127218) (GH-127231)
(cherry picked from commit 97b2ceaaaf)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-24 20:13:23 +02:00
Serhiy Storchaka
f1e7424802
[3.12] gh-109746: Make _thread.start_new_thread delete state of new thread on its startup failure (GH-109761) (GH-127173)
If Python fails to start newly created thread
due to failure of underlying PyThread_start_new_thread() call,
its state should be removed from interpreter' thread states list
to avoid its double cleanup.

(cherry picked from commit ca3ea9ad05)

Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
2024-11-22 19:56:39 +00:00
Serhiy Storchaka
29648980d4
[3.12] gh-127001: Fix PATHEXT issues in shutil.which() on Windows (GH-127035) (GH-127158)
* Name without a PATHEXT extension is only searched if the mode does not
  include X_OK.
* Support multi-component PATHEXT extensions (e.g. ".foo.bar").
* Support files without extensions in PATHEXT contains dot-only extension
  (".", "..", etc).
* Support PATHEXT extensions that end with a dot (e.g. ".foo.").
(cherry picked from commit 8899e85de1)
2024-11-22 16:33:50 +00:00
Miss Islington (bot)
c470e822bf
[3.12] GH-127078: url2pathname(): handle extra slash before UNC drive in URL path (GH-127132) (#127136)
GH-127078: `url2pathname()`: handle extra slash before UNC drive in URL path (GH-127132)

Decode a file URI like `file://///server/share` as a UNC path like
`\\server\share`. This form of file URI is created by software the simply
prepends `file:///` to any absolute Windows path.
(cherry picked from commit 8c98ed846a)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-22 04:37:51 +00:00
Miss Islington (bot)
4b705f50d1
[3.12] GH-126766: url2pathname(): handle 'localhost' authority (GH-127129) (#127131)
GH-126766: `url2pathname()`: handle 'localhost' authority (GH-127129)

Discard any 'localhost' authority from the beginning of a `file:` URI. As a
result, file URIs like `//localhost/etc/hosts` are correctly decoded as
`/etc/hosts`.
(cherry picked from commit ebf564a1d3)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-22 03:42:46 +00:00
Serhiy Storchaka
4b4e0dbdf4
[3.12] gh-126727: Fix locale.nl_langinfo(locale.ERA) (GH-126730) (GH-127098)
It now returns multiple era description segments separated by semicolons.
Previously it only returned the first segment on platforms with Glibc.
(cherry picked from commit 4803cd0244)
2024-11-21 11:44:37 +00:00
Miss Islington (bot)
d997be0510
[3.12] gh-126997: Fix support of non-ASCII strings in pickletools (GH-127062) (GH-127095)
* Fix support of STRING and GLOBAL opcodes with non-ASCII arguments.
* dis() now outputs non-ASCII bytes in STRING, BINSTRING and
  SHORT_BINSTRING arguments as escaped (\xXX).
(cherry picked from commit eaf2171082)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-21 11:32:16 +00:00
Miss Islington (bot)
b33c37aa8c
[3.12] gh-126991: Add tests for unpickling bad object state (GH-127031) (GH-127064)
This catches a memory leak in loading the BUILD opcode.
(cherry picked from commit addb225f38)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-20 15:49:58 +00:00
Miss Islington (bot)
7735f58ea5
[3.12] GH-85168: Use filesystem encoding when converting to/from file URIs (GH-126852) (#127040)
GH-85168: Use filesystem encoding when converting to/from `file` URIs (GH-126852)

Adjust `urllib.request.url2pathname()` and `pathname2url()` to use the
filesystem encoding when quoting and unquoting file URIs, rather than
forcing use of UTF-8.

No changes are needed in the `nturl2path` module because Windows always
uses UTF-8, per PEP 529.
(cherry picked from commit c9b399fbdb)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-19 21:55:10 +00:00
Russell Keith-Magee
1f911ba706
[3.12] gh-126789: Correct sysconfig test exclusions for iOS and Android. (GH-126941) (GH-126959)
(cherry picked from commit 3938fd60c0)
2024-11-19 11:01:54 +01:00
Miss Islington (bot)
9345dc165c
[3.12] gh-126594: Fix typeobject.c wrap_buffer() cast (GH-126754) (#127005)
gh-126594: Fix typeobject.c wrap_buffer() cast (GH-126754)

Reject flags smaller than INT_MIN.

(cherry picked from commit 84f07c3a4c)

Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-11-19 08:33:18 +00:00
Miss Islington (bot)
126acc1bb0
[3.12] gh-126911: Update credits output (GH-126913) (#126974)
Co-authored-by: Stan U <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
2024-11-18 15:58:22 +00:00
Miss Islington (bot)
fd241d64c1
[3.12] gh-126909: Fix running xattr tests on systems with lower limits (GH-126930) (#126964)
gh-126909: Fix running xattr tests on systems with lower limits (GH-126930)

Modify the extended attribute tests to write fewer and smaller extended
attributes, in order to fit within filesystems with total xattr limit
of 1 KiB (e.g. ext4 with 1 KiB blocks).  Previously, the test would
write over 2 KiB, making it fail with ENOSPC on such systems.
(cherry picked from commit 2c0a21c1aa)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
2024-11-18 13:22:58 +00:00
Miss Islington (bot)
06dc4bd073
[3.12] gh-101955: Fix SystemError in possesive quantifier with alternative and group (GH-111362) (GH-126963)
(cherry picked from commit f9c5573ded)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-18 12:03:19 +00:00
Serhiy Storchaka
8eb25faed7
[3.12] gh-67877: Fix memory leaks in terminated RE matching (GH-126840) (GH-126961)
If SRE(match) function terminates abruptly, either because of a signal
or because memory allocation fails, allocated SRE_REPEAT blocks might
be never released.

(cherry picked from commit 7538e7f569)
2024-11-18 11:24:13 +00:00
Miss Islington (bot)
9d986d9477
[3.12] gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919) (#126916)
gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919)

The header-folder of the new email API has a long standing known buglet where
if the first token is longer than max_line_length, it puts that token on the next
line.  It turns out there is also a *parsing* bug when parsing such a header:
the space prefixing that first, non-empty line gets preserved and tacked on to
the start of the header value, which is not the expected behavior per the RFCs.
The bug arises from the fact that the parser assumed that there would be at
least one token on the line with the header, which is going to be true for
probably every email producer other than the python email library with its
folding buglet.  Clearly, though, this is a case that needs to be handled
correctly.  The fix is simple: strip the blanks off the start of the whole
value, not just the first physical line of the value.

(cherry picked from commit ed81971e6b)

Co-authored-by: RanKKI <hliu86.me@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-17 15:12:29 -05:00
Miss Islington (bot)
50e42b9980
[3.12] GH-126789: fix some sysconfig data on late site initializations
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
2024-11-17 00:26:59 +00:00
Miss Islington (bot)
cdc1dff33f
[3.12] gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484) (GH-126878)
gh-126476: Raise IllegalMonthError for calendar.formatmonth() when the input month is not correct (GH-126484)
(cherry picked from commit 3be7498d24)

Co-authored-by: Nadeshiko Manju <me@manjusaka.me>
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
2024-11-15 15:20:10 -08:00
Miss Islington (bot)
d0d892f7a3
[3.12] gh-71936: Fix race condition in multiprocessing.Pool (GH-124973) (GH-126870)
Proxes of shared objects register a Finalizer in BaseProxy._incref(), and it
will call BaseProxy._decref() when it is GCed. This may cause a race condition
with Pool(maxtasksperchild=None) on Windows.

A connection would be closed and raised TypeError when a GC occurs between
_ConnectionBase._check_writable() and _ConnectionBase._send_bytes() in
_ConnectionBase.send() in the second or later task, and a new object
is allocated that shares the id() of a previously deleted one.

Instead of using the id() of the token (or the proxy), use a unique,
non-reusable number.

(cherry picked from commit ba088c8f9c)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Akinori Hattori <hattya@gmail.com>
2024-11-15 14:04:35 +00:00
Tomas R.
ad4f8debda
[3.12] gh-126413: Add translation tests for getopt and optparse (GH-126698) (GH-126756)
(cherry picked from commit dff074d144)
2024-11-15 13:07:16 +02:00
Miss Islington (bot)
04f38bb775
[3.12] GH-126766: url2pathname(): handle empty authority section. (GH-126767) (#126837)
GH-126766: `url2pathname()`: handle empty authority section. (GH-126767)

Discard two leading slashes from the beginning of a `file:` URI if they
introduce an empty authority section. As a result, file URIs like
`///etc/hosts` are correctly parsed as `/etc/hosts`.
(cherry picked from commit cae9d9d20f)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-14 23:52:46 +00:00
Miss Islington (bot)
306db142c2
[3.12] gh-126807: pygettext: Do not attempt to extract messages from function definitions. (GH-126808) (GH-126847)
Fixes a bug where pygettext would attempt
to extract a message from a code like this:

def _(x): pass

This is because pygettext only looks at one
token at a time and '_(x)' looks like a
function call.

However, since 'x' is not a string literal,
it would erroneously issue a warning.
(cherry picked from commit 9a456383be)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
2024-11-14 22:35:35 +00:00
Stéphane Bidoul
87b3318229
[3.12] gh-126188: Update bundled pip to 24.3.1 (gh-126805) (gh-126813)
Update bundled pip to 24.3.1
(cherry picked from commit f6b0361c17)
2024-11-13 23:42:54 +00:00
Miss Islington (bot)
df59b64589
[3.12] GH-126606: don't write incomplete pyc files (GH-126627) (GH-126810)
GH-126606: don't write incomplete pyc files (GH-126627)
(cherry picked from commit c695e37a3f)

Co-authored-by: CF Bolz-Tereick <cfbolz@gmx.de>
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Co-authored-by: Brett Cannon <brett@python.org>
2024-11-13 14:49:47 -08:00
Miss Islington (bot)
0bdcc84ae9
[3.12] gh-126341: add release check to __iter__ method of memoryview (GH-126759) (#126779)
gh-126341: add release check to `__iter__` method of `memoryview` (GH-126759)
(cherry picked from commit a12690ef49)

Co-authored-by: Ritvik Pasham <ritvikpasham@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: sobolevn <mail@sobolevn.me>
2024-11-13 20:44:01 +02:00
Miss Islington (bot)
dd21259283
[3.12] bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (GH-30196) (#126771)
bpo-46128: Strip IsolatedAsyncioTestCase frames from reported stacktraces (GH-30196)

---------

(cherry picked from commit 2e39d77dde)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2024-11-13 09:20:47 +00:00
Miss Islington (bot)
951ed33054
[3.12] gh-104745: Limit starting a patcher more than once without stopping it (GH-126649) (#126773)
gh-104745: Limit starting a patcher more than once without stopping it (GH-126649)

Previously, this would cause an `AttributeError` if the patch stopped more than once after this, and would also disrupt the original patched object.

---------

(cherry picked from commit 1e40c5ba47)

Co-authored-by: Red4Ru <39802734+Red4Ru@users.noreply.github.com>
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-13 08:37:34 +00:00
Miss Islington (bot)
361dda59a3
[3.12] GH-120423: pathname2url(): handle forward slashes in Windows paths (GH-126593) (#126763)
GH-120423: `pathname2url()`: handle forward slashes in Windows paths (GH-126593)

Adjust `urllib.request.pathname2url()` so that forward slashes in Windows
paths are handled identically to backward slashes.
(cherry picked from commit bf224bd7ce)

Co-authored-by: Barney Gale <barney.gale@gmail.com>
2024-11-12 21:53:58 +00:00
Bénédikt Tran
46710ca5f2
[3.12] gh-126595: fix a crash when calling itertools.count(sys.maxsize) (GH-126617) (#126740)
gh-126595: fix a crash when calling `itertools.count(sys.maxsize)` (#126617)
2024-11-12 14:05:23 +00:00
Alex Waygood
86efa2f1fa
[3.12] gh-126451: Revert backports of ABC registrations for contextvars.Context and multiprocessing proxies (#126735) 2024-11-12 12:26:23 +00:00
Miss Islington (bot)
7d091d54c5
[3.12] gh-126505: Fix bugs in compiling case-insensitive character classes (GH-126557) (GH-126690)
* upper-case non-BMP character was ignored
* the ASCII flag was ignored when matching a character range whose
  upper bound is beyond the BMP region
(cherry picked from commit 819830f34a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2024-11-11 16:47:37 +00:00
Miss Islington (bot)
aee80cd5e7
[3.12] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503) (GH-126572)
gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)

If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.
(cherry picked from commit c9cda1608e)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-11 15:26:10 +01:00
Miss Islington (bot)
d62f100fe1
[3.12] gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501) (GH-126573)
gh-126499: test_ssl: Don't assume err.reason is a string (GH-126501)

The skipping machinery called `getattr(err, "reason", "")` on an arbitrary
exception. As intermittent Buildbot failures show, sometimes it's set
to None.

Convert it to string for this specific check.
(cherry picked from commit 78ad7e6322)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2024-11-11 13:56:08 +01:00