Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled AttributeError in parse() call #42

Open
claudiamarcubina opened this issue Aug 7, 2020 · 0 comments
Open

Unhandled AttributeError in parse() call #42

claudiamarcubina opened this issue Aug 7, 2020 · 0 comments

Comments

@claudiamarcubina
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants