Giter Site home page Giter Site logo

Comments (8)

kliegeois avatar kliegeois commented on June 8, 2024 1

Currently, I implemented it as a per namespace option with one option to do it for all namespaces. Hopefully I can open the PR today.

from binder.

kliegeois avatar kliegeois commented on June 8, 2024

This is a known pybind11 issue pybind/pybind11#439

from binder.

kliegeois avatar kliegeois commented on June 8, 2024

This would probably require a modification of binder though.

from binder.

lyskov avatar lyskov commented on June 8, 2024

@kliegeois have you tried compiling and exporting using described approach? What i want to double check is that how Pybind11 reacts to attempts to register same type under different names.

re idea itself: assuming that proposed solution is works (see my above question), i am open to the idea but this seems a bit "messy". I imaging a few packages when each have its own std:: bindings... so user will ends up with multiple bindings for the same types. I wonder if cleaner solution is possible here, for instance perhaps it is possible to check if bindings for particular type_id was already registered? And if yes then skip bindings procedure. Have you investigate this approach?

from binder.

kliegeois avatar kliegeois commented on June 8, 2024

@lyskov the described approach:

For A:

pybind11::class_<std::fpos<__mbstate_t>> cl(M("std"), "A_fpos___mbstate_t_t", "");

For B:

pybind11::class_<std::fpos<__mbstate_t>> cl(M("std"), "B_fpos___mbstate_t_t", "");

does not work.

But,

For A:

pybind11::class_<std::fpos<__mbstate_t>> cl(M("std"), "_fpos___mbstate_t_t", "", py::module_local());

For B:

pybind11::class_<std::fpos<__mbstate_t>> cl(M("std"), "_fpos___mbstate_t_t", "", py::module_local());

Does work.

It seems to even work when you parse an instance of a class from one package to the other providing that both of them define that class.

I have a PR ready to solve this issue with extra options. I just cannot create the PR right now.

from binder.

lyskov avatar lyskov commented on June 8, 2024

oh, i am glad to hear that passing py::module_local() solve this, - this is much cleaner solution, - great! - looking forward for PR thats add this!

from binder.

lyskov avatar lyskov commented on June 8, 2024

re how to solve this: - i wonder if it will make sense to provide options to trigger local bindings both per-class and per-namespace basis 🤔...

from binder.

kliegeois avatar kliegeois commented on June 8, 2024

Closed by #251.

from binder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.