← 输入框|github.com|刷新
Skip to content

Fix #316: Return NotImplemented for comparisons - #318

Merged
tomschr merged 1 commit into
python-semver:masterfrom
tomschr:bugfix/316-notimplemented
Nov 8, 2020
Merged

tomschr merged 1 commit into
python-semver:masterfrom
tomschr:bugfix/316-notimplemented

Conversation

@tomschr

@tomschr tomschr commented Nov 8, 2020

Copy link
Copy Markdown
Member

The former code raised a TypeError exception for comparisons like __gt__, __lt__ etc. to indicate a wrong type.

However, according to NotImplemented documentation, we should return(!) NotImplemented (not raise) when a comparison with an invalid type is not implemented.

The former code raised a TypeError exception for comparisons
like __gt__, __lt__ etc. to indicate a wrong type.

However, according to NotImplemented[1] documentation,
we should return(!) NotImplemented (not raise) when a
comparison with an invalid type is not implemented.

[1] https://docs.python.org/3/library/constants.html#NotImplemented
@tomschr tomschr added the Bug Error, flaw or fault to produce incorrect or unexpected results label Nov 8, 2020
@tomschr tomschr self-assigned this Nov 8, 2020
@tomschr
tomschr merged commit c75737d into python-semver:master Nov 8, 2020
@tomschr
tomschr deleted the bugfix/316-notimplemented branch November 8, 2020 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Error, flaw or fault to produce incorrect or unexpected results

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant