Skip to content

Commit 8c58253

Browse files
committed
Explicitly pass the libs, refactor cc file
1 parent e23a7f9 commit 8c58253

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

tests/cc/current_py_cc_libs/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ cc_test(
4848
target_compatible_with = ["@platforms//os:windows"],
4949
deps = [
5050
"@rules_python//python/cc:current_py_cc_headers",
51+
"@rules_python//python/cc:current_py_cc_libs",
5152
],
5253
)

tests/cc/current_py_cc_libs/python_libs_linking_test.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
int main(int argc, char** argv) {
44

5-
PyObject *s = PyUnicode_FromString(argv[0]);
5+
// PyObject *s = PyUnicode_FromString(argv[0]);
66
// Early return to prevent the broken code below from running.
77
if (argc >= 1) {
8-
printf("%d\n", (int)s->ob_refcnt);
8+
// printf("%d\n", (int)s->ob_refcnt);
99
return 0;
1010
}
1111

@@ -15,6 +15,7 @@ int main(int argc, char** argv) {
1515
// To make it actually run, more custom initialization is necessary.
1616
// See https://docs.python.org/3/c-api/intro.html#embedding-python
1717
Py_Initialize();
18+
Py_BytesMain(argc, argv);
1819
Py_Finalize();
1920
return 0;
2021
}

0 commit comments

Comments
 (0)