Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python3 problem with munuit2.cpp #3

Open
GoogleCodeExporter opened this issue Mar 15, 2015 · 0 comments
Open

python3 problem with munuit2.cpp #3

GoogleCodeExporter opened this issue Mar 15, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

Tried to follow the instructions on http://code.google.com/p/pyminuit/ using 
Python3 (!!).

This worked. 

However, when I tried to replace in function "f(x,y)" the variable name "x" by 
"xx", I got the error:

  m.migrad()
KeyError:  'Parameter "x" is missing from values'.

I worked out the problem:
in  minuit_Minuit_init() self->upar is set like this:

self->upar->Add(Pystring_AsString(param)),
where "Pystring_AsString(x)" is replaced by "PyUnicode_AS_DATA(x)".

This however only returns a pointer to the first character of "param"

The problem is resolved by replacing the above with

PyObject * ascii_param=PyUnicode_AsASCIIString(param);
self->upar->Add(PyBytes_AsString(ascii_param),value,error);
Py_DECREF(ascii_param);

Original issue reported on code.google.com by [email protected] on 3 Jun 2013 at 9:19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant