Skip to content

Commit

Permalink
Leave first param pos-only
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed May 2, 2024
1 parent bd47bf3 commit 6172dbf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ are always available. They are listed here in alphabetical order.

.. _func-eval:

.. function:: eval(source, globals=None, locals=None)
.. function:: eval(source, /, globals=None, locals=None)

:param source:
A Python expression.
Expand Down Expand Up @@ -585,11 +585,11 @@ are always available. They are listed here in alphabetical order.

.. versionchanged:: 3.13

:func:`!eval` now accepts keyword arguments.
The *globals* and *locals* arguments can now be passed as keywords.

.. index:: pair: built-in function; exec

.. function:: exec(source, globals=None, locals=None, *, closure=None)
.. function:: exec(source, /, globals=None, locals=None, *, closure=None)

This function supports dynamic execution of Python code. *source* must be
either a string or a code object. If it is a string, the string is parsed as
Expand Down Expand Up @@ -646,7 +646,7 @@ are always available. They are listed here in alphabetical order.

.. versionchanged:: 3.13

:func:`!exec` now accepts keyword arguments.
The *globals* and *locals* arguments can now be passed as keywords.


.. function:: filter(function, iterable)
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Allow keyword arguments to be used when calling :meth:`~eval` and :meth:`~exec`.
Allow the *globals* and *locals* arguments to :func:`exec`
and :func:`eval` to be passed as keywords.
6 changes: 4 additions & 2 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ builtin_divmod_impl(PyObject *module, PyObject *x, PyObject *y)
eval as builtin_eval
source: object
/
globals: object = None
locals: object = None
Expand All @@ -940,7 +941,7 @@ If only globals is given, locals defaults to it.
static PyObject *
builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals,
PyObject *locals)
/*[clinic end generated code: output=0a0824aa70093116 input=4cbfb23dd7cbe2a9]*/
/*[clinic end generated code: output=0a0824aa70093116 input=7c7bce5299a89062]*/
{
PyObject *result = NULL, *source_copy;
const char *str;
Expand Down Expand Up @@ -1023,6 +1024,7 @@ builtin_eval_impl(PyObject *module, PyObject *source, PyObject *globals,
exec as builtin_exec
source: object
/
globals: object = None
locals: object = None
*
Expand All @@ -1042,7 +1044,7 @@ when source is a code object requiring exactly that many cellvars.
static PyObject *
builtin_exec_impl(PyObject *module, PyObject *source, PyObject *globals,
PyObject *locals, PyObject *closure)
/*[clinic end generated code: output=7579eb4e7646743d input=99951d1832fece9e]*/
/*[clinic end generated code: output=7579eb4e7646743d input=25e989b6d87a3a21]*/
{
PyObject *v;

Expand Down
18 changes: 9 additions & 9 deletions Python/clinic/bltinmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6172dbf

Please sign in to comment.