Commit Graph

3291 Commits

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