Skip to content

Commit

Permalink
Revert D52877026: Multisect successfully blamed "D52877026: delay sit…
Browse files Browse the repository at this point in the history
…e import" for otest failure

Summary:
This diff is reverting D52877026
D52877026: delay site import by zsol has been identified to be causing the following test failure:

Tests affected:
- [tools/make_par:environment_tests - test_ld_preload_xar_forkserver (tools.make_par.environment_tests.EnvironmentTests)](https://www.internalfb.com/intern/test/281475066289502/)

Here's the Multisect link:
https://www.internalfb.com/multisect/4026549
Here are the tasks that are relevant to this breakage:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

If you believe this diff has been generated in error you may Commandeer and Abandon it.

Reviewed By: zsol

Differential Revision: D52906644

fbshipit-source-id: d26c06e22921a4337f35572a73fcabf7dfad84bb
  • Loading branch information
generatedunixname89002005232357 authored and facebook-github-bot committed Jan 19, 2024
1 parent 8caf42f commit 3ec582c
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions prelude/python/tools/embedded_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,6 @@ std::optional<int> MaybeGetExitCode(PyStatus* status, PyConfig* config) {
extern struct _inittab _static_extension_info[];
PyMODINIT_FUNC PyInit__static_extension_utils();

void call_site_main() {
PyObject* siteModule = PyImport_ImportModule("site");
if (siteModule == nullptr) {
PyErr_Print();
fprintf(stderr, "Error: could not import module 'site'\n");
} else {
PyObject* siteMain = PyObject_GetAttrString(siteModule, "main");
Py_DECREF(siteModule);
if (siteMain == nullptr || !PyCallable_Check(siteMain)) {
PyErr_Print();
fprintf(
stderr, "Error: could not find function 'main' in module 'site'\n");
Py_DECREF(siteMain);
} else {
PyObject* siteMainResult = PyObject_CallObject(siteMain, nullptr);
Py_DECREF(siteMain);
if (siteMainResult == nullptr) {
PyErr_Print();
fprintf(
stderr, "Error: could not call function 'main' in module 'site'\n");
}
Py_DECREF(siteMainResult);
}
}
}

int main(int argc, char* argv[]) {
PyStatus status;
PyConfig config;
Expand Down Expand Up @@ -114,10 +88,6 @@ int main(int argc, char* argv[]) {
}
}

// Defer importing `site` until after static extension finder is initialized.
auto siteImport = config.site_import;
config.site_import = 0;

// Check if we're using par_style="native", if so, modify sys.path to include
// the executable-zipfile to it, and set a main module to run when invoked.
#ifdef NATIVE_PAR_STYLE
Expand Down Expand Up @@ -218,8 +188,5 @@ int main(int argc, char* argv[]) {
}

PyConfig_Clear(&config);
if (siteImport) {
call_site_main();
}
return Py_RunMain();
}

0 comments on commit 3ec582c

Please sign in to comment.