Ticket #4382: 0001-cast-ints-as-floats-when-passing-args-to-Python-bloc.patch

File 0001-cast-ints-as-floats-when-passing-args-to-Python-bloc.patch, 970 bytes (added by walter, 11 years ago)
  • plugins/turtle_blocks_extras/turtle_blocks_extras.py

    From 04986566b5d2bc0cd6982f8cb7dc19eac529e8ec Mon Sep 17 00:00:00 2001
    From: Walter Bender <walter.bender@gmail.com>
    Date: Wed, 16 Jan 2013 18:29:03 -0500
    Subject: [PATCH] cast ints as floats when passing args to Python block
    Organization: Sugar Labs Foundation
    
    ---
     plugins/turtle_blocks_extras/turtle_blocks_extras.py | 3 +++
     1 file changed, 3 insertions(+)
    
    diff --git a/plugins/turtle_blocks_extras/turtle_blocks_extras.py b/plugins/turtle_blocks_extras/turtle_blocks_extras.py
    index 183c4ac..43703a7 100644
    a b bullets')) 
    10841084
    10851085    def _prim_myfunction(self, f, x):
    10861086        """ Programmable block """
     1087        for i, v in enumerate(x):
     1088            if type(v) == int:  # Pass float values to Python block
     1089                x[i] = float(v)
    10871090        try:
    10881091            y = myfunc(f, x)
    10891092            if str(y) == 'nan':