Opened 10 years ago

Closed 10 years ago

#2313 closed defect (fixed)

Trap all math overflow errors in function block

Reported by: tonyforster Owned by: walter
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Turtleart Version: Unspecified
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description

Currently the python function block will give a bad dock visual indication for function=1/0
but for function=log(0) and sqrt(-1), all that happens is that the turtle disappears and an error is logged

can we have a bad dock indication?

Attachments (1)

TurtleArt-99.xo (961.4 KB) - added by walter 10 years ago.
release candidate 2

Download all attachments as: .zip

Change History (12)

comment:1 Changed 10 years ago by walter

Probably should trap NameError and ZeroDivisionError too.

comment:2 Changed 10 years ago by tonyforster

ZeroDivisionError is OK? print function block (1/0) shows block dock error

comment:3 Changed 10 years ago by walter

  • Resolution set to fixed
  • Status changed from new to closed

v97 seems to mostly do the right thing.

comment:4 Changed 10 years ago by tonyforster

See also #2314, redundant math. brings in a different library
math.log(0) and math.sqrt(-1) are trapped OK
but
log(0) is not trapped
and
sqrt(-1) returns NAN

comment:5 Changed 10 years ago by tonyforster

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:6 Changed 10 years ago by walter

See explanation in #2314. Should be behaving properly in v99

comment:7 Changed 10 years ago by walter

v99 attached should fix #2313, #2314, and #2330

Note that I am printing the error message for Value and Syntax errors since it seems more informative than the stock syntax error graphic, which really applies to the logo code, not the Python code.

Changed 10 years ago by walter

release candidate 2

comment:9 Changed 10 years ago by tonyforster

  • Resolution fixed deleted
  • Status changed from closed to reopened

File "/home/olpc/Activities/TurtleArt.activity/TurtleArt/talogo.py", line 855, in myfunction

raise logoerror('#' + str(e))

UnboundLocalError: local variable 'e' referenced before assignment

comment:11 Changed 10 years ago by walter

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.