Commit Graph

3546 Commits

Author SHA1 Message Date
Martin v. Löwis 0b49e02e03 Patch #977074: Move Encode/Decode to the top so gcc can inline them. 2004-08-03 13:08:07 +00:00
Michael W. Hudson 0bb8454ed4 Fix the reference count errors revealed by the test suite... 2004-08-03 11:31:31 +00:00
Raymond Hettinger cbcff93d49 Restore compilation on MSVC++ 6.0 2004-08-03 08:52:46 +00:00
Armin Rigo a41276956d SF bug #808756: refleaks in _hotshot.c. 2004-08-03 08:33:55 +00:00
Fred Drake 31d485c0f5 update to Expat 1.95.8 2004-08-03 07:06:22 +00:00
Mark Hammond a57ec93b93 Fix [ 1001018 ]: Windows: setdefaulttimeout causes unnecessary timeouts on
connect error
2004-08-03 05:06:26 +00:00
Michael W. Hudson c9f510aed2 Any call to insort_{left,right} with a non-list leaked a reference to None
(or to whatever the 'insert' method chose to return).
2004-08-02 13:24:54 +00:00
Anthony Baxter c2a5a63654 PEP-0318, @decorator-style. In Guido's words:
"@ seems the syntax that everybody can hate equally"
Implementation by Mark Russell, from SF #979728.
2004-08-02 06:10:11 +00:00
Neal Norwitz 014f103705 SF bug #999776, zlib home page wrong
Backport candidate.
2004-07-29 03:55:56 +00:00
Hye-Shik Chang eb34110190 Remove CJKCodecs implementation of UTF-7 and UTF-8 codec which
aren't intended to be part of Python distributiuon.  This was
accidently imported on mass converting from standalone version of
CJKCodecs.
2004-07-28 09:36:52 +00:00
Martin v. Löwis b600fe90a7 Switch arguments to memset (kudos to MSVC C4318 for finding that) 2004-07-27 15:03:53 +00:00
Martin v. Löwis 544f1195b1 Patch #995766: Keyword argument support in cPickle. 2004-07-27 05:22:33 +00:00
Gustavo Niemeyer 7bd33c5e22 This change implements the following gettext features, as
discussed recently in python-dev:

In _locale module:

- bind_textdomain_codeset() binding

In gettext module:

- bind_textdomain_codeset() function
- lgettext(), lngettext(), ldgettext(), ldngettext(),
  which return translated strings encoded in
  preferred system encoding, if
  bind_textdomain_codeset() was not used.
- Added equivalent functionality in translate()
  function and catalog classes.

Every change was also documented.
2004-07-22 18:44:01 +00:00
Neal Norwitz dc8e1942dd Fix SF #994580, typo in time.tzsets docstring. Backport candidate 2004-07-20 22:34:37 +00:00
Martin v. Löwis 81aec4bb80 Patch #984654: Add more address family constants. 2004-07-19 17:01:20 +00:00
Martin v. Löwis 8fbefe2874 Patch #993173: Enable audioop on 64-bit platforms. 2004-07-19 16:42:20 +00:00
Raymond Hettinger e9c89e8308 Silence a GCC unused variable warning in debug builds. 2004-07-19 00:10:24 +00:00
Hye-Shik Chang 64a9e38f35 Replace an extern magic to assigning declared pointer from array's.
And unifdef(1) compatibility blocks.
2004-07-18 15:02:45 +00:00
Hye-Shik Chang ca455e8bc9 Remove unused CNS-11643 mapping which shouldn't merged into main Python
yet.
2004-07-18 08:35:43 +00:00
Tim Peters 182b5aca27 Whitespace normalization, via reindent.py. 2004-07-18 06:16:08 +00:00
Tim Peters 91380d5f28 Repair MS compiler warning about signed-vs-unsigned mismatch. The plane
and width clearly don't need to be signed.
2004-07-18 04:34:33 +00:00
Tim Peters 7c7b3da46e Added a comment explaining the extern ugliness. 2004-07-18 04:26:10 +00:00
Tim Peters 0f27166e6a Changed the "predefinitions" of codec_list and mapping_list from static
to extern.  It's not legal C to say

     static whatever[];

because the size isn't given.  Presumably this is a gcc extension.
2004-07-18 04:20:15 +00:00
Hye-Shik Chang 2bb146f2f4 Bring CJKCodecs 1.1 into trunk. This completely reorganizes source
and installed layouts to make maintenance simple and easy.  And it
also adds four new codecs; big5hkscs, euc-jis-2004, shift-jis-2004
and iso2022-jp-2004.
2004-07-18 03:06:29 +00:00
Raymond Hettinger 67115a2b02 Apply VISIT macro. 2004-07-15 21:32:18 +00:00
Nicholas Bastin 9ba301e589 Moved SunPro warning suppression into pyport.h and out of individual
modules and objects.
2004-07-15 15:54:05 +00:00
Jack Jansen 59f072ad7c Moved PyMac_GetScript() to _localemodule, which is the only place where
it is used, and made it private. Should fix #978662.
2004-07-15 13:31:39 +00:00
Raymond Hettinger 58ed69b402 Exercise Jim's VISIT macro. 2004-07-15 05:32:47 +00:00
Hye-Shik Chang 69dc1c8f6a Fix typo. 2004-07-15 04:30:25 +00:00
Jim Fulton d15dc06df0 Implemented thread-local data as proposed on python-dev:
http://mail.python.org/pipermail/python-dev/2004-June/045785.html
2004-07-14 19:11:50 +00:00
Andrew M. Kuchling b8e1717041 [Patch #947352 from Jason Andryuk] Add support for AF_PACKET hardware addresses 2004-07-10 23:39:35 +00:00
Brett Cannon 3e377decef Change some declarations from ``char *`` to ``const char *``. Also added
docstrings for decode and encode; accidentally were left out of the PyMethodDev
table.
2004-07-10 21:41:14 +00:00
Andrew M. Kuchling 27d3dda7f1 [Patch #909007] Enable a bunch of safe bug workarounds in OpenSSL, for compatibility with various broken SSL implementations out there. 2004-07-10 21:36:55 +00:00
Andrew M. Kuchling 9c3efe3ec6 [Patch #945642] Fix non-blocking SSL sockets, which blocked on reads/writes in Python 2.3.
(It turns out that the Debian unstable packaging of Python 2.3.4 includes this patch.)
Patch by Tino Lange.
2004-07-10 21:15:17 +00:00
Brett Cannon 3ffff2a270 Add comments at end of every #endif and fix ones already there when for closing
off #ifndef's.
2004-07-10 19:30:39 +00:00
Andrew M. Kuchling 42851ab490 [Patch #982665 ] add SO_EXCLUSIVEADDRUSE constant 2004-07-10 14:19:21 +00:00
Marc-André Lemburg 3f41974525 Add generic codecs.encode() and .decode() APIs that don't impose
any restriction on the return type (like unicode.encode() et al. do).
2004-07-10 12:06:10 +00:00
Brett Cannon f6067ec336 Add an #ifdef __APPLE__ around typedef of foreachfunc to match Apple's
incorrect declaration for ypall_callback in /usr/include/rpcsvc/ypcInt.h .
Shouldn't hurt any code since the differences are unsigned long instead of int and
void * instead of char *.  Removes warning about improper function pointer
assignment during compilation.
2004-07-10 00:57:37 +00:00
Neal Norwitz 37b0c1dbf4 Fix memory leak and bump the version per Greg 2004-07-09 23:33:06 +00:00
Neal Norwitz b4a55813fe Cleanup support for older pythons (perhaps it should be removed?) 2004-07-09 23:30:57 +00:00
Raymond Hettinger a435c53e13 * balance the left/right search for getitem.
* use assertions instead of tests after internal calls that can't fail.
* expand test coverage
2004-07-09 04:10:20 +00:00
Michael W. Hudson 2384990603 PyThreadState_Swap(NULL) didn't do what I thought it did. Fixes
[ 987287 ] Python 2.4a1, interpreter hanging on Keyboard Interrupt
2004-07-08 15:28:26 +00:00
Michael W. Hudson 30ea2f223f This closes patch:
[ 960406 ] unblock signals in threads

although the changes do not correspond exactly to any patch attached to
that report.

Non-main threads no longer have all signals masked.

A different interface to readline is used.

The handling of signals inside calls to PyOS_Readline is now rather
different.

These changes are all a bit scary!  Review and cross-platform testing
much appreciated.
2004-07-07 17:44:12 +00:00
Andrew M. Kuchling ea271f2d5e [Bug #982806] The default argument for opening GDBM files is bogus. Patch #984672 by James Lamanna 2004-07-07 14:19:09 +00:00
Andrew MacIntyre 5a8b4593d3 OS/2 EMX needs addrinfo.h for code included from getaddrinfo.c 2004-07-07 14:02:59 +00:00
Fred Drake 0a4dd390bf Make weak references subclassable:
- weakref.ref and weakref.ReferenceType will become aliases for each
  other

- weakref.ref will be a modern, new-style class with proper __new__
  and __init__ methods

- weakref.WeakValueDictionary will have a lighter memory footprint,
  using a new weakref.ref subclass to associate the key with the
  value, allowing us to have only a single object of overhead for each
  dictionary entry (currently, there are 3 objects of overhead per
  entry: a weakref to the value, a weakref to the dictionary, and a
  function object used as a weakref callback; the weakref to the
  dictionary could be avoided without this change)

- a new macro, PyWeakref_CheckRefExact(), will be added

- PyWeakref_CheckRef() will check for subclasses of weakref.ref

This closes SF patch #983019.
2004-07-02 18:57:45 +00:00
Gregory P. Smith 19699a9351 Adds support for DB.pget and DBCursor.pget methods.
Based on a patch supplied by Ian Ward <ian@arevco.ca> on the pybsddb
mailing list 2004-03-26.
2004-06-28 04:06:49 +00:00
Gregory P. Smith 31c50659ea Add weakref support to all bsddb.db objects.
Make DBTxn objects automatically call abort() in their destructor if
not yet finalized and raise a RuntimeWarning to that effect.
2004-06-28 01:20:40 +00:00
Barry Warsaw 11b91a0ea3 Added socket.getservbyport(), and make its second argument and that of
getservbyname() optional.  Update the tests and the docs.
2004-06-28 00:50:43 +00:00
Gregory P. Smith 589c6abd1b raise the module minor version. 2004-06-27 23:36:37 +00:00
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