Commit Graph

3200 Commits

Author SHA1 Message Date
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