-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
<mutex>: Problem using mutex with pybind. #4875
Comments
Looks like #4730 You need to make sure Python uses the latest C++ runtime library. |
Thanks. I don't know how to make sure Python uses the latest C++ runtime library, but I solved this by adding the macro |
Yep, thanks @AlexGuteniev. Ideally this should be reported upstream (to pybind?), if they aren't redistributing a sufficiently new VCRedist (either system-wide or app-local), assuming this issue is in pybind itself and not in the usage of it. While our documented requirement is to have an equal or newer version, in this case one can physically get away with a VCRedist as old as VS 2022 17.8 being used with VS 2022 17.10's headers, so the VCRedist has to be quite old in order for this to be a problem. |
Describe the bug
I use std::lock_guard and std::unique_lock in my code and use pybind to generate python library.
The program crashed in python but not in C++.
Command-line test case
Expected behavior
The python program should run successfully and output "1".
STL version
Microsoft Visual Studio Community 2022
Version 17.10.5
Additional context
I switch to visual studio 2019 and this bug disappears.
Microsoft Visual Studio Professional 2019
Version 16.11.38
The text was updated successfully, but these errors were encountered: