Skip to content

Commit

Permalink
* pdb.py: set 'privileged' property when evaluating expressions
Browse files Browse the repository at this point in the history
* string.py: change whitespace to include \r, \v and \f.
  When importing strop succeeds, re-evaluate meaning of letters.
  • Loading branch information
gvanrossum committed Jul 29, 1993
1 parent 1fc238a commit 8e2ec56
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Lib/pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def default(self, line):
if line[:1] == '!': line = line[1:]
locals = self.curframe.f_locals
globals = self.curframe.f_globals
globals['__privileged__'] = 1
try:
exec(line + '\n', globals, locals)
except:
Expand Down Expand Up @@ -175,12 +176,14 @@ def do_retval(self, arg):
do_rv = do_retval

def do_p(self, arg):
self.curframe.f_globals['__privileged__'] = 1
try:
value = eval(arg, self.curframe.f_globals, \
self.curframe.f_locals)
except:
print '***', sys.exc_type + ':', `sys.exc_value`
return

print `value`

def do_list(self, arg):
Expand Down
5 changes: 4 additions & 1 deletion Lib/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# functions imported from built-in module "strop".

# Some strings for ctype-style character classification
whitespace = ' \t\n'
whitespace = ' \t\n\r\v\f'
lowercase = 'abcdefghijklmnopqrstuvwxyz'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
letters = lowercase + uppercase
Expand Down Expand Up @@ -181,10 +181,13 @@ def expandtabs(s, tabsize):

# Try importing optional built-in module "strop" -- if it exists,
# it redefines some string operations that are 100-1000 times faster.
# It also defines values for whitespace, lowercase and uppercase
# that match <ctype.h>'s definitions.
# The manipulation with index_error is needed for compatibility.

try:
from strop import *
letters = lowercase + uppercase
from strop import index
index_error = ValueError
except ImportError:
Expand Down
5 changes: 4 additions & 1 deletion Lib/stringold.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# functions imported from built-in module "strop".

# Some strings for ctype-style character classification
whitespace = ' \t\n'
whitespace = ' \t\n\r\v\f'
lowercase = 'abcdefghijklmnopqrstuvwxyz'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
letters = lowercase + uppercase
Expand Down Expand Up @@ -181,10 +181,13 @@ def expandtabs(s, tabsize):

# Try importing optional built-in module "strop" -- if it exists,
# it redefines some string operations that are 100-1000 times faster.
# It also defines values for whitespace, lowercase and uppercase
# that match <ctype.h>'s definitions.
# The manipulation with index_error is needed for compatibility.

try:
from strop import *
letters = lowercase + uppercase
from strop import index
index_error = ValueError
except ImportError:
Expand Down

0 comments on commit 8e2ec56

Please sign in to comment.