Skip to content

Commit 54fd9f8

Browse files
committed
add comment
1 parent 9fb7488 commit 54fd9f8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Lib/annotationlib.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,9 @@ def _get_dunder_annotations(obj):
10501050
10511051
Does not return a fresh dictionary.
10521052
"""
1053+
# This special case is needed to support types defined under
1054+
# from __future__ import annotations, where accessing the __annotations__
1055+
# attribute directly might return annotations for the wrong class.
10531056
if isinstance(obj, type):
10541057
try:
10551058
ann = _BASE_GET_ANNOTATIONS(obj)

0 commit comments

Comments
 (0)