mirror of
https://github.com/pybind/pybind11.git
synced 2026-03-14 20:27:47 +00:00
Add __builtins__ to globals argument of py::exec and py::eval if not present (#2616)
* Add __builtins__ to globals argument of `py::exec` and `py::eval` if not present * Refactor into inline ensure_builtins_in_globals function
This commit is contained in:
@@ -25,3 +25,11 @@ def test_eval_file():
|
||||
assert m.test_eval_file(filename)
|
||||
|
||||
assert m.test_eval_file_failure()
|
||||
|
||||
|
||||
def test_eval_empty_globals():
|
||||
assert "__builtins__" in m.eval_empty_globals(None)
|
||||
|
||||
g = {}
|
||||
assert "__builtins__" in m.eval_empty_globals(g)
|
||||
assert "__builtins__" in g
|
||||
|
||||
Reference in New Issue
Block a user