@@ -153,10 +153,10 @@ As another example, generating HTML attributes from data:
153153.. code-block :: python
154154
155155 attributes = {" src" : " shrubbery.jpg" , " alt" : " looks nice" }
156- template = t" <img {attributes} / >"
157- assert html(template) == ' <img src="shrubbery.jpg" alt="looks nice" class="looks-nice" / >'
156+ template = t" <img {attributes} >"
157+ assert html(template) == ' <img src="shrubbery.jpg" alt="looks nice" class="looks-nice">'
158158
159- Unlike f-strings , the ``html `` function has access to template attributes
159+ Compared to using an f-string , the ``html `` function has access to template attributes
160160containing the original information: static strings, interpolations, and values
161161from the original scope. Unlike existing templating approaches, t-strings build
162162from the well-known f-string syntax and rules. Template systems thus benefit
@@ -443,6 +443,9 @@ Python without deferred evaluation of annotations, reaches its end of life in 20
443443In Python 3.14, the behavior of code using ``from __future__ import annotations ``
444444is unchanged.
445445
446+ .. seealso ::
447+ :pep: `649 `.
448+
446449
447450Improved error messages
448451-----------------------
@@ -584,8 +587,27 @@ Improved error messages
584587 ^^^^^^
585588 SyntaxError: cannot use subscript as import target
586589
587- .. seealso ::
588- :pep: `649 `.
590+ * Improved error message when trying to add an instance of an unhashable type to
591+ a :class: `dict ` or :class: `set `. (Contributed by CF Bolz-Tereick and Victor Stinner
592+ in :gh: `132828 `.)
593+
594+ .. code-block :: pycon
595+
596+ >>> s = set()
597+ >>> s.add({'pages': 12, 'grade': 'A'})
598+ Traceback (most recent call last):
599+ File "<python-input-1>", line 1, in <module>
600+ s.add({'pages': 12, 'grade': 'A'})
601+ ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
602+ TypeError: cannot use 'dict' as a set element (unhashable type: 'dict')
603+ >>> d = {}
604+ >>> l = [1, 2, 3]
605+ >>> d[l] = 12
606+ Traceback (most recent call last):
607+ File "<python-input-4>", line 1, in <module>
608+ d[l] = 12
609+ ~^^^
610+ TypeError: cannot use 'list' as a dict key (unhashable type: 'list')
589611
590612
591613 .. _whatsnew314-pep741 :
0 commit comments