gh-131885: Update location of positional-only parameter indicator for eval and exec in the documentation#139978
Closed
gapplef wants to merge 1 commit intopython:mainfrom
Closed
gh-131885: Update location of positional-only parameter indicator for eval and exec in the documentation#139978gapplef wants to merge 1 commit intopython:mainfrom
eval and exec in the documentation#139978gapplef wants to merge 1 commit intopython:mainfrom
Conversation
… `exec` Fix incorrect location of positional-only parameter indicator for `eval` and `exec`
eval and exec in the documentationeval and exec in the documentation
5 tasks
Member
There was a problem hiding this comment.
This is wrong since 2770d5c (see versionchanged notes).
For example, globals can be passed as a positional argument:
>>> eval("x + 1", {'x': 1})
2
Member
|
Closing since the current implementation accepts keyword-arguments. |
Author
|
@picnixz May I ask which version you've tested? >>> import sys
>>> sys.version
'3.12.11 | packaged by conda-forge | (main, Jun 4 2025, 14:45:31) [GCC 13.3.0]'
>>> eval( "x + 1", globals={'x': 1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: eval() takes no keyword arguments
>>> exec( "x + 1", globals={'x': 1})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'globals' is an invalid keyword argument for exec() |
Member
|
Python 3.13 and later. We don't update 3.12 anymore (except for security fixes). |
Author
|
OK, Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix incorrect location of positional-only parameter indicator for
evalandexecin the documentation📚 Documentation preview 📚: https://cpython-previews--139978.org.readthedocs.build/
*and/as needed #131885