1996-05-22 13:38:17 -03:00
|
|
|
|
|
|
|
#ifndef Py_PYDEBUG_H
|
|
|
|
#define Py_PYDEBUG_H
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern DL_IMPORT(int) Py_DebugFlag;
|
|
|
|
extern DL_IMPORT(int) Py_VerboseFlag;
|
1997-02-14 15:51:09 -04:00
|
|
|
extern DL_IMPORT(int) Py_InteractiveFlag;
|
1997-03-03 15:13:54 -04:00
|
|
|
extern DL_IMPORT(int) Py_OptimizeFlag;
|
1997-08-29 19:34:00 -03:00
|
|
|
extern DL_IMPORT(int) Py_NoSiteFlag;
|
1997-08-29 19:01:11 -03:00
|
|
|
extern DL_IMPORT(int) Py_UseClassExceptionsFlag;
|
1998-02-06 18:27:46 -04:00
|
|
|
extern DL_IMPORT(int) Py_FrozenFlag;
|
1998-04-10 14:59:44 -03:00
|
|
|
extern DL_IMPORT(int) Py_TabcheckFlag;
|
2000-05-01 14:55:15 -03:00
|
|
|
extern DL_IMPORT(int) Py_UnicodeFlag;
|
2001-07-23 13:30:27 -03:00
|
|
|
extern DL_IMPORT(int) Py_IgnoreEnvironmentFlag;
|
Add warning mode for classic division, almost exactly as specified in
PEP 238. Changes:
- add a new flag variable Py_DivisionWarningFlag, declared in
pydebug.h, defined in object.c, set in main.c, and used in
{int,long,float,complex}object.c. When this flag is set, the
classic division operator issues a DeprecationWarning message.
- add a new API PyRun_SimpleStringFlags() to match
PyRun_SimpleString(). The main() function calls this so that
commands run with -c can also benefit from -Dnew.
- While I was at it, I changed the usage message in main() somewhat:
alphabetized the options, split it in *four* parts to fit in under
512 bytes (not that I still believe this is necessary -- doc strings
elsewhere are much longer), and perhaps most visibly, don't display
the full list of options on each command line error. Instead, the
full list is only displayed when -h is used, and otherwise a brief
reminder of -h is displayed. When -h is used, write to stdout so
that you can do `python -h | more'.
Notes:
- I don't want to use the -W option to control whether the classic
division warning is issued or not, because the machinery to decide
whether to display the warning or not is very expensive (it involves
calling into the warnings.py module). You can use -Werror to turn
the warnings into exceptions though.
- The -Dnew option doesn't select future division for all of the
program -- only for the __main__ module. I don't know if I'll ever
change this -- it would require changes to the .pyc file magic
number to do it right, and a more global notion of compiler flags.
- You can usefully combine -Dwarn and -Dnew: this gives the __main__
module new division, and warns about classic division everywhere
else.
2001-08-31 14:40:15 -03:00
|
|
|
extern DL_IMPORT(int) Py_DivisionWarningFlag;
|
2001-12-06 02:23:26 -04:00
|
|
|
/* _XXX Py_QnewFlag should go away in 2.3. It's true iff -Qnew is passed,
|
|
|
|
on the command line, and is used in 2.2 by ceval.c to make all "/" divisions
|
|
|
|
true divisions (which they will be in 2.3). */
|
|
|
|
extern DL_IMPORT(int) _Py_QnewFlag;
|
2001-07-23 13:30:27 -03:00
|
|
|
|
2001-07-23 13:50:15 -03:00
|
|
|
/* this is a wrapper around getenv() that pays attention to
|
2001-07-23 13:30:27 -03:00
|
|
|
Py_IgnoreEnvironmentFlag. It should be used for getting variables like
|
|
|
|
PYTHONPATH and PYTHONHOME from the environment */
|
|
|
|
#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))
|
1996-05-22 13:38:17 -03:00
|
|
|
|
2002-07-08 23:57:01 -03:00
|
|
|
DL_IMPORT(void) Py_FatalError(const char *message);
|
1996-05-22 13:38:17 -03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* !Py_PYDEBUG_H */
|