Skip to content

Commit 25b60de

Browse files
Drop _Py_IsDevelopmentEnv().
1 parent d93c1e7 commit 25b60de

File tree

4 files changed

+4
-60
lines changed

4 files changed

+4
-60
lines changed

Include/internal/pycore_pylifecycle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ PyAPI_FUNC(PyStatus) _Py_PreInitializeFromConfig(
124124
const struct _PyArgv *args);
125125

126126
PyAPI_FUNC(const wchar_t *) _Py_GetStdlibDir(const PyConfig *);
127-
PyAPI_FUNC(bool) _Py_IsDevelopmentEnv(const PyConfig *);
128127

129128
PyAPI_FUNC(int) _Py_HandleSystemExit(int *exitcode_p);
130129

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
Freeze all the modules that are imported during Python startup. This gives
22
us meaningful performance improvements to startup. Also add a new command
33
line option, "-X frozen_modules=[on|off]" to opt out of (or into) using
4-
frozen modules. This defaults to "on" (or "off" if running in a local
5-
development environment, saving contributors some frustration).
4+
frozen modules. This defaults to "on".

Python/initconfig.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,9 @@ _PyConfig_InitImportConfig(PyConfig *config)
21272127
/* -X frozen_modules=[on|off] */
21282128
const wchar_t *value = config_get_xoption_value(config, L"frozen_modules");
21292129
if (value == NULL) {
2130-
config->use_frozen_modules = !_Py_IsDevelopmentEnv(config);
2130+
// Use a meaningful default.
2131+
// XXX Add the logic.
2132+
config->use_frozen_modules = false;
21312133
}
21322134
else if (wcscmp(value, L"on") == 0) {
21332135
config->use_frozen_modules = true;

Python/pathconfig.c

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
99
#include "pycore_pystate.h" // _Py_GetMainConfig()
1010
#include <wchar.h>
11-
#include <stdbool.h>
1211
#ifdef MS_WINDOWS
1312
# include <windows.h> // GetFullPathNameW(), MAX_PATH
1413
#endif
@@ -37,17 +36,6 @@ copy_wstr(wchar_t **dst, const wchar_t *src)
3736
return 0;
3837
}
3938

40-
static size_t
41-
find_basename(const wchar_t *filename)
42-
{
43-
for (size_t i = wcslen(filename); i > 0; --i) {
44-
if (filename[i] == SEP) {
45-
return i + 1;
46-
}
47-
}
48-
return 0;
49-
}
50-
5139

5240
static void
5341
pathconfig_clear(_PyPathConfig *config)
@@ -659,50 +647,6 @@ Py_GetProgramName(void)
659647
}
660648

661649

662-
static const wchar_t *
663-
get_executable(const PyConfig *fallback)
664-
{
665-
const wchar_t *executable = Py_GetProgramFullPath();
666-
if (executable != NULL) {
667-
return executable;
668-
}
669-
if (fallback == NULL) {
670-
fallback = _Py_GetMainConfig();
671-
if (fallback == NULL) {
672-
return NULL;
673-
}
674-
}
675-
return fallback->executable;
676-
}
677-
678-
bool
679-
_Py_IsDevelopmentEnv(const PyConfig *fallback)
680-
{
681-
const wchar_t *executable = get_executable(fallback);
682-
if (executable == NULL) {
683-
return false;
684-
}
685-
size_t len = find_basename(executable);
686-
if (wcscmp(executable + len, L"python") != 0) {
687-
if (wcscmp(executable + len, L"python.exe") != 0) {
688-
return false;
689-
}
690-
}
691-
/* If dirname() is the same for both then it is a local (dev) build. */
692-
const wchar_t *stdlib = _Py_GetStdlibDir(fallback);
693-
if (stdlib == NULL) {
694-
return false;
695-
}
696-
if (len != find_basename(stdlib)) {
697-
return false;
698-
}
699-
if (wcsncmp(stdlib, executable, len) != 0) {
700-
return false;
701-
}
702-
return true;
703-
}
704-
705-
706650
/* Compute module search path from argv[0] or the current working
707651
directory ("-m module" case) which will be prepended to sys.argv:
708652
sys.path[0].

0 commit comments

Comments
 (0)