Commit Graph

1849 Commits

Author SHA1 Message Date
Guido van Rossum ecc23b07a9 Hopefully fix the problem with undeclared fdatasync() on HP-UX that
was reported twice so far.

Someone with access to HP-UX, please test this!  (Is '__hppa' or
'hppa' really the correct symbol to test for?)
2000-09-22 16:01:05 +00:00
Guido van Rossum ff555e383d Address Bug #115057: add a --with-suffix option to set the EXE
variable in the Makefiles from the configure script.  Usefil for
Cygwin and Mac OS X builds.
2000-09-22 15:38:21 +00:00
Neil Schemenauer 544de1effb - Add DEBUG_SAVEALL option. When enabled all garbage objects found by the
collector will be saved in gc.garbage.  This is useful for debugging a
  program that creates reference cycles.

- Fix else statements in gcmodule.c to conform to Python coding standards.
2000-09-22 15:22:38 +00:00
Fred Drake 676940b497 When PyInt_FromLong() returns NULL, you do not need to check
PyErr_Occurred().  Removed the extra test and setting of a
bogus exception.
2000-09-22 15:21:31 +00:00
Tim Peters f58a7aafea Implemented new os.startfile function, unique to Windows, exposing a
subset of Win32 ShellExecute's functionality.  Guido wants this because
IDLE's Help -> Docs function currently crashes his machine because of a
conflict between his version of Norton AntiVirus (6.10.20) and MS's
_popen.  Docs for startfile are being mailed to Fred (or just read the
docstring -- it tells the whole story).
Changed webbrowser.py to use os.startfile instead of os.popen on Windows.
Changed IDLE's EditorWindow.py to pass an absolute path for the docs
(hardcoding ShellExecute's "directory" arg to "." as used to be done let
IDLE work, but made the startfile command exceedingly obscure for other
uses -- the MS docs are terrible, of course, & still not sure I
understand it).
Note that Windows Python must link with shell32.lib now!  That's where
ShellExecute lives.
2000-09-22 10:05:54 +00:00
Tim Peters 954eef7e51 Fix for SF bug 115051: Dodgy use of PyTuple_SET_ITEM in pyexpat.c 2000-09-22 06:01:11 +00:00
Fred Drake 0f6dcb3f9e Remove debugging print. ;( 2000-09-22 04:49:50 +00:00
Marc-André Lemburg b425f5e35b Added a true unicode_internal_encode function and fixed the
unicode_internal_decode function to support Unicode objects
directly rather than by generating a copy of the object.
2000-09-21 21:09:45 +00:00
Fred Drake ca1f426080 Remove memory leaks of strings/Unicode objects passed into the character
data and default handlers -- a new reference was being passed to
Py_BuildValue() for the "O" format character; using "N" plugs the leak.

Fixed two other (minor) leaks that occurred on various error conditions.

Removed uses of the UNLESS macro, which makes code hard to read, and is
Evil.
2000-09-21 20:10:23 +00:00
Fredrik Lundh 5644b7fad1 - fixed yet another gcc -pedantic warning
- added experimental "expand" method to match objects
- don't use the buffer interface on unicode strings
2000-09-21 17:03:25 +00:00
Guido van Rossum cf06571a8b Use PyOS_setsig() instead of signal(). Also remove redundant spaces
from the FreeBSD code.
2000-09-21 14:32:04 +00:00
Guido van Rossum 6c0f33f8ef Add a definition of rl_library_version. Reported by jpettit@sourceforge. 2000-09-20 20:24:21 +00:00
Guido van Rossum 4622e146ee Randall Hopper: Add fpectl functionality patch for FreeBSD. 2000-09-19 13:35:40 +00:00
Martin v. Löwis c912a3a8fd Implement readlines function. Closes Bug #110686. 2000-09-19 11:06:46 +00:00
Guido van Rossum 9e8181b809 Make better use of GNU Pth -- patch by Andy Dustman.
I can't test this, so I'm just checking it in with blind faith in Andy.
I've tested that it doesn't broeak a non-Pth build on Linux.

Changes include:

- There's a --with-pth configure option.

- Instead of _GNU_PTH, we test for HAVE_PTH.

- Better signal handling.

- (The config.h.in file is regenerated in a slightly different order.)
2000-09-19 00:46:46 +00:00
Fred Drake ea4d3f0804 Add invert() and __invert__() as aliases for inv()/__inv__().
Add contains() as alias for __contains__().
Make PyArg_ParseTuple() formats include the function name.

Based on patch by Denis S. Otkidach <ods@users.sourceforge.net>,
this closes SourceForge patch #101390.
2000-09-17 16:09:27 +00:00
Tim Peters 077a11dd00 arraymodule: Fix SF bug 113960.
reverse() didn't work at all due to bad arg check.
    Fixed that.
    Added Brad Chapman to ACKS file, as the proud new owner of two
        implicitly copyrighted lines of Python source code <wink>.
    Repaired buffer_info's total lack of arg-checking.
    Replaced memmove by memcpy in reverse() guts, as memmove is
        often slower and the memory areas are guaranteed disjoint.
    Replaced poke-and-hope unchecked decl of tmp buffer size by
        assert-checked larger tmp buffer.
    Got rid of inconsistent spaces before open paren in docstrings.
    Added reverse() sanity tests to test_array.py.
2000-09-16 22:31:29 +00:00
Guido van Rossum 174efc9cdb Use PyOS_setsig() instead of directly calling signal() or sigaction().
This fixes the first half of bug #110611: the immediate exit when ^C
is hit when readline and threads are configured.

Also added a new module variable, readline.library_version.
2000-09-16 16:37:53 +00:00
Guido van Rossum d2cd7adf6f Use typedef PyOS_sighandler_t and APIs PyOS_getsig() and
PyOS_setsig(), instead of directly calling signal() or sigaction().

This fixes the second half of bug #110611: the mysterious ignoring of
the first ^C when readline isn't used.
2000-09-16 16:35:28 +00:00
Tim Peters 78fc0b57df Fixed legit gripe from c.l.py that math.fmod docs aren't confusing enough.
FRED, please check my monkey-see-monkey-do Tex fiddling!
2000-09-16 03:54:24 +00:00
Fred Drake 1ac526d7cc Add a constant "library" to the module which names the library used,
based on the available headers.

Update comments on the filename extensions used to reflect library
differences.

Added get() and setdefault() methods to the dbm object.

Added docstrings, convert all methods to PyArg_ParseTuple() so that
error messages will have the method names.
2000-09-15 21:35:14 +00:00
Fred Drake e64572bccb Some systems need -lucb to compile the mmap module. Add a comment to
this effect.

This address one aspect of SourceForge bug #113797.
2000-09-15 18:55:58 +00:00
Barry Warsaw 3b2aedbdc5 Py_Main(), usage(), usage_mid: Add -h and -V flags to print the usage
message and Python version number and exit immediately.  Closes patch
#101496.
2000-09-15 18:40:42 +00:00
Martin v. Löwis 2af72d5d6d Use symbolic constants for allowable short ranges. 2000-09-15 08:10:33 +00:00
Tim Peters 0bb44a4a3a Closes SF bug 113894: on Windows, things like os.listdir("k:") and
glob.glob("k:*py") (i.e., a raw drive letter + colon at the start) were
using the root of the drive rather than the expected Windows behavior
of using the drive's "current directory".
2000-09-15 07:44:49 +00:00
Martin v. Löwis 66de5497c5 Check range for bytes and shorts. Closes bug #110845. 2000-09-15 07:31:57 +00:00
Fred Drake ae90f8da24 Trent Mick points out that the BSD DB also provides an ndbm compatibility
layer.  If that is available, consider that as an option as well.
2000-09-15 03:38:12 +00:00
Fred Drake d94f70716e Use the configure support to determine which ndbm.h header to include. 2000-09-14 15:48:06 +00:00
Martin v. Löwis df23f33f9b Add several dl.RTLD_ constants. Closes bug 110842. 2000-09-13 16:26:10 +00:00
Fred Drake 0ac9b07963 Simplify some of the code. Use PyErr_Format() instead of sprintf(), etc.
Reduces lines of code and compiled object size.
2000-09-12 21:58:06 +00:00
Tim Peters bb307343e4 General cleanup in preparation for a bugfix: removed unused code, useless
declarations, added some comments where I had to think too hard to
understand what was happening, and changed the primary internal get/set
functions to assert they're passed objects of the correct type instead of
doing runtime tests for that (it's an internal error that "should never
happen", so it's good enough to check it only in the debug build).
2000-09-10 05:22:54 +00:00
Skip Montanaro ed33c9af97 autodetect presence of libdb - this allows bsddbmodule to be built
automatically if dbopen is found in libc or libdb.  This closes patch
#101420
2000-09-08 02:17:15 +00:00
Guido van Rossum ebba420285 Oops. Jim's fix didn't. This one does -- I tested it a bit better
this time!
2000-09-07 14:35:37 +00:00
Guido van Rossum c84d8bd7be Simple fix from Jin Fulton to avoid returning a half-initialized
module when e.g. copy_reg.py doesn't exist.  This caused a core dump.

This closes SF bug 112944.
2000-09-07 00:11:40 +00:00
Jeremy Hylton 3263dc2b15 compromise value for threshold0: not too high, not too low 2000-09-05 15:44:50 +00:00
Guido van Rossum a22865ec44 Instead of printing all 9 lines of copyright info, print
"Type \"copyright\", \"credits\" or \"license\" for more information."
2000-09-05 04:41:18 +00:00
Fredrik Lundh 510c97ba2f return -1 for undefined groups (as implemented in 1.5.2) instead of
None (as documented) from start/end/span.  closes bug #113254
2000-09-02 16:36:57 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Guido van Rossum 38d45b7da9 The second argument to start_new_thread() is not a tuple, as pointed
out by Curtis Jensen on c.l.py and forwarded by Fredrik Lundh.
2000-09-01 20:47:58 +00:00
Tim Peters 9acdd3aed8 Repaired damaged comments, and extra spaces in fatal error msgs we'd better
not ever see!
2000-09-01 19:26:36 +00:00
Guido van Rossum 7c55404207 Move the Py_DECREF(x) after the error: label so that we don't leak x
when PyDict_SetItemString() fails.
2000-09-01 15:35:12 +00:00
Barry Warsaw 9bfd2bf5ed Do the absolute minimal amount of modifications to eradicate
Py_FatalError() from module initialization functions.  The importing
mechanism already checks for PyErr_Occurred() after module importation
and it Does The Right Thing.

Unfortunately, the following either were not compiled or tested by the
regression suite, due to issues with my development platform:

	almodule.c
	cdmodule.c
	mpzmodule.c
	puremodule.c
	timingmodule.c
2000-09-01 09:01:32 +00:00
Tim Peters 736aa32a39 Fix test_popen2 on Windows, recently broken by changes to the dict(!)
implementation.  You don't want to know.  I've asked Guido to give this
a critical review (we agreed on the approach, but the implementation
proved more ... interesting ... than anticipated).  This will almost
certainly be the highlight of Mark Hammond's day <wink>.
2000-09-01 06:51:24 +00:00
Jeremy Hylton 045946d4ee set the default threshold much higher
we don't need to run gc frequently
2000-09-01 04:01:55 +00:00
Jeremy Hylton 51ee09b995 Don't call Py_FatalError in module initialization
(leaving the rest of the modules for Barry)
2000-09-01 03:46:16 +00:00
Jeremy Hylton b709df3810 refactor __del__ exception handler into PyErr_WriteUnraisable
add sanity check to gc: if an exception occurs during GC, call
PyErr_WriteUnraisable and then call Py_FatalEror.
2000-09-01 02:47:25 +00:00
Guido van Rossum b9ce5ada37 Add three prototypes for functions in history.h to shut up gcc -Wall. 2000-09-01 02:43:38 +00:00
Guido van Rossum b92b62771e Moodules -> Modules. 2000-09-01 02:40:11 +00:00
Fred Drake 6cfdffb2e5 Minor adjustment to Setup.in message, based on comment from Barry Warsaw. 2000-08-31 21:53:03 +00:00
Jeremy Hylton a3895c0d29 This module has a poor name, since it can be used under FreeBSD and
Linux.  Perhaps winaudio would be better, as it would offend both
parties equally.

tg@freebsd.org: allow this module to compile under FreeBSD
(he suggests voxwareaudio)
2000-08-31 18:11:07 +00:00
Fred Drake a54436fbdb If Setup is older than Setup.in, issue a bold warning that the Setup may
need to be checked to make sure all the latest information is present.

This closes SourceForge patch #101275.
2000-08-31 16:56:15 +00:00
Fred Drake c9cb84703b Skip Montanaro <skip@mojam.com>:
Update the build structures to automatically detect the presence of BSD db,
including the proper name of the header file to include.  Has all the
expected niceties associated with yet-more-configure-options.  ;)

This checkin includes changes for non-generated files only; subsequent
checkin will catch those.

This is part of SourceForge patch #101272.
2000-08-31 16:11:07 +00:00
Jeremy Hylton 0625777b53 apply patch #101362 by Vladimir Marangozov
also initial static debug variable to 0
2000-08-31 15:10:24 +00:00
Fred Drake 8ce159aef5 Peter Schneider-Kamp <nowonder@nowonder.de>:
Remove some of GCC's warning in -Wstrict-prototypes mode.

This closes SourceForge patch #101342.
2000-08-31 05:18:54 +00:00
Fred Drake c818d5347e Remove one compiler warning found with -Wstrict-prototypes. 2000-08-31 05:07:19 +00:00
Fredrik Lundh e67d8e514f oops. accidentally reintroduced a memory leak. put the bugfix back. 2000-08-27 21:32:46 +00:00
Fredrik Lundh 33accc1f5c don't mistake memory errors (including reaching the recursion limit)
with success.  also, check return values from the mark functions.

this addresses (but doesn't really solve) bug #112693, and low-memory
problems reported by jack jansen.
2000-08-27 20:59:47 +00:00
Guido van Rossum 0df002c45b Add three new APIs: PyRun_AnyFileEx(), PyRun_SimpleFileEx(),
PyRun_FileEx().  These are the same as their non-Ex counterparts but
have an extra argument, a flag telling them to close the file when
done.

Then this is used by Py_Main() and execfile() to close the file after
it is parsed but before it is executed.

Adding APIs seems strange given the feature freeze but it's the only
way I see to close the bug report without incompatible changes.

[ Bug #110616 ] source file stays open after parsing is done (PR#209)
2000-08-27 19:21:52 +00:00
Guido van Rossum fee3a2dd8c Charles Waldman's patch to reinitialize the interpreter lock after a
fork.  This solves the test_fork1 problem.  (ceval.c, signalmodule.c,
intrcheck.c)

SourceForge: [ Patch #101226 ] make threading fork-safe
2000-08-27 17:34:07 +00:00
Thomas Wouters 124af7cfd6 Fixed this problem. 2000-08-26 11:34:29 +00:00
Tim Peters 6d7c442e03 Try to supply a prototype for the module init function but avoid
Windows "inconsistent linkage" warnings at the same time.  I agree
with Mark Hammond that the whole DL_IMPORT/DL_EXPORT macro system
needs an overhaul; this is just an expedient hack until then.
2000-08-26 07:38:06 +00:00
Fred Drake 28f739aad4 Update the parser module to support augmented assignment.
Add some test cases.
2000-08-25 22:42:40 +00:00
Fred Drake 6f9876212d initpyexpat(): Code cleanup; makes it more robust and reduces warnings.
Added prototype to remove yet another warning.

Make a number of the handlers and helpers "static" since they are not
used in other C source files.  This also reduces the number of warnings.

Make a lot of the code "more Python".  (Need to get the style guide done!)
2000-08-25 18:03:30 +00:00
Sjoerd Mullender 239f836c10 Not every OS that support poll seems to support POLLMSG. 2000-08-25 13:59:18 +00:00
Andrew M. Kuchling cf96dc800e Add interface to poll() system call (SF patch #100852) 2000-08-25 01:15:33 +00:00
Thomas Wouters 65f39adfb3 Adjust the name for the socket module in the SSL line. 2000-08-24 22:54:53 +00:00
Fred Drake 9ed49e979f Fix the evil booboos. ;( Causes discussed with Jeremy offline. 2000-08-24 22:27:02 +00:00
Fred Drake c23b5239ae Remove the Py_FatalError() from initpyexpat(); the Guido has decreed
that this is not appropriate.

Made somewhat more robust in the face of reload() (exception is not
rebuilt, etc.).

Made the exception a class exception.
2000-08-24 21:57:43 +00:00
Fred Drake 85bf3bb44a validate_listmaker(): Revise to match Skip's latest changes to the
Grammar file.  This makes the test suite pass once again.
2000-08-23 15:35:26 +00:00
Tim Peters 72b93ec1c3 Nuked unused variable. 2000-08-22 01:44:16 +00:00
Fred Drake cff283c7b3 Update to reflect recent grammar changes (list comprehensions, extended
print statement), and fix up the extended call syntax support.

Minor stylistic cleanups.
2000-08-21 22:24:43 +00:00
Andrew M. Kuchling a98e92bc13 Add alias for old function name -- removing it broke Alexei Gilchrist's cfm 2000-08-20 23:37:02 +00:00
Andrew M. Kuchling f580d27aa3 Use METH_VARARGS constant in example module.
Fix comment typo
2000-08-19 15:36:41 +00:00
Sjoerd Mullender f28b898f13 Removed references to Py_FPROTO. 2000-08-18 10:00:28 +00:00
Barry Warsaw f087960e99 ANSI-fy function headers. Not much more can be done since I don't
have access to Purify anymore.
2000-08-18 05:13:47 +00:00
Barry Warsaw 4ddd8202bc lad_dealloc(): if xp->x_fd == -1, it means the descriptor's already
been closed.  Don't try to reclose it.  Found by Insure.
2000-08-18 05:10:45 +00:00
Barry Warsaw 152fbe88e9 pattern_findall(): Plug small memory leak discovered by Insure.
PyList_Append() always incref's the inserted item.  Be sure to decref
it regardless of whether the append succeeds or fails.
2000-08-18 05:09:50 +00:00
Barry Warsaw fc4514c22b init_locale(): This file defines the _locale module, so the
Py_FatalError() should reflect that.
2000-08-18 05:07:12 +00:00
Trent Mick 239548f37d The sre test suite currently overruns the stack on Win64, Linux64, and Monterey
(64-bit AIX) This is because the RECURSION_LIMIT is too low. This patch lowers
to recusion limit to 7500 such that the recusion check fires before a segfault.

Fredrik suggested/approved the fix in private email, modulo sre's recusion
limit checking no being necessary when PyOS_CheckStack is implemented for
Windows.
2000-08-16 22:29:55 +00:00
Fred Drake b526e5fa99 The socket module is now _socket on all platforms. 2000-08-16 14:19:43 +00:00
Fred Drake a136d4970c Remove a lot of the confusing conditional compilation from the beginning
of the init_socket() function.  This module is now *always* _socket.
2000-08-16 14:18:30 +00:00
Fred Drake 56221a7cfa Chris Herborth <chrish@pobox.com>:
Minor updates for BeOS R5.

Use of OSError in test.test_fork1 changed to TestSkipped, with corresponding
change in BeOS/README (by Fred).

This closes SourceForge patch #100978.
2000-08-15 18:52:33 +00:00
Tim Peters b59ab42487 Fix new compiler warnings. Unused var in compile.c. Argsize mismatches
in binascii.c (only on platforms with signed chars -- although Py_CHARMASK
is documented as returning an int, it only does so on platforms with
signed chars).
2000-08-15 16:41:26 +00:00
Barry Warsaw 16168477eb binascii_unhexlify(): Better error message, courtesy effbot. 2000-08-15 06:59:58 +00:00
Barry Warsaw e977c210cb After a brief conversation and code review with TP, adding two very
commonly used functions to convert an arbitrary binary string into
a hexadecimal digit representation and back again.  These are often
(and often differently) implemented in Python.  Best to have one
common fast implementation.  Specifically,

binascii_hexlify(): a.k.a. b2a_hex() to return the hex representation
of binary data.

binascii_unhexlify(): a.k.a. a2b_hex() to do the inverse conversion
(hex digits to binary data).  The argument must have an even length,
and must contain only hex digits, otherwise a TypeError is raised.
2000-08-15 06:07:13 +00:00
Barry Warsaw 57b808d21a SHA_hexdigest(): A couple of small patches to this function, added
after a brief conversation with TP.  First, the return values of the
PyString_* function calls should be checked for errors.  Second,
bit-manipulations should be used instead of division for spliting the
byte up into its 4 bit digits.
2000-08-15 06:03:35 +00:00
Barry Warsaw 3ec0fbb299 md5_hexdigest(): After a brief conversation with TP, added hexdigest()
to this module to mirror sha's hexdigest() method.
2000-08-15 05:59:44 +00:00
Mark Hammond 33a6da9971 Fix for bug #110670 - Win32 os.listdir raises confusing errors:
The existing win32_error() function now returns the new(ish) WindowsError, ensuring we get correct error messages.
2000-08-15 00:46:38 +00:00
Mark Hammond b37a373496 Patch #101032, from David Bolen:
This is an enhancement to a prior patch (100941) ...
[T]his patch removes the risk of deadlock waiting for the child previously present in certain cases. It adds tracking of all file handles returned from an os.popen* call and only waits for the child process, returning the exit code, on the closure of the final file handle to that child.
2000-08-14 04:47:33 +00:00
Trent Mick 6c116dd56b Use safer comparisons (only matters when sizeof(int) != sizeof(size_t)). fread
and fwrite return size_t, so it is safer to cast up to the largest type for the
comparison. I believe the cast is required at all to remove compiler warnings.
2000-08-12 20:58:11 +00:00
Fred Drake 091ec2cfdd Add support for FreeBSD --rpath linker option; this is equivalent to
-R on Solaris and -rpath on IRIX.

This closes SourceForge bug #110613 (Jitterbug PR#202), reported by
<aa8vb@yahoo.com>.
2000-08-11 13:58:37 +00:00
Fred Drake 68933b94d3 Clean up compiler warning exposed by GCC's -Wall option: make sure
Python.h is included before standard headers since we set _GNU_SOURCE
there.  This ensures that strdup() is prototyped.
2000-08-10 21:41:08 +00:00
Peter Schneider-Kamp 10e1bf2f64 remove all occurence of math.rint() from the sources
(and yes, "Currintly" also counts <0.5 wink>)
2000-08-10 04:23:30 +00:00
Fredrik Lundh 5810064476 -- changed findall to return empty strings instead of None
for undefined groups
2000-08-09 09:14:35 +00:00
Jack Jansen 0d15908629 Added a missing } in the USE_STACKCHECK code. 2000-08-07 21:02:50 +00:00
Fredrik Lundh 7898c3e685 -- reset marks if repeat_one tail doesn't match
(this should fix Sjoerd's xmllib problem)
-- added skip field to INFO header
-- changed compiler to generate charset INFO header
-- changed trace messages to support post-mortem analysis
2000-08-07 20:59:04 +00:00
Fredrik Lundh 18c2aa25a1 + if USE_STACKCHECK is defined, use PyOS_CheckStack to look
for excessive recursion.
2000-08-07 17:33:38 +00:00
Vladimir Marangozov f9d20c3786 Neil Schemenauer: GC enable(), disable(), isenabled() interface.
Small stylistic changes by VM:
- is_enabled() -> isenabled()
- static ... Py_<func> -> static ... gc_<func>
2000-08-06 22:45:31 +00:00
Moshe Zadka cf4d8ccb05 Removed unnecessary local variable -- gave warning on gcc -Wall 2000-08-04 22:31:42 +00:00
Moshe Zadka 6a078edb07 Removing warnings discovered by gcc -Wall 2000-08-04 15:53:06 +00:00