Skip to content

Commit 5f4179e

Browse files
committed
Use envvar instead of argc for early return
1 parent c567f70 commit 5f4179e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

tests/cc/current_py_cc_libs/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ cc_test(
4242
name = "python_libs_linking_windows_test",
4343
srcs = ["python_libs_linking_test.cc"],
4444
defines = ["Py_LIMITED_API=0x030A0000"],
45+
env = {"HELLO": "world"},
4546
target_compatible_with = ["@platforms//os:windows"],
4647
deps = [
4748
"@rules_python//python/cc:current_py_cc_headers",

tests/cc/current_py_cc_libs/python_libs_linking_test.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#include <cstdlib>
12
#include <Python.h>
23

34
int main(int argc, char** argv) {
45
// Early return to prevent the broken code below from running.
5-
if (argc >= 1) {
6+
char* val = std::getenv("HELLO");
7+
if (val || argc >= 1) {
68
return 0;
79
}
810

0 commit comments

Comments
 (0)