summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-07-29 09:37:38 (GMT)
committerGuido van Rossum <guido@python.org>1993-07-29 09:37:38 (GMT)
commit8e2ec56cbc74578a1e700dc237368e26bde07427 (patch)
tree3b42cd2506c5b3d88b846c77d024159a4a945f00 /Lib
parent1fc238a813c0c3f5210cd39cf5c70d5f9b70fabe (diff)
downloadcpython-8e2ec56cbc74578a1e700dc237368e26bde07427.zip
cpython-8e2ec56cbc74578a1e700dc237368e26bde07427.tar.gz
cpython-8e2ec56cbc74578a1e700dc237368e26bde07427.tar.bz2
* pdb.py: set 'privileged' property when evaluating expressions
* string.py: change whitespace to include \r, \v and \f. When importing strop succeeds, re-evaluate meaning of letters.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/pdb.py3
-rw-r--r--Lib/string.py5
-rw-r--r--Lib/stringold.py5
3 files changed, 11 insertions, 2 deletions
diff --git a/Lib/pdb.py b/Lib/pdb.py
index c5d3e1c..06f5cf8 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -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):
diff --git a/Lib/string.py b/Lib/string.py
index 8c7d102..ccc1043 100644
--- a/Lib/string.py
+++ b/Lib/string.py
@@ -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:
diff --git a/Lib/stringold.py b/Lib/stringold.py
index 8c7d102..ccc1043 100644
--- a/Lib/stringold.py
+++ b/Lib/stringold.py
@@ -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: