Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Doc/whatsnew/3.16.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ module_name
Removed
=======

annotationlib
-------------

* The :meth:`!annotationlib.ForwardRef._evaluate` method
which has been deprecated since Python 3.14.
Use :meth:`annotationlib.ForwardRef.evaluate`
or :func:`typing.evaluate_forward_ref` instead.

sysconfig
---------

Expand Down
23 changes: 0 additions & 23 deletions Lib/annotationlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,29 +226,6 @@ def evaluate(
new_locals.transmogrify(self.__cell__)
return result

def _evaluate(self, globalns, localns, type_params=_sentinel, *, recursive_guard):
import typing
import warnings

if type_params is _sentinel:
typing._deprecation_warning_for_no_type_params_passed(
"typing.ForwardRef._evaluate"
)
type_params = ()
warnings._deprecated(
"ForwardRef._evaluate",
"{name} is a private API and is retained for compatibility, but will be removed"
" in Python 3.16. Use ForwardRef.evaluate() or typing.evaluate_forward_ref() instead.",
remove=(3, 16),
)
return typing.evaluate_forward_ref(
self,
globals=globalns,
locals=localns,
type_params=type_params,
_recursive_guard=recursive_guard,
)

@property
def __forward_arg__(self):
if self.__arg__ is not None:
Expand Down
13 changes: 0 additions & 13 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,6 @@ def _rebuild_generic_alias(alias: GenericAlias, args: tuple[object, ...]) -> Gen
return t


def _deprecation_warning_for_no_type_params_passed(funcname: str) -> None:
import warnings

depr_message = (
f"Failing to pass a value to the 'type_params' parameter "
f"of {funcname!r} is deprecated, as it leads to incorrect behaviour "
f"when calling {funcname} on a stringified annotation "
f"that references a PEP 695 type parameter. "
f"It will be disallowed in Python 3.15."
)
warnings.warn(depr_message, category=DeprecationWarning, stacklevel=3)


def _eval_type(t, globalns, localns, type_params, *, recursive_guard=frozenset(),
format=None, owner=None, parent_fwdref=None, prefer_fwd_module=False):
"""Evaluate all forward references in the given type t.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove ``annotationlib.ForwardRef._evaludate`` deprecated method.
Loading