Calling parse(version, loose) can return None when the provided version is not a strictly semantic version. This case is not handled when parse(version, loose) is called from valid(version, loose):
# semver.__init__.py
def parse(version, loose):
if loose:
r = regexp[LOOSE]
else:
r = regexp[FULL]
m = r.search(version)
if m:
return semver(version, loose)
else:
return None # this can return None
def valid(version, loose):
v = parse(version, loose)
if v.version: # here it is just supposed that v has 'version' attribute
return v
else:
return None
Calling
parse(version, loose)
can returnNone
when the provided version is not a strictly semantic version. This case is not handled whenparse(version, loose)
is called fromvalid(version, loose)
: