Skip to content

Commit

Permalink
Fix unexpectable crush for empty prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
kxepal committed Feb 8, 2012
1 parent e932aac commit 4405995
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions semver.py
Expand Up @@ -49,13 +49,13 @@ def match(version, match_expr):
prefix = match_expr[:2]
if prefix in ('>=', '<=', '=='):
match_version = match_expr[2:]
elif prefix[0] in ('>', '<', '='):
elif prefix and prefix[0] in ('>', '<', '='):
prefix = prefix[0]
match_version = match_expr[1:]
else:
raise ValueError("match_expr parameter should be in format <op><ver>, "
"where <op> is one of ['<', '>', '==', '<=', '>=']. "
"You provided: %s" % match_expr)
"You provided: %r" % match_expr)

possibilities_dict = {
'>': (1,),
Expand Down

0 comments on commit 4405995

Please sign in to comment.