summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/ply
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/ply')
-rw-r--r--bitbake/lib/ply/lex.py6
-rw-r--r--bitbake/lib/ply/yacc.py18
2 files changed, 12 insertions, 12 deletions
diff --git a/bitbake/lib/ply/lex.py b/bitbake/lib/ply/lex.py
index 267ec100fc..182f2e8377 100644
--- a/bitbake/lib/ply/lex.py
+++ b/bitbake/lib/ply/lex.py
@@ -705,11 +705,7 @@ class LexerReflect(object):
# Sort the functions by line number
for f in self.funcsym.values():
- if sys.version_info[0] < 3:
- f.sort(lambda x,y: cmp(func_code(x[1]).co_firstlineno,func_code(y[1]).co_firstlineno))
- else:
- # Python 3.0
- f.sort(key=lambda x: func_code(x[1]).co_firstlineno)
+ f.sort(key=lambda x: func_code(x[1]).co_firstlineno)
# Sort the strings by regular expression length
for s in self.strsym.values():
diff --git a/bitbake/lib/ply/yacc.py b/bitbake/lib/ply/yacc.py
index d50886ed2f..381b50cf0b 100644
--- a/bitbake/lib/ply/yacc.py
+++ b/bitbake/lib/ply/yacc.py
@@ -488,7 +488,7 @@ class LRParser:
# --! DEBUG
return result
- if t == None:
+ if t is None:
# --! DEBUG
debug.error('Error : %s',
@@ -766,7 +766,7 @@ class LRParser:
n = symstack[-1]
return getattr(n,"value",None)
- if t == None:
+ if t is None:
# We have some kind of parsing error here. To handle
# this, we are going to push the current token onto
@@ -1021,7 +1021,7 @@ class LRParser:
n = symstack[-1]
return getattr(n,"value",None)
- if t == None:
+ if t is None:
# We have some kind of parsing error here. To handle
# this, we are going to push the current token onto
@@ -1205,7 +1205,7 @@ class Production(object):
# Precompute the list of productions immediately following. Hack. Remove later
try:
- p.lr_after = Prodnames[p.prod[n+1]]
+ p.lr_after = self.Prodnames[p.prod[n+1]]
except (IndexError,KeyError):
p.lr_after = []
try:
@@ -2797,11 +2797,15 @@ class ParserReflect(object):
# Compute a signature over the grammar
def signature(self):
try:
- from hashlib import md5
+ import hashlib
except ImportError:
- from md5 import md5
+ raise RuntimeError("Unable to import hashlib")
+ try:
+ sig = hashlib.new('MD5', usedforsecurity=False)
+ except TypeError:
+ # Some configurations don't appear to support two arguments
+ sig = hashlib.new('MD5')
try:
- sig = md5()
if self.start:
sig.update(self.start.encode('latin-1'))
if self.prec: