@@ -761,6 +761,14 @@ Other language changes
761761  ASCII :class: `bytes ` and :term: `bytes-like objects <bytes-like object> `.
762762  (Contributed by Daniel Pope in :gh: `129349 `.)
763763
764+ * :func: `str `, :func: `repr ` and :func: `ascii ` now always return an instance
765+   of :class: `str `, even if the special methods ``__str__() `` or ``__repr__() ``
766+   return an instance of a subclass of :class: `!str `.
767+   :func: `bytes ` now always returns an instance of :class: `bytes `, even
768+   if the special method ``__bytes__() `` returns an instance of a subclass of
769+   :class: `!bytes `.
770+   (Contributed by Serhiy Storchaka in :gh: `104231 `.)
771+ 
764772* Support ``\z `` as a synonym for ``\Z `` in :mod: `regular expressions <re> `.
765773  It is interpreted unambiguously in many other regular expression engines,
766774  unlike ``\Z ``, which has subtly different behavior.
@@ -2442,6 +2450,15 @@ Limited C API changes
24422450  C API. Keep :c:func: `PySequence_Fast ` in the limited C API.
24432451  (Contributed by Victor Stinner in :gh: `91417 `.)
24442452
2453+ * :c:func: `PyObject_Str `, :c:func: `PyObject_Repr ` and :c:func: `PyObject_ASCII `
2454+   now always return an instance of :class: `str `, even if the special methods
2455+   ``__str__() `` or ``__repr__() `` return an instance of a subclass of
2456+   :class: `!str `.
2457+   :c:func: `PyObject_Bytes ` now always returns an instance of :class: `bytes `,
2458+   even if the special method ``__bytes__() `` returns an instance of a subclass
2459+   of :class: `!bytes `.
2460+   (Contributed by Serhiy Storchaka in :gh: `104231 `.)
2461+ 
24452462
24462463Porting to Python 3.14
24472464---------------------- 
0 commit comments