Skip to content

Commit e37a662

Browse files
committedAug 31, 2020
Add Y_PYTHON_BYTES_WARNING
ref:87335a86302dd2c1fe0a1247329be307478cc698
1 parent e2ec660 commit e37a662

File tree

1 file changed

+6
-0
lines changed
  • library/python/runtime_py3/main

1 file changed

+6
-0
lines changed
 

‎library/python/runtime_py3/main/main.c

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ void Py_InitArgcArgv(int argc, wchar_t **argv);
99
char* GetPyMain();
1010

1111
static const char* env_entry_point = "Y_PYTHON_ENTRY_POINT";
12+
static const char* env_bytes_warning = "Y_PYTHON_BYTES_WARNING";
1213

1314
#ifdef _MSC_VER
1415
extern char** environ;
@@ -98,6 +99,11 @@ static int pymain(int argc, char** argv) {
9899
PyConfig_InitPythonConfig(&config);
99100
config.pathconfig_warnings = 0; /* Suppress errors from getpath.c */
100101

102+
const char* bytes_warning = getenv(env_bytes_warning);
103+
if (bytes_warning) {
104+
config.bytes_warning = atoi(bytes_warning);
105+
}
106+
101107
oldloc = _PyMem_RawStrdup(setlocale(LC_ALL, NULL));
102108
if (!oldloc) {
103109
fprintf(stderr, "out of memory\n");

0 commit comments

Comments
 (0)