require dates specified as strings to include 4-digit years, otherwise
2-digit years are converted based on rules described in the \fItime\fP
module documnetation.
+.IP PYTHONOPTIMIZE
+If this is set to a non-empty string it is equivalent to specifying
+the \fB\-O\fP option. If set to an integer, it is equivalent to
+specifying \fB\-O\fP multiple times.
.IP PYTHONDEBUG
If this is set to a non-empty string it is equivalent to specifying
-the \fB\-d\fP option.
+the \fB\-d\fP option. If set to an integer, it is equivalent to
+specifying \fB\-d\fP multiple times.
.IP PYTHONINSPECT
If this is set to a non-empty string it is equivalent to specifying
the \fB\-i\fP option.
the \fB\-u\fP option.
.IP PYTHONVERBOSE
If this is set to a non-empty string it is equivalent to specifying
-the \fB\-v\fP option.
+the \fB\-v\fP option. If set to an integer, it is equivalent to
+specifying \fB\-v\fP multiple times.
.SH AUTHOR
.nf
Guido van Rossum
*/
+static int
+add_flag(int flag, const char *envs)
+{
+ int env = atoi(envs);
+ if (flag < env)
+ flag = env;
+ if (flag < 1)
+ flag = 1;
+ return flag;
+}
+
void
Py_Initialize(void)
{
initialized = 1;
if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0')
- Py_DebugFlag = Py_DebugFlag ? Py_DebugFlag : 1;
+ Py_DebugFlag = add_flag(Py_DebugFlag, p);
if ((p = Py_GETENV("PYTHONVERBOSE")) && *p != '\0')
- Py_VerboseFlag = Py_VerboseFlag ? Py_VerboseFlag : 1;
+ Py_VerboseFlag = add_flag(Py_VerboseFlag, p);
if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
- Py_OptimizeFlag = Py_OptimizeFlag ? Py_OptimizeFlag : 1;
+ Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
interp = PyInterpreterState_New();
if (interp == NULL)