Skip to content

Commit 549223a

Browse files
committed
Revert "embed.h Python 3.11 config.use_environment=1 + PYTHONPATH test (pybind#4119)"
This reverts commit 2488530.
1 parent 2488530 commit 549223a

File tree

3 files changed

+0
-27
lines changed

3 files changed

+0
-27
lines changed

include/pybind11/embed.h

-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ inline void initialize_interpreter(bool init_signal_handlers = true,
150150
#else
151151
PyConfig config;
152152
PyConfig_InitIsolatedConfig(&config);
153-
config.isolated = 0;
154-
config.use_environment = 1;
155153
config.install_signal_handlers = init_signal_handlers ? 1 : 0;
156154

157155
PyStatus status = PyConfig_SetBytesArgv(&config, argc, const_cast<char *const *>(argv));

tests/test_embed/catch.cpp

-18
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,7 @@
2020
namespace py = pybind11;
2121

2222
int main(int argc, char *argv[]) {
23-
// Setup for TEST_CASE in test_interpreter.cpp, tagging on a large random number:
24-
std::string updated_pythonpath("pybind11_test_embed_PYTHONPATH_2099743835476552");
25-
const char *preexisting_pythonpath = getenv("PYTHONPATH");
26-
if (preexisting_pythonpath != nullptr) {
27-
#if defined(_WIN32)
28-
updated_pythonpath += ';';
29-
#else
30-
updated_pythonpath += ':';
31-
#endif
32-
updated_pythonpath += preexisting_pythonpath;
33-
}
34-
#if defined(_WIN32)
35-
_putenv_s("PYTHONPATH", updated_pythonpath.c_str());
36-
#else
37-
setenv("PYTHONPATH", updated_pythonpath.c_str(), /*replace=*/1);
38-
#endif
39-
4023
py::scoped_interpreter guard{};
41-
4224
auto result = Catch::Session().run(argc, argv);
4325

4426
return result < 0xff ? result : 0xff;

tests/test_embed/test_interpreter.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ PYBIND11_EMBEDDED_MODULE(throw_error_already_set, ) {
7575
d["missing"].cast<py::object>();
7676
}
7777

78-
TEST_CASE("PYTHONPATH is used to update sys.path") {
79-
// The setup for this TEST_CASE is in catch.cpp!
80-
auto sys_path = py::str(py::module_::import("sys").attr("path")).cast<std::string>();
81-
REQUIRE_THAT(sys_path,
82-
Catch::Matchers::Contains("pybind11_test_embed_PYTHONPATH_2099743835476552"));
83-
}
84-
8578
TEST_CASE("Pass classes and data between modules defined in C++ and Python") {
8679
auto module_ = py::module_::import("test_interpreter");
8780
REQUIRE(py::hasattr(module_, "DerivedWidget"));

0 commit comments

Comments
 (0)