Changeset 5715

Show
Ignore:
Timestamp:
08/30/12 13:05:54 (7 years ago)
Author:
mkaplan
Message:

Fix for ticket #982

Location:
seattle/branches/repy_v2/repy
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • seattle/branches/repy_v2/repy/safe.py

    r5700 r5715  
    153153_STR_NOT_BEGIN = ['im_','func_','tb_','f_','co_',] 
    154154 
     155# Disallow these exact strings. 
     156#   encode and decode are not allowed because of the potential for encoding bugs (#982)  
     157_STR_NOT_ALLOWED = ['encode','decode']  
    155158 
    156159def _is_string_safe(token): 
     
    175178  if token in _STR_OK: 
    176179    return True 
     180     
     181  # Check if the string is specifically prohibited: 
     182  if token in _STR_NOT_ALLOWED: 
     183    return False 
    177184 
    178185  # Check all the prohibited sub-strings 
  • seattle/branches/repy_v2/repy/virtual_namespace.py

    r3448 r5715  
    6666    code = code.replace('\r\n','\n') 
    6767 
     68    # Prepend an encoding string to protect against bugs in that code (ticket #982) 
     69    # Note that this will cause tracebacks to have an inaccurate line number. 
     70    code = "# coding: utf-8\n\n" + code  
     71 
    6872    # Do a safety check 
    6973    try: