@@ -3347,8 +3347,8 @@ Introspection helpers
33473347
33483348.. function :: get_type_hints(obj, globalns=None, localns=None, include_extras=False)
33493349
3350- Return a dictionary containing type hints for a function, method, module
3351- or class object.
3350+ Return a dictionary containing type hints for a function, method, module,
3351+ class object, or other callable object.
33523352
33533353 This is often the same as ``obj.__annotations__ ``, but this function makes
33543354 the following changes to the annotations dictionary:
@@ -3389,6 +3389,13 @@ Introspection helpers
33893389 :ref: `type aliases <type-aliases >` that include forward references,
33903390 or with names imported under :data: `if TYPE_CHECKING <TYPE_CHECKING> `.
33913391
3392+ .. note ::
3393+
3394+ Calling :func: `get_type_hints ` on an instance is not supported.
3395+ To retrieve annotations for an instance, call
3396+ :func: `get_type_hints ` on the instance's class instead
3397+ (for example, ``get_type_hints(type(obj)) ``).
3398+
33923399 .. versionchanged :: 3.9
33933400 Added ``include_extras `` parameter as part of :pep: `593 `.
33943401 See the documentation on :data: `Annotated ` for more information.
@@ -3398,6 +3405,11 @@ Introspection helpers
33983405 if a default value equal to ``None `` was set.
33993406 Now the annotation is returned unchanged.
34003407
3408+ .. versionchanged :: 3.14
3409+ Calling :func: `get_type_hints ` on instances is no longer supported.
3410+ Some instances were accepted in earlier versions as an undocumented
3411+ implementation detail.
3412+
34013413.. function :: get_origin(tp)
34023414
34033415 Get the unsubscripted version of a type: for a typing object of the form
0 commit comments