-
Notifications
You must be signed in to change notification settings - Fork 2.2k
pybind11/stl.h converts string to vector<string> #1258
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
Comments
My 2c: I think the fundamental issue is that
A related question is what should happen with |
I agree that this seems like a bug. I think blacklisting |
In Python,
Now change the binding code to list the
vector<string>
constructor before thestring
constructor. Then in Python,If I do not
include
stl.h
, then this does not happen---thevector<string>
constructor wouldn't take a string parameter. Clearly the behavior listed above is automatic conversion bystl.h
.However, in my opinion a
str
should never be auto converted to avector<string>
. Because on the Python side it's trivial to convert astr
to alist
, the user should explicitly do this conversion if they wants to use a vector binding.Because
stl.h
is often useful, the chance of the above situation happening is not low.The text was updated successfully, but these errors were encountered: