Skip to content

Commit

Permalink
Bug 1378410 - 2a. Expose set to moz.build sandbox; r=gps
Browse files Browse the repository at this point in the history
To construct an empty set, we need to use the `set()` notation. In order
to do that, we need to expose `set` to the moz.build sandbox.

MozReview-Commit-ID: DMyKnF0FEx2

--HG--
extra : rebase_source : 5cfe8080ec333a1eca70cd3edba2aaaff6406820
  • Loading branch information
Jim Chen committed Sep 1, 2017
1 parent f0ca31b commit c3c2bfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build/docs/mozbuild-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ The following properties make execution of ``moz.build`` files special:
files.

The limited subset of Python is actually an extremely limited subset.
Only a few symbols from ``__builtins__`` are exposed. These include
``True``, ``False``, and ``None``. Global functions like ``import``,
``print``, and ``open`` aren't available. Without these, ``moz.build``
files can do very little. *This is by design*.
Only a few symbols from ``__builtin__`` are exposed. These include
``True``, ``False``, ``None``, ``sorted``, ``int``, and ``set``. Global
functions like ``import``, ``print``, and ``open`` aren't available.
Without these, ``moz.build`` files can do very little. *This is by design*.

The execution sandbox treats all ``UPPERCASE`` variables specially. Any
``UPPERCASE`` variable must be known to the sandbox before the script
Expand Down
1 change: 1 addition & 0 deletions python/mozbuild/mozbuild/frontend/sandbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class Sandbox(dict):
'True': True,
'sorted': alphabetical_sorted,
'int': int,
'set': set,
})

def __init__(self, context, builtins=None, finder=default_finder):
Expand Down

0 comments on commit c3c2bfc

Please sign in to comment.