Commit Graph

3383 Commits

Author SHA1 Message Date
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
Andrew M. Kuchling a3016678ed [Patch #708374] Only apply the check for file size if the file is a regular file, not a character or block device. 2003-07-15 12:37:46 +00:00
Raymond Hettinger 1d7a3489e9 SF patch #770521: make itertools type declarations static
(Contributed by Andrew I MacIntyre.)
2003-07-14 07:07:12 +00:00
Jeremy Hylton fff093fa7f The Unpickler forget about its find_class attribute. 2003-07-11 19:42:49 +00:00
Mark Hammond 14350ab006 Fix [ 766669 ] Consistent GPF on exit
Use Py_AtExit instead of atexit so we are called during Py_Finalize()
rather than during DLL teardown.
2003-07-09 04:57:46 +00:00
Gregory P. Smith 455d46f0d9 bsddb 4.1.6:
* Extended DB & DBEnv set_get_returns_none functionality to take a
   "level" instead of a boolean flag.  The boolean 0 and 1 values still
   have the same effect.  A value of 2 extends the "return None instead
   of raising an exception" behaviour to the DBCursor set methods.
   This will become the default behaviour in pybsddb 4.2.
 * Fixed a typo in DBCursor.join_item method that made it crash instead
   of returning a value.  Obviously nobody uses it.  Wrote a test case
   for join and join_item.
2003-07-09 04:45:59 +00:00
Skip Montanaro bd2de3a65b typo 2003-07-08 21:17:25 +00:00
Gregory P. Smith 84261d2f13 Fix a typo/cut-n-paste error in DBCursor.join_item so that it doesn't
return a tuple.  (this also implies that nobody uses this method; the
bug has been here for a long time)
2003-07-07 19:06:45 +00:00
Neal Norwitz 21d896cfa1 Use appropriate macros not the deprecated DL_IMPORT/DL_EXPORT macros 2003-07-01 20:15:21 +00:00
Brett Cannon 20def8bb19 Make temporary change of using _strptime for time.strptime permanent.
Flesh out docs to better explain time.strptime (closes bug #697990).
2003-07-01 05:16:08 +00:00
Neal Norwitz a9002f824b Fix SF #754870, SSL crash interpreter when remote side closes during connect
Also fix a memory leak.
2003-06-30 03:25:20 +00:00
Neal Norwitz 4730880d76 Fix typo, refer to proper argument name 2003-06-30 01:54:04 +00:00
Barry Warsaw d86dcd3554 Py_Main(): Add a check for the PYTHONINSPECT environment variable
after running the script so that a program could do something like:

os.environ['PYTHONINSPECT'] = 1

to programmatically enter a prompt at the end.

(After a patch by Skip Montanaro w/ proposal by Troy Melhase
2003-06-29 17:07:06 +00:00
Raymond Hettinger ef7343c6cd SF patch #760257: add socket.timeout exception
(Contributed by Bob Halley)

Added a new exception, socket.timeout so that timeouts can be differentiated
from other socket exceptions.

Docs, more tests, and newsitem to follow.
2003-06-29 03:08:05 +00:00
Martin v. Löwis afec8e3bde Patch #751916: Check for signals, fix some refcounting errors. 2003-06-28 07:40:23 +00:00
Jeremy Hylton 9263f5797c Fix several bugs in handling of exceptions with trace function enabled.
If the callback raised an exception but did not set curexc_traceback,
the trace function was called with PyTrace_RETURN.  That is, the trace
function was called with an exception set.  The main loop detected the
exception when the trace function returned; it complained and disabled
tracing.

Fix the logic error so that PyTrace_RETURN only occurs if the callback
returned normally.

The trace function must be called for exceptions, too.  So we had
to add new functionality to call with PyTrace_EXCEPTION.  (Leads to a
rather ugly ifdef / else block that contains only a '}'.)

Reverse the logic and name of NOFIX_TRACE to FIX_TRACE.

Joint work with Fred.
2003-06-27 16:13:17 +00:00
Raymond Hettinger f69d9f6818 SF bug #761337: datetime.strftime fails on trivial format string
The interning of short strings violates the refcnt==1 assumption for
_PyString_Resize().

A simple fix is to boost the initial value of "totalnew" by 1.
Combined with an NULL argument to PyString_FromStringAndSize(),
this assures that resulting format string is not interned.
This will remain true even if the implementation of
PyString_FromStringAndSize() changes because only the uninitialized
strings that can be interned are those of zero length.

Added a test case.
2003-06-27 08:14:17 +00:00
Gustavo Niemeyer 28b5bb33ea Fixing bug described in patch #756032, where SRE reads invalid data
due to a corrupted end pointer.
2003-06-26 14:41:08 +00:00
Raymond Hettinger befa37dd05 Minor updates:
* Updated comment on design of imap()
* Added untraversed object in izip() structure
* Replaced the pairwise() example with a more general window() example
2003-06-18 19:25:37 +00:00
Raymond Hettinger 7d98fb9806 Add missing DECREF. 2003-06-17 23:14:40 +00:00
Jeremy Hylton f00368f9ed Remove many blanket try/except clauses.
SF bug [ 751276 ] cPickle doesn't raise error, pickle does (recursiondepth)

Most of the calls to PyErr_Clear() were intended to catch & clear an
attribute error and try something different.  Guard all those cases
with a PyErr_ExceptionMatches() and fail if some other error
occurred.  The other error is likely a bug in the user code.

This is basically the C equivalent of changing "except:" to
"except AttributeError:"
2003-06-16 20:19:49 +00:00
Kurt B. Kaiser a1ad5f658c Correct function name. 2003-06-16 18:51:28 +00:00
Martin v. Löwis d6efae500c Properly deal with tuples in Open._fixresult. Fixes bug reported in
follow-up to #621891.
2003-06-14 21:34:32 +00:00
Martin v. Löwis 19d173486b Patch #752671: NetBSD needs to link libintl to _locale.so. 2003-06-14 21:03:05 +00:00
Kurt B. Kaiser a11e846135 Add interrupt_main() to thread module. 2003-06-13 21:59:45 +00:00
Brett Cannon 807413d3b2 Clarify docstring for symlink. 2003-06-11 00:18:09 +00:00
Andrew MacIntyre 1a44448b24 Changes to sre.c after the application of patch #726869 have increased
stack usage on FreeBSD, requiring the recursion limit to be lowered
further.  Building with gcc 2.95 (the standard compiler on FreeBSD 4.x)
is now also affected.

The underlying issue is that FreeBSD's pthreads implementation has a
hard-coded 1MB stack size for the initial (or "primary") thread, which
can not be changed without rebuilding libc_r.  Exhausting this stack
results in a bus error.

Building without pthreads (configure --without-threads), or linking
with the port of the Linux pthreads library (aka Linuxthreads) instead
of libc_r, avoids this limitation.

On OS/2, only gcc 3.2 is affected and the stack size is controllable,
so the special handling has been removed.
2003-06-09 08:22:11 +00:00
Andrew McNamara dcfb38c21b Fix potential leaks identified by Neal Norwitz. 2003-06-09 05:59:23 +00:00
Guido van Rossum 0741f801ba Whitespace normalization; break a long line. 2003-06-02 14:15:34 +00:00
Guido van Rossum f39dafb10a Fix a subtle decref bug that caused a GC assertion to fail in a debug
build (assert(gc->gc.gc_refs != 0) in visit_decref()).

Because OSSAudioError is a global, we must compensate (twice!) for
PyModule_AddObject()'s "helpful" decref of the object it adds.
2003-06-02 14:11:45 +00:00
Greg Ward 84f8ecd072 Comment fix. 2003-05-29 23:44:44 +00:00
Greg Ward 38c9266f42 Change _ssize() so it doesn't rely on sizeof(char) or sizeof(short):
8 bits is 1 byte, and that isn't about to change any time soon.  (I hope!)
2003-05-29 21:55:41 +00:00
Greg Ward d676906ab7 Completely change the interface to setparameters():
* it no longer takes ssize, which served no purpose apart from
    scolding you if you got it wrong
  * changed the order of the three remaining required arguments
    to (format, channels, rate) to match the order in which they
    must be set
  * replaced the optional argument 'emulate' with 'strict': if strict
    true, and the audio device does not accept the requested sampling
    parameters, raise OSSAudioError
  * return a tuple (format, channels, rate) reflecting the sampling
    parameters that were actually set

Change the canonical name of ossaudiodev.error to
ossaudiodev.OSSAudioError (keep an alias for backwards compatibility).

Remove 'audio_types' list and 'n_audio_types' (no longer needed now that
setparameters() no longer has an 'ssize' argument to police).
2003-05-29 21:53:06 +00:00
Neal Norwitz d1c5510b99 Fix SF #745055, Memory leak in _tkinter.c/Tkapp_SplitList()
Also fix a memory leak in Tkapp_Split.

This needs to be backported.  I'll leave it up to Barry whether this
is for 2.2.3 or 2.2.4.
2003-05-29 00:17:03 +00:00
Greg Ward d0d592fd32 Oops, move the GIL release/reacquire from oss_sync() to _do_ioctl_0():
that way it applies to *only* the ioctl() call, and also happens for the
other blocking ioctls (POST, RESET).
2003-05-27 01:57:21 +00:00
Greg Ward b804390ae3 Release the GIL in two more methods:
* sync(), because it waits for hardware buffers to flush, which
    can take several seconds depending on cirumstances (according
    to the OSS docs)
  * close(), because it does an implicit sync()
2003-05-26 22:47:30 +00:00
Gustavo Niemeyer 3d5cbea202 Fixed minor typo in Setup.dist. 2003-05-26 21:19:47 +00:00
Neal Norwitz 8225103d2d Get test_ioctl to pass on HPUX 11.
TIOCGPGRP and many other definitions come from bsdtty.h, so it needs
to be included at least on HPUX.
2003-05-23 14:35:24 +00:00
Walter Dörwald 8bb1ae9c34 All calls to getarrayitem() (which is static) are done either in loops
over the size of the array, or the callers check the index bounds themselves,
so the index check never failed => Replace it with an assert().
2003-05-23 10:01:07 +00:00
Raymond Hettinger bfef18ca0e PyType_GenericAlloc is inherited from object. 2003-05-23 03:55:42 +00:00
Greg Ward 6492785ee5 Release the GIL around read(), write(), and select() calls.
Bug spotted by Joerg Lehmann <joerg@luga.de>.
2003-05-23 01:50:37 +00:00
Raymond Hettinger d449eab1e4 Fixed dotted name assertion. 2003-05-22 16:32:58 +00:00
Tim Peters 3cfe75470d PyType_Ready(): Complain if the type is a base type, and gc'able, and
tp_free is NULL or PyObject_Del at the end.  Because it's a base type
it must call tp_free in its dealloc function, and because it's gc'able
it must not call PyObject_Del.

inherit_slots():  Don't inherit tp_free unless the type and its base
agree about whether they're gc'able.  If the type is gc'able and the
base is not, and the base uses the default PyObject_Del for its
tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate
default for a gc'able type).

cPickle.c:  The Pickler and Unpickler types claim to be base classes
and gc'able, but their dealloc functions didn't call tp_free.
Repaired that.  Also call PyType_Ready() on these typeobjects, so
that the correct (PyObject_GC_Del) default memory-freeing function
gets plugged into these types' tp_free slots.
2003-05-21 21:29:48 +00:00
Martin v. Löwis 8fd86cc46e Only return objects if wantobjects is set in GetVar. 2003-05-19 19:57:42 +00:00
Walter Dörwald 9e46abed50 Fix array.array.insert(), so that it treats negative indices as
being relative to the end of the array, just like list.insert() does.
This closes SF bug #739313.
2003-05-18 03:15:10 +00:00
Tim Peters 03eaf8b1ae Added more words about the abuse of the tp_alloc nitems argument
perpetrated by the time and datetime classes.
2003-05-18 02:24:46 +00:00
Tim Peters b0c854d6a7 datetime.timedelta is now subclassable in Python. The new test shows
one good use:  a subclass adding a method to express the duration as
a number of hours (or minutes, or whatever else you want to add).  The
native breakdown into days+seconds+us is often clumsy.  Incidentally
moved a large chunk of object-initialization code closer to the top of
the file, to avoid worse forward-reference trickery.
2003-05-17 15:57:00 +00:00
Tim Peters a98924a063 datetime.datetime and datetime.time can now be subclassed in Python. Brr. 2003-05-17 05:55:19 +00:00
Tim Peters 4c53013030 Turns out there wasn't a need to define tp_free for any of the types here. 2003-05-16 22:44:06 +00:00
Tim Peters 0490011075 Stopped using the old macro form of _PyObject_Del. 2003-05-16 20:02:26 +00:00
Gregory P. Smith f655dff807 DB.remove() needs to set the internal DB handle to NULL after being called.
(sourceforge pybsddb bug #737970).

Also: don't allow other threads to run during calls that invalidate the
DB handle.
2003-05-15 00:13:18 +00:00
Martin v. Löwis a94568a753 Patch #734231: Update RiscOS support. In particular, correct
riscospath.extsep, and use os.extsep throughout.
2003-05-10 07:36:56 +00:00
Michael W. Hudson 505c4c2858 Simple fix for
[ 733781 ] fcntl fails to build on old RH Linux
2003-05-09 10:45:20 +00:00
Martin v. Löwis 28e9ce9df2 Patch #734118: Add {get|set}busywaitinterval. 2003-05-09 08:19:48 +00:00
Just van Rossum 16e426bb15 Yet another addition to [731644]: only use the lock if thread-support
is enabled.
2003-05-09 08:12:00 +00:00
Just van Rossum 09aecd7a0d Addition to [731644]: also use the lock when using the getaddrinfo
emulation (ie. when HAVE_GETADDRINFO isn't defined).
2003-05-09 08:03:44 +00:00
Just van Rossum 1040d2ce7d [ 731644] & [ 604210 ] Release the GIL around getaddrinfo(), yet protect
access with lock on those platforms that getaddrinfo() isn't (known to be)
thread-safe. Thanks to MvL for mentoring this patch.
2003-05-09 07:53:18 +00:00
Skip Montanaro c797ceb545 add open function to bsddb185 module so the file format sniffing can be
restricted to the whichdb module
2003-05-06 20:38:52 +00:00
Martin v. Löwis e941617671 Patch #724588: Check whether the address of hstrerror and inet_pton can
be taken, and define NI_MAX{HOST|SERV} if necessary.
2003-05-03 10:12:45 +00:00
Martin v. Löwis dd6cd65b98 Implement tcl object __cmp__. 2003-05-03 09:45:12 +00:00
Martin v. Löwis c16f3bd8a3 Patch #708495: Port more stuff to OpenVMS. 2003-05-03 09:14:54 +00:00
Raymond Hettinger 7c2bb5bc57 * Added a substantial number of edge case and argument tests for
the itertoolsmodule.
* Taught itertools.repeat(obj, n) to treat negative repeat counts as
  zero.  This behavior matches that for sequences and prevents
  infinite loops.
2003-05-03 05:59:48 +00:00
Raymond Hettinger 341deb74e7 The previous made the stop argument optional.
It is better to be explicit and just allow stop to be None.
2003-05-02 19:44:20 +00:00
Raymond Hettinger 14ef54cd83 SF bug #730685: itertools.islice stop argument is not optional
* itertools.islice() stop argument did not perform as documented.
* beefed-up test suite
2003-05-02 19:04:37 +00:00