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

Error when setting member of type er7_utils::Integration::Technique from Python context #692

Open
dbankieris opened this issue Nov 2, 2018 · 2 comments

Comments

@dbankieris
Copy link
Contributor

S_define

#include "sim_objects/default_trick_sys.sm"
##include "trick/Integrator.hh"

class Sandbox : public Trick::SimObject {
    public:
    er7_utils::Integration::Technique technique;
};

Sandbox sandbox;

input.py

sandbox.technique = trick.Integration.SymplecticEuler

Result

Traceback (most recent call last):
  File "RUN_test/input.py", line 1, in <module>
    sandbox.technique = trick.Integration.SymplecticEuler
TypeError: in method 'Sandbox_technique_set', argument 2 of type 'er7_utils::Integration::Technique'
@dbankieris
Copy link
Contributor Author

@alexlin0 Repeating the test with a member of type Trick::MonteRun::ExitStatus does not result in an error. The generated wrapper code is different as well.

    res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_er7_utils__Integration__Technique,  0  | 0); 
    if (!SWIG_IsOK(res2)) {
      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Sandbox_technique_set" "', argument " "2"" of type '" "er7_utils::Integration::Technique""'"); 
    }     
    if (!argp2) {
      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Sandbox_technique_set" "', argument " "2"" of type '" "er7_utils::Integration::Technique""'");
    } else {
      er7_utils::Integration::Technique * temp = reinterpret_cast< er7_utils::Integration::Technique * >(argp2);
      arg2 = *temp;
      if (SWIG_IsNewObj(res2)) delete temp; 
    }
    int ret ;
    ret = typemap_in_scalar<Trick::MonteRun::ExitStatus >( arg2 , obj1 , "Sandbox_status_set") ;
    if ( ret != 0 ) {
      SWIG_exception_fail(SWIG_TypeError,"Right hand side could not be converted proper scalar type");
    }

@ccsullivan2
Copy link

Commenting to note that this is still an issue. Using a workaround for now, but would prefer that this be resolved eventually.

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

No branches or pull requests

2 participants