Commit Graph

3340 Commits

Author SHA1 Message Date
Greg Ward 58ae13c1b2 Rename the parameter 'xp' in several methods to 'self', since that's
what it is.
2002-12-31 03:07:21 +00:00
Greg Ward 499b73e1cd For symmetry with the mixer interface, rename oss_t to oss_audio_t and
OSSType to OSSAudioType.
2002-12-31 03:04:52 +00:00
Greg Ward da1cacb38b Add a bunch of comments to clearly delineate sections of the code. 2002-12-31 03:02:23 +00:00
Greg Ward 2d6f9a9a86 Yet another renaming of some mixer methods:
devices(), stereodevices(), recdevices() ->
  controls(), stereocontrols(), reccontrols()

Based on recommendation of Hannu Savolainen <hannu@opensound.com>:

  The right term to use for things like bass/treble/mic/vol/etc is
  "control".

  "Device" refers to different mixer devices (/dev/mixer0 to /dev/mixerN).

  "Channel" cannot be used because it refers to mono/stereo/multich
  channels. In fact most mixer controls have left/right channels so ...
2002-12-31 02:54:43 +00:00
Greg Ward f05aa10eae Rename more mixer methods: getrecsrc() -> get_recsrc(),
setrecsrc() -> set_recsrc().
2002-12-30 23:19:32 +00:00
Jack Jansen 5eaeaf9174 Added casts to forestall warnings with MetroWerks. 2002-12-30 23:06:14 +00:00
Tim Peters f271c272a2 Squashed compiler wng from MSVC6. 2002-12-30 22:44:03 +00:00
Tim Peters 1ea93f2b1d Wouldn't compile on Windows; fixed. 2002-12-30 22:42:57 +00:00
Just van Rossum 52e14d640b PEP 302 + zipimport:
- new import hooks in import.c, exposed in the sys module
- new module called 'zipimport'
- various changes to allow bootstrapping from zip files

I hope I didn't break the Windows build (or anything else for that
matter), but then again, it's been sitting on sf long enough...

Regarding the latest discussions on python-dev: zipimport sets
pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as
/path/to/Archive.zip/subdir/ are supported again.
2002-12-30 22:08:05 +00:00
Tim Peters e39a80c362 Bite the bullet on all the indirect timetz and datetimetz tzinfo methods:
make the callers figure out the right tzinfo arguments to pass, instead of
making the callees guess.  The code is uglier this way, but it's less
brittle (when the callee guesses, the caller can get surprised).
2002-12-30 21:28:52 +00:00
Barry Warsaw 9a0d779c7d Port BerkeleyDB 4.1 support from the pybsddb project. bsddb is now at
version 4.1.1 and works with up to BerkeleyDB 4.1.25.
2002-12-30 20:53:52 +00:00
Tim Peters bad8ff089a A step on the way to making tzinfo classes writable by mortals: get rid
of the timetz case.  A tzinfo method will always see a datetimetz arg,
or None, now.  In the former case, it's still possible that it will get
a datetimetz argument belonging to a different timezone.  That will get
fixed next.
2002-12-30 20:52:32 +00:00
Martin v. Löwis 5b177f18ee Silence cast warnings for Tcl 8.3. 2002-12-30 18:14:15 +00:00
Guido van Rossum faf5e4d48f Patch 659834 by Magnus Lie Hetland:
Check for readline 2.2 features.  This should make it possible to
compile readline.c again with GNU readline versions 2.0 or 2.1; this
ability was removed in readline.c rev. 2.49.  Apparently the older
versions are still in widespread deployment on older Solaris
installations.  With an older readline, completion behavior is subtly
different (a space is always added).
2002-12-30 16:25:41 +00:00
Greg Ward ad4d9b9749 Untabify. 2002-12-30 03:02:22 +00:00
Greg Ward e70376646e Whitespace fixes to conform to coding standards. 2002-12-30 03:01:48 +00:00
Greg Ward 5c5c577c08 Comment fix. 2002-12-30 02:58:04 +00:00
Greg Ward 37897c2672 Rename some mixer methods:
* channels() -> devices()
  * stereochannels() -> stereodevices()
  * recchannels() -> recdevices()
  * getvol() -> get()
  * setvol() -> set()
This is for (slightly) more consistency with the OSS ioctl names
(READ_DEVMASK, READ_RECMASK, READ_STEREODEVS).

Also make sure the C function names correspond more closely to the
Python method names for mixer methods.
2002-12-30 02:43:36 +00:00
Greg Ward 7b43c68162 Remove 'x_' prefix from oss_t and oss_mixer_t struct members.
(It added nothing, and served no obvious purpose.)

Export SOUND_MIXER_NRDEVICES constant.
2002-12-30 02:29:28 +00:00
Raymond Hettinger 40f6217092 SF patch 658251: Install a C implementation of the Mersenne Twister as the
core generator for random.py.
2002-12-29 23:03:38 +00:00
Raymond Hettinger 3c736f1a41 Demonstrate use of PyType_Ready() in the example. 2002-12-29 17:16:49 +00:00
Raymond Hettinger ea3fdf44a2 SF patch #659536: Use PyArg_UnpackTuple where possible.
Obtain cleaner coding and a system wide
performance boost by using the fast, pre-parsed
PyArg_Unpack function instead of PyArg_ParseTuple
function which is driven by a format string.
2002-12-29 16:33:45 +00:00
Tim Peters 4643bd9a9c Apparently FreeBSD enables some HW floating-point exceptions by default.
This can cause core dumps when Python runs.  Python relies on the 754-
(and C99-) mandated default "non-stop" mode for FP exceptions.  This
patch from Ben Laurie disables at least one FP exception on FreeBSD at
Python startup time.
2002-12-28 21:56:08 +00:00
Martin v. Löwis 5b26abb37a Gracefully delay runtime error up to 1s. Add .willdispatch(). 2002-12-28 09:23:09 +00:00
Martin v. Löwis 438b534ad0 Patch #657889: Implement posix.getloadavg. 2002-12-27 10:16:42 +00:00
Tim Peters 8702d5f33f And put back a little code duplication, in the form of asserts. 2002-12-27 02:26:16 +00:00
Tim Peters 00237037ae Squash recently-introduced code duplication. 2002-12-27 02:21:51 +00:00
Tim Peters 60c76e4016 Make comparison and subtraction of aware objects ignore tzinfo if the
operands have identical tzinfo members (meaning object identity -- "is").
I misunderstood the intent here, reading wrong conclusion into
conflicting clues.
2002-12-27 00:41:11 +00:00
Tim Peters 80475bb4d2 Implemented datetime.astimezone() and datetimetz.astimezone(). 2002-12-25 07:40:55 +00:00
Guido van Rossum 75bfd0585b Add an XXX comment about relative imports. 2002-12-24 18:10:07 +00:00
Tim Peters 12bf339aea Implemented .replace() methods for date, datetime, datetimetz, time and
timetz.
2002-12-24 05:41:27 +00:00
Jack Jansen 0a116f3a29 Squashed compiler warnings by adding casts, making sure prototypes are in
scope and looking at types.
2002-12-23 21:03:36 +00:00
Tim Peters 2736285035 call_utc_tzinfo_method(): Got rid of the label and the gotos. 2002-12-23 16:17:39 +00:00
Tim Peters d684415572 I give up: unless I write my own strftime by hand, datetime just can't
be trusted with years before 1900, so now we raise ValueError if a date or
datetime or datetimetz .strftime() method is called with a year before
1900.
2002-12-22 20:58:42 +00:00
Tim Peters 83b85f1d6c Python's strftime implementation does strange things with the year,
such that the datetime tests failed if the envar PYTHON2K was set.
This is an utter mess, and the datetime module's strftime functions
inherit it.  I suspect that, regardless of the PYTHON2K setting, and
regardless of platform limitations, the datetime strftime wrappers
will end up delivering nonsense results (or bogus exceptions) for
any year before 1900.  I should probably just refuse to accept years
earlier than that -- else we'll have to implement strftime() by hand.
2002-12-22 20:34:46 +00:00
Tim Peters 14b6941197 classify_object(): Renamed more meaningfully, to classify_utcoffset().
Also changed logic so that instances of user-defined subclasses of date,
time, and datetime are called OFFSET_NAIVE instead of OFFSET_UNKNOWN.
2002-12-22 18:10:22 +00:00
Tim Peters 855fe88b24 Implemented a Wiki suggestion:
{timetz,datetimetz}.{utcoffset,dst}() now return a timedelta (or None)
instead of an int (or None).

tzinfo.{utcoffset,dst)() can now return a timedelta (or an int, or None).

Curiously, this was much easier to do in the C implementation than in the
Python implementation (which lives in the Zope3 code tree) -- the C code
already had lots of hair to extract C ints from offset objects, and used
C ints internally.
2002-12-22 03:43:39 +00:00
Martin v. Löwis 9c36c29156 Use wcscoll for _locale.strcoll if available. 2002-12-21 18:34:06 +00:00
Tim Peters 328fff7214 format_utcoffset(): The natural type of the buflen arg is size_t, so
used that.

wrap_strftime():  Removed the most irritating uses of buf.

TestDate.test_ordinal_conversions():  The C implementation is fast enough
that we can afford to check the endpoints of every year.  Also added
tm_yday tests at the endpoints.
2002-12-20 01:31:27 +00:00
Neal Norwitz dfb8086760 Fix another long vs int mismatch. test_datetime now passes on alpha 2002-12-19 02:30:56 +00:00
Tim Peters 0b0f41cf1f Fixed typo in string. 2002-12-19 01:44:38 +00:00
Neal Norwitz c296c63c73 Fix crash on alphas due to mismatch between 'l' format and int variables. 2002-12-19 00:42:03 +00:00
Tim Peters ba873472d2 delta_str(): Purged last uses of sprintf (in favor of PyOS_snprintf). 2002-12-18 20:19:21 +00:00
Jack Jansen 51cd8a2d24 "time_second" is apparently a #define on MacOSX. Renamed the (static)
routine to py_time_second.
2002-12-17 20:57:24 +00:00
Guido van Rossum bd43e9195b Fix GCC warnings. It turns out two out of three pointed to real bugs! 2002-12-16 20:34:55 +00:00
Tim Peters 2a799bf77a datetime escapes the sandbox. The Windows build is all set. I leave it
to others to argue about how to build it on other platforms (on Windows
it's in its own DLL).
2002-12-16 20:18:38 +00:00
Raymond Hettinger 866964c3a3 Apply SF patch 652930: Add optional base argument to math.log(x[, base]). 2002-12-14 19:51:34 +00:00
Guido van Rossum 0847c5c6c7 execve(), spawnve(): add some extra sanity checking to env;
PyMapping_Check() doesn't guarantee that PyMapping_Size() won't raise
an exception, nor that keys and values are lists.

Also folded some long lines and did a little whitespace normalization.

Probably a 2.2 backport candidate.
2002-12-13 18:36:22 +00:00
Jack Jansen 747c3d3f02 We need macglue on MacPython-OS9 too. 2002-12-13 15:20:53 +00:00
Martin v. Löwis 7d1349553b Always initialize objc. 2002-12-12 19:05:48 +00:00
Marc-André Lemburg b28de0d79f Patch to make _codecs a builtin module. This is necessary since
Python 2.3 will support source code encodings which rely on the
builtin codecs being available to the parser.

Remove struct dependency from codecs.py
2002-12-12 17:37:50 +00:00
Greg Ward b69bb3d019 Typo fix. 2002-12-12 17:35:45 +00:00
Martin v. Löwis b5bfb9f38c Support threads-enabled Tcl installations. 2002-12-12 17:07:58 +00:00
Martin v. Löwis 135594648f This is not used anymore. 2002-12-11 19:55:48 +00:00
Greg Ward 3d9994d3b0 Add OSS mixer interface (from Nicholas FitzRoy-Dale <wzdd@lardcave.net>):
* add oss_mixer_t and OSSMixerType
  * add newossmixerobject(), oss_mixer_dealloc(), ossopenmixer()
  * add _do_ioctl_1_internal() to support mixer ioctls
  * add mixer methods: oss_mixer_{close,fileno,channels,stereo_channels,
    rec_channels,getvol,setvol,getrecsrc,setrecsrc}()
  * add oss_mixer_methods list
  * add oss_mixer_getattr() (why?!)
  * export SOUND_MIXER_* constants from soundcard.h
2002-12-11 15:12:01 +00:00
Greg Ward da9f853b49 Prepare for the coming mixer support patch: change _do_ioctl_0() and
_do_ioctl_1() so they take a file descriptor rather than an oss_t
pointer.
2002-12-11 14:49:59 +00:00
Greg Ward 8c6b6a9f1e Finish expunging the 'linuxaudiodev' name:
* rename oss_t to lad_t, Ladtype to OSSType,
  * rename lad_*() methods to oss_*()
  * rename lad_methods list to oss_methods
Patch and impetus supplied by Nicholas FitzRoy-Dale <wzdd@lardcave.net>.
2002-12-11 14:43:13 +00:00
Martin v. Löwis cf8f47ea95 Patch #650422: Use Posix AF_ constants instead of PF_ ones. 2002-12-11 13:10:57 +00:00
Martin v. Löwis 33ec3ba217 Remove C++ comment. Silence unsigned char* cast warning. 2002-12-07 14:57:11 +00:00
Martin v. Löwis 2fb661fb80 Remove C++ comment. 2002-12-07 14:56:36 +00:00
Tim Peters 4e52ca82ae A patch from Kevin Jacobs, plugging several leaks discovered when
running the sandbox datetime tests.

Bugfix candidate.
2002-12-07 02:43:28 +00:00
Martin v. Löwis 9e43730ca3 Don't include <ioctl.h> unless on __VMS. 2002-12-06 12:57:26 +00:00
Martin v. Löwis 79acb9edfa Patch #614055: Support OpenVMS. 2002-12-06 12:48:53 +00:00
Jason Tishler d0ebd7edb1 Patch #649060: Cygwin bz2module patch
This patch enables the bz2 module to build cleanly under Cygwin.
2002-12-05 20:31:53 +00:00
Martin v. Löwis e07e18d41b Decode untyped strings from UTF-8. 2002-12-04 19:54:36 +00:00
Skip Montanaro 56643679f4 correct wording of comments about old bsddb (now bsddb185) module 2002-12-02 00:27:10 +00:00
Greg Ward 9a568eb245 Expunge any remaining mentions of linuxaudiodev -- it's ossaudiodev now! 2002-11-30 23:20:09 +00:00
Greg Ward 97708bc6f8 Rename LinuxAudioError to OSSAudioError ('ossaudiodev.error').
Use OSSAudioError much less frequently -- all real I/O errors (ie. any
time open(), read(), write(), ioctl(), or select() return an error)
become IOError.  OSSAudioError is only used now for bad open() mode.
2002-11-30 23:17:10 +00:00
Greg Ward 1e0f57d0bb Added mode 'rw' for full-duplex (play and record at the same time) mode.
Added _EXPORT_INT macro to export an integer constant to Python-space.
Use it for all the AFMT_* constants, and update the list of AFMT_*
constants to match what's in Linux 2.4: add AFMT_{QUERY,IMA_ADPCM,
MPEG,AC3}.  This should probably be tested with older versions of OSS,
eg. with Linux 2.2 and 2.0.

Export all SNDCTL_* ioctl numbers (where "all" is the set found in
/usr/include/linux/soundcard.h on my Debian 3.0 system -- again
Linux 2.4).  Again needs to be tested with older OSS versions.
2002-11-30 23:05:26 +00:00
Greg Ward 131bce035a * Don't put the device in non-blocking mode at open() time; this makes
it impossible to access blocking mode!

* Rename write() to writeall(), and add a write() method that just
  does one write().

* Rearrange/simplify writeall(): in particular, don't supply a timeout
  to select().  Let it block forever if it has to.

* Add a bunch of simple ioctl() wrappers: nonblock(), setfmt(),
  getfmts(), channels(), speed(), sync(), reset(), post().  These
  wrap, respectively, SNDCTL_DSP_NONBLOCK, SNDCTL_DSP_SETFMT,
  SNDCTL_DSP_GETFMTS, etc.

* Reduce flush() (which was a wrapper for the SNDCTL_DSP_SYNC ioctl) to
  an alias for sync().

* Rearrange the lad_methods list to reflect the order in which the
  methods are defined, and add some grouping comments.
2002-11-30 22:56:44 +00:00
Greg Ward 04613a9308 ossaudiodev -- Python interface to the OSS (Open Sound System) API.
This module is a replacement for linuxaudiodev, which will eventually
be deprecated.

Initial revision is rev 2.20 of linuxaudiodev.c, with a rewritten
header comment.
2002-11-30 22:47:45 +00:00
Greg Ward a34b1a0749 Allow the device name to be passed to linuxaudiodev.open(), for
consistency with the built-in open() (and every other sane open()
function, for that matter).  The two valid ways to call this open() are
now open(mode) and open(device, mode).

For backwards compatibility, retain the old open(mode) calling syntax --
this makes the error message when you call open(device) a bit confusing,
but oh well.

This is the first half of SF patch #644977.
2002-11-27 22:19:15 +00:00
Martin v. Löwis 4ec2e7071e Avoid including tclInt.h. 2002-11-26 22:12:12 +00:00
Martin v. Löwis 8c8aa5d666 Rename want_objects to wantobjects throughout, for consistency. 2002-11-26 21:39:48 +00:00
Martin v. Löwis ffad633af9 Patch #518625: Return objects in Tkinter. 2002-11-26 09:28:05 +00:00
Martin v. Löwis 52ea7e9244 Patch #632973: Implement _getdefaultlocale for OS X. 2002-11-26 09:05:36 +00:00
Martin v. Löwis b5c980b802 Add unidata_version. Bump generator version number. 2002-11-25 09:13:37 +00:00
Martin v. Löwis d5169bad94 Regenerate from Unicode 3.2.0 to include all First/Last ranges. 2002-11-24 23:10:08 +00:00
Martin v. Löwis 8d93ca1383 Verify that the code in CJK UNIFIED IDEOGRAPH- actually denotes an ideograph. 2002-11-23 22:10:29 +00:00
Martin v. Löwis 677bde2dd1 Patch #626485: Support Unicode normalization. 2002-11-23 22:08:15 +00:00
Martin v. Löwis ef7fe2e813 Implement names for CJK unified ideographs. Add name to KeyError output.
Verify that the lookup for an existing name succeeds.
2002-11-23 18:01:32 +00:00
Martin v. Löwis 2f4be4e38a Fix off-by-one error. 2002-11-23 17:11:06 +00:00
Martin v. Löwis 7d41e29c58 Patch #626548: Support Hangul syllable names. 2002-11-23 12:22:32 +00:00
Martin v. Löwis b2c7affbaa Merge with bsddb3 2002.11.23.10.42.36 2002-11-23 11:26:07 +00:00
Martin v. Löwis e17af7b3db Include Python.h first. 2002-11-23 09:16:19 +00:00
Neal Norwitz 8d4c9817a2 Fix SF # 640557, '64-bit' systems and the dbm module
datum.dsize can apparently be long on some systems.
Ensure we pass an int* to PyArg_Parse("s#"), not &datum.dsize

Will backport.
2002-11-22 23:29:31 +00:00
Fredrik Lundh 09705f0b89 fix for SF #635398 (don't "downcast" return strings from unicode to ascii) 2002-11-22 12:46:35 +00:00
Martin v. Löwis 0073f2e428 Fix --disable-unicode compilation problems. 2002-11-21 23:52:35 +00:00
Walter Dörwald 3b918c3787 Comment out the getcwdu implementation for --disable-unicode builds 2002-11-21 20:18:46 +00:00
Michael W. Hudson 2100798b8c Always call tparm with 10 arguments. It seems it's not varargs i
more often than it is.  In response to bug:

[ 641808 ] Portability of Modules/_cursesmodule.c

submitted by Nick Mclaren.
2002-11-21 14:17:51 +00:00
Martin v. Löwis 21645fc073 Don't try to use unsupported DB versions. 2002-11-19 08:30:08 +00:00
Martin v. Löwis 6aa4a1f29c Import PyBSDDB 3.4.0. Rename historical wrapper to bsddb185. 2002-11-19 08:09:52 +00:00
Neil Schemenauer 47ec6c0790 Don't use PyNumber_Float() since it's is nearly useless. Instead, rely on
PyFloat_AsDouble to generate a good error message.
2002-11-18 16:02:29 +00:00
Walter Dörwald 08c4cc4127 Use PyInt_AsLong instead of PyInt_AS_LONG after the call to
PyNumber_Int, because now PyNumber_Int might return a long,
and PyInt_AsLong can handle that, whereas PyInt_AS_LONG can't.

This closes SF bug #629989.
2002-11-12 11:42:20 +00:00
Neal Norwitz addfe0c09c Make private functions static so we don't pollute the namespace 2002-11-10 14:33:26 +00:00
Martin v. Löwis 774348c8d6 Fix typo. 2002-11-09 19:54:06 +00:00
Tim Peters 6ee6db81c2 bz2_compress/bz2_decompress: more casting away LONG_LONG for
_PyString_Resize calls.
2002-11-09 04:33:36 +00:00
Tim Peters 39185d622d BZ2Decomp_decompress(): Fixed more long vs LONG_LONG confusions. 2002-11-09 04:31:38 +00:00
Tim Peters 2858e5e84b BZ2Comp_flush(): Fixed more int vs LONG_LONG confusions. 2002-11-09 04:30:08 +00:00
Tim Peters f29f0c6a78 BZ2Comp_compress(): Explicitly cast the LONG_LONG size argument to
_PyString_Resize to int.
2002-11-09 04:28:17 +00:00
Tim Peters 07f075cebb BZ2Comp_compress(): changed decl of totalout to LONG_LONG, since it's
solely used to hold LONG_LONG values, and the compiler rightfully warns
about potential data loss otherwise.
2002-11-09 04:26:02 +00:00
Tim Peters a17c0c4509 Repaired signed-vs-unsigned mismatch. 2002-11-09 04:23:31 +00:00
Tim Peters e32280987c This couldn't compile on WIndows, due to hardcoded "long long". Repaired. 2002-11-09 04:21:44 +00:00
Gustavo Niemeyer 49ea7be7e9 * Modules/bz2module.c
(BZ2File_dealloc): Call Util_DropReadAhead().
  (*): Included aesthetic changes by Neal Norwitz.
2002-11-08 14:31:49 +00:00
Michael W. Hudson 019a78e76d Assorted patches from Armin Rigo:
[ 617309 ] getframe hook (Psyco #1)
[ 617311 ] Tiny profiling info (Psyco #2)
[ 617312 ] debugger-controlled jumps (Psyco #3)

These are forward ports from 2.2.2.
2002-11-08 12:53:11 +00:00
Thomas Heller 1f043e28f4 Enforce valid filemode. Fixes SF Bug #623464. 2002-11-07 16:00:59 +00:00
Gustavo Niemeyer c523b04b0f Fixed sre bug "[#581080] Provoking infinite scanner loops".
This bug happened because: 1) the scanner_search and scanner_match methods
were not checking the buffer limits before increasing the current pointer;
and 2) SRE_SEARCH was using "if (ptr == end)" as a loop break, instead of
"if (ptr >= end)".

* Modules/_sre.c
  (SRE_SEARCH): Check for "ptr >= end" to break loops, so that we don't
  hang forever if a pointer passing the buffer limit is used.
  (scanner_search,scanner_match): Don't increment the current pointer
  if we're going to pass the buffer limit.

* Misc/NEWS
  Mention the fix.
2002-11-07 03:28:56 +00:00
Andrew M. Kuchling 7e23f00948 [Patch #633635 from David M. Cooke]
Make keyname raise ValueError if passed -1, avoiding a segfault
   Make getkey() match the docs and raise an exception in nodelay mode
   The return type of getch() is int, not chtype
2002-11-06 14:15:36 +00:00
Gustavo Niemeyer 4e7be06a65 Fixed bug #470582, using a modified version of patch #527371,
from Greg Chapman.

* Modules/_sre.c
  (lastmark_restore): New function, implementing algorithm to restore
  a state to a given lastmark. In addition to the similar algorithm used
  in a few places of SRE_MATCH, restore lastindex when restoring lastmark.
  (SRE_MATCH): Replace lastmark inline restoring by lastmark_restore(),
  function. Also include it where missing. In SRE_OP_MARK, set lastindex
  only if i > lastmark.

* Lib/test/re_tests.py
* Lib/test/test_sre.py
  Included regression tests for the fixed bugs.

* Misc/NEWS
  Mention fixes.
2002-11-06 14:06:53 +00:00
Gustavo Niemeyer 7d7930bb3f * bzmodule.c
More fixes of XDECREF'd values not initialized.
2002-11-05 18:41:53 +00:00
Neal Norwitz 18142c0ca7 Fix SF #633935, test_bz2 fails
Needed to init ret since it was Py_XDECREF()d on error.
All regressions pass in debug build for me.
2002-11-05 18:17:32 +00:00
Gustavo Niemeyer f8ca8364c9 Patch implementing bz2 module.
* setup.py
  (PyBuildExt.detect_modules): Included bz2 module detection.

* Modules/bz2module.c
* Lib/test/test_bz2.py
* Doc/lib/libbz2.tex
  Included files implementing, testing, and documenting bz2 module.

* Doc/Makefile.deps
* Doc/lib/lib.tex
  Include references to libbz2.tex.

* Misc/NEWS
  (Library): Mention distutils' c++ linkage patch, and new bz2 module.
2002-11-05 16:50:05 +00:00
Neal Norwitz 662390681e SF #633013, Fix NIS causing interpreter core dump
Prevent the lengths passed to PyString_FromStringAndSize()
from being negative in some cases.
2002-11-04 23:21:09 +00:00
Neal Norwitz 39d22e5693 Use O_NONBLOCK rather than O_NDELAY, so we get POSIX non-blocking I/O.
On HPUX, Solaris, Tru64 (Dec UNIX), and IRIX (I think),
O_NONBLOCK is the POSIX version of non-blocking I/O
which is what we want.

On Linux and FreeBSD (at least), O_NONBLOCK and O_NDELAY are the same.
So this change should have no negative effect on those platforms.

Tested on Linux, Solaris, HPUX.

Thanks to Anders Qvist for diagnosing this problem.
2002-11-02 19:55:21 +00:00
Neal Norwitz 94a83fdc15 Fix SF #632624, test_resource failure on alpha/64bit
Return PyLongs instead ot PyInts.
On alphas, 9223372036854775807 became -1.
2002-11-02 17:46:24 +00:00
Martin v. Löwis d631ebe20b Remove extra argument in mknod. Fixes #632628. 2002-11-02 17:42:33 +00:00
Walter Dörwald 0ae2981dec Add docstrings to register, lookup, register_error
and lookup_error. This closes SF patch #630622.
2002-10-31 13:36:29 +00:00
Andrew M. Kuchling 3adefccdcb Use personal e-mail address 2002-10-30 21:08:34 +00:00
Martin v. Löwis 566f6afe9a Patch #512981: Update readline input stream on sys.stdin/out change. 2002-10-26 14:39:10 +00:00
Martin v. Löwis c9d07dfc87 Remove duplicate definitions of _XOPEN_SOURCE_EXTENDED. 2002-10-26 13:36:13 +00:00
Martin v. Löwis 9def6a3a77 Update to Unicode 3.2 database. 2002-10-18 16:11:54 +00:00
Fred Drake 5134a54df9 Fix minor whitespace nit, for consistency with Python's C style rules. 2002-10-17 20:37:50 +00:00
Martin v. Löwis 60a5d72908 Patch #623780: Replace obsolete struct macros. 2002-10-16 20:28:25 +00:00
Martin v. Löwis f607bdaa77 Add PyStructSequence_UnnamedField. Add stat_float_times.
Use integers in stat tuple, optionally floats in named fields.
2002-10-16 18:27:39 +00:00
Guido van Rossum 1e700d24e9 posix_execve(): add missing argument for "et" format in PyArg_Parse()
call.  This caused mysterious crashes (hard to debug because it was
happening in a child process).
2002-10-16 16:52:11 +00:00
Neal Norwitz c18b308229 Fix a few docstrings, remove extra commas 2002-10-11 22:19:42 +00:00
Neal Norwitz 98a355d0b3 SF #621948, update docstring for md5 by David M. Cooke. Will backport. 2002-10-11 21:53:01 +00:00
Martin v. Löwis dbe3f76270 Patch #569139: Implementation of major, minor and makedev. 2002-10-10 14:27:30 +00:00
Guido van Rossum 60c8a3aba8 GNU readline() mistakenly sets the LC_CTYPE locale.
This is evil.  Only the user or the app's main() should do this!
We must save and restore the locale around the rl_initialize() call.
2002-10-09 21:27:33 +00:00
Martin v. Löwis 114619e1ed Apply file system default encoding to exec and spawn path and arguments. 2002-10-07 06:44:21 +00:00
Tim Peters 92e4dd8657 s/_alloca/alloca/g; Windows doesn't need the former, at least not unless
__STDC__ is defined (or something like that ...).
2002-10-05 01:47:34 +00:00
Mark Hammond d389036069 Trivial fix to the pep277 checkin: ensure that exceptions always have a filename attribute (previously did only when string filenames were passed, but not when unicode) 2002-10-03 07:24:48 +00:00
Mark Hammond c2e85bd4e2 Patch 594001: PEP 277 - Unicode file name support for Windows NT. 2002-10-03 05:10:39 +00:00
Martin v. Löwis 3c6d6f2ff7 Support UCS-4 builds. 2002-10-01 18:50:56 +00:00
Martin v. Löwis 71e25a0e06 Eliminate constness warnings with Tcl 8.4. 2002-10-01 18:08:06 +00:00
Martin v. Löwis 6bfa2e6892 Drop support for Tk 8.0 and 8.1. 2002-10-01 17:48:31 +00:00
Martin v. Löwis 21ee4091e1 Patch #615069: Fix build problems on SCO Open Server 5. Backported to 2.2. 2002-09-30 16:19:48 +00:00
Guido van Rossum 9b1a80baf4 Patch for the DEC Alpha under Linux, by Lee Busby. 2002-09-26 16:52:02 +00:00
Thomas Heller 7bdabe67a3 I did fix too much - including winsock.h is sufficient. 2002-09-24 17:03:26 +00:00
Thomas Heller 106f4c7ba7 On Windows, call WSAGetLastError() to retrieve the error number.
Bugfix candidate, will backport to release22-maint myself.
2002-09-24 16:51:00 +00:00
Fred Drake 117ac85c4e Be more careful with the type of the xmlhandlersetter; it takes an
XML_Parser, which happens to be a pointer type, not an XML_Parser*.
This generated warnings when compiled with Expat 1.95.5, which no
longer defines XML_Parser to be void*.
2002-09-24 16:24:54 +00:00
Martin v. Löwis 8eb92a014b Patch #608999: Fix portability problems with MIPSPro 7.x 2002-09-19 08:03:21 +00:00
Martin v. Löwis 29275c9331 Deal with NULL fields in mkpwent. 2002-09-17 09:34:06 +00:00
Martin v. Löwis ceb7c18c10 Deal with a NULL gr_passwd. Reported by Anders Qvist. 2002-09-17 07:05:25 +00:00
Martin v. Löwis 658009afdb Make BadPickleGet a class. Fixes #609164. 2002-09-16 17:26:24 +00:00
Guido van Rossum bd6be7aba5 I think it makes more sense that the pseudo filename used by fdopen()
be "<fdopen>" rather than "(fdopen)".
2002-09-15 18:45:46 +00:00
Neal Norwitz bcf9f9eb3b SF # 602108 ensure string is null terminated after strncpy 2002-09-13 14:35:56 +00:00
Michael W. Hudson 806d1c817a Fix *really* embarrassing typo reported by Raymond Hettinger. 2002-09-11 17:09:45 +00:00
Michael W. Hudson 02ff6a9952 A slight change to SET_LINENO-less tracing.
This makes things a touch more like 2.2.  Read the comments in
Python/ceval.c for more details.
2002-09-11 15:36:32 +00:00
Tim Peters 96940cf30d extract_time(): Squash compiler warning about possibly information-
losing implicit double->long cast.
2002-09-10 15:37:28 +00:00
Martin v. Löwis 076b209ca4 Add missing return statement. 2002-09-10 15:04:41 +00:00
Martin v. Löwis 6aa9fdb86a Use utimes(2) where available to support microsecond timestamps. 2002-09-10 09:16:13 +00:00
Martin v. Löwis a32c994129 Always generate floats for stat_result; fix configure test. 2002-09-09 16:17:47 +00:00
Martin v. Löwis 94717ed1d4 Patch #606592: Subsecond timestamps in stat_result. 2002-09-09 14:24:16 +00:00
Neal Norwitz b567392bbf SF bug # 585792, Invalid mmap crashes Python interpreter
Raise ValueError if user passes a size to mmap which is larger
than the file.
2002-09-05 21:48:07 +00:00
Neal Norwitz 884baa1e6b --with(out)-thread is deprecated according to configure --help 2002-09-05 21:31:04 +00:00
Guido van Rossum 83a072d953 Update the module doc comment. 2002-09-03 19:10:18 +00:00
Guido van Rossum 960bc5490b (Most of) SF patch 601369 (Christos Georgiou): obmalloc,structmodule:
64bit, big endian (issue 2 only).

This adds a bunch of memcpy calls via a temporary variable to avoid
alignment errors.  That's needed for some platforms.
2002-09-03 18:42:21 +00:00
Fred Drake f57b22a716 Minor change for symmetry with PyXML: PyDoc_STR should not include
the "safety" parentheses since some older compilers refuse to compile
the module then, claiming that static initializers are non-constant.

This doesn't actually make any difference for Python, since these
definitions are not used when compiling with a version of Python that
already defines the PyDoc_* macros.
2002-09-02 15:54:06 +00:00
Walter Dörwald 3aeb632c31 PEP 293 implemention (from SF patch http://www.python.org/sf/432401) 2002-09-02 13:14:32 +00:00
Guido van Rossum 674deb2eea SF bug 601775 - some int results that should be bool. 2002-09-01 15:06:28 +00:00
Raymond Hettinger 5959c559df Added __pow__(a,b) to the operator module. Completes the pattern of
all operators having a counterpart in the operator module.

Closes SF bug #577513.
2002-08-19 03:19:09 +00:00
Tim Peters 7dca21e59f SF bug 595919: popenN return only text mode pipes
popen2() and popen3() created text-mode pipes even when binary mode
was asked for.  This was specific to Windows.
2002-08-19 00:42:29 +00:00
Guido van Rossum 84b2bed435 Squash a few calls to the hideously expensive PyObject_CallObject(o,a)
-- replace then with slightly faster PyObject_Call(o,a,NULL).  (The
difference is that the latter requires a to be a tuple; the former
allows other values and wraps them in a tuple if necessary; it
involves two more levels of C function calls to accomplish all that.)
2002-08-16 17:01:09 +00:00
Barry Warsaw 0a51b58e6b base64.decodestring('') should return '' instead of raising an
exception.  The bug fix for SF #430849 wasn't quite right.  This
closes SF bug #595671.  I'll backport this to Python 2.2.
2002-08-15 22:14:24 +00:00
Michael W. Hudson dd32a91cc0 This is my patch
[ 587993 ] SET_LINENO killer

Remove SET_LINENO.  Tracing is now supported by inspecting co_lnotab.

Many sundry changes to document and adapt to this change.
2002-08-15 14:59:02 +00:00
Martin v. Löwis 8a8da798a5 Patch #505705: Remove eval in pickle and cPickle. 2002-08-14 07:46:28 +00:00
Neal Norwitz 72cf6a8c07 Fix memory leaks reported by valgrind 2002-08-14 02:03:50 +00:00
Skip Montanaro 23b5918f68 add some example docstrings using PyDoc_STR 2002-08-14 01:45:37 +00:00
Skip Montanaro d9e7d24557 add PyDoc_STR and PyDoc_STRVAR calls as examples for module authors 2002-08-14 01:44:33 +00:00
Neal Norwitz 200788ce45 Allow more docstrings to be removed during compilation in some modules 2002-08-13 22:20:41 +00:00
Guido van Rossum 4030714a93 For new-style classes, we can now test for tp_del instead of asking
for a __del__ attribute, to see if there's a finalizer.
2002-08-09 17:39:14 +00:00
Sjoerd Mullender 9cf424b04b On Cygwin, put stdin, stderr, and stdout in binary mode when the -u
flag is given (to mimic native Windows).
2002-08-09 13:35:18 +00:00
Neal Norwitz 90128ba22c SF bug #592645 fix memory leak in socket.getaddrinfo 2002-08-09 03:37:42 +00:00
Fred Drake 9d416a7c10 Update the text on the Expat module and library. 2002-08-09 02:39:13 +00:00
Guido van Rossum 12e3c710db The other half of the patches added to SF patch 555085 by A I
MacIntyre.  At least on OS/2, a subsequent connect() on a nonblocking
socket returns errno==EISCONN to indicate success.  This seems
harmless on Unix.
2002-08-08 20:39:30 +00:00
Guido van Rossum 22a97159cd Clean up some docstrings. Some docstrings didn't show their return
value; others were inconsistent in what to name the argument or return
value; a few module-global functions had "socket." in front of their
name, against convention.
2002-08-08 20:37:08 +00:00
Jason Tishler 4df78cddaa Patch #588561: Cygwin _hotshot patch
YA Cygwin module patch very similar to other patches
that I have submitted.  I tested under Cygwin and Red
Hat Linux 7.1.
2002-08-08 19:46:15 +00:00
Martin v. Löwis 3f19b10ca5 Replace abort with Py_FatalError. 2002-08-07 16:21:51 +00:00
Tim Peters 5814187f5b internal_connect(): Windows. When sock_timeout > 0 and connect() yields
WSAEWOULDBLOCK, the second connect() attempt appears to yield WSAEISCONN
on Win98 but WSAEINVAL on Win2K.  So accept either as meaning "yawn,
fine".  This allows test_socket to succeed on my Win2K box (which it
already did on my Win98SE box).
2002-08-06 22:25:02 +00:00
Guido van Rossum 8ee5243434 Mark xreadlines deprecated. Don't use f.xreadlines() in test_iter.py. 2002-08-06 17:14:04 +00:00
Fred Drake 5f8a23f32f Since the errno module is needed by os._execvpe(), and that is used by the
setup.py (indirectly) script to build the standard dynamically loaded
modules, the errno module is being made static so it will always be
available.
Closes SF bug #591205 (needed on trunk only).
2002-08-05 18:06:17 +00:00
Martin v. Löwis 7d6e19d70c Add trace_frame. Fixes #534864. Backported to 2.2. 2002-08-04 08:24:49 +00:00
Martin v. Löwis 5a39530274 Add recursion counter for pickling. Fixes #576084.
2.2 bugfix candidate (may cause RuntimeError for applications that
currently work fine).
2002-08-04 08:20:23 +00:00
Fred Drake 610291cf5a Fix ref(), proxy() docstrings, based on comments from David Abrahams. 2002-08-02 20:23:40 +00:00
Skip Montanaro 71ffc5cc4b add #include branch for compilation with Berkeley DB 2002-08-02 17:13:01 +00:00
Jack Jansen 21ed16acbe Added one call to Py_Main(), for OSX framework builds only, that will get the
actual script to run in case we are running from an applet. If we are indeed
running an applet we skip the normal option processing leaving it all to the
applet code.

This allows us to get use the normal python binary in the Python.app bundle,
giving us all the normal command line options through PythonLauncher while
still allowing Python.app to be used as the template for building applets.

Consequently, pythonforbundle is gone, and Mac/Python/macmain.c isn't used
on OSX anymore.
2002-08-02 14:11:24 +00:00
Mark Hammond fe51c6d66e Excise DL_EXPORT/DL_IMPORT from Modules/*. Required adding a prototype
for Py_Main().

Thanks to Kalle Svensson and Skip Montanaro for the patches.
2002-08-02 02:27:13 +00:00
Jack Jansen ea0c3828c0 - Get _environ through the NSEnviron call in a MacOSX framework. This allows
us to completely decouple the framework from the executable, so we
  can use a two-level namespace.
- Do framework builds with a twolevel namespace.
- Reorganized the code that creates the minimal framework in the build
  directory, to make it more robust against incomplete frameworks (from
  earlier aborted builds, or builds of previous Python versions).
2002-08-01 21:57:49 +00:00
Michael W. Hudson b6a4505123 Cray fixup as seen in bug #558153. 2002-07-31 09:54:24 +00:00
Neal Norwitz cfa1f52941 Revert changes to use PyArg_Parse(), so any sequence will continue to work -- Spotted by Just van Rossum 2002-07-30 12:27:43 +00:00
Neal Norwitz 50584b4c78 Use PyArg_ParseTuple() instead of PyArg_Parse() which is deprecated 2002-07-30 01:23:07 +00:00
Neal Norwitz 50d5d4fe31 Fix docstring to be consistent with parameter name (prefix) 2002-07-30 01:17:43 +00:00
Neal Norwitz 1169011f6f SF patch #584245, get python to link on OSF1 (Dec Unix) 2002-07-30 01:08:28 +00:00
Michael W. Hudson 56796f672f Fix for
[ 587875 ] crash on deleting extended slice

The array code got simpler, always a good thing!
2002-07-29 14:35:04 +00:00
Martin v. Löwis 0cec0ffc78 Patch #573770: Implement lchown. 2002-07-28 16:33:45 +00:00
Martin v. Löwis ddc6f4748e Pass length of result structure into setipaddr. Fixes bug #565747.
Committed to 2.2 branch.
2002-07-28 16:10:31 +00:00
Neal Norwitz 2026584016 SF patch #577031, remove PyArg_NoArgs() since it's deprecated
Explicitly use METH_OLDARGS
2002-07-28 15:23:23 +00:00
Neal Norwitz 77c72bb323 SF patch #577031, remove PyArg_Parse() since it's deprecated 2002-07-28 15:12:10 +00:00
Neal Norwitz ce233b462d Fix last checkin, can't use " inside a string 2002-07-28 13:53:05 +00:00
Martin v. Löwis 611a7101ca Patch #552812: Better description in "python -h" for -u. 2002-07-28 10:34:08 +00:00
Martin v. Löwis 09c35f78fe Patch #575827: allow threads inside SSL creation. 2002-07-28 09:57:45 +00:00
Jeremy Hylton 825e47b655 Put checks for error returns in the right place. 2002-07-25 16:37:51 +00:00
Jeremy Hylton c075e197d6 Extended socket.htonl and ntohl to accept longs.
Fixes SF bug #568322.

The code should raise an OverflowError if the long is > 32 bits, even
on platforms where sizeof(long) > 4.
2002-07-25 16:01:12 +00:00
Mark Hammond 62b1ab1b31 Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." link
command line for Windows builds.  This should allow MSVC to import and
build the Python MSVC6 project files without error.
2002-07-23 06:31:15 +00:00
Guido van Rossum 0b624f69b5 unpack_string(): avoid a compiler warning (about a real bug!) by
copying the result of fgetc() into an int variable before testing it
for EOF.
2002-07-20 00:38:01 +00:00
Fred Drake 814f9fe806 Return NULL instead of 0 from function with a pointer return value. 2002-07-19 22:03:03 +00:00
Guido van Rossum d3c46d5463 Patch to call the Pure python strptime implementation if there's no
C implementation.  See SF patch 474274, by Brett Cannon.

(As an experiment, I'm adding a line that #undefs HAVE_STRPTIME,
so that you'll always get the Python version.  This is so that it
gets some good exercise.  We should eventually delete that line.)
2002-07-19 17:06:47 +00:00
Guido van Rossum ad65490628 Bail out early from internal_select() when socket file descriptor
closed.  Prevents core dump.
2002-07-19 12:44:59 +00:00
Mark Hammond 8235ea1c3a Land Patch [ 566100 ] Rationalize DL_IMPORT and DL_EXPORT. 2002-07-19 06:55:41 +00:00
Tim Peters a12b4cfaa5 A Python float is a C double; redeclare defaulttimeout as such; stops
compiler wngs on Windows.
2002-07-18 22:38:44 +00:00
Guido van Rossum 1693ba8bf8 Silence warning about getdefaulttimeout in PyMethodDef. 2002-07-18 21:11:26 +00:00
Jeremy Hylton 7fa4bfa173 Fix indentation. 2002-07-18 20:58:57 +00:00
Fred Drake 666bf52a16 - When the log reader detects end-of-file, close the file.
- The log reader now provides a "closed" attribute similar to the
  profiler.
- Both the profiler and log reader now provide a fileno() method.
- Use METH_NOARGS where possible, allowing simpler code in the method
  implementations.
2002-07-18 19:11:44 +00:00
Guido van Rossum 9d0c8cee66 Add default timeout functionality. This adds setdefaulttimeout() and
getdefaulttimeout() functions to the socket and _socket modules, and
appropriate tests.
2002-07-18 17:08:35 +00:00
Fred Drake 5c3ed3db9a Mark the closed attribute of the profiler with PyDoc_STR(), and added
a docstring for the info attribute of the logreader object.
2002-07-17 19:38:05 +00:00
Fred Drake d1eb8b61d0 Added a docstring for the closed attribute.
write_header():  When we encounter a non-string object in sys.path, record
    a fairly mindless placeholder rather than dying.  Possibly could record
    the repr of the object found, but not clear whether that matters.
2002-07-17 18:54:20 +00:00
Tim Peters 0c32279626 Removed more stray instances of statichere, but left _sre.c alone. 2002-07-17 16:49:03 +00:00
Jeremy Hylton 938ace69a0 staticforward bites the dust.
The staticforward define was needed to support certain broken C
compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the
static keyword when it was used with a forward declaration of a static
initialized structure.  Standard C allows the forward declaration with
static, and we've decided to stop catering to broken C compilers.  (In
fact, we expect that the compilers are all fixed eight years later.)

I'm leaving staticforward and statichere defined in object.h as
static.  This is only for backwards compatibility with C extensions
that might still use it.

XXX I haven't updated the documentation.
2002-07-17 16:30:39 +00:00
Guido van Rossum 9cb64b954a Some modernization. Get rid of the redundant next() method. Always
assume tp_iter and later fields exist.  Use PyObject_GenericGetAttr
instead of providing our own tp_getattr hook.
2002-07-17 16:15:35 +00:00
Fred Drake f042db6a94 Remove RCSId; this produces annoying warnings.
This is already removed from Expat 1.95.4, so the problem will not
recur when we update.
2002-07-17 14:45:33 +00:00
Guido van Rossum 2335100b6a Wipe out some warnings about non-ANSI code and an unsafe arg to
isdigit().
2002-07-17 14:33:34 +00:00
Jeremy Hylton 39c6116483 Given the persistent id code a shot at a class before calling save_global().
Some persistent picklers (well, probably, the *only* persistent
pickler) would like to pickle some classes in a special way.
2002-07-16 19:47:43 +00:00
Mark Hammond 975e3921ae Fix bug 581232 - [Windows] Can not interrupt time.sleep()
time.sleep() will now be interrupted on the main thread when Ctrl+C is pressed.  Other threads are never interrupted.
2002-07-16 01:29:19 +00:00
Tim Peters ee66d0c3d5 /F revealed that ShellExecute() only requires shellapi.h, not the
full-blown windows.h, so changed accordingly.
2002-07-15 16:10:55 +00:00
Mark Hammond 155adbdcbb Fix bug 231273 - [windows] os.popen doens't kill subprocess when interrupted
Don't pass CREATE_NEW_CONSOLE to CreateProcess(), meaning our child process is in the same "console group" and therefore interrupted by the same Ctrl+C that interrupts the parent.
2002-07-14 23:28:16 +00:00
Tim Peters 7a1f91709b WINDOWS_LEAN_AND_MEAN: There is no such symbol, although a very few
MSDN sample programs use it, apparently in error.  The correct name
is WIN32_LEAN_AND_MEAN.  After switching to the correct name, in two
cases more was needed because the code actually relied on things that
disappear when WIN32_LEAN_AND_MEAN is defined.
2002-07-14 22:14:19 +00:00
Jeremy Hylton 9ee91f11b3 remove decl of unused variable 2002-07-11 22:02:33 +00:00
Jeremy Hylton 0e1f7a82e9 Do more robust test of whether global objects are accessible.
PyImport_ImportModule() is not guaranteed to return a module object.
When another type of object was returned, the PyModule_GetDict() call
return NULL and the subsequent GetItem() seg faulted.

Bug fix candidate.
2002-07-11 22:01:40 +00:00
Tim Peters 803526b9e2 Trashcan cleanup: Now that cyclic gc is always there, the trashcan
mechanism is no longer evil:  it no longer plays dangerous games with
the type pointer or refcounts, and objects in extension modules can play
along too without needing to edit the core first.

Rewrote all the comments to explain this, and (I hope) give clear
guidance to extension authors who do want to play along.  Documented
all the functions.  Added more asserts (it may no longer be evil, but
it's still dangerous <0.9 wink>).  Rearranged the generated code to
make it clearer, and to tolerate either the presence or absence of a
semicolon after the macros.  Rewrote _PyTrash_destroy_chain() to call
tp_dealloc directly; it was doing a Py_DECREF again, and that has all
sorts of obscure distorting effects in non-release builds (Py_DECREF
was already called on the object!).  Removed Christian's little "embedded
change log" comments -- that's what checkin messages are for, and since
it was impossible to correlate the comments with the code that changed,
I found them merely distracting.
2002-07-07 05:13:56 +00:00
Tim Peters 943382c8e5 Removed WITH_CYCLE_GC #ifdef-ery. Holes:
+ I'm not sure what to do about configure.in.  Left it alone.

+ Ditto pyexpat.c.  Fred or Martin will know what to do.
2002-07-07 03:59:34 +00:00
Michael W. Hudson 8b7f131f8b gc_list_move defined but not used. 2002-07-04 17:11:36 +00:00
Tim Peters 934c1a1c6b Another stab at SF 576327: zipfile when sizeof(long) == 8
binascii_crc32():  The previous patch forced this to return the same
result across platforms.  This patch deals with that, on a 64-bit box,
the *entry* value may have "unexpected" bits in the high four bytes.

Bugfix candidate.
2002-07-02 22:24:50 +00:00
Tim Peters aab713bdf7 visit_decref(): Added another assert. 2002-07-02 22:15:28 +00:00
Tim Peters a98011c388 Fix for SF bug #576327: zipfile when sizeof(long) == 8
binascii_crc32():  Make this return a signed 4-byte result across
platforms.  The other way to make this platform-independent would be to
make it return an unsigned unbounded int, but the evidence suggests
other code out there treats it like a signed 4-byte int (e.g., existing
code writing the result with struct.pack "l" format).

Bugfix candidate.
2002-07-02 20:20:08 +00:00
Jeremy Hylton 4e54730ed5 Repair badly formatted code. 2002-07-02 18:25:00 +00:00
Tim Peters 6fc13d9595 Finished transitioning to using gc_refs to track gc objects' states.
This was mostly a matter of adding comments and light code rearrangement.
Upon untracking, gc_next is still set to NULL.  It's a cheap way to
provoke memory faults if calling code is insane.  It's also used in some
way by the trashcan mechanism.
2002-07-02 18:12:35 +00:00
Fred Drake b28467b713 Do not depend on pymemcompat.h (was only used for PyXML); Martin likes
it all inline.
2002-07-02 15:44:36 +00:00
Jack Jansen 84262fb1f3 Mac OS X Jaguar (developer preview) seems to have a working getaddrinfo(). 2002-07-02 14:40:42 +00:00
Tim Peters ea405639bf Reserved another gc_refs value for untracked objects. Every live gc
object should now have a well-defined gc_refs value, with clear transitions
among gc_refs states.  As a result, none of the visit_XYZ traversal
callbacks need to check IS_TRACKED() anymore, and those tests were removed.
(They were already looking for objects with specific gc_refs states, and
the gc_refs state of an untracked object can no longer match any other
gc_refs state by accident.)
Added more asserts.
I expect that the gc_next == NULL indicator for an untracked object is
now redundant and can also be removed, but I ran out of time for this.
2002-07-02 00:52:30 +00:00
Fred Drake 7c75bf2090 Bring this back into sync with PyXML revision 1.58. 2002-07-01 14:02:31 +00:00
Tim Peters 19b74c7868 OK, I couldn't stand it <0.5 wink>: removed all uncertainty about what's
in gc_refs, even at the cost of putting back a test+branch in
visit_decref.

The good news:  since gc_refs became utterly tame then, it became
clear that another special value could be useful.  The move_roots() and
move_root_reachable() passes have now been replaced by a single
move_unreachable() pass.  Besides saving a pass over the generation, this
has a better effect:  most of the time everything turns out to be
reachable, so we were breaking the generation list apart and moving it
into into the reachable list, one element at a time.  Now the reachable
stuff stays in the generation list, and the unreachable stuff is moved
instead.  This isn't quite as good as it sounds, since sometimes we
guess wrongly that a thing is unreachable, and have to move it back again.

Still, overall, it yields a significant (but not dramatic) boost in
collection speed.
2002-07-01 03:52:19 +00:00
Tim Peters 93cd83e4ae visit_decref(): Two optimizations.
1. You're not supposed to call this with a NULL argument, although the
   docs could be clearer about that.  The other visit_XYZ() functions
   don't bother to check.  This doesn't either now, although it does
   assert non-NULL-ness now.

2. It doesn't matter whether the object is currently tracked, so don't
   bother checking that either (if it isn't currently tracked, it may
   have some nonsense value in gc_refs, but it doesn't hurt to
   decrement gibberish, and it's cheaper to do so than to make everyone
   test for trackedness).

It would be nice to get rid of the other tests on IS_TRACKED.  Perhaps
trackedness should not be a matter of not being in any gc list, but
should be a matter of being in a new "untracked" gc list.  This list
simply wouldn't be involved in the collection mechanism.  A newly
created object would be put in the untracked list.  Tracking would
simply unlink it and move it into the gen0 list.  Untracking would do
the reverse.  No test+branch needed then.  visit_move() may be vulnerable
then, though, and I don't know how this would work with the trashcan.
2002-06-30 21:31:03 +00:00
Tim Peters 8839617cc9 SF bug #574132: Major GC related performance regression
"The regression" is actually due to that 2.2.1 had a bug that prevented
the regression (which isn't a regression at all) from showing up.  "The
regression" is actually a glitch in cyclic gc that's been there forever.

As the generation being collected is analyzed, objects that can't be
collected (because, e.g., we find they're externally referenced, or
are in an unreachable cycle but have a __del__ method) are moved out
of the list of candidates.  A tricksy scheme uses negative values of
gc_refs to mark such objects as being moved.  However, the exact
negative value set at the start may become "more negative" over time
for objects not in the generation being collected, and the scheme was
checking for an exact match on the negative value originally assigned.
As a result, objects in generations older than the one being collected
could get scanned too, and yanked back into a younger generation.  Doing
so doesn't lead to an error, but doesn't do any good, and can burn an
unbounded amount of time doing useless work.

A test case is simple (thanks to Kevin Jacobs for finding it!):

x = []
for i in xrange(200000):
    x.append((1,))

Without the patch, this ends up scanning all of x on every gen0 collection,
scans all of x twice on every gen1 collection, and x gets yanked back into
gen1 on every gen0 collection.  With the patch, once x gets to gen2, it's
never scanned again until another gen2 collection, and stays in gen2.

Bugfix candidate, although the code has changed enough that I think I'll
need to port it by hand.  2.2.1 also has a different bug that causes
bound method objects not to get tracked at all (so the test case doesn't
burn absurd amounts of time in 2.2.1, but *should* <wink>).
2002-06-30 17:56:40 +00:00
Martin v. Löwis 6238d2b024 Patch #569753: Remove support for WIN16.
Rename all occurrences of MS_WIN32 to MS_WINDOWS.
2002-06-30 15:26:10 +00:00
Martin v. Löwis b4fcf4d102 Define PyDoc_STRVAR if it is not available (PyXML 1.54).
Remove support for Python 1.5 (PyXML 1.55).
2002-06-30 06:40:55 +00:00
Martin v. Löwis 6b2cf0e5ea Undo usage of PyOS_snprintf (rev. 1.51 of PyXML). 2002-06-30 06:03:35 +00:00
Fred Drake 2a3d7db93e Added character data buffering to pyexpat parser objects.
Setting the buffer_text attribute to true causes the parser to collect
character data, waiting as long as possible to report it to the Python
callback.  This can save an enormous number of callbacks from C to
Python, which can be a substantial performance improvement.

buffer_text defaults to false.
2002-06-28 22:56:48 +00:00
Fred Drake 71b63ff342 pyexpat code cleanup and minor refactorings:
The handlers array on each parser now has the invariant that None will
never be set as a handler; it will always be NULL or a Python-level
value passed in for the specific handler.

have_handler():  Return true if there is a Python handler for a
    particular event.

get_handler_name():  Return a string object giving the name of a
    particular handler.  This caches the string object so it doesn't
    need to be created more than once.

get_parse_result():  Helper to allow the Parse() and ParseFile()
    methods to share the same logic for determining the return value
    or exception state.

PyUnknownEncodingHandler(), PyModule_AddIntConstant():
    Made these helpers static.  (The later is only defined for older
    versions of Python.)

pyxml_UpdatePairedHandlers(), pyxml_SetStartElementHandler(),
pyxml_SetEndElementHandler(), pyxml_SetStartNamespaceDeclHandler(),
pyxml_SetEndNamespaceDeclHandler(), pyxml_SetStartCdataSection(),
pyxml_SetEndCdataSection(), pyxml_SetStartDoctypeDeclHandler(),
pyxml_SetEndDoctypeDeclHandler():
    Removed.  These are no longer needed with Expat 1.95.x.

handler_info:
    Use the setter functions provided by Expat 1.95.x instead of the
    pyxml_Set*Handler() functions which have been removed.

Minor code formatting changes for consistency.
Trailing whitespace removed.
2002-06-28 22:29:01 +00:00
Neil Schemenauer c9051640f8 Fix small bug. The count of objects in all generations younger then the
collected one should be zeroed.
2002-06-28 19:16:04 +00:00
Fred Drake b91a36b230 Integrate the changes from PyXML's version of pyexpat.c revisions
1.47, 1.48, 1.49 (name interning support).
2002-06-27 19:40:48 +00:00
Jack Jansen c5601f4839 Undefine DPRINTF before defining it, there was a conflict with some other
definition.
2002-06-26 20:41:30 +00:00
Jack Jansen 3a96702b2b Undefine TRUE and FALSE before redefining them. 2002-06-26 20:40:42 +00:00
Fred Drake f7ce04dcb4 Clean up docstrings:
- Include a blank line between the signature line and the description
  (Guido sez).
- Don't include "-> None" for API functions that always return None
  because they don't have a meaningful return value.
2002-06-20 18:31:21 +00:00
Michael W. Hudson 9c14badc5f Fix the bug described in
http://mail.python.org/pipermail/python-dev/2002-June/025461.html

with test cases.

Also includes extended slice support for arrays, which I thought I'd
already checked in but obviously not.
2002-06-19 15:44:15 +00:00
Guido van Rossum a0b9075816 Corect speling and add \n\ to line ends in new docstring for access(). 2002-06-18 16:22:43 +00:00
Fred Drake 7f59124693 Clarified documentation for os.access().
Patch contributed by Sean Reifschneider.
Closes SF patch #570618.
2002-06-18 16:15:51 +00:00
Tim Peters 0add0e86c7 Removed newmodule.c from the project, and removed references to it from
the Windowish builds.
2002-06-16 01:34:49 +00:00
Guido van Rossum bea18ccde6 SF patch 568629 by Oren Tirosh: types made callable.
These built-in functions are replaced by their (now callable) type:

    slice()
    buffer()

and these types can also be called (but have no built-in named
function named after them)

    classobj (type name used to be "class")
    code
    function
    instance
    instancemethod (type name used to be "instance method")

The module "new" has been replaced with a small backward compatibility
placeholder in Python.

A large portion of the patch simply removes the new module from
various platform-specific build recipes.  The following binary Mac
project files still have references to it:

    Mac/Build/PythonCore.mcp
    Mac/Build/PythonStandSmall.mcp
    Mac/Build/PythonStandalone.mcp

[I've tweaked the code layout and the doc strings here and there, and
added a comment to types.py about StringTypes vs. basestring.  --Guido]
2002-06-14 20:41:17 +00:00
Skip Montanaro 57454e57f8 This introduces stricter library/header file checking for the Berkeley DB
library.  Since multiple versions can be installed simultaneously, it's
crucial that you only select libraries and header files which are compatible
with each other.  Version checking is done from highest version to lowest.
Building using version 1 of Berkeley DB is disabled by default because of
the hash file bugs people keep rediscovering.  It can be enabled by
uncommenting a few lines in setup.py.  Closes patch 553108.
2002-06-14 20:30:31 +00:00
Neal Norwitz 4178515035 SF # 533070 Silence AIX C Compiler Warnings
Warning caused by using &func.  & is not necessary.
2002-06-13 21:42:51 +00:00
Neal Norwitz 0c2c17c473 Use new PyDoc_STRVAR macro 2002-06-13 21:22:11 +00:00
Neal Norwitz 35fc7606f0 SF #561244 Micro optimizations
Convert loops to memset()s.
2002-06-13 21:11:11 +00:00
Martin v. Löwis 606edc1d97 Patch #568235: Add posix.setpgid. 2002-06-13 21:09:11 +00:00
Martin v. Löwis 14f8b4cfcb Patch #568124: Add doc string macros. 2002-06-13 20:33:02 +00:00
Guido van Rossum 7b8bac106a Fix non-blocking connect() for Windows. Refactored the code
that retries the connect() call in timeout mode so it can be shared
between connect() and connect_ex(), and needs only a single #ifdef.

The test for this was doing funky stuff I don't approve of,
so I removed it in favor of a simpler test.  This allowed me
to implement a simpler, "purer" form of the timeout retry code.
Hopefully that's enough (if you want to be fancy, use non-blocking
mode and decode the errors yourself, like before).
2002-06-13 16:07:04 +00:00
Guido van Rossum 11ba094957 Major overhaul of timeout sockets:
- setblocking(0) and settimeout(0) are now equivalent, and ditto for
  setblocking(1) and settimeout(None).

- Don't raise an exception from internal_select(); let the final call
  report the error (this means you will get an EAGAIN error instead of
  an ETIMEDOUT error -- I don't care).

- Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets,
  so other theads can run (this was a bug in the original code).

- Redid the retry logic in connect() and connect_ex() to avoid masking
  errors.  This probably doesn't work for Windows yet; I'll fix that
  next.  It may also fail on other platforms, depending on what
  retrying a connect does; I need help with this.

- Get rid of the retry logic in accept().  I don't think it was needed
  at all.  But I may be wrong.
2002-06-13 15:07:44 +00:00
Andrew MacIntyre 74a3bec592 _Py prefix is verboten for static entry points 2002-06-13 11:55:14 +00:00
Andrew MacIntyre 7aec4a2e2c work around name clash with OS/2 TCPIP routine sock_init() 2002-06-13 11:53:52 +00:00
Skip Montanaro a039274ccc patch #562492 - prevent duplicate lines in history
also call using_history() to properly initialize history variables
2002-06-11 14:32:46 +00:00
Martin v. Löwis f90ae20354 Patch #488073: AtheOS port. 2002-06-11 06:22:31 +00:00
Guido van Rossum 804cdca7ea Don't accept null bytes in the key. 2002-06-10 19:46:18 +00:00
Guido van Rossum db9198a8b5 SF bug 563750 (Alex Martelli): posix_tmpfile():
The file returned by tmpfile() has mode w+b, so use that in the call
to PyFile_FromFile().

Bugfix candidate.
2002-06-10 19:23:22 +00:00
Guido van Rossum 1790e65d43 Move the conex_finally label up, so that the errno value is always
returned.
2002-06-07 19:55:29 +00:00
Guido van Rossum e8008f0013 I decided to change the interaction between setblocking() and
settimeout().   Already, settimeout() canceled non-blocking mode; now,
setblocking() also cancels the timeout.  This is easier to document.

(XXX should settimeout(0) be an alias for setblocking(0)?  They seem
to have roughly the same effect.  Also, I'm not sure that the code in
connect() and accept() is correct in all cases.  We'll sort this out
soon enough.)
2002-06-07 03:36:20 +00:00
Guido van Rossum c4fcfa3457 Major cleanup. Renamed static methods to avoid Py prefix. Other misc
cleanup as well, e.g. renamed NTinit to os_init.
2002-06-07 03:19:37 +00:00
Guido van Rossum be8db07ab5 Repair a comment. 2002-06-07 02:27:50 +00:00
Guido van Rossum 3eede5ad81 Whitespace normalization, folding long lines, uniform comment
delimiters.  Also repaired some docstrings and comments.
2002-06-07 02:08:35 +00:00
Guido van Rossum b9e916a0b5 Correct several blunders in the timeout code, mostly my own fault (for
not testing it -- apparently test_timeout.py doesn't test anything
useful):

In internal_select():

- The tv_usec part of the timeout for select() was calculated wrong.

- The first argument to select() was one too low.

- The sense of the direction argument to internal_select() was
  inverted.

In PySocketSock_settimeout():

- The calls to internal_setblocking() were swapped.

Also, repaired some comments and fixed the test for the return value
of internal_select() in sendall -- this was in the original patch.
2002-06-07 01:42:47 +00:00
Jeremy Hylton 8a13518d25 Remove casts to PyObject * when declaration is for PyObject * 2002-06-06 23:23:55 +00:00
Guido van Rossum 67f7a38849 SF patch 555085 (timeout socket implementation) by Michael Gilfix.
I've made considerable changes to Michael's code, specifically to use
the select() system call directly and to store the timeout as a C
double instead of a Python object; internally, -1.0 (or anything
negative) represents the None from the API.

I'm not 100% sure that all corner cases are covered correctly, so
please keep an eye on this.  Next I'm going to try it Windows before
Tim complains.

No way is this a bugfix candidate. :-)
2002-06-06 21:08:16 +00:00
Guido van Rossum c9a55776c8 The insint() function is not used. Nuke it. 2002-06-06 20:41:10 +00:00
Guido van Rossum e1c478ff8a The tp_new implementation should initialize the errorhandler field,
otherwise this code could segfault:

  from socket import socket
  s = socket.__new__(socket)
  s.recv(100)
2002-06-06 20:08:25 +00:00
Neal Norwitz b5b5a260ea Fix SF bug #557436, TclError is a str should be an Exception
Make Tkinter.TclError derive from Exception, it was a string.
2002-06-04 17:14:07 +00:00
Neal Norwitz 3e12905e03 Remove unused static function 2002-05-31 21:47:02 +00:00
Guido van Rossum 84271bb34f SF #558432: Prevent Annoying ' ' from readline (Holker Krekel).
readline in all python versions is configured
    to append a 'space' character for a successful
    completion. But for almost all python expressions
    'space' is not wanted (see coding conventions PEP 8).
    For example if you have a function 'longfunction'
    and you type 'longf<TAB>' you get 'longfunction '
    as a completion. note the unwanted space at the
    end.

    The patch fixes this behaviour by setting readline's
    append_character to '\0' which means don't append
    anything. This doesn't work with readline < 2.1
    (AFAIK nowadays readline2.2 is in good use).

    An alternative approach would be to make the
    append_character
    accessable from python so that modules like
    the rlcompleter.py can set it to '\0'.

[Ed.: I think expecting readline >= 2.2 is fine.  If a completer wants
another character they can append that to the keyword in the list.]
2002-05-30 15:41:56 +00:00
Neil Schemenauer 8b6b491ed7 The logreader object did not always refill the input buffer correctly
and got confused by certain log files.  Remove logreader_refill and the
associated logic and replace with fgetc.
2002-05-29 18:19:14 +00:00
Guido van Rossum e85ee8d815 Issue an explicit error when we can't find an appropriate type for
UINT4.
2002-05-29 14:00:22 +00:00
Michael W. Hudson 1e1542fcff This is patch
[ 558914 ] Build md5.c fails on Cray T3E

I've also deleted a comment that I didn't understand.  Feel free to
put it back if it makes/made sense to you.
2002-05-29 10:32:24 +00:00
Michael W. Hudson 34f20eac98 This is patch
[ 559250 ] more POSIX signal stuff

Adds support (and docs and tests and autoconfery) for posix signal
mask handling -- sigpending, sigprocmask and sigsuspend.
2002-05-27 15:08:24 +00:00
Guido van Rossum 2d3b986480 Disambiguate the grammar for backtick.
The old syntax suggested that a trailing comma was OK inside backticks,
but in fact (due to ideosyncrasies of pgen) it was not.  Fix the grammar
to avoid the ambiguity.  Fred: you may want to update the refman.
2002-05-24 15:47:06 +00:00
Tim Peters c9ca5c82f9 Whitespace normalization. 2002-05-23 15:49:38 +00:00
Neil Schemenauer a2b11ecb08 Add IS_TRACKED and IS_MOVED macros. This makes the logic a little more clear. 2002-05-21 15:53:24 +00:00
Michael W. Hudson 1755ad9b02 array_tounicode isn't defined in --disable-unicode builds...
I have a patch to make the test work too, but it's not pretty so
I'll submit it to sf.
2002-05-13 10:14:59 +00:00
Raymond Hettinger d6f2267a83 Added degrees() and radians() to mathmodule. Closes patch 552452 and
feature request 426539.
2002-05-13 03:56:10 +00:00
Martin v. Löwis 000e37c3c4 Patch #551011: Fix compilation problems with Cygwin. 2002-05-08 07:16:37 +00:00
Martin v. Löwis 2b41b0d6a7 Rename posix_WCONTINUED to posix_WIFCONTINUED, call WIFCONTINUED inside,
add it to the posix_methods.
2002-05-04 13:13:41 +00:00
Neil Schemenauer 2880ae53e6 Move all data for a single generation into a structure. The set of
generations is now an array.  This cleans up some code and makes it easy
to change the number of generations.  Also, implemented a
gc_list_is_empty() function.  This makes the logic a little clearer in
places.  The performance impact of these changes should be negligible.

One functional change is that allocation/collection counters are always
zeroed at the start of a collection.  This should fix SF bug #551915.
This change is too big for back-porting but the minimal patch on SF
looks good for a bugfix release.
2002-05-04 05:35:20 +00:00
Martin v. Löwis b9132a2a15 Indicate delayed initialization of slots. Suggested by tim.one. 2002-05-02 20:34:12 +00:00
Martin v. Löwis edbffc1725 Patch #551009: Initialize array type dynamically. 2002-05-02 20:09:59 +00:00
Martin v. Löwis c6a7d7ef49 Guard gettext and friends with HAVE_LIBINTL_H. Fixes #549907. 2002-05-02 12:16:29 +00:00
Fred Drake 0ebacc8b38 Pickler_clear_memo(): convert to METH_NOARGS. 2002-05-01 20:36:39 +00:00
Guido van Rossum a883a3d5fd See discussion at SF bug 547537.
Unicode objects are currently taken as binary data by the write()
method.  This is not what Unicode users expect, nor what the
StringIO.py code does.  Until somebody adds a way to specify binary or
text mode for cStringIO objects, change the format string to use "t#"
instead of "s#", so that it will request the "text buffer" version.
This will try the default encoding for Unicode objects.

This is *not* a 2.2 bugfix (since it *is* a semantic change).
2002-04-29 13:54:48 +00:00
Tim Peters fa8efab30f _PyObject_GC_New: Could call PyObject_INIT with a NULL 1st argument.
_PyObject_GC_NewVar:  Could call PyObject_INIT_VAR likewise.

Bugfix candidate.
2002-04-28 01:57:25 +00:00
Tim Peters 5de9842b34 Repair widespread misuse of _PyString_Resize. Since it's clear people
don't understand how this function works, also beefed up the docs.  The
most common usage error is of this form (often spread out across gotos):

	if (_PyString_Resize(&s, n) < 0) {
		Py_DECREF(s);
		s = NULL;
		goto outtahere;
	}

The error is that if _PyString_Resize runs out of memory, it automatically
decrefs the input string object s (which also deallocates it, since its
refcount must be 1 upon entry), and sets s to NULL.  So if the "if"
branch ever triggers, it's an error to call Py_DECREF(s):  s is already
NULL!  A correct way to write the above is the simpler (and intended)

	if (_PyString_Resize(&s, n) < 0)
		goto outtahere;

Bugfix candidate.
2002-04-27 18:44:32 +00:00
Jeremy Hylton d95efe4257 Check for overflow errors in setrlimit(),
and reflow a long line.
2002-04-23 20:15:04 +00:00
Fred Drake 106c1a0e7a WCOREDUMP(), WIFCONTINUED(), WCONTINUED, WUNTRACED: New.
isatty(), WIFEXITED(), WIFSIGNALED(), WIFSTOPPED(): Changed to return
    bools instead of ints.
2002-04-23 15:58:02 +00:00
Anthony Baxter 8388895fe4 SF patch [ 545523 ] patch for 514433 bsddb.dbopen (NULL)
closes SF #514433

can now pass 'None' as the filename for the bsddb.*open functions,
and you'll get an in-memory temporary store.

docs are ripped out of the bsddb dbopen man page. Fred may want to
clean them up.

Considering this for 2.2, but not 2.1.
2002-04-23 02:11:05 +00:00
Neal Norwitz 8ee3cd47a9 #546156, Remove load_false()/load_true(), they are not used 2002-04-21 23:44:34 +00:00
Neal Norwitz 0e0ee598fc #544265, Remove warnings for passing const to free() 2002-04-21 15:03:18 +00:00
Neal Norwitz 3d94942000 #546163, fix link problem on Solaris 8 for makedev when using mknod 2002-04-20 13:46:43 +00:00
Martin v. Löwis 6af3e2dc31 Forward port of patch # 500311: Work around for buggy https servers.
Fixes #494762.
2002-04-20 07:47:40 +00:00
Martin v. Löwis 2ea2c9d1c3 Patch #546194: Check constants individually. Fixes 534143 on OpenBSD.
Will backport to 2.2.
2002-04-19 21:04:41 +00:00
Neal Norwitz fdbeb5a4ce #546155, remove posix_int() it is not used 2002-04-19 14:58:40 +00:00
Jeremy Hylton c72737e7b6 Fix SF #544995 (zlib crash on second flush call)
Bug fix by mhammond.

Bug fix candidate for 2.2, not present in 2.1.
2002-04-19 14:37:07 +00:00
Martin v. Löwis bbeb1e6d91 Document the build process more precisely. Suggested by Hugh Sasse. 2002-04-19 09:47:23 +00:00
Fred Drake 4d1e64bb46 posix_fildes(): New helper: run a function that takes a file descriptor
and returns None.  This allows any object that supports the fileno()
    method to be passed as a file descriptor, not just an integer.

posix_fchdir():  New exposed function: implements posix.fchdir().  This
    closes SF feature #536796.

posix_fsync(), posix_fdatasync():  Convert to use posix_fildes() instead
    of posix_int().  This also changes them from METH_VARARGS to METH_O
    functions.

setup_confname_table():  Remove unused variable.  Change to take a module
    rather than a dict to save the resulting table into.

setup_confname_tables():  Change to take a module instead of a dict to
    pass to setup_confname_table().
2002-04-15 19:40:07 +00:00
Neal Norwitz 726e013eff Remove unused variable reported by Walter Dörwald 2002-04-15 16:29:00 +00:00
Martin v. Löwis 06a83e90aa Patch #543447: Add posix.mknod. 2002-04-14 10:19:44 +00:00
Fred Drake 88c9344986 initpwd(): Clean up initialization, avoid PyModule_GetDict(). 2002-04-13 21:07:45 +00:00
Tim Peters af3e8de580 First stab at rationalizing the PyMem_ API. Mixing PyObject_xyz with
PyMem_{Del, DEL} doesn't work yet (compilation problems).

pyport.h:  _PyMem_EXTRA is gone.

pmem.h:  Repaired comments.  PyMem_{Malloc, MALLOC} and
PyMem_{Realloc, REALLOC} now make the same x-platform guarantees when
asking for 0 bytes, and when passing a NULL pointer to the latter.

object.c:  PyMem_{Malloc, Realloc} just call their macro versions
now, since the latter take care of the x-platform 0 and NULL stuff
by themselves now.

pypcre.c, grow_stack():  So sue me.  On two lines, this called
PyMem_RESIZE to grow a "const" area.  It's not legit to realloc a
const area, so the compiler warned given the new expansion of
PyMem_RESIZE.  It would have gotten the same warning before if it
had used PyMem_Resize() instead; the older macro version, but not the
function version, silently cast away the constness.  IMO that was a wrong
thing to do, and the docs say the macro versions of PyMem_xyz are
deprecated anyway.  If somebody else is resizing const areas with the
macro spelling, they'll get a warning when they recompile now too.
2002-04-12 07:22:56 +00:00
Neil Schemenauer aa769ae468 PyObject_Del can now be used as a function designator. 2002-04-12 02:44:10 +00:00
Neil Schemenauer fec4eb1be1 Allow PyObject_Del to be used as a function designator. Provide binary
compatibility function.

Make PyObject_GC_Track and PyObject_GC_UnTrack functions instead of
trivial macros wrapping functions.  Provide binary compatibility
functions.
2002-04-12 02:41:03 +00:00
Jack Jansen 8ab04b4d65 Got rid of ifdefs for long-obsolete GUSI versions. 2002-04-11 20:46:23 +00:00
Thomas Heller 1630520e5c Fix an obvious bug. 2002-04-09 12:50:13 +00:00
Martin v. Löwis 688357e035 Patch #512005: getrusage() returns struct-like object. 2002-04-08 21:28:20 +00:00
Guido van Rossum 8fdc75ba5e Lock methods acquire() and locked() now return bools. 2002-04-07 06:32:21 +00:00
Guido van Rossum e276339cea Implement an idea by Paul Rubin:
Change pickling format for bools to use a backwards compatible
encoding.  This means you can pickle True or False on Python 2.3
and Python 2.2 or before will read it back as 1 or 0.  The code
used for pickling bools before would create pickles that could
not be read in previous Python versions.
2002-04-05 19:30:08 +00:00
Tim Peters bc0e910826 Convert a pile of obvious "yes/no" functions to return bool. 2002-04-04 22:55:58 +00:00
Guido van Rossum 2e1c09c1fd Removed old Digital Creations copyright/license notices (with
permission from Paul Everitt).  Also removed a few other references to
Digital Creations and changed the remaining ones to Zope Corporation.
2002-04-04 17:52:50 +00:00
Guido van Rossum 77f6a65eb0 Add the 'bool' type and its values 'False' and 'True', as described in
PEP 285.  Everything described in the PEP is here, and there is even
some documentation.  I had to fix 12 unit tests; all but one of these
were printing Boolean outcomes that changed from 0/1 to False/True.
(The exception is test_unicode.py, which did a type(x) == type(y)
style comparison.  I could've fixed that with a single line using
issubtype(x, type(y)), but instead chose to be explicit about those
places where a bool is expected.

Still to do: perhaps more documentation; change standard library
modules to return False/True from predicates.
2002-04-03 22:41:51 +00:00
Fred Drake a2bd8d3816 Remove direct manipulation of the module dict. 2002-04-03 21:39:26 +00:00
Mark Hammond e7fefbf68d Fix bugs:
457466: popenx() argument mangling hangs python
 226766: popen('python -c"...."') tends to hang

Fixes argument quoting in w9xpopen.exe for Windows 9x.  w9xpopen.exe
also never attempts to display a MessageBox when not executed
interactively.

Added test_popen() test.  This test currently just executes
"python -c ..." as a child process, and checks that the expected
arguments were all recieved correctly by the child process.  This
test succeeds for me on Win9x, win2k and Linux, and I hope it does
for other popen supported platforms too :)
2002-04-03 01:47:00 +00:00
Neal Norwitz b0aaec5706 Convert more METH_OLDARGS & PyArg_Parse()
Please review.
2002-04-02 18:26:33 +00:00
Neal Norwitz 187ae56166 Get rid of more PyArg_Parse & METH_OLDARGS.
PyArg_Parse( "s" )  -> PyString_AsString
  PyArg_Parse( "t#" ) -> PyString_AsStringAndSize
2002-04-02 18:17:57 +00:00
Martin v. Löwis 2f6ef4c630 Reindent. Break long lines. Move comments before the statements. 2002-04-01 17:40:08 +00:00
Fred Drake 4baedc1d9b Use the PyModule_Add*() APIs instead of manipulating the module dict
directly.
2002-04-01 14:53:37 +00:00
Fred Drake 9bb7432114 Remove all but one use of the module dict. 2002-04-01 14:49:59 +00:00
Fred Drake d63e504d33 Remove unused variable and call to PyModule_GetDict(). 2002-04-01 14:30:50 +00:00
Fred Drake acee69faf8 Switch to using METH_NOARGS where possible.
Convert to use PyModule_*() instead of manipulating the module dict directly.
2002-04-01 14:28:58 +00:00
Martin v. Löwis 43c9d8ad23 Remove UNLESS. 2002-04-01 12:34:33 +00:00
Fred Drake f4e3484692 Use the PyModule_*() API instead of manipulating the module dictionary
directly.
2002-04-01 03:45:06 +00:00
Neal Norwitz 02098fa56b Get rid of all METH_OLDARGS & PyArg_Parse.
Fix floating point exception if mpz.powm(10, 1, 0) (modulus == 0).
Add a test.
2002-04-01 01:37:14 +00:00
Neal Norwitz dfd59e039a mpz_float() only takes one parameter now 2002-03-31 22:02:37 +00:00
Neal Norwitz 767f83539d Get rid of warnings due to changing to METH_NOARGS 2002-03-31 16:13:39 +00:00
Neal Norwitz 28faa1bf28 Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Use METH_OLDARGS explicitly rather than implicitly.
2002-03-31 15:56:56 +00:00
Neal Norwitz bb2769f580 Revert use of METH_OLDARGS (use 0) to support 1.5.2 2002-03-31 15:46:00 +00:00
Neal Norwitz b82d34f91e Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
Please review for correctness.
2002-03-31 15:43:28 +00:00
Neal Norwitz ba3a16c6c3 Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple
  Convert METH_OLDARGS -> METH_NOARGS: remove args parameter
Please review.  All tests pass, but some modules don't have tests.
I spot checked various functions to try to make sure nothing broke.
2002-03-31 15:27:00 +00:00
Neal Norwitz 50905b557b Convert from using METH_OLDARGS to METH_NOARGS.
These should be safe.
2002-03-31 14:57:24 +00:00
Neal Norwitz 01b2694acb Fix whitespace 2002-03-31 14:55:17 +00:00
Neal Norwitz b049325e92 Use symbolic METH_VARARGS/METH_OLDARGS instead of 1/0 for ml_flags 2002-03-31 14:44:22 +00:00
Neil Schemenauer cc07ec17a3 Add missing typecast. 2002-03-29 19:58:25 +00:00
Andrew M. Kuchling f4a4fb9a11 [Patch #536769] Add -Xcompiler flag for adding arguments and switches for
the compiler
2002-03-29 18:00:19 +00:00
Neil Schemenauer b883310d59 Make _PyObject_GC_UnTrack do nothing if WITH_CYCLE_GC is not defined. 2002-03-29 03:04:25 +00:00
Neil Schemenauer 78662cf9a1 Add type cast. 2002-03-28 21:04:14 +00:00
Guido van Rossum ff413af605 This is Neil's fix for SF bug 535905 (Evil Trashcan and GC interaction).
The fix makes it possible to call PyObject_GC_UnTrack() more than once
on the same object, and then move the PyObject_GC_UnTrack() call to
*before* the trashcan code is invoked.

BUGFIX CANDIDATE!
2002-03-28 20:34:59 +00:00
Fred Drake f841aa6fc0 Add a simple test of the METH_CLASS and METH_STATIC flags for type methods. 2002-03-28 15:49:54 +00:00
Martin v. Löwis 2e64c34850 Expose C library's gettext. Fixes #516412. 2002-03-27 18:49:02 +00:00
Martin v. Löwis 496f9e41ef Don't imply XPG4 constants from CODESET presence. Fixes #534153.
2.2.2 candiate.
2002-03-27 12:15:57 +00:00
Neal Norwitz 4632117e37 Missed change METH_OLDARGS to METH_NOARGS for two aliased functions 2002-03-26 14:52:00 +00:00
Neal Norwitz 7e78acbb1b Remove last occurrance of PyArg_GetInt. It is deprecated, 2002-03-25 22:23:53 +00:00
Neal Norwitz 2358425146 Missed change METH_OLDARGS to METH_NOARGS for two aliased functions 2002-03-25 21:05:50 +00:00
Neal Norwitz 3a6f97850b Remove many uses of PyArg_NoArgs macro, change METH_OLDARGS to METH_NOARGS. 2002-03-25 20:46:46 +00:00
Jack Jansen 6d8898b5eb Due to interaction between the MSL C library and the GUSI I/O library I can get reads from sockets to work consistently either for unbuffered binary files or for buffered binary files, but not for both:-(
The workaround is to force socket.makefile() to disable buffering for binary files.

Fixes bug 534625. 2.2.1 candidate.
2002-03-25 15:32:01 +00:00
Neil Schemenauer 29ac3cb7ed Expose RLIM_INFINITY constant. Closes SF patch 489066. 2002-03-24 22:27:39 +00:00
Neil Schemenauer 0f75e0dcad Add get_history_item, get_current_history_length, and redisplay functions.
Clarify the docstring for get_history_length.  Closes SF patch 494066.
2002-03-24 01:09:04 +00:00
Neil Schemenauer fa79c65235 Match behavior of the pickle.py module more closely. 2002-03-22 23:02:53 +00:00
Neil Schemenauer 94b866a030 Handle os.listdir("") case correctly on Windows. Closes bug 500705. 2002-03-22 20:51:58 +00:00
Neil Schemenauer 1b0e4fcc29 Use pymalloc for realloc() as well. 2002-03-22 15:41:03 +00:00
Neil Schemenauer dcc819a5c9 Use pymalloc if it's enabled. 2002-03-22 15:33:15 +00:00
Neal Norwitz 3afb2d2bba Remove compiler warnings on Solaris 8.
Can go into 2.2.x, but not necessary.
2002-03-20 21:32:07 +00:00
Neal Norwitz 5909402cde Remove extraneous #define as per effbot's instructions in:
[ 530285 ] redefining SRE_CODE in Modules/sre.h
2002-03-18 18:46:14 +00:00
Martin v. Löwis d4233b2b8c Include Python.h first. Fixes #530159. 2002-03-15 09:16:40 +00:00
Martin v. Löwis dc0b61d0b1 Verify arguments for nl_langinfo. Fixes #528879. 2002-03-12 22:05:02 +00:00
Fred Drake 1de5a722d6 Change the example code to prefer PyModule_Add*() instead of using the
module dictionary directly.  Also, be more careful about not re-initializing
globals in the event of re-initialization of a C extension.
2002-03-12 21:49:44 +00:00
Fred Drake 193a3f6d37 Update docstrings to use te attribute names of the new structures returned
by stat and time functions.
This closes SF patch #523271.
2002-03-12 21:38:49 +00:00
Sjoerd Mullender 556a938d10 Changed C++ comment into standard comment. 2002-03-11 09:20:47 +00:00
Tim Peters dc5a508761 SF bug 525705: [2.2] underflow raise OverflowException.
Another year in the quest to out-guess random C behavior.

Added macros Py_ADJUST_ERANGE1(X) and Py_ADJUST_ERANGE2(X, Y).  The latter
is useful for functions with complex results.  Two corrections to errno-
after-libm-call are attempted:

1. If the platform set errno to ERANGE due to underflow, clear errno.
   Some unknown subset of libm versions and link options do this.  It's
   allowed by C89, but I never figured anyone would do it.

2. If the platform did not set errno but overflow occurred, force
   errno to ERANGE.  C89 required setting errno to ERANGE, but C99
   doesn't.  Some unknown subset of libm versions and link options do
   it the C99 way now.

Bugfix candidate, but hold off until some Linux people actually try it,
with and without -lieee.  I'll send a help plea to Python-Dev.
2002-03-09 04:58:24 +00:00
Jeremy Hylton b189b07dcc Fix SF bug #526518
The doc string for cStringIO suggested that str() of a StringIO object
was equivalent to getvalue().  This was never true, so repair the doc
string.  (doctest would have helped here.)

Bug fix candidate for any past versions.
2002-03-08 17:17:33 +00:00
Tim Peters c9ffa068d1 SF bug 515943: searching for data with \0 in mmap.
mmap_find_method():  this obtained the string to find via s#, but it
ignored its length, acting as if it were \0-terminated instead.

Someone please run on Linux too (the extended test_mmap works on Windows).

Bugfix candidate.
2002-03-08 05:43:32 +00:00
Martin v. Löwis aa158be623 Remove tp_print. 2002-03-04 09:38:52 +00:00
Tim Peters bc2e10e7b6 Python no longer compiled on Windows, due to #include file confusion
over SEP, ALTSEP and MAXPATHLEN.
Patched up posixmodule.c for MSVC, but unsure what the story is now on
other non-Unixish platforms -- the preprocessor maze has no exit <wink>.
2002-03-03 23:17:02 +00:00
Andrew MacIntyre 6c73af2754 OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    posixmodule.c

- use SEP,ALTSEP #defines instead of hard coded path separator chars
- use EMX specific variants of chdir2(),getcwd() that support drive letters
- OS/2+EMX spawnv(),spawnve() support
- EMX specific popen[234]() derived from Win32 popen[234]() code
2002-03-03 03:07:07 +00:00
Andrew MacIntyre ba43e8700b OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    socketmodule.c

EMX handles sockets like Posix, rather than use native APIs
2002-03-03 03:03:52 +00:00
Andrew MacIntyre 7bf6833e17 OS/2 EMX port changes (Modules part of patch #450267):
Modules/
    _hotshot.c
    dbmmodule.c
    fcntlmodule.c
    main.c
    pwdmodule.c
    readline.c
    selectmodule.c
    signalmodule.c
    termios.c
    timemodule.c
    unicodedata.c
2002-03-03 02:59:16 +00:00
Guido van Rossum 6f33250ef9 SF patch 517245 by Marc Recht.
Support GMP version >= 2.

Bugfix candidate.
2002-03-01 21:31:27 +00:00
Martin v. Löwis dbd55b3737 Patch #523268, #522027: return enhanced tuples. 2002-03-01 10:38:44 +00:00
Martin v. Löwis 9986633609 Patch 520694: arraymodule.c improvements:
- make array.array a type
- add Py_UNICODE arrays
- support +=, *=
2002-03-01 10:27:01 +00:00
Martin v. Löwis 272cb40e31 Patch #520062: Support IPv6 with VC.NET. 2002-03-01 08:31:07 +00:00
Marc-André Lemburg 666e70de25 Add documentation about how the inter-module linking works. 2002-02-25 14:45:40 +00:00
Tim Peters 643a7fc62f Moved the declaration of PySocketSock_Type from socketmodule.h to
socketmodule.c.  No code outside of the .c file references it, so it
doesn't belong the .h file (at least not yet ...), and declaring it
an imported symbol in the .h file can't be made to work on Windows (it's
a cross-DLL symbol then) without substantial code rewriting.  Also
repaired the comment that goes along with the decl, to stop referring
to names and functions that haven't existed for 7 years <wink>.

socketmodule.c compiles cleanly on Windows again.  The test_socket dies
at once, though (later).
2002-02-17 04:13:21 +00:00
Tim Peters 6f5505aaf9 For readability, switch to tab indents; was using a mix of tab indents,
4-space indents, and ambiguous space+tab indents.  Added an XXX comment
about a confusing part.  Still doesn't build on Windows.
2002-02-17 03:58:51 +00:00
Martin v. Löwis b2c92f44d4 Patch #511193: Implement killpg in posixmodule. 2002-02-16 23:35:41 +00:00
Martin v. Löwis e6cc5b68bf Remove extraneous variable 'total', as reported by James Rucker. 2002-02-16 23:13:54 +00:00
Marc-André Lemburg 976ade691c Also fix the comment. 2002-02-16 18:47:07 +00:00
Marc-André Lemburg bb8b78b77a Fix the name of the header file. 2002-02-16 18:44:52 +00:00
Marc-André Lemburg a5d2b4cb18 Break SSL support out of _socket module and place it into a new
helper module _ssl.

The support for the RAND_* APIs in _ssl is now only enabled
for OpenSSL 0.9.5 and up since they were added in that
release.

Note that socketmodule.* should really be renamed to _socket.* --
unfortunately, this seems to lose the CVS history of the file.

Please review and test... I was only able to test the header file
chaos in socketmodule.c/h on Linux. The test run through fine
and compiles don't give errors or warnings.

WARNING: This patch does *not* include changes to the various
non-Unix build process files.
2002-02-16 18:23:30 +00:00
Fred Drake 2eeec9bde5 Fix typo. 2002-02-14 07:16:30 +00:00
Fred Drake 78f6c867ae Use PyModule_AddObject() instead of accessing the module dict directly. 2002-02-14 07:11:23 +00:00
Fred Drake cca657b8fe Use PyModule_AddIntConstant() instead of creating a private helper function.
This also avoids directly accessing the module'd __dict__.
2002-02-14 06:59:26 +00:00
Michael W. Hudson 0c1ceaf66d Simon Budig's patch (posted by me):
[ #513235 ] prevent readline filename completion
2002-02-13 11:58:25 +00:00
Martin v. Löwis 8fef47be5f Define VERSION in expat.h. 2002-02-13 07:47:16 +00:00
Tim Peters 9ad4b688ec Windows time_clock(): rewrite to get rid of horrid casting tricks.
Don't blame Mark!  The horrid casting tricks were my idea to begin with.
The rewrite works fine under VC6, and I *expect* will work fine under VC7.
2002-02-13 05:14:18 +00:00
Martin v. Löwis b48d198c12 "Generate" from expat.h.in, for 1.95.2. 2002-02-12 09:52:22 +00:00
Mark Hammond 7ba5e810fd Ensure we also build on VC7. Involves replacing largeint.h helper functions with msvc's native 64 bit integers. 2002-02-12 04:02:33 +00:00
Martin v. Löwis cf453fe2a8 Use included Expat library. Drop support for older expat versions. 2002-02-11 23:27:45 +00:00
Martin v. Löwis 481f68aaa6 Disable usage of Expat's config.h. 2002-02-11 23:16:32 +00:00
Martin v. Löwis 1dbb1caf86 Initial revision 2002-02-11 23:13:04 +00:00
Marc-André Lemburg aeff6687b5 Remove mentioning of -U option in "python -h" output. 2002-02-11 18:46:47 +00:00
Fred Drake 2c146bfa28 start() and stop() methods: return None where there is no exception;
returning NULL causes the interpreter to raise a SystemError.
Noted by Anthony Baxter at Python 10.
2002-02-08 21:27:50 +00:00
Jack Jansen 4892f2406f Got rid of a few more NeXT ifdefs. The last, I think. 2002-02-01 15:46:29 +00:00
Tim Peters ab034fab03 Implement os.waitpid() for Windows, in a way that's compatible with Linux
where their capabilities intersect.  Would be nice if people using non-
MSVC compilers (Borland etc) took a whack at doing something similar for
them (this code relies on the MS _cwait function).
2002-02-01 11:27:43 +00:00
Michael W. Hudson cf6bfe49b1 Oh look, another one.
2.2.1 candiate (he says, largely talking to himself :)
2002-01-30 15:47:34 +00:00
Michael W. Hudson 67fb0c3705 I think this fixes
[ #510644 ] test_curses segfaults

If we use the *object* *allocator*, we should use the *object* *deallocator*,
not the *raw memory* deallocator (confused yet?).

I think this was what caused segfaults when pymalloc was enabled.

Even if it wasn't the cause, it's still wrong.

2.2.1 candidate.
2002-01-30 15:39:28 +00:00
Tim Peters 5aa916029d Expose more MS WIndows constants usable w/ low-level os.open(). 2002-01-30 05:46:57 +00:00
Neal Norwitz 2a47c0fa23 Fix spelling mistakes. Bugfix candidates. 2002-01-29 00:53:41 +00:00
Martin v. Löwis 84432eb4c0 Encode Unicode arguments to split/splitlist as UTF-8. Fixes #507962.
2.2.1 bugfix candidate.
2002-01-26 20:21:50 +00:00
Tim Peters 902952b910 Removed an XXX question (the answer is "yes" <wink>). 2002-01-26 17:58:02 +00:00
Martin v. Löwis 43b936d08c Patch #477750: Use METH_ constants in Modules. 2002-01-17 23:15:58 +00:00
Martin v. Löwis c0e1671c71 Patch #477752: Drop old-style getargs from curses. 2002-01-17 23:08:27 +00:00
Michael W. Hudson 8f5146088a Change some spaces to tabs. I don't *think* that was me, but it
might have been...
2002-01-16 15:18:09 +00:00
Michael W. Hudson f24281251f Fix for
[ #504284 ] Last build problems on AIX

I'm ignoring the suggestion that this should be an autoconf test in the
interests of having a fix today.  Feel free to quibble.
2002-01-16 15:14:49 +00:00
Martin v. Löwis 02af964924 Patch #504225: add plan9 ifdef to timemodule floatsleep. 2002-01-16 11:04:06 +00:00
Guido van Rossum 4f3a62d9bc There's no need for typechecks on the second and third argument of
new.instancemethod() -- the instancemethod object is now a perfectly
general container.

This fixes SF bug ##503091 (Pedro Rodriquez): new.instancemethod fails
for new classes

This is a 2.2.1 candidate.
2002-01-15 19:21:05 +00:00
Martin v. Löwis 175af2574f Export SIGINFO. Fixes #502077. 2002-01-12 11:43:25 +00:00
Martin v. Löwis cdc4451222 Include <unistd.h> in Python.h. Fixes #500924. 2002-01-12 11:05:12 +00:00
Marc-André Lemburg 3e3eacb5fc Fixed "u#" parser marker to pass through Unicode objects as-is without
going through the buffer interface API.

Added tests for this to the _testcapi module and updated docs.
2002-01-09 16:21:27 +00:00
Martin v. Löwis 93227275dc Patch #497126: Always compile dl. 2002-01-01 20:18:30 +00:00
Martin v. Löwis 1baeba6839 Add fcntl.h constants from glibc 2.2.4. Fixes #496171. 2001-12-28 21:08:12 +00:00
Guido van Rossum bb2501f638 Due to a cut-and-paste error, the type object exported under the name
statvfs_result was in fact the stat_result type object. :-(

2.2.1 bugfix!
2001-12-27 16:23:28 +00:00
Martin v. Löwis 3cde2cb78a Add TCP socket options from glibc 2.2.4. Fixes #495680.
2.2.1 bugfix candidate.
2001-12-22 15:05:32 +00:00
Barry Warsaw 52acb49298 Merge of the release22 branch changes back into the trunk. 2001-12-21 20:04:22 +00:00
Tim Peters 500bd035fa SF bug #495021: Crash calling os.stat with a trailing backslash
Patch from Mark Hammond, plus code rearrangement and comments from me.
posix_do_stat():  Windows-specific code could try to free() stack
memory in some cases when a path ending with a forward or backward slash
was passed to os.stat().
2001-12-19 19:05:01 +00:00
Guido van Rossum 950dce6f01 save(): Fix for SF bug #494904: Cannot pickle a class with a
metaclass, reported by Dan Parisien.

Objects that are instances of custom metaclasses, i.e. whose ob_type
is a subclass of PyType_Type, should be pickled the same as new-style
classes (objects whose ob_type is PyType_Type).  This can't be done
through the existing dispatch switches, and the __reduce__ trick
doesn't work for these, since it finds the unbound __reduce__ for
instances of the class (inherited from PyBaseObject_Type).  So check
explicitly using PyType_IsSubtype().
2001-12-19 16:56:54 +00:00
Tim Peters 1fbb577ee2 SF bug #494738: binascii_b2a_base64 overwrites memory.
binascii_b2a_base64():  We didn't allocate enough buffer space for very
short inputs (e.g., a 1-byte input can produce a 5-byte output, but we
only allocated 2 bytes).  I expect that malloc overheads absorbed the
overrun in practice, but computing a correct upper bound is a very simple
change.
2001-12-19 04:41:35 +00:00
Tim Peters 4befff95e9 initxxsubtype(): Add a comment to make the magic clearer; I doubt it's
obvious to anyone except PyType_Ready's author <0.9 wink>.
2001-12-17 18:26:19 +00:00
Guido van Rossum a7b9b3ccba Use PyType_Ready() for initialization of the ob_type field of our
types (the tp_base field must be initialized prior to that call).
2001-12-17 17:25:53 +00:00
Tim Peters dd5c05fe6d David Abrahams tried to compile this as a separate DLL under MSVC, and
got a barrage of compile errors that didn't make sense to the C++ brain:
MSVC does not allow C (but does allow C++) initializers to contain
data addresses supplied by other DLLs.  So changed the initializers here
to use dummy nulls, and changed module init to plug in the foreign
addresses at runtime (manually simulating what C++ does by magic).  Tested
on Windows, and Guido tested on Linux (thanks!).  BTW, the *point* is that
people are going to use this module as a template for writing their own
subtypes, and it's unusual for extension authors to build their extensions
into Python directly (separate DLLs are the norm on Windows); so it's
better if we give them a template that works <wink>.
2001-12-17 01:27:01 +00:00
Tim Peters 65760b2173 Give xxsubtype a module docstring, so its oddball purpose is discoverable
from a prompt without searching the source code (there was an SF bug
report about this, already closed ...  "479568 xxsubtype builtin").
2001-12-10 22:53:30 +00:00
Jack Jansen cb85244228 Mods by Tony Lownds (patch 490100, slightly massaged by me) to make Tkinter
work with Mac OS X Aqua-Tk, all nicely within ifdefs.

The process is not for the faint of heart, though: you need to download
and install the (alfa) Aqua-Tk, obtain a few needed X11 headers from
somewhere else and then everything builds. To run scripts using Tkinter
you must build with --enable-framework, build Python.app in Mac/OSX
and run your Tkinter scripts with that. Then, about half the tests in
Demo/tkinter work (or at least do something).

Checking this in anyway because it shouldn't break anything, and newer
versions of Aqua-Tk will streamline the process.
2001-12-09 23:15:56 +00:00
Fredrik Lundh 82b230732f bug #133283, #477728, #483789, #490573
backed out of broken minimal repeat patch from July

also fixed a couple of minor potential resource leaks in pattern_subx
(Guido had already fixed the big one)
2001-12-09 16:13:15 +00:00
Guido van Rossum 146483964e Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.

This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this).  Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right.  Apologies if they're
not.  This also touches the weakref docs, which contains a sample type
object initializer.  It also touches the mmap test output, because the
mmap type's repr is included in that output.  It touches object.h to
put the correct description in a comment.
2001-12-08 18:02:58 +00:00
Guido van Rossum 7745218c05 SF patch #489989 (Charles G Waldman) linuxaudiodev.c - fix initialization
The OSS Programmer's Reference (www.4front-tech.com)
states:

*Setting Sampling Parameters

There are three parameters which affect the sound
quality (and therefore memory and bandwidth
requirements) of sampled audio data. These are:

** sample format (sometimes called number of bits)
** number of channels (mono or stereo), and
** sampling rate (speed)

NOTE:

It is important to always set these parameters in the
above order. Setting sampling rate before the number
of channels doesn't work with all devices.
2001-12-08 17:13:45 +00:00
Tim Peters 25059d30c3 SF patch #489173: Make os.spawnv not block the interpreter, from
Anthony Roach.
Release the global interpreter lock around platform spawn calls.
Bugfix candidate?  Hard to say; I favor "yes, bugfix".
These clearly *should* have been releasing the GIL all along, if for no
other reason than compatibility with the similar os.system().  But it's
possible some program out there is (a) multithreaded, (b) calling a spawn
function with P_WAIT, and (c) relying on the spawn call to block all their
threads until the spawned program completes.  I think it's very unlikely
anyone is doing that on purpose, but someone may be doing so by accident.
2001-12-07 20:35:43 +00:00
Guido van Rossum 2f09812efa O_cwrite(): rewrote for clarity, replacing all the (Oobject *)self
casts with a variable oself that has the proper type.  A smart
compiler may put this thing into a register.

(I'm not sure what good this does except satisfy my desire to
understand this function; I got a report about an uninitialized read
from Insure++ about this function and it hurt my eyes to even look at
it.  I gotta run away or I'll get tempted to reformat the entire
file...)
2001-12-07 20:20:28 +00:00
Guido van Rossum 4e173846c8 Fix for #489672 (Neil Norwitz): memory leak in test_sre.
(At least for the repeatable test case that Tim produced.)

pattern_subx(): Add missing DECREF(filter) in both exit branches
(normal and error return).  Also fix a DECREF(args) that should
certainly be a DECREF(match) -- because it's inside if (!args) and
right after allocation of match.
2001-12-07 04:25:10 +00:00
Tim Peters eb4b7bad33 audioop_ratecv() again: settle for a sloppier upper bound that's less
obnoxious to compute and easier to explain.  No compromise on safety.
2001-12-07 00:37:39 +00:00
Martin v. Löwis a631f580ea Undefine addrinfo.h constants if the system header defined them.
Fixes #486099.
2001-12-06 19:04:35 +00:00
Jeremy Hylton 2554dd993a Fix [ #489673 ] memory leak in test_symtable: Free the st_future slot.
The st_future slot of the symtable is not freed by PySymtable_Free()
because it is shared by the symtable and compiling structs in
compiel.c.  Since it is shared, it is explicitly deallocated when the
compiling struct is freed.
2001-12-06 14:34:58 +00:00
Tim Peters 3caca2326e SF bug #488514: -Qnew needs work
Big Hammer to implement -Qnew as PEP 238 says it should work (a global
option affecting all instances of "/").

pydebug.h, main.c, pythonrun.c:  define a private _Py_QnewFlag flag, true
iff -Qnew is passed on the command line.  This should go away (as the
comments say) when true division becomes The Rule.  This is
deliberately not exposed to runtime inspection or modification:  it's
a one-way one-shot switch to pretend you're using Python 3.

ceval.c:  when _Py_QnewFlag is set, treat BINARY_DIVIDE as
BINARY_TRUE_DIVIDE.

test_{descr, generators, zipfile}.py:  fiddle so these pass under
-Qnew too.  This was just a matter of s!/!//! in test_generators and
test_zipfile.  test_descr was trickier, as testbinop() is passed
assumptions that "/" is the same as calling a "__div__" method; put
a temporary hack there to call "__truediv__" instead when the method
name is "__div__" and 1/2 evaluates to 0.5.

Three standard tests still fail under -Qnew (on Windows; somebody
please try the Linux tests with -Qnew too!  Linux runs a whole bunch
of tests Windows doesn't):
    test_augassign
    test_class
    test_coercion
I can't stay awake longer to stare at this (be my guest).  Offhand
cures weren't obvious, nor was it even obvious that cures are possible
without major hackery.

Question:  when -Qnew is in effect, should calls to __div__ magically
change into calls to __truediv__?  See "major hackery" at tail end of
last paragraph <wink>.
2001-12-06 06:23:26 +00:00
Tim Peters 3127c28b3f audioop_ratecv(): I left a potentially unsafe multiply unchecked
yesterday -- repair that.  Also renamed the silly size_times_nchannels
to bytes_per_frame.
2001-12-05 22:30:21 +00:00
Fred Drake 8b55b2d9aa Fix memory leak in the parser module: There were two leaks in
parser_tuple2st() and a failure to propogate an error in
build_node_children() (masking yet another leak, of course!).
This closes SF bug #485133 (confirmed by Insure++).
2001-12-05 22:10:44 +00:00
Tim Peters 1691bd9f1e SF bug 482574: audioop.ratecv crashes.
Bugfix candidate.
A numerically naive computation of output buffer size caused crashes
and spurious MemoryErrors for reasonable arguments.
audioop_ratecv():  Avoid spurious overflow by careful reworking of the
buffer size computations, triggering MemoryError if and only if the
final buffer size can't be represented in a C int (although
PyString_FromStringAndSize may legitimately raise MemoryError even if
it does fit in a C int).  All reasonable arguments should work as
intended now, and all unreasonable arguments should be cuaght.
2001-12-05 06:05:07 +00:00
Fred Drake 62c1e3c1b9 Make sure to propogate errors that arise when profiling data cannot be
written to the log file, and turn off the profiler.
This closes SF bug #483925.
2001-12-04 21:40:53 +00:00
Tim Peters 22a51efc1c More sprintf -> PyOS_snprintf. 2001-12-04 01:11:32 +00:00
Tim Peters c8996f5965 posix_execve(), posix_spawnve(), posix_putenv():
sprintf -> PyOS_snprintf.  This is the last of this
stuff I intend to do.
2001-12-03 20:41:00 +00:00
Jack Jansen 55070f5d96 Changed logic for finding python home in Mac OS X framework Pythons.
Now sys.executable points to the executable again, in stead of to
the shared library. The latter is used only for locating the python
home.
2001-12-02 23:56:28 +00:00
Martin v. Löwis f8a6f241b3 Check for NULL return value of PyList_New (follow-up to patch #486743). 2001-12-02 18:31:02 +00:00
Martin v. Löwis b3cfc1d7ea Patch #481718: Time module doc string changes. 2001-12-02 12:27:43 +00:00
Martin v. Löwis 155aad17be Patch #486743: remove bad INCREF, propagate exception in append_objects. 2001-12-02 12:21:34 +00:00
Martin v. Löwis 44ddbde3ab Remove INET6 define. Use ENABLE_IPV6 instead. 2001-12-02 10:15:37 +00:00
Tim Peters 69b83b113f unicodedata_decomposition(): sprintf -> PyOS_snprintf. 2001-11-30 07:23:05 +00:00
Martin v. Löwis c8fe77bd4c Use identity instead of equality when looking for referrers. Fixes #485781. 2001-11-29 18:08:31 +00:00
Tim Peters 75cdad5584 More sprintf -> PyOS_snprintf. 2001-11-28 22:07:30 +00:00
Jeremy Hylton 179c48c60e Use PyOS_snprintf() instead of sprintf(). 2001-11-28 21:49:51 +00:00
Tim Peters 1ceb5fb946 Repair a botched PyOS_snprintf conversion. 2001-11-28 20:32:57 +00:00
Tim Peters 885d457709 sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the
former didn't make sense.
2001-11-28 20:27:42 +00:00
Marc-André Lemburg d4c0a9c59b Fixes for possible buffer overflows in sprintf() usages. 2001-11-28 11:47:00 +00:00
Andrew M. Kuchling 3072ecdcd2 Fix docstring typo 2001-11-28 04:28:31 +00:00
Martin v. Löwis e75f0e4801 Correct typo. Fixes #484611. 2001-11-24 09:31:44 +00:00
Martin v. Löwis 560da62fc7 Rename get_referents to get_referrers. Fixes #483815. 2001-11-24 09:24:51 +00:00
Martin v. Löwis fba64e1eca Test for negative buffer sizes. Fixes #482871. 2001-11-19 10:41:26 +00:00
Fred Drake 8188e792d9 assert.h was not always included by Python.h; make sure we import it for
older versions.  (Thanks to Martijn Faassen.)
2001-11-18 02:36:07 +00:00
Barry Warsaw 9b481ff3d6 A change to sync with pickle.py:
find_class(): We no longer mask all exceptions[1] by transforming them
into SystemError.  The latter is definitely not the right thing to do,
so we let any exceptions that occur in the PyObject_GetAttr() call to
simply propagate up if they occur.

[1] Note that pickle only masked ImportError, KeyError, and
AttributeError, but cPickle masked all exceptions.
2001-11-15 23:45:26 +00:00
Tim Peters 5ebfd36afa CVS patch #477161: New "access" keyword for mmap, from Jay T Miller.
This gives mmap() on Windows the ability to create read-only, write-
through and copy-on-write mmaps.  A new keyword argument is introduced
because the mmap() signatures diverged between Windows and Unix, so
while they (now) both support this functionality, there wasn't a way to
spell it in a common way without introducing a new spelling gimmick.
The old spellings are still accepted, so there isn't a backward-
compatibility issue here.
2001-11-13 23:11:19 +00:00
Tim Peters 88d21319ba new_code(): The last patch to this left behind an unreferenced local;
deleted its declaration.
2001-11-13 20:11:55 +00:00
Tim Peters bf5ca65c2d load_string(): Force use of unsigned compare in a context that was
clearly (but incorrectly) assuming it.
2001-11-12 22:26:10 +00:00
Martin v. Löwis 43f2dc6251 Limit string size on one-character-strings. Fixes #480384. 2001-11-11 14:49:15 +00:00
Martin v. Löwis 00ff10cae4 Patch in bug report #477700: Fix memory leaks in gdbm & curses. 2001-11-11 14:24:05 +00:00
Martin v. Löwis 42ba08fab0 Patch #473265: UpdatePairedHandlers nonsensical. 2001-11-10 13:59:16 +00:00
Martin v. Löwis 1d7c55faee Merge 1.42 from PyXML: Flag errors resulting from argument conversion problems.
Fixes problem with not detecting UTF-8 errors.
2001-11-10 13:57:55 +00:00
Jeremy Hylton 9f64caaf00 Use PyObject_CheckReadBuffer(). 2001-11-09 22:02:48 +00:00
Fred Drake 03459a5cd7 Fix memory leak. This is part of SF patch #478006. 2001-11-09 16:00:41 +00:00
Fred Drake f12a68ccd0 Fix memory leak. This is (very!) similar to part of SF patch #478006. 2001-11-09 15:59:36 +00:00
Michael W. Hudson 03f96bd8f5 Fixes to compile cPickle.c & socketmodule.c on cygwin and possibly
other platforms that have funny ideas about whether addresses of
functions in dlls are compile-time constants.
2001-11-09 10:06:23 +00:00
Martin v. Löwis f0b11d2893 Fix memory leaks detecting in bug report #478003. 2001-11-07 08:31:03 +00:00
Andrew M. Kuchling 10f9c075b9 Remove obsolete e-mail address 2001-11-05 21:25:42 +00:00
Tim Peters 603c6831d0 SF patch 473749 compile under OS/2 VA C++, from Michael Muller.
Changes enabling Python to compile under OS/2 Visual Age C++.
2001-11-05 02:45:59 +00:00
Martin v. Löwis 0bd292f004 Correct argument parsing for alp_getstatus, which is METH_VARARGS. 2001-11-03 10:48:43 +00:00
Martin v. Löwis dedbe255d3 Patch #474169: Move fdopen calls out of critical section. 2001-11-02 23:59:11 +00:00
Martin v. Löwis 06b1d21e7d Correct getnameinfo refcounting and tuple parsing. Fixes #476648. 2001-11-02 23:34:52 +00:00
Fred Drake 52a42e9888 Simplify initmd5() to use PyModule_AddIntConstant(). 2001-11-02 22:05:06 +00:00
Fred Drake 8b14ac9898 Clean up a Tab inconsistency.
Simplfy the insint() macro to use PyModule_AddIntConstant().
2001-11-02 22:04:17 +00:00
Andrew M. Kuchling 75fec2c8ed [Patch #476612] Add attributes from PEP247 to the md5 and sha modules 2001-11-02 21:41:00 +00:00
Tim Peters db8656118a has_finalizer(): simplified "if (complicated_bool) 1 else 0" to
"complicated_bool".
2001-11-01 19:35:45 +00:00
Neil Schemenauer a765c120f6 Add has_finalizer predictate function. Use it when deciding which
objects to save in gc.garbage.  This should be the last change needed to
fix SF bug 477059: "__del__ on new classes vs. GC".

Note that this change slightly changes the behavior of the collector.
Before, if a cycle was found that contained instances with __del__
methods then all instance objects in that cycle were saved in
gc.garbage.  Now, only objects with __del__ methods are saved in
gc.garbage.
2001-11-01 17:35:23 +00:00
Guido van Rossum 8cc705eabc SF bug #477059 (my own): __del__ on new classes vs. GC.
When moving objects with a __del__ attribute to a special list, look
for __del__ on new-style classes with the HEAPTYPE flag set as well.
(HEAPTYPE means the class was created by a class statement.)
2001-11-01 14:23:28 +00:00
Neil Schemenauer e8c40cb722 Make the gc.collect() function respect the collection lock. This fixes
SF bug 476129: "gc.collect sometimes hangs".
2001-10-31 23:09:35 +00:00
Guido van Rossum 355bc0c88e Change the limit on the input size for b2a_base64 to what will fit in
memory, rather than the standard's 57.

This fixes SF bug #473009.
2001-10-30 03:00:52 +00:00
Tim Peters c32410ae8f PySocketSock_connect_ex(): On Windows, return the correct Windows exit
code.  The patch is from Jeremy, and allows test_asynchat to run again.
Bugfix candidate.
2001-10-30 01:26:49 +00:00
Fred Drake 4c2e1af890 Make the low-level log-reader object export a dictionary mapping keys
to lists of values, giving the contents of all the ADD_INFO records
seen so far.  This is initialized agressively when the log file is
opened, so that whoever is looking at the log reader can always see
the initial data loaded into the data stream.  ADD_INFO events later
in the log file continue to be reported to the application layer as
before.

Add a new method, addinfo(), to the profiler.  This can be used to
insert additional ADD_INFO records into the profiler log.

Fix the tp_flags and tp_name slots on the type objects.
2001-10-29 20:45:57 +00:00
Guido van Rossum ca6dfa55c5 Oops. In the tp_name field, the name should be "_socket.socket", not
"socket.socket" -- on Windows, "socket.socket" is the wrapper class.
Also added the module name to the SSL type (which is not a new-style
class -- I don't want to mess with it yet).
2001-10-28 12:31:33 +00:00
Guido van Rossum 384ca9c6dd Made SocketType and socket the same thing: a subclassable type whose
constructor acts just like socket() before.  All three arguments have
a sensible default now; socket() is equivalent to
socket(AF_INET, SOCK_STREAM).

One minor issue: the socket() function and the SocketType had
different doc strings; socket.__doc__ gave the signature,
SocketType.__doc__ gave the methods.  I've merged these for now, but
maybe the list of methods is no longer necessary since it can easily
be recovered through socket.__dict__.keys().  The problem with keeping
it is that the total doc string is a bit long (34 lines -- it scrolls
of a standard tty screen).

Another general issue with the socket module is that it's a big mess.
There's pages and pages of random platform #ifdefs, and the naming
conventions are totally wrong: it uses Py prefixes and CapWords for
static functions.  That's a cleanup for another day...  (Also I think
the big starting comment that summarizes the API can go -- it's a
repeat of the docstring.)
2001-10-27 22:20:47 +00:00
Guido van Rossum 9f7a539afe Add sendall() method, which loops until all data is written or an
error occurs, and doesn't return a count.  (This is my second patch
from SF patch #474307, with small change to the docstring for send().)

2.1.2 "bugfix" candidate.
2001-10-26 03:25:00 +00:00
Guido van Rossum a0dfc8577d Fix SF bug #474538: Memory (reference) leak in poller.register (Dave Brueck)
Replace some tortuous code that was trying to be clever but forgot to
DECREF the key and value, by more longwinded but obviously correct
code.

(Inspired by but not copying the fix from SF patch #475033.)
2001-10-25 20:18:35 +00:00
Martin v. Löwis 7c4b5faa93 After discussion with itojun, it was clarified that Tru64 is in error,
and that the work-around should be restricted to that system.
2001-10-25 09:04:03 +00:00
Fredrik Lundh 703ce8122c (experimental) "finditer" method/function. this works pretty much
like findall, but returns an iterator (which returns match objects)
instead of a list of strings/tuples.
2001-10-24 22:16:30 +00:00
Guido van Rossum e2ae77b8b8 SF patch #474590 -- RISC OS support 2001-10-24 20:42:55 +00:00
Martin v. Löwis b8fc972100 Fix typo. Thanks to Jack Jansen for spotting it. 2001-10-24 17:35:46 +00:00
Martin v. Löwis eb9b103296 Check for HP/UX curses problems. Define _XOPEN_SOURCE_EXTENDED and
STRICT_SYSV_CURSES when compiling curses module on HP/UX. Generalize
access to _flags on systems where WINDOW is opaque. Fixes bugs
#432497, #422265, and the curses parts of #467145 and #473150.
2001-10-24 17:10:49 +00:00
Martin v. Löwis 861a65bc2f Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfo
not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
2001-10-24 14:36:00 +00:00
Jack Jansen 72af01aac6 Added missing cast. 2001-10-23 22:29:06 +00:00
Jack Jansen 963659af29 Got this to work in MacPython. The code is #ifdef macintosh style (to match the existing #ifdef MS_WINDOWS), but eventually ifdeffing on configure features is probably better. 2001-10-23 22:26:16 +00:00
Fred Drake 0d429e8cdd Convert the ref() and proxy() implementations to use the new
PyArg_UnpackTuple() function (serves as an example and test case).
2001-10-23 21:12:47 +00:00
Fredrik Lundh 6de22ef677 another major speedup: let sre.sub/subn check for escapes in the
template string, and don't call the template compiler if we can
avoid it.
2001-10-22 21:18:08 +00:00
Fredrik Lundh f864aa8fd9 sre.split should return the last segment, even if empty
(sorry, barry)
2001-10-22 06:01:56 +00:00
Neil Schemenauer 2677512fc1 Adding missing "static" declarations (found by "make smelly"). 2001-10-21 22:26:43 +00:00
Fredrik Lundh dac58492aa fixed character set description in docstring (SRE uses Python
strings, not C strings)

removed USE_PYTHON defines, and related sre.py helpers

skip calling the subx helper if the template is callable.
interestingly enough, this means that

	def callback(m):
	    return literal
	result = pattern.sub(callback, string)

is much faster than

	result = pattern.sub(literal, string)
2001-10-21 21:48:30 +00:00
Fredrik Lundh 1296a8d77e sre.Scanner fixes (from Greg Chapman). also added a Scanner sanity
check to the test suite.

added a few missing exception checks in the _sre module
2001-10-21 18:04:11 +00:00
Fredrik Lundh bec95b9d88 rewrote the pattern.sub and pattern.subn methods in C
removed (conceptually flawed) getliteral helper; the new sub/subn code
uses a faster code path for literal replacement strings, but doesn't
(yet) look for literal patterns.

added STATE_OFFSET macro, and use it to convert state.start/ptr to
char indexes
2001-10-21 16:47:57 +00:00
Martin v. Löwis 5b68ce3122 Change clear_handlers argument to indicate whether this is an initialization.
Do not set the Expat handlers if it is. Fixes PyXML bug #473195.
2001-10-21 08:53:52 +00:00
Fredrik Lundh 971e78b55b rewrote the pattern.split method in C
also restored SRE Unicode support for 1.6/2.0/2.1
2001-10-20 17:48:46 +00:00
Andrew M. Kuchling 16e65a023e Add two forgotten 'break' statements
Allow passing strings to the .border() method
Correct some error messages ("1 or 4" -> "1 to 4")
Bump version number
Tweak code formatting
Update my e-mail address
2001-10-20 16:05:52 +00:00
Guido van Rossum cad8fa1501 (Hopefully) fix SF bug #472675: CVS socketmodule now doesn't compile
This appears to be a case of a missing \n\ in a multiline string
literal.
2001-10-19 12:40:40 +00:00
Guido van Rossum c524d952da SF patch #460805 by Chris Gonnerman: Support for unsetenv()
This adds unsetenv to posix, and uses it in the __delitem__ method of
os.environ.

(XXX Should we change the preferred name for putenv to setenv, for
consistency?)
2001-10-19 01:31:59 +00:00
Guido van Rossum b6c1d5239c SF patch #443759: Add Interface to readline's add_history
This was submitted by Moshe, but apparently he's too busy to check it
in himself.  He wrote:

    Here is a function in GNU readline called add_history,
    which is used to manage the history list. Though Python
    uses this function internally, it does not expose it to
    the Python programmer. This patch adds direct interface
    to this function with documentation.

    This could be used by friendly modules to "seed" the
    history with commands.
2001-10-19 01:18:43 +00:00
Martin v. Löwis 4fe3c27323 Expose O_LARGEFILE, O_DIRECT, O_DIRECTORY, and O_NOFOLLOW. 2001-10-18 22:05:36 +00:00
Guido van Rossum a4dc73e246 Don't leave bare newlines in long strings -- VC doesn't like that. 2001-10-18 20:53:15 +00:00
Guido van Rossum 98bf58f1c6 SF patch #462296: Add attributes to os.stat results; by Nick Mathewson.
This is a big one, touching lots of files.  Some of the platforms
aren't tested yet.  Briefly, this changes the return value of the
os/posix functions stat(), fstat(), statvfs(), fstatvfs(), and the
time functions localtime(), gmtime(), and strptime() from tuples into
pseudo-sequences.  When accessed as a sequence, they behave exactly as
before.  But they also have attributes like st_mtime or tm_year.  The
stat return value, moreover, has a few platform-specific attributes
that are not available through the sequence interface (because
everybody expects the sequence to have a fixed length, these couldn't
be added there).  If your platform's struct stat doesn't define
st_blksize, st_blocks or st_rdev, they won't be accessible from Python
either.

(Still missing is a documentation update.)
2001-10-18 20:34:25 +00:00
Guido van Rossum a6535fd40b Shut up warnings for setgroups() on Linux -- you have to #include
<grp.h> it seems.  This requires yet another configure test.
2001-10-18 19:44:10 +00:00
Fredrik Lundh 397a654791 SRE bug #441409:
compile should raise error for non-strings
SRE bug #432570, 448951:
    reset group after failed match

also bumped version number to 2.2.0
2001-10-18 19:30:16 +00:00
Martin v. Löwis 61c5edf6fc Expose setgroups. Fixes feature request #468116. 2001-10-18 04:06:00 +00:00
Jeremy Hylton de80f2efb5 Expose three OpenSSL API calls for dealing with the PRNG.
Quoth the OpenSSL RAND_add man page:

    OpenSSL makes sure that the PRNG state is unique for each
    thread. On systems that provide /dev/urandom, the
    randomness device is used to seed the PRNG transparently.
    However, on all other systems, the application is
    responsible for seeding the PRNG by calling RAND_add(),
    RAND_egd(3) or RAND_load_file(3).

I decided to expose RAND_add() because it's general and RAND_egd()
because it's a useful special case.  RAND_load_file() didn't seem to
offer much over RAND_add(), so I skipped it.  Also supplied
RAND_status() which returns true if the PRNG is seeded and false if
not.
2001-10-18 00:28:50 +00:00
Jeremy Hylton a25d995ab0 The Python symtable module depends on .h files that setup.py doesn't track. 2001-10-17 13:46:44 +00:00
Jeremy Hylton 771f9146d5 Remove unused convenience routine. 2001-10-17 13:32:02 +00:00
Tim Peters adbd35bbcc Simplify and regularize docstrings. Also reformat so that each docstring
line fits in reasonable screen width.
2001-10-17 04:16:15 +00:00
Tim Peters 977e540e4b Trimmed trailing whitespace. 2001-10-17 03:57:20 +00:00
Tim Peters b1a37c0196 Removed more comments that didn't make much sense.
Made the presence/absence of a semicolon after macros consistent.
2001-10-17 03:56:45 +00:00
Tim Peters 6605c64c83 Removed obsolete comments about confused string refcount tricks (Jeremy
removed the tricks).

Changed the ENTER/LEAVE_ZLIB macros so as not to create a new block (a
new block is neither necessary nor helpful).
2001-10-17 03:43:54 +00:00
Jeremy Hylton ba3dd9990f Undo needless INCREF chicanery introduced by SF patch #450702.
Apparently this patch (rev 2.41) replaced all the good old "s#"
    formats in PyArg_ParseTuple() with "S".  Then it did
    PyString_FromStringAndSize() to get back the values setup by the
    "s#" format.  It also incref'd and decref'd the string obtained by
    "S" even though the argument tuple had a reference to it.

Replace PyString_AsString() calls with PyString_AS_STRING().

    A good rule of thumb -- if you never check the return value of
    PyString_AsString() to see if it's NULL, you ought to be using the
    macro <wink>.
2001-10-16 23:26:08 +00:00
Jeremy Hylton 9d620d018c Simplify and fix error handling for most cases.
Many functions used a local variable called return_error, which was
initialized to zero.  If an error occurred, it was set to true.  Most
of the code paths checked were only executed if return_error was
false.  goto is clearer.

The code also seemed to be written under the curious assumption that
calling Py_DECREF() on a local variable would assign the variable to
NULL.  As a result, more of the error-exit code paths returned an
object that had a reference count of zero instead of just returning
NULL.  Fixed the code to explicitly assign NULL after the DECREF.

A bit more reformatting, but not much.

XXX Need a much better test suite for zlib, since it the current tests
don't exercise any of this broken code.
2001-10-16 23:02:32 +00:00
Jeremy Hylton 4990000077 More reformatting. 2001-10-16 21:59:35 +00:00
Jeremy Hylton 0965e084cd Add zlib_error() helper.
It sets a ZlibError exception, using the msg from the z_stream pointer
if one is available.
2001-10-16 21:56:09 +00:00
Jeremy Hylton 9bc9d66eb1 Remove many calls to set MemoryError exceptions.
When PyString_FromStringAndSize() and _PyString_Resize() fail, they
set an exception.  There's no need to set a new exception.
2001-10-16 21:23:58 +00:00
Jeremy Hylton 9714f99d60 Reformat!
Consistently indent 4 spaces.
Use whitespace around operators.
Put braces in the right places.
2001-10-16 21:19:45 +00:00
Guido van Rossum 3c28863e08 Partial patch from SF #452266, by Jason Petrone.
This changes Pythread_start_thread() to return the thread ID, or -1
for an error.  (It's technically an incompatible API change, but I
doubt anyone calls it.)
2001-10-16 21:13:49 +00:00
Jeremy Hylton 511e2cacc4 [ #403753 ] zlib decompress; uncontrollable memory usage
Mostly by Toby Dickenson and Titus Brown.

Add an optional argument to a decompression object's decompress()
method.  The argument specifies the maximum length of the return
value.  If the uncompressed data exceeds this length, the excess data
is stored as the unconsumed_tail attribute.  (Not to be confused with
unused_data, which is a separate issue.)

Difference from SF patch: Default value for unconsumed_tail is ""
rather than None.  It's simpler if the attribute is always a string.
2001-10-16 20:39:49 +00:00
Jeremy Hylton 3eb46f3a5d Must terminate the Pickler_members[] and Pickler_getsets with NULL. 2001-10-16 17:10:49 +00:00
Fred Drake 30d1c75d15 Removed useless code to count the number of calls into the profiler.
Added support for saving the names of the functions observed into the
profile log.
Added support for using the profiler to measure coverage without collecting
timing information (which is the slow part).  Coverage logs can also be
substantially smaller than profiling logs where per-line information is
being collected.
Updated comments on the log format; corrected record type values in some
of the record descriptions.
2001-10-15 22:11:02 +00:00