Skip to content

eval() documentation is wrong about keyword arguments #100546

Closed
@wjandrea

Description

@wjandrea

Documentation

The docs for eval() say it takes keyword arguments, which is incorrect:

eval(expression, /, globals=None, locals=None)

For example:

>>> eval('a', locals={'a': 0})
  ...
TypeError: eval() takes no keyword arguments

Meanwhile, help(eval) has the correct signature:

eval(source, globals=None, locals=None, /)

I found a previous, similar issue, #69996, which was resolved in #15173 (which shipped in 3.7) but then the syntax was changed in #96579 and the same sort of mistake was added back (which shipped in 3.11).

This issue is also similar:

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions