Skip to content

Commit eb73c2b

Browse files
committed
Merge main
2 parents 4dfdd1e + 4ae1a26 commit eb73c2b

5 files changed

Lines changed: 10 additions & 36 deletions

File tree

Doc/tools/removed-ids.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ c-api/allocation.html: deprecated-aliases
55
c-api/file.html: deprecated-api
66

77
library/asyncio-task.html: terminating-a-task-group
8+
library/symtable.html: symtable.Class.get_methods

Doc/whatsnew/3.16.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ module_name
106106
Removed
107107
=======
108108

109+
annotationlib
110+
-------------
111+
112+
* The :meth:`!annotationlib.ForwardRef._evaluate` method
113+
which has been deprecated since Python 3.14.
114+
Use :meth:`annotationlib.ForwardRef.evaluate`
115+
or :func:`typing.evaluate_forward_ref` instead.
116+
109117
symtable
110118
--------
111119

Lib/annotationlib.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -226,29 +226,6 @@ def evaluate(
226226
new_locals.transmogrify(self.__cell__)
227227
return result
228228

229-
def _evaluate(self, globalns, localns, type_params=_sentinel, *, recursive_guard):
230-
import typing
231-
import warnings
232-
233-
if type_params is _sentinel:
234-
typing._deprecation_warning_for_no_type_params_passed(
235-
"typing.ForwardRef._evaluate"
236-
)
237-
type_params = ()
238-
warnings._deprecated(
239-
"ForwardRef._evaluate",
240-
"{name} is a private API and is retained for compatibility, but will be removed"
241-
" in Python 3.16. Use ForwardRef.evaluate() or typing.evaluate_forward_ref() instead.",
242-
remove=(3, 16),
243-
)
244-
return typing.evaluate_forward_ref(
245-
self,
246-
globals=globalns,
247-
locals=localns,
248-
type_params=type_params,
249-
_recursive_guard=recursive_guard,
250-
)
251-
252229
@property
253230
def __forward_arg__(self):
254231
if self.__arg__ is not None:

Lib/typing.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -434,19 +434,6 @@ def _rebuild_generic_alias(alias: GenericAlias, args: tuple[object, ...]) -> Gen
434434
return t
435435

436436

437-
def _deprecation_warning_for_no_type_params_passed(funcname: str) -> None:
438-
import warnings
439-
440-
depr_message = (
441-
f"Failing to pass a value to the 'type_params' parameter "
442-
f"of {funcname!r} is deprecated, as it leads to incorrect behaviour "
443-
f"when calling {funcname} on a stringified annotation "
444-
f"that references a PEP 695 type parameter. "
445-
f"It will be disallowed in Python 3.15."
446-
)
447-
warnings.warn(depr_message, category=DeprecationWarning, stacklevel=3)
448-
449-
450437
def _eval_type(t, globalns, localns, type_params, *, recursive_guard=frozenset(),
451438
format=None, owner=None, parent_fwdref=None, prefer_fwd_module=False):
452439
"""Evaluate all forward references in the given type t.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove ``annotationlib.ForwardRef._evaludate`` deprecated method.

0 commit comments

Comments
 (0)