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

Python bindings: Check whether to-/from-Python converters are registered before registering them #191

Closed
tswilliams opened this issue Mar 19, 2020 · 0 comments

Comments

@tswilliams
Copy link
Collaborator

Currently, the following type of warning will be emitted if uhal is imported in Python after another Python library that already provides converter functions some of the same classes as uHAL:

python -c "import smash; import uhal"
/usr/lib/python2.7/site-packages/uhal/__init__.py:5: RuntimeWarning: to-Python converter for std::vector<std::string, std::allocator<std::string> > already registered; second conversion method ignored.

The implementation of the Python bindings should be updated to only load to-/from-Python converter functions if converters haven't already been registered for the corresponding class - e.g. as follows (taking MP7/EMP as an example):

    const bpy::converter::registration* reg;

    reg = bpy::converter::registry::query(bpy::type_id< std::vector<bool> >());
    if (reg == NULL or (*reg).m_to_python == NULL) {
        Converter_std_vector_from_list<bool>();
        bpy::to_python_converter < std::vector<bool>, emp::python::Converter_std_vector_to_list<bool> >();
    }
@tswilliams tswilliams added this to the v2.7.3 release milestone Mar 21, 2020
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
jhegeman pushed a commit to jhegeman/ipbus-software that referenced this issue Dec 6, 2021
Updates for compatibility with dev/2021f tag of IPBB
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

1 participant