Skip to content

gh-119180: Fix annotationlib.ForwardRef.evaluate with no globals#124326

Merged
JelleZijlstra merged 3 commits intopython:mainfrom
JelleZijlstra:optstring
Sep 23, 2024
Merged

gh-119180: Fix annotationlib.ForwardRef.evaluate with no globals#124326
JelleZijlstra merged 3 commits intopython:mainfrom
JelleZijlstra:optstring

Conversation

@JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented Sep 23, 2024

We were sometimes passing None as the globals argument to eval(), which makes it
inherit the globals from the calling scope. Instead, ensure that globals is always
non-None. The test was passing accidentally because I passed "annotationlib" as a
module object; fix that. Also document the parameters to ForwardRef() and remove
two unused private ones.

…onlib module scope

We were sometimes passing None as the globals argument to eval(), which makes it
inherit the globals from the calling scope. Instead, ensure that globals is always
non-None. The test was passing accidentally because I passed "annotationlib" as a
module object; fix that. Also document the parameters to ForwardRef() and remove
two unused private ones.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
@JelleZijlstra JelleZijlstra enabled auto-merge (squash) September 23, 2024 18:21
@JelleZijlstra JelleZijlstra merged commit 2e0d445 into python:main Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants