Skip to content

Commit 1307572

Browse files
Merge branch 'main' into base64-excess-data
2 parents 0229b06 + 4401f23 commit 1307572

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

Doc/c-api/dict.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ Dictionary objects
8282
8383
Return a new dictionary that contains the same key-value pairs as *p*.
8484
85+
.. versionchanged:: next
86+
If *p* is a subclass of :class:`frozendict`, the result will be a
87+
:class:`frozendict` instance instead of a :class:`dict` instance.
8588
8689
.. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val)
8790

Doc/library/stdtypes.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2504,6 +2504,19 @@ expression support in the :mod:`re` module).
25042504
done using the specified *fillchar* (default is an ASCII space). The
25052505
original string is returned if *width* is less than or equal to ``len(s)``.
25062506

2507+
For example:
2508+
2509+
.. doctest::
2510+
2511+
>>> 'Python'.rjust(10)
2512+
' Python'
2513+
>>> 'Python'.rjust(10, '.')
2514+
'....Python'
2515+
>>> 'Monty Python'.rjust(10, '.')
2516+
'Monty Python'
2517+
2518+
See also :meth:`ljust` and :meth:`zfill`.
2519+
25072520

25082521
.. method:: str.rpartition(sep, /)
25092522

@@ -2828,13 +2841,17 @@ expression support in the :mod:`re` module).
28282841
than before. The original string is returned if *width* is less than
28292842
or equal to ``len(s)``.
28302843

2831-
For example::
2844+
For example:
2845+
2846+
.. doctest::
28322847

28332848
>>> "42".zfill(5)
28342849
'00042'
28352850
>>> "-42".zfill(5)
28362851
'-0042'
28372852

2853+
See also :meth:`rjust`.
2854+
28382855

28392856
.. index::
28402857
single: ! formatted string literal

Doc/library/typing.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,8 +3353,8 @@ Introspection helpers
33533353

33543354
.. function:: get_type_hints(obj, globalns=None, localns=None, include_extras=False)
33553355

3356-
Return a dictionary containing type hints for a function, method, module
3357-
or class object.
3356+
Return a dictionary containing type hints for a function, method, module,
3357+
class object, or other callable object.
33583358

33593359
This is often the same as ``obj.__annotations__``, but this function makes
33603360
the following changes to the annotations dictionary:
@@ -3395,6 +3395,13 @@ Introspection helpers
33953395
:ref:`type aliases <type-aliases>` that include forward references,
33963396
or with names imported under :data:`if TYPE_CHECKING <TYPE_CHECKING>`.
33973397

3398+
.. note::
3399+
3400+
Calling :func:`get_type_hints` on an instance is not supported.
3401+
To retrieve annotations for an instance, call
3402+
:func:`get_type_hints` on the instance's class instead
3403+
(for example, ``get_type_hints(type(obj))``).
3404+
33983405
.. versionchanged:: 3.9
33993406
Added ``include_extras`` parameter as part of :pep:`593`.
34003407
See the documentation on :data:`Annotated` for more information.
@@ -3404,6 +3411,11 @@ Introspection helpers
34043411
if a default value equal to ``None`` was set.
34053412
Now the annotation is returned unchanged.
34063413

3414+
.. versionchanged:: 3.14
3415+
Calling :func:`get_type_hints` on instances is no longer supported.
3416+
Some instances were accepted in earlier versions as an undocumented
3417+
implementation detail.
3418+
34073419
.. function:: get_origin(tp)
34083420

34093421
Get the unsubscripted version of a type: for a typing object of the form

0 commit comments

Comments
 (0)