-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[BUG] Python develop mode issues (3.8 and 3.9+) on macOS #2422
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
I'm getting test failures using a recent debug build (on Ubuntu 20.04) of Python 3.9 too:
|
Excluding a couple of tests allows tests to "pass":
|
Another failure observed in #2459:
|
A recipe for reproducing: docker run --rm -it -v $PWD:/pybind11 ubuntu:20.04
apt-get update && apt-get install -y git python3-dbg python3-dev python3-distutils python3-pytest cmake g++ ninja-build
cmake -S pybind11 -B build -GNinja -DPYTHON_EXECUTABLE=$(which python3-dbg) -DCMAKE_BUILD_TYPE=Debug
cmake --build build -t check Failing test:
Excluding this one test causes the ubuntu tests to pass. |
To be more concrete, I believe this line should throw but doesn't: pybind11/include/pybind11/cast.h Line 1867 in 2e31e46
EDIT: Adding a simple |
Simply discarding the TypeError seems to work. diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h
index d6e440f..aa51de8 100644
--- a/include/pybind11/cast.h
+++ b/include/pybind11/cast.h
@@ -1870,7 +1870,11 @@ private:
#if !defined(NDEBUG)
, type(type_id<T>())
#endif
- { }
+ {
+ if(PyErr_Occurred()) {
+ pybind11::error_already_set().discard_as_unraisable("");
+ }
+ }
public:
/// Direct construction with name, default, and description The tests all pass, but I don't know if this breaks something that we're not testing already. Hence, not making a pull request already. This does have some similarities with #2336, but #2336 can't be solved so easily. |
I haven't been testing against debug Python before, so it could be something on my end, but I'm getting segfaults when building and running against debug Python.
Python 3.8:
Click to see output
Python 3.9rc1 and master:
The text was updated successfully, but these errors were encountered: