Skip to content

Commit 48c55af

Browse files
committed
* Rollback of PR pybind#3068.
* Using latest pytest main branch for 3.9 and 3.10. * WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 in test_class_sh_trampoline_shared_from_this.py First experiment combining two potential fixes: latest pytest, workaround. If this succeeds the next step will be to try only latest pytest without the workaround. Note: the workaround is known to resolve the MSAN error reported under pybind#3068 (comment)
1 parent 9cd8e74 commit 48c55af

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

.github/workflows/ci.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,9 @@ jobs:
175175
fail-fast: false
176176
matrix:
177177
include:
178-
# valgrind started failing for the final version of PR #3023 (same gcc, python, valgrind as before).
179178
- python-version: 3.9
180179
python-debug: true
181-
valgrind: false
180+
valgrind: true
182181
- python-version: 3.10-dev
183182
python-debug: false
184183

.github/workflows/ci_sh_def.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,9 @@ jobs:
189189
fail-fast: false
190190
matrix:
191191
include:
192-
# valgrind started failing for the final version of PR #3023 (same gcc, python, valgrind as before).
193192
- python-version: 3.9
194193
python-debug: true
195-
valgrind: false
194+
valgrind: true
196195
- python-version: 3.10-dev
197196
python-debug: false
198197

@@ -402,7 +401,7 @@ jobs:
402401
run: yum -y install https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc-20-9-20.9-1.x86_64.rpm https://developer.download.nvidia.com/hpc-sdk/20.9/nvhpc-2020-20.9-1.x86_64.rpm
403402

404403
# On CentOS 7, we have to filter a few tests (compiler internal error)
405-
# and allow deeper templete recursion (not needed on CentOS 8 with a newer
404+
# and allow deeper template recursion (not needed on CentOS 8 with a newer
406405
# standard library). On some systems, you many need further workarounds:
407406
# https://github.com/pybind/pybind11/pull/2475
408407
- name: Configure

.github/workflows/ci_sh_def.yml.patch

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
--- ci.yml 2021-06-30 17:20:07.213156515 -0700
2-
+++ ci_sh_def.yml 2021-06-30 17:22:01.585076084 -0700
1+
--- ci.yml 2021-07-10 10:55:33.768884147 -0700
2+
+++ ci_sh_def.yml 2021-07-10 10:56:02.326861782 -0700
33
@@ -1,4 +1,16 @@
44
-name: CI-SH-AVL
55
+# PLEASE KEEP THIS GROUP OF FILES IN SYNC AT ALL TIMES:
@@ -34,15 +34,15 @@
3434
${{ matrix.args }}
3535
${{ matrix.args2 }}
3636

37-
@@ -288,6 +302,7 @@
37+
@@ -287,6 +301,7 @@
3838
-DPYBIND11_WERROR=ON
3939
-DDOWNLOAD_CATCH=ON
4040
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
4141
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
4242
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
4343

4444
- name: Build
45-
@@ -317,7 +332,8 @@
45+
@@ -316,7 +331,8 @@
4646
run: apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y cmake git python3-dev python3-pytest python3-numpy
4747

4848
- name: Configure
@@ -52,7 +52,7 @@
5252

5353
- name: Build
5454
run: cmake --build build -j2 --verbose
55-
@@ -397,7 +413,7 @@
55+
@@ -396,7 +412,7 @@
5656
cmake3 -S . -B build -DDOWNLOAD_CATCH=ON \
5757
-DCMAKE_CXX_STANDARD=11 \
5858
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)") \
@@ -61,63 +61,63 @@
6161
-DPYBIND11_TEST_FILTER="test_smart_ptr.cpp;test_virtual_functions.cpp"
6262

6363
# Building before installing Pip should produce a warning but not an error
64-
@@ -456,6 +472,7 @@
64+
@@ -455,6 +471,7 @@
6565
-DPYBIND11_WERROR=ON
6666
-DDOWNLOAD_CATCH=ON
6767
-DCMAKE_CXX_STANDARD=${{ matrix.std }}
6868
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
6969
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
7070

7171
- name: Build
72-
@@ -511,6 +528,7 @@
72+
@@ -510,6 +527,7 @@
7373
-DDOWNLOAD_CATCH=ON \
7474
-DDOWNLOAD_EIGEN=OFF \
7575
-DCMAKE_CXX_STANDARD=11 \
7676
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT" \
7777
-DCMAKE_CXX_COMPILER=$(which icpc) \
7878
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
7979

80-
@@ -543,6 +561,7 @@
80+
@@ -542,6 +560,7 @@
8181
-DDOWNLOAD_CATCH=ON \
8282
-DDOWNLOAD_EIGEN=OFF \
8383
-DCMAKE_CXX_STANDARD=17 \
8484
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT" \
8585
-DCMAKE_CXX_COMPILER=$(which icpc) \
8686
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
8787

88-
@@ -613,6 +632,7 @@
88+
@@ -612,6 +631,7 @@
8989
-DDOWNLOAD_CATCH=ON
9090
-DDOWNLOAD_EIGEN=ON
9191
-DCMAKE_CXX_STANDARD=11
9292
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
9393
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
9494

9595
- name: Build
96-
@@ -663,6 +683,7 @@
96+
@@ -662,6 +682,7 @@
9797
cmake ../pybind11-tests
9898
-DDOWNLOAD_CATCH=ON
9999
-DPYBIND11_WERROR=ON
100100
+ -DCMAKE_CXX_FLAGS="-DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
101101
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
102102
working-directory: /build-tests
103103

104-
@@ -758,6 +779,7 @@
104+
@@ -757,6 +778,7 @@
105105
-DPYBIND11_WERROR=ON
106106
-DDOWNLOAD_CATCH=OFF
107107
-DDOWNLOAD_EIGEN=ON
108108
+ -DCMAKE_CXX_FLAGS="/GR /EHsc /DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
109109
${{ matrix.args }}
110110
- name: Build C++11
111111
run: cmake --build build -j 2
112-
@@ -804,6 +826,7 @@
112+
@@ -803,6 +825,7 @@
113113
-DPYBIND11_WERROR=ON
114114
-DDOWNLOAD_CATCH=OFF
115115
-DDOWNLOAD_EIGEN=ON
116116
+ -DCMAKE_CXX_FLAGS="/GR /EHsc /DPYBIND11_USE_SMART_HOLDER_AS_DEFAULT"
117117

118118
- name: Build C++14
119119
run: cmake --build build -j 2
120-
@@ -824,12 +847,13 @@
120+
@@ -823,12 +846,13 @@
121121
- 3.7
122122
std:
123123
- 14

tests/requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ numpy==1.19.3; (platform_python_implementation!="PyPy" or sys_platform=="linux")
55
numpy==1.20.0; (platform_python_implementation!="PyPy" or sys_platform=="linux") and python_version>="3.7" and python_version<"3.10"
66
pytest==4.6.9; python_version<"3.5"
77
pytest==6.1.2; python_version=="3.5"
8-
pytest==6.2.1; python_version>="3.6" and python_version<="3.9"
9-
pytest @ git+https://github.com/pytest-dev/pytest@c117bc350ec1e570672fda3b2ad234fd52e72b53; python_version>="3.10"
8+
pytest==6.2.1; python_version>="3.6" and python_version<="3.8"
9+
pytest @ git+https://github.com/pytest-dev/pytest@5d8392cb68fe0b3d6aba3a351d76fc9f02297980; python_version>="3.9"
1010
pytest-timeout
1111
scipy==1.2.3; (platform_python_implementation!="PyPy" or sys_platform=="linux") and python_version<"3.6"
1212
scipy==1.5.4; (platform_python_implementation!="PyPy" or sys_platform=="linux") and python_version>="3.6" and python_version<"3.10"

tests/test_class_sh_trampoline_shared_from_this.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,29 @@ def test_multiple_registered_instances_for_same_pointee_recursive():
213213
break # Comment out for manual leak checking (use `top` command).
214214

215215

216+
WORKAROUND_ENABLING_ROLLBACK_OF_PR3068 = env.LINUX
217+
218+
216219
def test_std_make_shared_factory():
217220
class PySftMakeShared(m.Sft):
218221
def __init__(self, history):
219222
super(PySftMakeShared, self).__init__(history, 0)
220223

221224
obj = PySftMakeShared("PySftMakeShared")
222225
assert obj.history == "PySftMakeShared"
223-
with pytest.raises(RuntimeError) as exc_info:
224-
m.pass_through_shd_ptr(obj)
226+
if WORKAROUND_ENABLING_ROLLBACK_OF_PR3068:
227+
try:
228+
m.pass_through_shd_ptr(obj)
229+
except RuntimeError as e:
230+
str_exc_info_value = str(e)
231+
else:
232+
str_exc_info_value = "RuntimeError NOT RAISED"
233+
else:
234+
with pytest.raises(RuntimeError) as exc_info:
235+
m.pass_through_shd_ptr(obj)
236+
str_exc_info_value = str(exc_info.value)
225237
assert (
226-
str(exc_info.value)
238+
str_exc_info_value
227239
== "smart_holder_type_casters loaded_as_shared_ptr failure: not implemented:"
228240
" trampoline-self-life-support for external shared_ptr to type inheriting"
229241
" from std::enable_shared_from_this."

0 commit comments

Comments
 (0)