From 804c213c89366dd5ffa7feeb1bd4feccfee75b38 Mon Sep 17 00:00:00 2001 From: Micah Najacht Date: Mon, 27 Apr 2026 01:27:05 -0500 Subject: [PATCH 1/3] gh-82665 Mention that HTMLParser.handle_starttag value can be None (#134312) * Specify boolean attribute behavior in parser * Tweak wording and example Co-authored-by: Serhiy Storchaka Co-authored-by: Ezio Melotti * Fix backticks --------- Co-authored-by: Ezio Melotti Co-authored-by: Serhiy Storchaka --- Doc/library/html.parser.rst | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Doc/library/html.parser.rst b/Doc/library/html.parser.rst index 341a8337ba2ceb..11f851d4f6c4b7 100644 --- a/Doc/library/html.parser.rst +++ b/Doc/library/html.parser.rst @@ -141,7 +141,7 @@ implementations do nothing (except for :meth:`~HTMLParser.handle_startendtag`): argument is a list of ``(name, value)`` pairs containing the attributes found inside the tag's ``<>`` brackets. The *name* will be translated to lower case, and quotes in the *value* have been removed, and character and entity references - have been replaced. + have been replaced. For empty attributes, *value* is ``None``. For instance, for the tag ````, this method would be called as ``handle_starttag('a', [('href', 'https://www.cwi.nl/')])``. @@ -317,6 +317,18 @@ without further parsing: Data : alert("hello! ☺"); End tag : script +Attribute names are converted to lowercase, quotes from attribute values removed, +and ``None`` is returned as *value* for empty attributes (such as ``checked``): + +.. doctest:: + + >>> parser.feed("") + Start tag: input + attr: ('type', 'checkbox') + attr: ('checked', None) + attr: ('required', '') + attr: ('disabled', 'disabled') + Parsing comments: .. doctest:: From 54a8921140ba98461ca915fb80a043271c275b51 Mon Sep 17 00:00:00 2001 From: Anonymous941 <36797492+Anonymous941@users.noreply.github.com> Date: Mon, 27 Apr 2026 03:21:53 -0400 Subject: [PATCH 2/3] Fix typo in `ceval.c` error message (#148860) Fix the "multiple values for keyword argument" error message used when the function's `__qualname__` cannot be retrieved. --- Python/ceval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/ceval.c b/Python/ceval.c index 506ea591c385c0..0d7f8a62e246ae 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3409,7 +3409,7 @@ _PyEval_FormatKwargsError(PyThreadState *tstate, PyObject *func, PyObject *kwarg _PyErr_Format( tstate, PyExc_TypeError, "%V got multiple values for keyword argument '%S'", - funcstr, "finction", dupkey); + funcstr, "function", dupkey); Py_XDECREF(funcstr); return; } From 62792c8f77222b86f8d2d985fc3a2b9fffc679e8 Mon Sep 17 00:00:00 2001 From: Manoj K M Date: Mon, 27 Apr 2026 12:52:20 +0530 Subject: [PATCH 3/3] gh-148868: Increase test coverage for `cmath.isinf` (#148869) --- Lib/test/test_cmath.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_cmath.py b/Lib/test/test_cmath.py index 389a3fa0e0a1eb..a986fd6b892bd2 100644 --- a/Lib/test/test_cmath.py +++ b/Lib/test/test_cmath.py @@ -516,6 +516,7 @@ def test_isinf(self): self.assertFalse(cmath.isinf(1j)) self.assertFalse(cmath.isinf(NAN)) self.assertTrue(cmath.isinf(INF)) + self.assertTrue(cmath.isinf(-INF)) self.assertTrue(cmath.isinf(complex(INF, 0))) self.assertTrue(cmath.isinf(complex(0, INF))) self.assertTrue(cmath.isinf(complex(INF, INF)))