Skip to content

Conversation

gapplef
Copy link

@gapplef gapplef commented Oct 12, 2025

Fix incorrect location of positional-only parameter indicator for eval and exec in the documentation


📚 Documentation preview 📚: https://cpython-previews--139978.org.readthedocs.build/

… `exec`

Fix incorrect location of positional-only parameter indicator for `eval` and `exec`
@bedevere-app bedevere-app bot added docs Documentation in the Doc dir skip news labels Oct 12, 2025
@python-cla-bot
Copy link

python-cla-bot bot commented Oct 12, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Oct 12, 2025
@StanFromIreland StanFromIreland changed the title Update location of positional-only parameter indicator for eval and exec in the documentation gh-131885: Update location of positional-only parameter indicator for eval and exec in the documentation Oct 12, 2025
Copy link
Member

@StanFromIreland StanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong since 2770d5c (see versionchanged notes).

For example, globals can be passed as a positional argument:

>>> eval("x + 1", {'x': 1})
2

@StanFromIreland StanFromIreland added the pending The issue will be closed if no feedback is provided label Oct 12, 2025
@picnixz
Copy link
Member

picnixz commented Oct 12, 2025

Closing since the current implementation accepts keyword-arguments.

@picnixz picnixz closed this Oct 12, 2025
@gapplef
Copy link
Author

gapplef commented Oct 12, 2025

@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()

@picnixz
Copy link
Member

picnixz commented Oct 12, 2025

Python 3.13 and later. We don't update 3.12 anymore (except for security fixes).

@gapplef
Copy link
Author

gapplef commented Oct 12, 2025

OK, Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir pending The issue will be closed if no feedback is provided skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants