Skip to content

Commit 034d797

Browse files
committed
Request stringified annotations
1 parent 199cd54 commit 034d797

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/attr/_compat.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@
1717
PY_3_14_PLUS = sys.version_info[:2] >= (3, 14)
1818

1919

20-
if PY_3_14_PLUS: # pragma: no cover
20+
if PY_3_14_PLUS:
2121
import annotationlib
2222

23-
_get_annotations = annotationlib.get_annotations
23+
# We request stringified annotations to not break in the presence of
24+
# forward references.
25+
26+
def _get_annotations(cls):
27+
return annotationlib.get_annotations(
28+
cls, format=annotationlib.Format.STRING
29+
)
2430

2531
else:
2632

0 commit comments

Comments
 (0)