mirror of https://github.com/python/cpython
Commented out debug print statements; be a little more clever
about strings containing backslashes.
This commit is contained in:
parent
c1b5cec10e
commit
24e77d429d
|
@ -67,7 +67,7 @@ def checkcache(filename):
|
||||||
try:
|
try:
|
||||||
fp = open(cachename, 'r')
|
fp = open(cachename, 'r')
|
||||||
except IOError:
|
except IOError:
|
||||||
print 'flp: no cache file', cachename
|
#print 'flp: no cache file', cachename
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
if fp.read(4) != MAGIC:
|
if fp.read(4) != MAGIC:
|
||||||
|
@ -76,9 +76,9 @@ def checkcache(filename):
|
||||||
cache_mtime = rdlong(fp)
|
cache_mtime = rdlong(fp)
|
||||||
file_mtime = getmtime(filename)
|
file_mtime = getmtime(filename)
|
||||||
if cache_mtime != file_mtime:
|
if cache_mtime != file_mtime:
|
||||||
print 'flp: outdated cache file', cachename
|
#print 'flp: outdated cache file', cachename
|
||||||
return None
|
return None
|
||||||
print 'flp: valid cache file', cachename
|
#print 'flp: valid cache file', cachename
|
||||||
altforms = marshal.load(fp)
|
altforms = marshal.load(fp)
|
||||||
forms = {}
|
forms = {}
|
||||||
for name in altforms.keys():
|
for name in altforms.keys():
|
||||||
|
@ -139,7 +139,7 @@ def writecache(filename, forms):
|
||||||
fp.seek(0)
|
fp.seek(0)
|
||||||
fp.write(MAGIC)
|
fp.write(MAGIC)
|
||||||
fp.close()
|
fp.close()
|
||||||
print 'flp: wrote cache file', cachename
|
#print 'flp: wrote cache file', cachename
|
||||||
|
|
||||||
#
|
#
|
||||||
# Internal: Locate form file (using PYTHONPATH) and open file
|
# Internal: Locate form file (using PYTHONPATH) and open file
|
||||||
|
@ -218,6 +218,12 @@ class _newobj:
|
||||||
# Internal parsing routines.
|
# Internal parsing routines.
|
||||||
#
|
#
|
||||||
def _parse_string(str):
|
def _parse_string(str):
|
||||||
|
if '\\' in str:
|
||||||
|
s = '\'' + str + '\''
|
||||||
|
try:
|
||||||
|
return eval(s)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return str
|
return str
|
||||||
|
|
||||||
def _parse_num(str):
|
def _parse_num(str):
|
||||||
|
|
|
@ -67,7 +67,7 @@ def checkcache(filename):
|
||||||
try:
|
try:
|
||||||
fp = open(cachename, 'r')
|
fp = open(cachename, 'r')
|
||||||
except IOError:
|
except IOError:
|
||||||
print 'flp: no cache file', cachename
|
#print 'flp: no cache file', cachename
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
if fp.read(4) != MAGIC:
|
if fp.read(4) != MAGIC:
|
||||||
|
@ -76,9 +76,9 @@ def checkcache(filename):
|
||||||
cache_mtime = rdlong(fp)
|
cache_mtime = rdlong(fp)
|
||||||
file_mtime = getmtime(filename)
|
file_mtime = getmtime(filename)
|
||||||
if cache_mtime != file_mtime:
|
if cache_mtime != file_mtime:
|
||||||
print 'flp: outdated cache file', cachename
|
#print 'flp: outdated cache file', cachename
|
||||||
return None
|
return None
|
||||||
print 'flp: valid cache file', cachename
|
#print 'flp: valid cache file', cachename
|
||||||
altforms = marshal.load(fp)
|
altforms = marshal.load(fp)
|
||||||
forms = {}
|
forms = {}
|
||||||
for name in altforms.keys():
|
for name in altforms.keys():
|
||||||
|
@ -139,7 +139,7 @@ def writecache(filename, forms):
|
||||||
fp.seek(0)
|
fp.seek(0)
|
||||||
fp.write(MAGIC)
|
fp.write(MAGIC)
|
||||||
fp.close()
|
fp.close()
|
||||||
print 'flp: wrote cache file', cachename
|
#print 'flp: wrote cache file', cachename
|
||||||
|
|
||||||
#
|
#
|
||||||
# Internal: Locate form file (using PYTHONPATH) and open file
|
# Internal: Locate form file (using PYTHONPATH) and open file
|
||||||
|
@ -218,6 +218,12 @@ class _newobj:
|
||||||
# Internal parsing routines.
|
# Internal parsing routines.
|
||||||
#
|
#
|
||||||
def _parse_string(str):
|
def _parse_string(str):
|
||||||
|
if '\\' in str:
|
||||||
|
s = '\'' + str + '\''
|
||||||
|
try:
|
||||||
|
return eval(s)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return str
|
return str
|
||||||
|
|
||||||
def _parse_num(str):
|
def _parse_num(str):
|
||||||
|
|
Loading…
Reference in New Issue