cpython/Modules
Guido van Rossum 393661d15f 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 17:40:15 +00:00
..
.cvsignore Add Setup.config 2000-06-30 16:09:01 +00:00
_codecsmodule.c Patch #445762: Support --disable-unicode 2001-08-17 18:39:25 +00:00
_curses_panel.c init_curses_panel(): Be more consistent with indentation and blank lines. 2001-01-27 18:58:04 +00:00
_cursesmodule.c Remove warnings from the SGI compiler. 2001-07-19 20:48:32 +00:00
_localemodule.c Fix portability problems with glibc 2.0, as reported in #449157. 2001-08-15 17:14:33 +00:00
_sre.c Removed unreachable return to silence SGI compiler. 2001-08-30 14:37:07 +00:00
_testcapimodule.c Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
_tkinter.c Patch #445762: Support --disable-unicode 2001-08-17 18:39:25 +00:00
_weakref.c Use new GC API. 2001-08-29 23:54:21 +00:00
addrinfo.h Fix portability problems with glibc 2.0, as reported in #449157. 2001-08-15 17:14:33 +00:00
almodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
ar_beos Moved BeOS/ar-fake and BeOS/linkmodule to Modules/ar_beos and 2001-02-16 03:24:50 +00:00
arraymodule.c Fix buffer_info() docstring to match reality. See SF bug #444842. 2001-07-27 16:05:32 +00:00
audioop.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
binascii.c This closes bug #430849 (internal error produced by binascii.a2b_base64) 2001-06-07 05:51:36 +00:00
bsddbmodule.c Don't raise MemoryError in keys() when the database is empty. 2001-03-22 00:19:22 +00:00
ccpython.cc Patch and new file by Geoff Furnish for C++ compilation. 1999-12-16 17:52:08 +00:00
cdmodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
cgen.py Change copyright notice. 2000-07-01 00:16:13 +00:00
cgensupport.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
cgensupport.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
clmodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
cmathmodule.c asin micro-optimization suggested in email. 2001-02-22 19:51:56 +00:00
config.c.in gcmodule is now enabled here 2001-08-30 00:12:32 +00:00
cPickle.c load_int: The fallback to long ints was coded in such a way that it 2001-08-28 22:08:34 +00:00
cryptmodule.c Use METH_OLDARGS instead of numeric constant 0 in method def. tables 2000-08-03 02:34:44 +00:00
cStringIO.c In O_writelines: Replace use of string.joinfields with "".join. 2001-02-09 23:44:22 +00:00
cstubs REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
dbmmodule.c SF Patch #103185, by jlt63: Some more standard modules cleanup for Cygwin 2001-01-22 15:29:14 +00:00
dlmodule.c Patch #404680: disables the nis module and enables the dl module when 2001-02-27 20:54:23 +00:00
errnomodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
fcntlmodule.c fcntl.ioctl(): Update error message; necessity noted by Michael Hudson. 2001-05-14 21:02:36 +00:00
flmodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
fmmodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
fpectlmodule.c Define sunmath prototypes if sunmath.h was not included. 2001-03-07 10:22:20 +00:00
fpetestmodule.c Needed to add DL_EXPORT to (redundant?) extern decl of module init function. 1998-12-10 16:49:28 +00:00
gcmodule.c Make more things internal to this file. Remove 2001-08-30 00:05:51 +00:00
gdbmmodule.c SF patch 404928: Support for next Cygwin gcc (2.95.2-8) 2001-02-28 16:44:18 +00:00
getaddrinfo.c Removed an unreachable break statement to silence SGI compiler. 2001-08-30 14:15:38 +00:00
getbuildinfo.c Patch #411138: Rename config.h to pyconfig.h. Closes bug #231774. 2001-07-26 13:41:06 +00:00
getnameinfo.c Fix portability problems with glibc 2.0, as reported in #449157. 2001-08-15 17:14:33 +00:00
getpath.c With WITH_NEXT_FRAMEWORK defined we now also expect a normal Python 2001-08-15 01:14:40 +00:00
glmodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
grpmodule.c Make sure we close the group and password databases when we are done with 2001-03-11 03:03:07 +00:00
imageop.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
imgfile.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
ld_so_aix Mod suggested by Donn Cave -- invoke makexp_aix relative to $0 1997-09-03 00:45:30 +00:00
ld_so_beos Remove a hard coded Python version, and a now incorrect relative path. Closes 2001-02-16 03:27:35 +00:00
license.terms Add an optional hack for threads in Tkinter. 1997-09-28 05:52:41 +00:00
linuxaudiodev.c Applying SF patch #412553 by Christopher Lee: fix linuxaudiodev 2001-04-02 17:59:02 +00:00
main.c Add warning mode for classic division, almost exactly as specified in 2001-08-31 17:40:15 +00:00
makesetup Separate CFLAGS and CPPFLAGS. CFLAGS should not contain preprocessor 2001-06-02 06:16:02 +00:00
makexp_aix remove C++ entries of the form Class::method 1998-04-09 21:46:02 +00:00
mathmodule.c Part of SF patch [#431848] mathmodule.c: doc strings & conversion, from 2001-08-07 22:10:00 +00:00
md5.h Rationalize use of limits.h, moving the inclusion to Python.h. 2000-09-26 05:46:01 +00:00
md5c.c Fix includes; not including Python.h caused the module not to compile on 2000-09-28 02:54:51 +00:00
md5module.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
mmapmodule.c Fix SF #441664: Python crash on del of a slice of a mmap 2001-07-16 15:47:36 +00:00
mpzmodule.c Python.h: Don't attempt to redefine NDEBUG if it's already defined. 2001-07-15 18:38:47 +00:00
newmodule.c Back out trying to use the C values for CO_xxx. 2001-08-24 06:29:12 +00:00
nismodule.c Move declaration of 'clnt_create()' NIS function to pyport.h, as it's 2001-01-21 23:34:12 +00:00
operator.c Add wrappers around the rich-comparison operations. 2001-08-09 20:14:34 +00:00
parsermodule.c Use the abstract object interfaces when digging around in module objects 2001-08-15 16:44:56 +00:00
pcre-int.h AMK's revised version of the previous patch. 1998-05-07 15:32:44 +00:00
pcre.h Jack Jansen: Mac Carbon: don't include sys/types if we don't have it 2000-06-28 20:56:30 +00:00
pcremodule.c Make more warnings go away on the SGI compiler. 2001-07-19 21:29:49 +00:00
posixmodule.c SF bug [#456252] Python should never stomp on [u]intptr_t. 2001-08-29 21:37:10 +00:00
puremodule.c Do the absolute minimal amount of modifications to eradicate 2000-09-01 09:01:32 +00:00
pwdmodule.c Make sure we close the group and password databases when we are done with 2001-03-11 03:03:07 +00:00
pyexpat.c Patch #445762: Support --disable-unicode 2001-08-17 18:39:25 +00:00
pypcre.c Fix for bug #110651 (Jitterbug PR#343): only use the low 8 bits of an octal 2000-08-02 13:41:18 +00:00
python.c Even more ANSIfication: fix as many function pointers and declarations as 2000-07-22 23:57:55 +00:00
readline.c Cleaned up the docstring for readline.set_completer(). 2001-08-01 21:44:14 +00:00
regexmodule.c initregex(): this function is declared void, so the recent change to 2001-07-09 18:15:38 +00:00
regexpr.c Python.h: Don't attempt to redefine NDEBUG if it's already defined. 2001-07-15 18:38:47 +00:00
regexpr.h Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either 2000-07-16 12:04:32 +00:00
resource.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
rgbimgmodule.c Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)', 2000-07-21 06:00:07 +00:00
rotormodule.c Part of SF patch #102409 by jlt63 to support building these modules 2001-01-10 21:03:32 +00:00
selectmodule.c Stop adding 3 to FD_SETSIZE -- it makes no sense. If it turns out it 2001-08-16 21:59:46 +00:00
Setup.config.in gcmodule is now always compiled 2001-08-30 00:13:38 +00:00
Setup.dist Merge changes from r22a2-branch back into trunk. Also, change patch 2001-08-22 19:24:42 +00:00
sgimodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
shamodule.c Cleanup logic a little. Check args first, then try to create the 2001-01-29 22:46:35 +00:00
signalmodule.c Make more warnings go away on the SGI compiler. 2001-07-19 21:29:49 +00:00
socketmodule.c SF bug [#456252] Python should never stomp on [u]intptr_t. 2001-08-29 21:37:10 +00:00
sre.h merged with pythonware's SRE 2.1.1 codebase 2001-07-02 16:42:49 +00:00
sre_constants.h added martin's BIGCHARSET patch to SRE 2.1.1. martin reports 2x 2001-07-02 16:58:38 +00:00
stropmodule.c Add warnings to the strop module, for to those functions that really 2001-05-15 02:14:44 +00:00
structmodule.c SF bug #442520: test_struct fails on SPARC. 2001-07-18 20:47:31 +00:00
sunaudiodev.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
svmodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
symtablemodule.c Export three optimization (fast locals) flags 2001-04-16 18:42:13 +00:00
syslogmodule.c Do the absolute minimal amount of modifications to eradicate 2000-09-01 09:01:32 +00:00
tclNotify.c Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)', 2000-07-21 06:00:07 +00:00
termios.c Forward-port revision 2.24.2.4 from the release21-maint branch: 2001-06-15 12:05:44 +00:00
testcapi_long.h Fix error in comment, and in test_long_api and test_longlong_api remove 2001-06-16 08:10:13 +00:00
threadmodule.c Use PyThreadState_DeleteCurrent() instead of PyThreadState_Delete() 2001-01-23 01:47:18 +00:00
timemodule.c make the gettmarg error message more correct by making it more vague ;-) 2001-08-22 12:39:16 +00:00
timing.h remove rcs history 1996-01-26 21:10:22 +00:00
timingmodule.c Do the absolute minimal amount of modifications to eradicate 2000-09-01 09:01:32 +00:00
tkappinit.c Removing warnings discovered by gcc -Wall 2000-08-04 15:53:06 +00:00
unicodedata.c Kill a warning on the SGI compiler. 2001-07-19 21:11:13 +00:00
unicodedata_db.h compress unicode decomposition tables (this saves another 55k) 2001-01-21 22:41:08 +00:00
unicodename_db.h compress unicode decomposition tables (this saves another 55k) 2001-01-21 22:41:08 +00:00
xreadlinesmodule.c Remove bogus PyGC_HEAD_SIZE. 2001-08-29 23:50:42 +00:00
xxmodule.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
xxsubtype.c Change the type names to xxsublist.<name>. 2001-08-16 09:10:42 +00:00
yuv.h REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
yuvconvert.c REMOVED all CWI, CNRI and BeOpen copyright markings. 2000-09-01 23:29:29 +00:00
zlibmodule.c Patch #103926: fix two warnings from Tru64's compiler 2001-02-22 15:52:55 +00:00