-
Notifications
You must be signed in to change notification settings - Fork 30
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
Calls to std::ostringstream.str() in pybind11 modules do not work on Python 3.12 #655
Comments
Uhhh it would be incredibly surprising if anything in pytest-randomly was doing more than incidentally triggering this. My guess would be that it's one of the things that pytest-randomly imports that's actually fiddling with something that the function relies on. Try editing your local copy to remove the optional imports, like xdist, factory boy, etc.: pytest-randomly/src/pytest_randomly/__init__.py Lines 25 to 66 in 01a0f6c
I think it will be a bug in one of those, or indeed pybind11 or Python 3.12. |
Python Version
3.12
pytest Version
8.3.3
Package Version
3.15.0
Description
Making a simple pybind11 module that binds a function calling
ostringstream.str()
appears to break in pytest withpytest-randomly
on py3.12 (but not 3.11). To reproduce:testrandomly.cc
Compiled with conda-forge provided g++ 14.1.0 and pybind11 2.13.1 by:
g++ -Wall -shared -fPIC -std=c++17 $(python3 -m pybind11 --includes) testrandomly.cc -o testrandomly$(python3-config --extension-suffix)
test_randomly.py
pytest --randomly-seed=0 test_randomly.py
works on py3.11 with any seed.pytest -p no:randomly test_randomly.py
also works on py3.12.pytest --randomly-seed=0 test_randomly.py
fails on py3.12 with any seed like so:std::to_string
works just fine, hence I suspect that this is a strange interaction with ostringstream. It's possible that this is a pybind11 or py3.12 bug but I figured I'd file an issue here first because I can only reproduce it with pytest-randomly enabled and can't guess at why.The text was updated successfully, but these errors were encountered: