Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5997f18
Convert _interpreters.create()
AA-Turner Aug 11, 2025
4b159b3
Convert _interpreters.destroy()
AA-Turner Aug 11, 2025
eda5fa0
Convert _interpreters.list_all()
AA-Turner Aug 11, 2025
699dc6d
Convert _interpreters.get_current()
AA-Turner Aug 11, 2025
c313b80
Convert _interpreters.get_main()
AA-Turner Aug 11, 2025
abe7aaa
Convert _interpreters.set___main___attrs()
AA-Turner Aug 11, 2025
6903b3f
Convert _interpreters.exec()
AA-Turner Aug 11, 2025
d0b2e8d
Convert _interpreters.run_string()
AA-Turner Aug 11, 2025
91d15b5
Convert _interpreters.run_func()
AA-Turner Aug 11, 2025
98a75b2
Convert _interpreters.call()
AA-Turner Aug 11, 2025
6d863cb
Convert _interpreters.is_shareable()
AA-Turner Aug 11, 2025
84217c8
Convert _interpreters.is_running()
AA-Turner Aug 11, 2025
bfed2bf
Convert _interpreters.get_config()
AA-Turner Aug 11, 2025
599bde4
Convert _interpreters.whence()
AA-Turner Aug 11, 2025
20c67ee
Convert _interpreters.incref()
AA-Turner Aug 11, 2025
b7a49d3
Convert _interpreters.decref()
AA-Turner Aug 11, 2025
d07daae
Convert _interpreters.capture_exception()
AA-Turner Aug 11, 2025
9e5577e
Add note on new_config()
AA-Turner Aug 11, 2025
eb21bb1
Indicate positional-only parameters
AA-Turner Aug 11, 2025
6e26591
Update docstrings
AA-Turner Aug 11, 2025
08dce29
Update tests
AA-Turner Aug 11, 2025
af65824
Blurb
AA-Turner Aug 11, 2025
435389f
make regen-all
AA-Turner Aug 11, 2025
be2fe07
Fix new_config_doc
AA-Turner Aug 11, 2025
073e2ff
Undo docstring changes
AA-Turner Aug 11, 2025
1cdf313
Revert "Indicate positional-only parameters"
AA-Turner Aug 11, 2025
e8f0b6c
Serhiy's review
AA-Turner Aug 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Convert _interpreters.set___main___attrs()
  • Loading branch information
AA-Turner committed Aug 11, 2025
commit abe7aaaa04ae26409fec48ff4175b6f3a8b2c709
32 changes: 14 additions & 18 deletions Modules/_interpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,19 +1028,21 @@ _interpreters_get_main_impl(PyObject *module)
}


/*[clinic input]
_interpreters.set___main___attrs
id: object
updates: object(subclass_of='&PyDict_Type')
*
restrict as restricted: bool = False

Bind the given attributes in the interpreter's __main__ module.
[clinic start generated code]*/

static PyObject *
interp_set___main___attrs(PyObject *self, PyObject *args, PyObject *kwargs)
_interpreters_set___main___attrs_impl(PyObject *module, PyObject *id,
PyObject *updates, int restricted)
/*[clinic end generated code: output=f3803010cb452bf0 input=d16ab8d81371f86a]*/
{
static char *kwlist[] = {"id", "updates", "restrict", NULL};
PyObject *id, *updates;
int restricted = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
"OO!|$p:" MODULE_NAME_STR ".set___main___attrs",
kwlist, &id, &PyDict_Type, &updates, &restricted))
{
return NULL;
}

// Look up the interpreter.
int reqready = 1;
PyInterpreterState *interp = \
Expand Down Expand Up @@ -1087,11 +1089,6 @@ interp_set___main___attrs(PyObject *self, PyObject *args, PyObject *kwargs)
Py_RETURN_NONE;
}

PyDoc_STRVAR(set___main___attrs_doc,
"set___main___attrs(id, ns, *, restrict=False)\n\
\n\
Bind the given attributes in the interpreter's __main__ module.");


static PyObject *
_handle_script_error(struct run_result *runres)
Expand Down Expand Up @@ -1622,8 +1619,7 @@ static PyMethodDef module_functions[] = {
{"run_func", _PyCFunction_CAST(interp_run_func),
METH_VARARGS | METH_KEYWORDS, run_func_doc},

{"set___main___attrs", _PyCFunction_CAST(interp_set___main___attrs),
METH_VARARGS | METH_KEYWORDS, set___main___attrs_doc},
_INTERPRETERS_SET___MAIN___ATTRS_METHODDEF

{"incref", _PyCFunction_CAST(interp_incref),
METH_VARARGS | METH_KEYWORDS, NULL},
Expand Down
77 changes: 76 additions & 1 deletion Modules/clinic/_interpretersmodule.c.h

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