Skip to content

Commit fee64b8

Browse files
committed
added try/except around inspect.getsource
1 parent edf2e4f commit fee64b8

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

compiler/__init__.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@
1010
import os, os.path
1111
import hashlib
1212
import cPickle
13-
import inspect
1413
import json
1514
from multiprocessing import Pool, cpu_count
1615
import sys
1716

1817
compiler.grammar.source.parseWithTabs()
1918

20-
data = ""
21-
data += inspect.getsource(compiler.grammar)
22-
data += inspect.getsource(compiler.lang)
23-
data += inspect.getsource(compiler.pyparsing)
24-
grammar_digest = hashlib.sha1(data).hexdigest()
25-
del data
19+
try:
20+
import inspect
21+
data = ""
22+
data += inspect.getsource(compiler.grammar)
23+
data += inspect.getsource(compiler.lang)
24+
data += inspect.getsource(compiler.pyparsing)
25+
grammar_digest = hashlib.sha1(data).hexdigest()
26+
del data
27+
except:
28+
grammar_digest = '0000000000000000000000000000000000000000'
2629

2730
class Cache(object):
2831
def __init__(self, dir = '.cache'):

0 commit comments

Comments
 (0)