Commit Graph

3546 Commits

Author SHA1 Message Date
Gregory P. Smith dc5af70631 SF patch / bug #967763
Fix memory leaks revealed by valgrind and ensuing code inspection.

In the existing test suite valgrind revealed two memory leaks (DB_get
and DBC_set_range).  Code inspection revealed that there were many other
potential similar leaks (many on odd code error paths such as passing
something other than a DBTxn object for a txn= parameter or in the face
of an out of memory error).  The most common case that would cause a
leak was when using recno or queue format databases with integer keys,
sometimes only with an exception exit.
2004-06-27 23:32:34 +00:00
Tim Peters e7c053233f sizeof(char) is 1, by definition, so get rid of that expression in
places it's just noise.
2004-06-27 17:24:49 +00:00
Raymond Hettinger 616f4f61ba Add a comment with implementation notes. 2004-06-26 04:42:06 +00:00
Brett Cannon f6af76da61 Modules/getpath.c now compiles properly under OS X when using the
--disable-framework build; header file was protected in an #if using the wrong
macro to check.

Closes bug #978645.
2004-06-26 04:03:06 +00:00
Brett Cannon 6cc48148fe Change comment from C++ style to C. 2004-06-24 00:48:44 +00:00
Tim Peters 9ddf40b4e1 SF patch 876130: add C API to datetime module, from Anthony Tuininga.
The LaTeX is untested (well, so is the new API, for that matter).
Note that I also changed NULL to get spelled consistently in concrete.tex.
If that was a wrong thing to do, Fred should yell at me.
2004-06-20 22:41:32 +00:00
Raymond Hettinger 28224f897a Improve the documented advice on how to best use heapq.heapreplace(). 2004-06-20 09:07:53 +00:00
Raymond Hettinger 1761a7cc8b Use PyArg_UnpackTuple() where possible. 2004-06-20 04:23:19 +00:00
Tim Peters 1b6f7a9057 Bug 975996: Add _PyTime_DoubleToTimet to C API
New include file timefuncs.h exports private API function
_PyTime_DoubleToTimet() from timemodule.c.  timemodule should export
some other functions too (look for painful bits in datetimemodule.c).

Added insane-argument checking to datetime's assorted fromtimestamp()
and utcfromtimestamp() methods.  Added insane-argument tests of these
to test_datetime, and insane-argument tests for ctime(), localtime()
and gmtime() to test_time.
2004-06-20 02:50:16 +00:00
Brett Cannon 298c380c74 Raise ValueError when value being stored in a time_t variable will result in
more than a second of precision.  Primarily affects ctime, localtime, and
gmtime.

Closes bug #919012 thanks to Tim Peters' code.

Tim suggests that the new funciton being introduced, _PyTime_DoubletoTimet(),
should be added to the internal C API and then used in datetime where
appropriate.  Not being done now for lack of time.
2004-06-19 20:48:43 +00:00
Nicholas Bastin 1ce9e4cfc1 Fixed end-of-loop code not reached warning when using SunPro C 2004-06-17 18:27:18 +00:00
Michael W. Hudson 24ec21174c silly typo 2004-06-17 15:55:53 +00:00
Raymond Hettinger aefde435ef Reverse argument order for nsmallest() and nlargest().
Reads better when the iterable is a generator expression.
2004-06-15 23:53:35 +00:00
Martin v. Löwis 969297f488 Return unicode strings from _getfullpathname even on W9X. Fixes #924703 . 2004-06-15 18:49:58 +00:00
Raymond Hettinger b67ad7e671 Patch #826074: cmath.log optional base argument, fixes #823209
(Contributed by Andrew Gaul.)
2004-06-14 07:40:10 +00:00
Neal Norwitz 7a135166f6 SF patch #969180, hotshot incorrectly computes elapsed time by Jason
Beardsley.

If the seconds are different, we still need to calculate the differences
between milliseconds.

Also, on a Gentoo Linux (2.6.5) dual Athlon MP box with glibc 2.3,
time can go backwards.  This probably happens when the process switches
the CPU it's running on.  Time can also go backwards when running NTP.
If we detect a negative time delta (ie, time went backwards), return
a delta of 0.  This prevents an illegal array access elsewhere.
I think it's safest to *not* update prev_timeofday in this case, so we
return without updating.

Backport candidate.
2004-06-13 20:45:11 +00:00
Neal Norwitz 75a3204095 Remove warning (static not being first) when building with -W 2004-06-13 20:31:17 +00:00
Neal Norwitz 0a8266a7e3 Remove warning about implicit declaration of strcmp() 2004-06-13 20:29:55 +00:00
Raymond Hettinger de72eddf69 Fixup error exits in nlargest() and nsmallest(). 2004-06-13 15:36:56 +00:00
Raymond Hettinger 2e3dfaf707 Install C version of heapq.nsmallest(). 2004-06-13 05:26:33 +00:00
Raymond Hettinger c929766361 Install C version of heapq.nlargest().
Maxheap version of heapq.smallest() is forthcoming.
2004-06-12 22:48:46 +00:00
Neal Norwitz 2adf210993 Ensure path is initialized to prevent freeing random memory
(reported by Thomas Heller).  If have_unicode_filename is set,
path looks like it will not be used, so there's no need to free it.
2004-06-09 01:46:02 +00:00
Martin v. Löwis 737ea82a5a Patch #774665: Make Python LC_NUMERIC agnostic. 2004-06-08 18:52:54 +00:00
Tim Peters 604c013ef2 SF 952807: Unpickling pickled instances of subclasses of datetime.date,
datetime.datetime and datetime.time could yield insane objects.  Thanks
to Jiwon Seo for the fix.

Bugfix candidate.  I'll backport it to 2.3.
2004-06-07 23:04:33 +00:00
Neal Norwitz 9665271f92 Plug a few memory leaks in utime(). path is allocated from within
PyArg_ParseTuple() since the format is "et"  This change should
be reviewed carefully.

Bugfix candidate.
2004-06-06 20:40:27 +00:00
Neal Norwitz fe92eef85b Valgrind was reporting an uninitialized read for bad input.
This fixes the problem and the test passes.  I'm not sure
the test is really correct though.  It seems like it would
be better to raise an exception.  I think that wasn't done
for backwards compatability.

Bugfix candidate.
2004-06-06 20:13:10 +00:00
Jack Jansen 1afd4807d9 Fix for #932977: MacOSX does not pass the whole pathname in argv[0] for
#!-scripts, only the filename part, and this can lead to incorrect
initialization of sys.path and sys.executable if there is another python
on $PATH before the one used in #!.

The fix was picked up from the darwinports crowd, thanks!
2004-06-03 14:33:03 +00:00
Martin v. Löwis 77ca6c4c84 Warn abou missing mutate flag to ioctl. Fixes #696535. 2004-06-03 12:47:26 +00:00
Martin v. Löwis 558d9bf528 Patch #929192: Improvements to bluetooth support.
Added setbdaddr and makebdaddr.
Extended makesockaddr to understand Bluetooth addresses.
Changed getsockaddr to expect the Bluetooth addresses as a string,
not a six element tuple.
Reformatted some of the Bluetooth code to be more consistent with PEP 7.
2004-06-03 09:24:42 +00:00
Andrew M. Kuchling 5ededdd685 Remove pcre module 2004-06-02 17:44:36 +00:00
Hye-Shik Chang 974ed7cfa5 - SF #962502: Add two more methods for unicode type; width() and
iswide() for east asian width manipulation. (Inspired by David
Goodger, Reviewed by Martin v. Loewis)
- Move _PyUnicode_TypeRecord.flags to the end of the struct so that
no padding is added for UCS-4 builds. (Suggested by Martin v. Loewis)
2004-06-02 16:49:17 +00:00
Martin v. Löwis 04697e89b9 Patch #924294: Do not check for AF_INET6 if it is not defined.
Will backport to 2.3.
2004-06-02 12:35:29 +00:00
Martin v. Löwis d8948725d2 Patch #954115: Fix os.stat handling of UNC roots.
Will backport to 2.3.
2004-06-02 09:57:56 +00:00
Raymond Hettinger 027bb633b6 Add weakref support to sockets and re pattern objects. 2004-05-31 03:09:25 +00:00
Raymond Hettinger cb87bc8e7e Add weakref support to array.array and file objects. 2004-05-31 00:35:52 +00:00
Raymond Hettinger 691d80532b Make sets and deques weak referencable. 2004-05-30 07:26:47 +00:00
Michael W. Hudson 76b8cc84a4 Band-aid type fix for
[ 728330 ] Don't define _SGAPI on IRIX

The Right Thing would be nice, for now this'll do.  At least it isn't
going to break anything *other* than IRIX...
2004-05-26 17:06:31 +00:00
Skip Montanaro 79cddc56b3 stupid, stupid, stupid... raw_input() already supports readline() if the
readline module is loaded.
2004-05-24 14:20:16 +00:00
Skip Montanaro 0dc23101a0 Exposed readline() function from the readline module. 2004-05-23 17:46:50 +00:00
Andrew M. Kuchling 16581c8614 Set data pointer to NULL after an error; this keeps the mmap_dealloc() function from trying to do msync(-1);munmap(-1).
2.3 bugfix candidate, but this bug isn't critical enough that the fix has to go into 2.3.4
2004-05-19 14:39:08 +00:00
Raymond Hettinger 354433a59d SF patch #872326: Generator expression implementation
(Code contributed by Jiwon Seo.)

The documentation portion of the patch is being re-worked and will be
checked-in soon.  Likewise, PEP 289 will be updated to reflect Guido's
rationale for the design decisions on binding behavior (as described in
in his patch comments and in discussions on python-dev).

The test file, test_genexps.py, is written in doctest format and is
meant to exercise all aspects of the the patch.  Further additions are
welcome from everyone.  Please stress test this new feature as much as
possible before the alpha release.
2004-05-19 08:20:33 +00:00
Raymond Hettinger 285cfccecb Make type check work with subclasses 2004-05-18 18:15:03 +00:00
Raymond Hettinger 0e371f2cb6 Make sure "del d[n]" is properly supported. Was necessary because the
same method that implements __setitem__ also implements __delitem__.
Also, there were several good use cases (removing items from a queue
and implementing Forth style stack ops).
2004-05-12 20:55:56 +00:00
Barry Warsaw 23164a5ca7 In order to fix SF bug # 824977, we replace calloc()/free() calls in
binascii_a2b_qp() and binascii_b2a_qp() with calls to PyMem_Malloc() and
PyMem_Free().  These won't return NULL unless the allocations actually fail,
so it won't trigger a bogus memory error on some platforms <cough>AIX</cough>
when passed a length of zero.
2004-05-11 02:05:11 +00:00
Greg Ward fd0283eaa0 SF #832236: merge from release23-maint branch: wrap a bunch of
_EXPORT_INT calls in #ifdef's, to avoid breaking the build on MkLinux
(Linux 2.0).
2004-05-11 01:34:55 +00:00
Raymond Hettinger 9d7c870c6d SF #950057: itertools.chain doesn't "process" exceptions as they occur
Both cycle() and chain() were handling exceptions only when switching
input sources.  The patch makes the handle more immediate.

Will backport.
2004-05-08 19:49:42 +00:00
Martin v. Löwis 7d9c6c7e8c Fix _sre.CODESIZE on 64-bit machines in UCS-4 mode. Fixes #931848.
Backported to 2.3.
2004-05-07 07:18:13 +00:00
Mark Hammond 2d5914b17e Fix [ 947405 ] os.utime() raises bad exception for unicode filenames 2004-05-04 08:10:37 +00:00
Hye-Shik Chang ce97fbe772 Correct the file name of _heapq module. 2004-04-25 17:51:47 +00:00
Raymond Hettinger 1660e0c1f1 * Restore the pure python version of heapq.py.
* Mark the C version as private and only use when available.
2004-04-19 19:21:43 +00:00
Raymond Hettinger c46cb2a1a9 * Restore the pure python version of heapq.py.
* Mark the C version as private and only use when available.
2004-04-19 19:06:21 +00:00
Martin v. Löwis 61e40bd897 Special case normalization of empty strings. Fixes #924361.
Backported to 2.3.
2004-04-17 19:36:48 +00:00
Brett Cannon 0046839dd2 Change two instance of format strings for PyString_FromFormat() to use %ld
instead of %d .
2004-04-13 02:43:53 +00:00
Raymond Hettinger 7892b1c651 * Add unittests for iterators that report their length
* Document the differences between them
* Fix corner cases covered by the unittests
* Use Py_RETURN_NONE where possible for dictionaries
2004-04-12 18:10:01 +00:00
Andrew MacIntyre daedf21852 Fixes for AF_UNIX support on OS/2:
- return the full size of the sockaddr_un structure, without which
  bind() fails with EINVAL;
- set test_socketserver to use a socket name that meets the form
  required by the underlying implementation;
- don't bother exercising the forking AF_UNIX tests on EMX - its
  fork() can't handle the stress.
2004-04-11 12:03:57 +00:00
Raymond Hettinger 7dacda2947 Provide more information representations of repeat() and count(). 2004-04-08 21:54:00 +00:00
Andrew MacIntyre d12dfbbcd9 OS/2's TCP/IP stack supports AF_UNIX sockets, with the limitation that
the socket name must start with /socket32/.  Unlike Unix systems, this
file never exists in the file system.
2004-04-04 07:13:49 +00:00
Andrew MacIntyre 69e18c9344 OS/2 has support for spawnvp() and spawnvpe() in the C libraries supplied
with major C compilers (VACPP, EMX+gcc and [Open]Watcom).

Also tidy up the export of spawn*() symbols in the os module to match what
is found/implemented.
2004-04-04 07:11:43 +00:00
Andrew MacIntyre da4d6cb573 OS/2 VACPP build updates/fixes 2004-03-29 11:53:38 +00:00
Nicholas Bastin 2786d90617 A few more PyThreadState_Get to PyThreadState_GET conversions 2004-03-25 02:16:23 +00:00
Nicholas Bastin e5662aedef Changed random calls to PyThreadState_Get() to use the macro 2004-03-24 22:22:12 +00:00
Brett Cannon 06c34798df Make socket.sslerror a subclass of socket.error .
Added socket.error to the socket module's C API.
2004-03-23 23:16:54 +00:00
Hye-Shik Chang 77d9a3effa Patch #871657: Set EDOM for `nan' return values on FreeBSD and OpenBSD.
This fixes a problem that math.sqrt(-1) doesn't raise math.error.
2004-03-22 08:43:55 +00:00
Nicholas Bastin e62c5c88f1 Added configure check for broken poll() on some unix systems (MacOS X 10.3)
Fixes SF Bug #850981
2004-03-21 23:45:42 +00:00
Tim Peters 3f60629242 SF bug 847019 datetime.datetime initialization needs more strict checking
It's possible to create insane datetime objects by using the constructor
"backdoor" inserted for fast unpickling.  Doing extensive range checking
would eliminate the backdoor's purpose (speed), but at least a little
checking can stop honest mistakes.

Bugfix candidate.
2004-03-21 23:38:41 +00:00
Hye-Shik Chang c3a87b8dbb Bug #920575: Add a workaround for GNU libc nl_langinfo()'s returning NULL.
(Reported by Matthias Klose)
2004-03-21 19:34:30 +00:00
Raymond Hettinger 1e5809ff02 Improve deque iteration.
* The default __reversed__ performed badly, so reintroduced a custom
  reverse iterator.
* Added length transparency to improve speed with map(), list(), etc.
2004-03-18 11:04:57 +00:00
Raymond Hettinger 0faa1ca51d Speedup the inner loops for dropwhile(), islice(), ifilter(), and
ifilterfalse().
2004-03-17 04:27:44 +00:00
Gregory P. Smith 0c65771f92 fixes SF bug 914019 - DB.has_key was not honoring its txn argument 2004-03-16 06:56:58 +00:00
Raymond Hettinger 49f9bd15ff SF feature request #686323: Minor array module enhancements
array.extend() now accepts iterable arguments implements as a series
of appends.  Besides being a user convenience and matching the behavior
for lists, this the saves memory and cycles that would be used to
create a temporary array object.
2004-03-14 05:43:59 +00:00
Raymond Hettinger 6e2ee866fa Update the array overallocation scheme to match the approach used for
lists.  Speeds append() operations and reduces memory requirements
(because of more conservative overallocation).

Paves the way for the feature request for array.extend() to support
arbitrary iterable arguments.
2004-03-14 04:37:50 +00:00
Raymond Hettinger 3aa82c07f7 SF bug #910986: copy.copy fails for array.array
Added support for the copy module.
2004-03-13 18:18:51 +00:00
Raymond Hettinger 6ec099658a SF patch #907403: Improvements to cStringIO.writelines()
The writelines() method now accepts any iterable argument and writes
the lines one at a time rather than using ''.join(lines) followed by
a single write.  Results in considerable memory savings and makes
the method suitable for use with generator expressions.
2004-03-08 18:17:31 +00:00
Raymond Hettinger 6c79a518e7 Special case endpoint access for speed. 2004-03-04 08:00:54 +00:00
Brett Cannon d1080a3418 Have strftime() check its time tuple argument to make sure the tuple's values
are within proper boundaries as specified in the docs.

This can break possible code (datetime module needed changing, for instance)
that uses 0 for values that need to be greater 1 or greater (month, day, and
day of year).

Fixes bug #897625.
2004-03-02 04:38:10 +00:00
Raymond Hettinger 0a4977c2f3 Replace left(), right(), and __reversed__() with the more general purpose
__getitem__() and __setitem__().

Simplifies the API, reduces the code size, adds flexibility, and makes
deques work with bisect.bisect(), random.shuffle(), and random.sample().
2004-03-01 23:16:22 +00:00
Skip Montanaro 786ea6bc23 Add pystack definition to Misc/gdbinit with some explanation of its behavior
and add flag comments to ceval.c and main.c alerting people to the coupling
between pystack and the layout of those files.
2004-03-01 15:44:05 +00:00
Neal Norwitz 87f10137bf Make deque_type static so namespace is not polluted. 2004-02-29 15:40:53 +00:00
Raymond Hettinger 738ec90ca1 Improvements to collections.deque():
* Add doctests for the examples in the library reference.
* Add two methods, left() and right(), modeled after deques in C++ STL.
* Apply the new method to asynchat.py.
* Add comparison operators to make deques more substitutable for lists.
* Replace the LookupErrors with IndexErrors to more closely match lists.
2004-02-29 02:15:56 +00:00
Neal Norwitz a9208f1f99 Get rid of unused variable 2004-02-28 15:56:27 +00:00
Raymond Hettinger bc72c5ae8b Speed-up the joiner call by avoiding Py_BuildValue(). 2004-02-27 10:30:49 +00:00
Christian Tismer 2460c62152 made cPickle fall back to the copy_reg/reduce protocol,
if a function cannot be stored as global.
This is for compatibility with pickle.py .
2004-02-26 16:21:45 +00:00
Gregory P. Smith a7befda8d8 Fixes SF bug # 778421
* Fixed a bug in the compatibility interface set_location() method
   where it would not properly search to the next nearest key when
   used on BTree databases.  [SF bug id 788421]
 * Fixed a bug in the compatibility interface set_location() method
   where it could crash when looking up keys in a hash or recno
   format database due to an incorrect free().
2004-02-26 10:07:14 +00:00
Neal Norwitz 44dbae8cca Remove gcc warning from using "main". Use METH_NOARGS instead of METH_VARARGS 2004-02-19 02:44:22 +00:00
David Ascher e2b4b32025 Implementation of patch 869468
Allow the user to create Tkinter.Tcl objects which are
just like Tkinter.Tk objects except that they do not
initialize Tk. This is useful in circumstances where the
script is being run on machines that do not have an X
server running -- in those cases, Tk initialization fails,
even if no window is ever created.

Includes documentation change and tests.

Tested on Linux, Solaris and Windows.

Reviewed by Martin von Loewis.
2004-02-18 05:59:53 +00:00
Anthony Baxter 5d7c06720d Make socketmodule compile again on a modern Linux (that supports Bluetooth).
The Bluetooth code was obviously never tested on Linux.
2004-02-16 05:35:28 +00:00
Neal Norwitz 94f1d71d70 Fix docstrings to mention the correct function 2004-02-16 01:26:34 +00:00
Gustavo Niemeyer 601b963be0 - Fixing annoying warnings. 2004-02-14 00:31:13 +00:00
Gustavo Niemeyer a6e436e4b4 - Fixed #853061: allow BZ2Compressor.compress() to receive an empty string
as parameter.
2004-02-14 00:02:45 +00:00
Walter Dörwald 70a6b49821 Replace backticks with repr() or "%r"
From SF patch #852334.
2004-02-12 17:35:32 +00:00
Skip Montanaro f3938fd029 need to initialize ob_type slot at run-time, at least on cygwin 2004-02-10 20:27:40 +00:00
Skip Montanaro 7befb9966e remove support for missing ANSI C header files (limits.h, stddef.h, etc). 2004-02-10 16:50:21 +00:00
Raymond Hettinger 5cab2e3a88 Give itertools.repeat() a length method. 2004-02-10 09:25:40 +00:00
Raymond Hettinger ee33b27ef0 Make deque.rotate() smarter. Beef-up related tests. 2004-02-08 04:05:26 +00:00
Raymond Hettinger 5c5eb86347 * Incorporate Skip's suggestions for documentation (explain the word deque
comes from and show the differences from lists).
* Add a rotate() method.
2004-02-07 21:13:00 +00:00
Skip Montanaro db6080507d Remove support for --without-universal-newlines (see PEP 11). 2004-02-07 13:53:46 +00:00
Raymond Hettinger c058fd14a9 * Fix ref counting in extend() and extendleft().
* Let deques support reversed().
2004-02-07 02:45:22 +00:00
Raymond Hettinger 3ba85c2e8a Have deques support high volume loads. 2004-02-06 19:04:56 +00:00
Hye-Shik Chang 96c44658b9 Add FreeBSD support for bluetooth sockets. (SF Patch #888148) 2004-02-02 08:48:45 +00:00
Hye-Shik Chang 81268608bf Add FreeBSD support for bluetooth sockets.
(SF Patch #888148, reviewed by loewis)
2004-02-02 06:05:24 +00:00
Martin v. Löwis 12af0485f8 Patch #874083: Bluetooth support for socket module. 2004-01-31 12:34:17 +00:00
Raymond Hettinger d0814eb7fe Fix spelling. 2004-01-29 07:29:32 +00:00
Raymond Hettinger 756b3f3c15 * Move collections.deque() in from the sandbox
* Add unittests, newsitem, and whatsnew
* Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py
* Docs are forthcoming
2004-01-29 06:37:52 +00:00
Hye-Shik Chang 141d4e5643 Add missed entry for cjkcodecs._iso_2022_kr. 2004-01-28 09:03:28 +00:00
Hye-Shik Chang d210a5bed2 Fix MSVC6 warnings. (spotted by Tim Peters) 2004-01-23 14:36:17 +00:00
Barry Warsaw e1b1c87636 pwd_getpwuid(), pwd_getpwnam(): Patch # 868499, improvement to the error
messages.
2004-01-20 21:07:23 +00:00
Barry Warsaw c7a7709321 grp_getgrgid(), grp_getgrnam(): Patch # 868499, improvement to the error
messages.
2004-01-20 21:06:00 +00:00
Gustavo Niemeyer f073b7584f Removing TODO comment for None keys, as suggested by Neal Norwitz. 2004-01-20 15:24:29 +00:00
Gustavo Niemeyer 8974f72b81 When key is None, give up if _DB_get_type() returns -1 as well. 2004-01-20 15:20:03 +00:00
Gustavo Niemeyer 024f2de05f Fixing #880531: raise TypeError when trying to use a None key with RECNO
or QUEUE database.
2004-01-20 15:14:55 +00:00
Hye-Shik Chang 3e2a306920 Add CJK codecs support as discussed on python-dev. (SF #873597)
Several style fixes are suggested by Martin v. Loewis and
Marc-Andre Lemburg. Thanks!
2004-01-17 14:29:29 +00:00
Skip Montanaro ce59c04127 Remove support for SunOS 4.
Remove BAD_EXEC_PROTOYPE (leftover from IRIX 4 demolition).
2004-01-17 14:19:44 +00:00
Andrew M. Kuchling 8135fd5365 Make parameter names in docstring more mnemonic 2004-01-16 13:18:42 +00:00
Sjoerd Mullender 7e6bbe1516 The format of the string data used in the imageop module is described
as "This is the same format as used by gl.lrectwrite() and the imgfile
module."  This implies a certain byte order in multi-byte pixel
formats.  However, the code was originally written on an SGI
(big-endian) and *uses* the fact that bytes are stored in a particular
order in ints.  This means that the code uses and produces different
byte order on little-endian systems.

This fix adds a module-level flag "backward_compatible" (default not
set, and if not set, behaves as if set to 1--i.e. backward compatible)
that can be used on a little-endian system to use the same byte order
as the SGI.  Using this flag it is then possible to prepare
SGI-compatible images on a little-endian system.

This patch is the result of a (small) discussion on python-dev and was
submitted to SourceForge as patch #874358.
2004-01-10 20:43:43 +00:00
Raymond Hettinger 0c4102760c SF Patch #864863: Bisect C implementation
(Contributed by Dmitry Vasiliev.)
2004-01-05 10:13:35 +00:00
Hye-Shik Chang 2b2c97356f FIx unicodefilename support of posix.uname(). This fixes test_unicode_file
failure on FreeBSD.
2004-01-04 13:54:25 +00:00
Raymond Hettinger 674d56b82e Convert return value to boolean. 2004-01-04 04:00:13 +00:00
Martin v. Löwis da91d02461 Add IPV6_ socket options from RFCs 3493 and 3542. Fixes #867012. 2003-12-30 11:14:01 +00:00
Hye-Shik Chang a7b673f47c Fix erroneus argument parsing of socket.htons() on 64bit big endian
machines.
2003-12-17 09:40:23 +00:00
Neal Norwitz 9342fb41c3 Make private/local functions static 2003-12-13 22:31:53 +00:00
Gustavo Niemeyer 2cbdc2a461 Cleaning up recursive pieces left in the reorganization. 2003-12-13 20:32:08 +00:00
Raymond Hettinger d25c1c6351 Implement itertools.groupby()
Original idea by Guido van Rossum.
Idea for skipable inner iterators by Raymond Hettinger.
Idea for argument order and identity function default by Alex Martelli.
Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger).
2003-12-06 16:23:06 +00:00
Raymond Hettinger bd3a240e6d Fix typos. 2003-12-04 22:17:49 +00:00
Mark Hammond 817c929bba Fix [ 846133 ] os.chmod/os.utime/shutil do not work with unicode filenames 2003-12-03 01:22:38 +00:00
Skip Montanaro 148eb6a6b6 doc nit 2003-12-02 18:57:47 +00:00
Raymond Hettinger 166958b5df As discussed on python-dev, added two extractor functions to the
operator module.
2003-12-01 13:18:39 +00:00
Martin v. Löwis 94681fc4a3 Patch #849595: Add socket.shutdown() constants. 2003-11-27 19:40:22 +00:00
Guido van Rossum 0bba722fff Silence GCC warning when asserts are turned off. 2003-11-24 04:02:13 +00:00
Tim Peters 403a203223 SF bug 839548: Bug in type's GC handling causes segfaults.
Also SF patch 843455.

This is a critical bugfix.
I'll backport to 2.3 maint, but not beyond that.  The bugs this fixes
have been there since weakrefs were introduced.
2003-11-20 21:21:46 +00:00
Jack Jansen 7107c1aff3 Got rid of macglue.h, replacing it by pymactoolbox.h where relevant.
Cleaned up various things in the toolbox modules.
2003-11-20 13:31:00 +00:00
Jack Jansen eddc1449ba Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
Jack Jansen 4bae2d5e46 Getting rid of code dependent on GUSI or the MetroWerks compiler. 2003-11-19 22:52:23 +00:00
Jack Jansen fb2765666f Getting rid of support for the ancient Apple MPW compiler. 2003-11-19 15:24:47 +00:00
Martin v. Löwis 6caea370ac Patch #794400: Let PYTHONSTARTUP influence the compiler flags. 2003-11-18 19:46:25 +00:00
Raymond Hettinger 6dab05231d Change ValueErrors to TypeErrors and add PyList_Check() assertions. 2003-11-15 12:40:28 +00:00
Raymond Hettinger 236a2443fb Verify heappop argument is a list. 2003-11-15 12:33:01 +00:00
Tim Peters 780c497972 update_refs(): assert that incoming refcounts aren't 0. The comment
for this function has always claimed that was true, but it wasn't
verified before.  For the latest batch of "double deallocation" bugs
(stemming from weakref callbacks invoked by way of subtype_dealloc),
this assert would have triggered (instead of waiting for
_Py_ForgetReference to die with a segfault later).
2003-11-14 00:01:17 +00:00
Martin v. Löwis f56d015a71 Patch #804543: strdup saved locales. Backported to 2.3. 2003-11-13 07:43:21 +00:00
Raymond Hettinger ad983e79d6 Improve the implementation of itertools.tee().
Formerly, underlying queue was implemented in terms of two lists.  The
new queue is a series of singly-linked fixed length lists.

The new implementation runs much faster, supports multi-way tees, and
allows tees of tees without additional memory costs.

The root ideas for this structure were contributed by Andrew Koenig
and Guido van Rossum.
2003-11-12 14:32:26 +00:00
Martin v. Löwis 49ee14dac5 Patch #839038: Add getsid(2). 2003-11-10 06:35:36 +00:00
Raymond Hettinger b3af1813eb Convert heapq.py to a C implementation. 2003-11-08 10:24:38 +00:00
Martin v. Löwis d2171d2ba4 Overallocate target buffer for normalization more early. Fixes #834676.
Backported to 2.3.
2003-11-06 20:47:57 +00:00
Gregory P. Smith 7441e65821 * SF patch 835100 - C++ // comments are not allowed. Use /* */ 2003-11-03 21:35:31 +00:00
Gregory P. Smith a703a21b48 * Use weakref's of DBCursor objects for the iterator cursors to avoid a
memory leak that would've occurred for all iterators that were
  destroyed before having iterated until they raised StopIteration.

* Simplify some code.

* Add new test cases to check for the memleak and ensure that mixing
  iteration with modification of the values for existing keys works.
2003-11-03 01:04:41 +00:00
Gregory P. Smith dc113a8a06 * Fix the singlethreaded deadlocks occurring in the simple bsddb interface.
* Add support for multiple iterator/generator objects at once on the simple
  bsddb _DBWithCursor interface.
2003-11-02 09:10:16 +00:00
Gregory P. Smith e276717113 Fix a tuple memory leak when raising DB, DBEnv and DBCursor "object
has been closed" exceptions.

Adds a DBCursorClosedError exception in the closed cursor case for
future use in fixing the legacy bsddb interface deadlock problems
due to its use of cursors with DB_INIT_LOCK | DB_THREAD support
enabled.
2003-11-02 08:06:29 +00:00
Martin v. Löwis be4fea6198 Patch #787189: Explicitly define CTRL on SGI. 2003-10-31 13:01:24 +00:00
Martin v. Löwis 9ad853bc37 Patch #788404: ignore "b" and "t" mode modifiers in posix_popen.
Fixes #703198. Backported to 2.3.
2003-10-31 10:01:53 +00:00
Raymond Hettinger 0e4f76405d Fix nits in error messages. 2003-10-28 07:32:28 +00:00
Martin v. Löwis 405a7952fd Patch #803998: Correctly check for error in SSL_write. 2003-10-27 14:24:37 +00:00
Raymond Hettinger f0c5aec85f Minor improvements to itertools.tee():
* tee object is no longer subclassable
* independent iterators renamed to "itertools.tee_iterator"
* fixed doc string typo and added entry in the module doc string
2003-10-26 14:25:56 +00:00
Raymond Hettinger 4514369f27 Improvements to coding for itertools.tee():
* Add error checking code to PyList_Append() call.

* Replace PyObject_CallMethod(to->outbasket, "pop", NULL) with equivalent
  in-line code.  Inlining is important here because the search for the
  pop method will occur for every element returned by the iterator.

* Make tee's dealloc() a little smarter.  If the trailing iterator is
  being deallocated, then the queue data is no longer needed and can
  be freed.
2003-10-25 06:37:47 +00:00
Raymond Hettinger 6a5b027742 Added itertools.tee()
It works like the pure python verion except:
* it stops storing data after of the iterators gets deallocated
* the data queue is implemented with two stacks instead of one dictionary.
2003-10-24 08:45:23 +00:00
Guido van Rossum 16b9fa8db3 - The pwd module incorrectly advertised its struct type as
struct_pwent; this has been renamed to struct_passwd.  (The old name
  is still supported for backwards compatibility.)
2003-10-23 23:54:57 +00:00
Fred Drake 08317aefef Update to Expat 1.95.7; there are no changes to the Expat sources. 2003-10-21 15:38:55 +00:00
Walter Dörwald f0dfc7ac5c Fix a bunch of typos in documentation, docstrings and comments.
(From SF patch #810751)
2003-10-20 14:01:56 +00:00
Gustavo Niemeyer 0f0c06a5c2 Removing dead code. 2003-10-18 20:54:44 +00:00
Gustavo Niemeyer ad3fc44ccb Implemented non-recursive SRE matching. 2003-10-17 22:13:16 +00:00
Raymond Hettinger 8ae4689657 Simplify and speedup uses of Py_BuildValue():
* Py_BuildValue("(OOO)",a,b,c)  -->  PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a)         -->  PyTuple_New(0)
* Py_BuildValue("O", a)         -->  Py_INCREF(a)
2003-10-12 19:09:37 +00:00
Raymond Hettinger 2f726e9093 SF bug #812202: randint is always even
* Added C coded getrandbits(k) method that runs in linear time.
* Call the new method from randrange() for ranges >= 2**53.
* Adds a warning for generators not defining getrandbits() whenever they
  have a call to randrange() with too large of a population.
2003-10-05 09:09:15 +00:00
Anthony Baxter bab23cfc26 made the SGI INET_ADDRSTRLEN define apply for any compiler on Irix. Both the
SGI compiler and GCC seem to need this.
2003-10-04 08:00:49 +00:00
Martin v. Löwis d46e684edd Check for TclError when reading variables. Fixes #807314.
Backported to 2.3.
2003-10-03 17:12:26 +00:00
Martin v. Löwis a0f1734e44 Patch #813445: Add missing socket.IPPROTO_IPV6. Backported to 2.3. 2003-10-03 13:56:20 +00:00
Gregory P. Smith be0db8b125 bsddb3 4.2.2, adds DBCursor.get_current_size() method to return the length
of the current value without reading the value itself.
2003-10-01 06:48:51 +00:00
Gregory P. Smith 7000225fbc raise pybsddb version number to 4.2.1 to differentiate between it and the
version in the python 2.3.1 tree.
2003-09-21 23:29:41 +00:00
Gregory P. Smith 41631e8f66 Adds basic support for BerkeleyDB 4.2.x. Compiles and passes tests; new
features in BerkeleyDB not exposed.  notably: the DB_MPOOLFILE interface
has not yet been wrapped in an object.

Adds support for building and installing bsddb3 in python2.3 that has
an older version of this module installed as bsddb without conflicts.
The pybsddb.sf.net build/packaged version of the module uses a
dynamicly loadable module called _pybsddb rather than _bsddb.
2003-09-21 00:08:14 +00:00
Martin v. Löwis e7a9796a0f Patch #800697: Add readline.clear_history. 2003-09-20 16:08:33 +00:00
Martin v. Löwis 212ede6cbf Patch #730597: Disable POPEN for RTEMS. 2003-09-20 11:20:30 +00:00
Martin v. Löwis 1b699a5f00 Patch #790000: Allow os.access to handle Unicode file name. 2003-09-12 16:25:38 +00:00
Brett Cannon 62dba4c277 select.select() now accepts a sequence (as defined by PySequence_Fast()) for
its first three arguments.

Closes RFE #798046 .
2003-09-10 19:37:42 +00:00
Just van Rossum ee8f10fa37 Patch #801349: 64-bit fix for AMD64 from Gwenole Beauchesne.
Classical problem with int vs. long mismatch in varargs.
2.3 backport candidate.
2003-09-07 13:36:48 +00:00
Martin v. Löwis f5b93736a2 Patch #798145: Return correct information from nl_langinfo(RADIXCHAR).
Will backport to 2.3.
2003-09-04 18:24:47 +00:00
Jason Tishler 6bc06eca70 Bug #794140: cygwin builds do not embed
The embed2.diff patch solves the user's problem by exporting the missing
symbols from the Python core so Python can be embedded in another Cygwin
application (well, at lest vim).
2003-09-04 11:59:50 +00:00
Martin v. Löwis 25f90d5c5d Use de_DE in example, change message for unknown locale. Fixes #797447.
Will backport to 2.3.
2003-09-03 04:50:13 +00:00
Raymond Hettinger b5cb66542d SF patch #798534: Windows os.popen needlessly gets a reference to tuple ()
(Contributed by Andrew Gaul.)

Fixes a minor leak.
2003-09-01 22:25:41 +00:00
Raymond Hettinger 4f01f89b8c For safety, replace a tuple entry before decreffing it. 2003-08-30 00:10:06 +00:00
Raymond Hettinger a56f6b6600 SF bug #793826: using itertools.izip to mutate tuples
Avoid Armin Rigo's dastardly exercise in re-entrancy.
2003-08-29 23:09:58 +00:00
Gregory P. Smith 6676f6edc1 Support DBEnv.set_shm_key() to allow multi-threaded multi-process
database environments to use shared memory on systems supporting it.
2003-08-28 21:50:30 +00:00
Raymond Hettinger 3432118022 SF #784031: Byte-order bug in socket-module getaddrinfo.c 2003-08-17 21:28:39 +00:00
Michael W. Hudson f02bcee095 Fix silly leak in test used in test_exceptions. 2003-08-15 13:03:30 +00:00
Andrew M. Kuchling 69f31eb80c [Patch #739124] Add use_default_colors() to curses module 2003-08-13 23:11:04 +00:00
Skip Montanaro eb2f0612e1 reverting to 2.41 version (distinct tp_names) - will add verbiage to the
docs
2003-08-11 14:51:15 +00:00
Skip Montanaro e138828d03 shit - just change the visible name, not the comments - strictly speaking,
the tp_name is not correct, but what's exposed to users is known visibly as
"StringIO", not "StringI" or "StringO".
2003-08-11 13:15:11 +00:00
Skip Montanaro 4a0d3d2e40 typos 2003-08-11 13:09:12 +00:00
Raymond Hettinger 5475f2394a SF bug #770485: cStringIO does not set closed attr 2003-08-08 12:20:03 +00:00
Raymond Hettinger b5a420883c Modified itertools.izip() to match the behavior of __builtin__.zip()
which can now take zero arguments.
2003-08-08 05:10:41 +00:00
Martin v. Löwis 5db099a4fe Release host name memory. Fixes #783312. Will backport to 2.3. 2003-08-07 11:55:15 +00:00
Mark Hammond 7edd0a9b21 Demonstrate and fix [ 783882 ] os.lstat crashes with Unicode filename.
Will also check in on the 2.3 branch.
2003-08-06 02:46:58 +00:00
Raymond Hettinger 85004cc47d SF bug #782369: Massive memory leak in array module
Fixed leak caused by switching from PyList_GetItem to PySequence_GetItem.
Added missing NULL check.
Clarified code by converting an "if" to an "else if".

Will backport to 2.3.
2003-08-05 11:23:59 +00:00
Martin v. Löwis 106490915b Patch #781722: Reject AF_INET6 if IPv6 is disabled. Will backport to 2.3. 2003-08-05 06:25:06 +00:00
Anthony Baxter f37f37dec0 Patch [ 776725 ] add SIGRTMIN, SIGRTMAX to signalmodule.c
Trivial patch, and the alternative is to guess at the right values
based on platform...
2003-07-31 10:35:29 +00:00
Mark Hammond 9a71475e9e Fix [ 776721 ] locale.setlocale() leaks
Our saved locale was not being freed.  Also check correct variable for
NULL.
2003-07-24 14:15:07 +00:00
Thomas Heller 354e3d90d3 Change the zipimport implementation to accept files containing
arbitrary bytes before the actual zip compatible archive.  Zipfiles
containing comments at the end of the file are still not supported.

Add a testcase to test_zipimport, and update NEWS.

This closes sf #775637 and sf #669036.
2003-07-22 18:10:15 +00:00
Fred Drake f239c6d537 Repair mis-application of Jeremy's patch. Thanks, Neal! 2003-07-21 17:22:43 +00:00
Fred Drake 7b6caffd70 Fix memory leak reported & discussed on the Python XML-SIG mailing list.
This patch was provided by Jeremy Kloth, and corresponds to pyexpat.c
1.77 in the PyXML CVS.
2003-07-21 17:05:56 +00:00
Tim Peters 6a627250d2 Merge 23c1-branch back into the head. Barry will send email about the
New Plan (releases to be made off the head, ongoing random 2.4 stuff
to be done on a short-lived branch, provided anyone is motivated enough
to create one).
2003-07-21 14:25:23 +00:00
Jeremy Hylton fb509a36c8 Get socketmodule compiling on IRIX 6.5.10.
I don't think the fix here is very good, but I'm not sure what would
be better.  In particular, we should not be defining _SGIAPI, but lots
of things break if we remove it.
2003-07-17 16:58:48 +00:00
Michael W. Hudson afd43b5512 Remove inaccurate (and it turns out, entirely superfluous) declarations of
PyOS_InputHook and PyOS_ReadlineFunctionPointer).

The inaccuracies were causing problems in framework builds on Mac OS X.
2003-07-17 16:26:58 +00:00
Jeremy Hylton 032fffefe6 Remove unused variable. 2003-07-17 15:56:07 +00:00
Martin v. Löwis 35c38eaeae heck environment closed status before closing a cursors. Fixes #763928. 2003-07-15 19:12:54 +00:00