Skip to content

Commit

Permalink
Use envvar instead of argc for early return
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjng committed Apr 8, 2024
1 parent c567f70 commit 5f4179e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/cc/current_py_cc_libs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ cc_test(
name = "python_libs_linking_windows_test",
srcs = ["python_libs_linking_test.cc"],
defines = ["Py_LIMITED_API=0x030A0000"],
env = {"HELLO": "world"},
target_compatible_with = ["@platforms//os:windows"],
deps = [
"@rules_python//python/cc:current_py_cc_headers",
Expand Down
4 changes: 3 additions & 1 deletion tests/cc/current_py_cc_libs/python_libs_linking_test.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#include <cstdlib>
#include <Python.h>

int main(int argc, char** argv) {
// Early return to prevent the broken code below from running.
if (argc >= 1) {
char* val = std::getenv("HELLO");
if (val || argc >= 1) {
return 0;
}

Expand Down

0 comments on commit 5f4179e

Please sign in to comment.