set_option in Python interface does not work with floats

Bug #1405171 reported by Christian Jacobs
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Spud
New
Undecided
Unassigned

Bug Description

With the latest version of the trunk, the following code prints out 0.0 instead of 2.5. Setting it as a string "2.5" (or a list, [2.5]) works fine, but this isn't quite what I'm after.

import libspud

f = open("test.flml", "w")
f.write("<?xml version='1.0' encoding='utf-8'?>\n")
f.write("<options>\n")
f.write("</options>\n")
f.close()

libspud.clear_options()
libspud.load_options("test.flml")

a = 2.5
libspud.set_option("/test", a)
print libspud.get_option("/test")

Revision history for this message
Christian Jacobs (ctjacobs) wrote :

This appears to be an issue when PyErr_SetString is called in error_checking (libspud.c:39) as a result of a SPUD_NEW_KEY_WARNING. After calling this function, the value stored in secondArg (libspud:691) seems to get overwritten if it's a float or a double. I've commented out line libspud.c:39 as a work-around.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.