-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Wrong std::string overload called when given numpy.ndarray argument #685
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
Looks like it only affects Python 2. PyUnicode_FromObject might be a bit too permissive and accepts
@jagerman Perhaps an additional |
jagerman
added a commit
to jagerman/pybind11
that referenced
this issue
Feb 23, 2017
The string conversion logic added in PR pybind#624 for all std::basic_strings was using the old std::wstring logic, but that was underused and turns out to have hade a bug in accepting almost anything convertible to the previous std::string logic by only accepting unicode or byte/string (Python 3/2) types. Fixes pybind#685.
jagerman
added a commit
to jagerman/pybind11
that referenced
this issue
Feb 23, 2017
The string conversion logic added in PR pybind#624 for all std::basic_strings was derived from the old std::wstring logic, but that was underused and turns out to have had a bug in accepting almost anything convertible to unicode, while the previous std::string logic was much stricter. This restores the previous std::string logic by only allowing actual unicode or string types. Fixes pybind#685.
wjakob
pushed a commit
that referenced
this issue
Feb 24, 2017
* Make string conversion stricter The string conversion logic added in PR #624 for all std::basic_strings was derived from the old std::wstring logic, but that was underused and turns out to have had a bug in accepting almost anything convertible to unicode, while the previous std::string logic was much stricter. This restores the previous std::string logic by only allowing actual unicode or string types. Fixes #685. * Added missing 'requires numpy' decorator (I forgot that the change to a global decorator here is in the not-yet-merged Eigen PR)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When an overload is present that takes a
std::string
argument, this overload is also (wrongly) called when given anumpy.ndarray
.See attached unit test patch to latest master.
broken_overload.txt
The text was updated successfully, but these errors were encountered: