Skip to content

sfml.system.Vector2 comparison raises wrong type #169

Description

@chonkerboi

The rich compare for sfml Vector2 is broken.

import sfml
a = sfml.system.Vector2(10, 10)
b = sfml.system.Vector2(10, 10)
a == b
a > b
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "src/sfml/system/system.pyx", line 124, in sfml.system.Vector2.__richcmp__
TypeError: raise: exception class must be a subclass of BaseException

I traced the problem to 'src/sfml/system/system.pyx' line 124:
raise NotImplemented

NotImplemented is not supposed to be raised. I propose to either do:
return NotImplemented

or maybe raise an error like this one:

abs(sfml.system.Vector2(1, 2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: bad operand type for abs(): 'sfml.system.Vector2'

I can implement the solution if needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions