Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Resolve several TODOs.
  • Loading branch information
ericsnowcurrently committed May 23, 2017
commit 9669ca75456b2dd07192075181ee29ea3d507017
6 changes: 3 additions & 3 deletions Doc/library/_interpreters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ It defines the following functions:
threads do. If the code results in an exception then that exception
is raised in the thread in which run_string() was called, similar to
how :func:`exec` works. This aligns with how interpreters are not
inherently threaded.

.. XXX sys.exit() (and SystemExit) is swallowed?
inherently threaded. Note that SystemExit (as raised by sys.exit())
is not treated any differently and will result in the process ending
if not caught explicitly.


.. function:: run_string_unrestricted(id, command, ns=None)
Expand Down
12 changes: 3 additions & 9 deletions Modules/_interpretersmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ _look_up(PyObject *requested_id)
long long id = PyLong_AsLongLong(requested_id);
if (id == -1 && PyErr_Occurred() != NULL)
return NULL;
// XXX Fail if larger than INT64_MAX?
assert(id <= INT64_MAX);
return _look_up_int64(id);
}

Expand Down Expand Up @@ -100,7 +100,6 @@ _run_string(PyInterpreterState *interp, const char *codestr, PyObject *updates)
PyThreadState *save_tstate = PyThreadState_Swap(tstate);

// Run the string (see PyRun_SimpleStringFlags).
// XXX How to handle sys.exit()?
PyObject *exc = NULL, *value = NULL, *tb = NULL;
PyObject *ns = NULL;
// XXX Force a fresh __main__ module?
Expand Down Expand Up @@ -141,8 +140,6 @@ _run_string(PyInterpreterState *interp, const char *codestr, PyObject *updates)

/* module level code ********************************************************/

// XXX track count?

static PyObject *
interp_create(PyObject *self, PyObject *args)
{
Expand Down Expand Up @@ -205,10 +202,9 @@ interp_destroy(PyObject *self, PyObject *args)
// Destroy the interpreter.
//PyInterpreterState_Delete(interp);
PyThreadState *tstate, *save_tstate;
tstate = PyInterpreterState_ThreadHead(interp); // XXX Is this the right one?
tstate = PyInterpreterState_ThreadHead(interp);
save_tstate = PyThreadState_Swap(tstate);
// XXX Stop current execution?
Py_EndInterpreter(tstate); // XXX Handle possible errors?
Py_EndInterpreter(tstate);
PyThreadState_Swap(save_tstate);

Py_RETURN_NONE;
Expand All @@ -229,8 +225,6 @@ interp_enumerate(PyObject *self)
PyObject *ids, *id;
PyInterpreterState *interp;

// XXX Handle multiple main interpreters.

ids = PyList_New(0);
if (ids == NULL)
return NULL;
Expand Down