Skip to content

Commit

Permalink
source code documentation with questions and todos
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Feb 1, 2017
1 parent 9bdf7dc commit 3b72dea
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/RestrictedPython/compile.py
Expand Up @@ -18,6 +18,11 @@ def _compile_restricted_mode(
# Unrestricted Source Checks
byte_code = compile(source, filename, mode=mode, flags=flags,
dont_inherit=dont_inherit)
# TODO: Should be an elif check if policy is subclass of
# RestrictionNodeTransformer any other object passed in as policy might
# throw an error or is a NodeVisitor subclass that could be initialized with
# three params.
# elif issubclass(policy, RestrictingNodeTransformer):
else:
c_ast = None
try:
Expand All @@ -44,6 +49,7 @@ def _compile_restricted_mode(
except TypeError as v:
byte_code = None
errors.append(v)
# TODO: returning a named tuple should be considered
return byte_code, tuple(errors), warnings, used_names


Expand Down Expand Up @@ -146,4 +152,5 @@ def compile_restricted(
raise TypeError('unknown mode %s', mode)
if errors:
raise SyntaxError(errors)
# TODO: logging of warnings should be discussed and considered.
return byte_code

0 comments on commit 3b72dea

Please sign in to comment.