[Checkins] SVN: RestrictedPython/branches/davisagli-python27/ do a name check for names assigned during 'from' imports

David Glick davidglick at onenw.org
Thu Jul 8 13:20:14 EDT 2010


Log message for revision 114344:
  do a name check for names assigned during 'from' imports

Changed:
  U   RestrictedPython/branches/davisagli-python27/CHANGES.txt
  U   RestrictedPython/branches/davisagli-python27/src/RestrictedPython/RestrictionMutator.py
  U   RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax.py
  U   RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax26.py

-=-
Modified: RestrictedPython/branches/davisagli-python27/CHANGES.txt
===================================================================
--- RestrictedPython/branches/davisagli-python27/CHANGES.txt	2010-07-08 16:51:02 UTC (rev 114343)
+++ RestrictedPython/branches/davisagli-python27/CHANGES.txt	2010-07-08 17:20:14 UTC (rev 114344)
@@ -4,6 +4,9 @@
 3.6.0 (unreleased)
 ------------------
 
+- Added name check for names assigned during imports using the
+  "from x import y" format.
+
 - Added test for name check when assigning an alias using multiple-context with
   statements in Python 2.7.
 

Modified: RestrictedPython/branches/davisagli-python27/src/RestrictedPython/RestrictionMutator.py
===================================================================
--- RestrictedPython/branches/davisagli-python27/src/RestrictedPython/RestrictionMutator.py	2010-07-08 16:51:02 UTC (rev 114343)
+++ RestrictedPython/branches/davisagli-python27/src/RestrictedPython/RestrictionMutator.py	2010-07-08 17:20:14 UTC (rev 114344)
@@ -400,3 +400,5 @@
             if asname:
                 self.checkName(node, asname)
         return node
+
+    visitFrom = visitImport

Modified: RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax.py
===================================================================
--- RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax.py	2010-07-08 16:51:02 UTC (rev 114343)
+++ RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax.py	2010-07-08 17:20:14 UTC (rev 114344)
@@ -41,6 +41,9 @@
 def import_as_bad_name():
     import os as _leading_underscore
 
+def from_import_as_bad_name():
+    from x import y as _leading_underscore
+
 def except_using_bad_name():
     try:
         foo

Modified: RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax26.py
===================================================================
--- RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax26.py	2010-07-08 16:51:02 UTC (rev 114343)
+++ RestrictedPython/branches/davisagli-python27/src/RestrictedPython/tests/security_in_syntax26.py	2010-07-08 17:20:14 UTC (rev 114344)
@@ -5,3 +5,6 @@
 def with_as_bad_name():
     with x as _leading_underscore:
         pass
+
+def relative_import_as_bad_name():
+    from .x import y as _leading_underscore



More information about the checkins mailing list