sgzwiz / brython

Automatically exported from code.google.com/p/brython
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Implicit boolean conversion missing #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

YES = True
assert (YES * 1 + YES) == 2 
assert (1 + YES) == 2 
print('OK')

What is the expected output? What do you see instead?

OK

Instead fails with TypeError

--
[07:38:14.640] TypeError: YES.__mul__ is not a function @ 
http://www.brython.info/py_classes.js:240

or if line 2 commented:
--
[07:38:59.847] TypeError: unsupported operand type(s) for +: undefined (float) 
and '<class 'bool'>'
module '__main__' line 3
assert ( 1 + YES) == 2  @ http://www.brython.info/py_utils.js:139

What version of the product are you using? On what operating system?
Brython version 1.1.20130217-084411
Linux Mint 14

Please provide any additional information below.
Useful for suppressing several if statements

Original issue reported on code.google.com by ca...@nce.ufrj.br on 17 Feb 2013 at 10:51

GoogleCodeExporter commented 9 years ago
I'll handle this one.

Original comment by billy.earney@gmail.com on 27 Feb 2013 at 3:00

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r607.

Original comment by billy.earney@gmail.com on 27 Feb 2013 at 11:44

GoogleCodeExporter commented 9 years ago
I've modified py_classes.js to fix this issue, and I've committed the fixes.  
If you find other related issues, please reopen this ticket, and provide some 
samples that are broken.

Thanks!

Billy

Original comment by billy.earney@gmail.com on 27 Feb 2013 at 11:47