Skip to content

check_specifier() raises an exception when not passed as string #1932

@plannigan

Description

@plannigan

dist.check_specifier() is used to validate that the given argument is valid. The documentation and the error message it produces clearly states the value should be a string. However, if the value is something other than a string, DistutilsSetupError is not raised. This is because SpecifierSet class .split() assuming that the value is a string. This causes:

AttributeError: 'lXXX' object has no attribute 'split' 

In my case, it happened to be a list containing one valid specifier.

Instead of failing with this error, check_specifier() should raise DistutilsSetupError to clearly indicate that it was given a value of the wrong type.

This is related to #1869 in that it is hitting the same error. But, I'm suggesting the type be properly checked instead of allowing other types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions