Skip to content

Commit e4cee5d

Browse files
committed
Undoing MSVC 2015 workaround in test_constants_and_functions.cpp
1 parent fed54f7 commit e4cee5d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tests/test_constants_and_functions.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,12 @@ TEST_SUBMODULE(constants_and_functions, m) {
137137
m.def("f4", f4);
138138

139139
// test_function_record_leaks
140-
struct LargeCapture {
140+
m.def("register_large_capture_with_invalid_arguments", [](py::module_ m) {
141141
// This should always be enough to trigger the alternative branch
142142
// where `sizeof(capture) > sizeof(rec->data)`
143-
uint64_t zeros[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
144-
};
145-
m.def("register_large_capture_with_invalid_arguments", [](py::module_ m) {
146-
LargeCapture capture; // VS 2015's MSVC was acting up when creating the array here
143+
uint64_t capture[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
147144
m.def(
148-
"should_raise",
149-
[capture](int) { return capture.zeros[9] + 33; },
150-
py::kw_only(),
151-
py::arg());
145+
"should_raise", [capture](int) { return capture[9] + 33; }, py::kw_only(), py::arg());
152146
});
153147
m.def("register_with_raising_repr", [](py::module_ m, const py::object &default_value) {
154148
m.def(

0 commit comments

Comments
 (0)