beeware/batavia

Wrong error type returned by pow function

djmgit opened this issue · 2 comments

Expected Behavior

Pow function should return ValueError when there are 3 arguments and the second argument is
negative.

Current Behavior

Batavia is returning TypeError for the above mentioned case. This is also causing the tests in tests/builts/test_pow to fail.

Steps to reproduce

  1. Execite the following code snippet using Batavia
    print(pow(1, -1, 1)
    
    Batavia returns TypeError:
    Traceback (most recent call last):
    File "/home/deep/batavia/test3.py", line 1, in <module>
    TypeError: pow() 2nd argument cannot be negative when 3rd argument specified
    
    however python returns ValueError
    Traceback (most recent call last):
    File "../test3.py", line 1, in <module>
    print(pow(2, -4, 1))
    ValueError: pow() 2nd argument cannot be negative when 3rd argument specified
    

Your Environment

  • Python Version (list the specific version number)
    3.5.2

  • Operating System and Version (select from the following and list the specific version number; if your OS is not listed, list that as well)

    • OSX
    • Linux
    • Windows
    • Ubuntu

I am working on this.

This was fixed by #784.