fesoliveira014 / pyeuclid

Automatically exported from code.google.com/p/pyeuclid
0 stars 0 forks source link

cocos.euclid.Vector2.__rsub__ bug #5

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. in the python interpreter do
2. import euclid
3. a = euclid.Vector2(1,1)
4. (0,0) - a

What is the expected output? What do you see instead?
(-1.0, -1.0) is expected, you get
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    (0,0)-a
  File "D:\tmp\euclid.py", line 202, in __rsub__
    return Vector2(other.x - self[0],
AttributeError: 'tuple' object has no attribute 'x'

What version of the product are you using? On what operating system?
euclid 0.31, python 2.6.1 , windows XP

Please provide any additional information below.
I think is a typo, with trivial fix (attached a svn diff against r31)

Original issue reported on code.google.com by ccanepacc@gmail.com on 18 Apr 2009 at 8:07

Attachments:

GoogleCodeExporter commented 8 years ago
PD: the subject refers to cocos.euclid.Vector2 ( thats where I originally found 
the 
problem) but I checked out this project ( pyeuclid ) and verified it manifest 
the 
same problem. The traceback and svn diff are against pyeuclid r31.

Original comment by ccanepacc@gmail.com on 24 Apr 2009 at 4:39

GoogleCodeExporter commented 8 years ago
Fix seems pretty straightforward, attached is a patch

>>> import euclid
>>> a = euclid.Vector2(1,1)
>>> (0,0) - a
Vector2(-1.00, -1.00)

Explanation:
The bug assessed correctly that the other object is not a euclid.VectorX, but 
then
still tries to access members .x and .y. Simple copy and paste mistake.

Original comment by julian.k...@gmail.com on 12 May 2009 at 9:09

GoogleCodeExporter commented 8 years ago
Argg, sorry ccanepacc, didn't see you already attached a fix ;) It is already 
late.
Anyway, the patch I added also fixes the same problem for Vector3.__rsub__

Original comment by julian.k...@gmail.com on 12 May 2009 at 9:12