]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
* pdb.py: set 'privileged' property when evaluating expressions
authorGuido van Rossum <guido@python.org>
Thu, 29 Jul 1993 09:37:38 +0000 (09:37 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 29 Jul 1993 09:37:38 +0000 (09:37 +0000)
* string.py: change whitespace to include \r, \v and \f.
  When importing strop succeeds, re-evaluate meaning of letters.

Lib/pdb.py
Lib/string.py
Lib/stringold.py

index c5d3e1c2a3319a5bd1806e00cd6d538ccc5bfe95..06f5cf8c7b566ca3461b9234cc8673e8dd180bf4 100755 (executable)
@@ -66,6 +66,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
                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:
@@ -175,12 +176,14 @@ class Pdb(bdb.Bdb, cmd.Cmd):
        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):
index 8c7d102b46409befa8dbade500889571c48d9aab..ccc10431e4cc0d8d31bb3895badd5c564f871ec9 100644 (file)
@@ -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
@@ -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:
index 8c7d102b46409befa8dbade500889571c48d9aab..ccc10431e4cc0d8d31bb3895badd5c564f871ec9 100644 (file)
@@ -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
@@ -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: