[pypy-commit] [COMMENT] Pull request #43 for pypy/pypy: Sprint: Fixes for py3k modules

Bitbucket notifications-noreply at bitbucket.org
Tue Mar 13 21:07:42 CET 2012


New comment on pull request:

https://bitbucket.org/pypy/pypy/pull-request/43/sprint-fixes-for-py3k-modules#comment-3858

Preston Timmons (prestontimmons) said:

Thanks, Philip.

The log1p implementation raises an OverflowError for -1, and a ValueError for values like -100.

The ValueError catch keeps the traceback consistent for both cases.

With the catch:

>>>> log1p(-1)
Traceback (application-level):
  File "<inline>", line 1 in <module>
    log1p(-1)
ValueError: math domain error

>>>> log1p(-100)
Traceback (application-level):
  File "<inline>", line 1 in <module>
    log1p(-100)
ValueError: math domain error


Without it:

>>>> log1p(-100)
Traceback (most recent call last):
  File "../../../bin/py.py", line 187, in <module>
    sys.exit(main_(sys.argv))
  File "../../../bin/py.py", line 173, in main_
    con.interact(banner)
  File "/root/pypy/pypy/interpreter/interactive.py", line 137, in interact
    code.InteractiveConsole.interact(self, banner)
  File "/usr/lib/python2.7/code.py", line 243, in interact
    more = self.push(line)
  File "/usr/lib/python2.7/code.py", line 265, in push
    more = self.runsource(source, self.filename)
  File "/root/pypy/pypy/interpreter/interactive.py", line 200, in runsource
    main.run_toplevel(self.space, doit, verbose=self.verbose)
  File "/root/pypy/pypy/interpreter/main.py", line 103, in run_toplevel
    f()
  File "/root/pypy/pypy/interpreter/interactive.py", line 192, in doit
    code.exec_code(self.space, self.w_globals, self.w_globals)
  File "/root/pypy/pypy/interpreter/eval.py", line 33, in exec_code
    return frame.run()
  File "/root/pypy/pypy/interpreter/pyframe.py", line 141, in run
    return self.execute_frame()
  File "/root/pypy/pypy/interpreter/pyframe.py", line 175, in execute_frame
    executioncontext)
  File "/root/pypy/pypy/interpreter/pyopcode.py", line 85, in dispatch
    next_instr = self.handle_bytecode(co_code, next_instr, ec)
  File "/root/pypy/pypy/interpreter/pyopcode.py", line 91, in handle_bytecode
    next_instr = self.dispatch_bytecode(co_code, next_instr, ec)
  File "/root/pypy/pypy/interpreter/pyopcode.py", line 267, in dispatch_bytecode
    res = meth(oparg, next_instr)
  File "/root/pypy/pypy/interpreter/pyopcode.py", line 960, in CALL_FUNCTION
    w_result = self.space.call_valuestack(w_function, nargs, self)
  File "/root/pypy/pypy/interpreter/baseobjspace.py", line 985, in call_valuestack
    return w_func.funccall_valuestack(nargs, frame)
  File "/root/pypy/pypy/interpreter/function.py", line 123, in funccall_valuestack
    return code.fastcall_1(self.space, self, frame.peekvalue(0))
  File "/root/pypy/pypy/interpreter/gateway.py", line 724, in fastcall_1
    self.handle_exception(space, e)
  File "/root/pypy/pypy/interpreter/gateway.py", line 717, in fastcall_1
    w_result = self.fastfunc_1(space, w1)
  File "/root/pypy/pypy/module/math/interp_math.py", line 385, in log1p
    y = rfloat.log1p(x)
ValueError: math domain error

The log1p test is covered in pypy/lib-python/3.2/test/math_testcases.txt, but I added an explicit test in test_log1p.

--
This is a pull request comment notification from bitbucket.org.
You are receiving this either because you are participating
in a pull request, or you are following it.


More information about the pypy-commit mailing list