Commit Graph

1869 Commits

Author SHA1 Message Date
Marc-André Lemburg ff50ad53a9 Fix header file usage so that NULL is defined. NULL is needed by
unicodedata_db.h.
2000-09-30 17:34:31 +00:00
Fred Drake a77254a724 PyModule_AddStringConstant(): Make this static since it isn't used
elsewhere in 1.5.2.
2000-09-29 19:23:29 +00:00
Martin v. Löwis c0718eba21 Remove unused VERSION #define.
Add PyModule_AddStringConstant and PyModule_AddObject if version <2.0,
to allow to share this file with PyXML.
2000-09-29 19:05:48 +00:00
Andrew M. Kuchling 36d97ebd58 Add #ifdef's for platforms that don't have the constants POLLRDNORM and
friends.  (Modified version of patch #101682 from Neil Schemenauer)
2000-09-28 21:33:44 +00:00
Fred Drake b64c2239b0 Minor ANSIfication: lib_python no longer needs to be initialized
dynamically to support K&R C since we are requiring an ANSI compiler.
2000-09-28 14:32:29 +00:00
Fred Drake a6debecce5 Fix includes; not including Python.h caused the module not to compile on
some platforms.

This *should* close SourceForge patch #115506.
2000-09-28 02:54:51 +00:00
Jeremy Hylton 6372fe1e40 Fix buffer overflow vulnerabilities in calculate_path(). Code used
copied strings from environment variables and argv[0] into
fixed-length buffers without checking their length.

Reported by Stan Bubrouski; advice on fix from John Viega.
2000-09-27 20:51:17 +00:00
Fred Drake d5fadf75e4 Rationalize use of limits.h, moving the inclusion to Python.h.
Add definitions of INT_MAX and LONG_MAX to pyport.h.
Remove includes of limits.h and conditional definitions of INT_MAX
and LONG_MAX elsewhere.

This closes SourceForge patch #101659 and bug #115323.
2000-09-26 05:46:01 +00:00
Jeremy Hylton 7198ba986d fix bug #114290: when interpreter's argv[0] has a relative path make
it absolute by joining it with getcwd result.  avoid including
    unnecessary ./ in path but do not test for ../ (more complicated)
2000-09-25 17:00:24 +00:00
Guido van Rossum b00adfbd83 Add missing prototypes for the benefit of SunOS 4.1.4 */ 2000-09-25 13:22:00 +00:00
Guido van Rossum 4b36e6bde1 For the benefit of SunOS 4.1.4, define MS_SYNC as 0 when it's
undefined.  ccording to MvL, this is safe: the MS_SYNC flag means that
msync() returns when all I/O operations are scheduled; without it, it
waits until they are complete, which is acceptable behavior.
2000-09-25 13:16:15 +00:00
Fredrik Lundh cfcea49218 unicode database compression, step 2:
- fixed attributions
- moved decomposition data to a separate table, in preparation
  for step 3 (which won't happen before 2.0 final, promise!)
- use relative paths in the generator script

I have a lot more stuff in the works for 2.1, but let's leave
that for another day...
2000-09-25 08:07:06 +00:00
Tim Peters 51dc968b0b Repaired damaged string. 2000-09-24 22:12:45 +00:00
Fred Drake 28adf52b06 xmlparse_ExternalEntityParserCreate(): Add required cast to return to
avoid compiler warnings.
2000-09-24 22:07:59 +00:00
Fredrik Lundh a4287c29b3 unicode database compression, step 1:
- use unidb compression for the unicodedata module.  on Windows,
  the new unidatabase module is 120k, down from nearly 600k.
2000-09-24 21:45:34 +00:00
Fredrik Lundh eedb5764a5 unicode database compression, step 1:
- use unidb compression for the unicodedata module.  on Windows,
  the new unidatabase module is 120k, down from nearly 600k.
2000-09-24 21:28:28 +00:00
Lars Gustäbel 4a30a07186 Added ExternalEntityParserCreate method (patch 101635). 2000-09-24 20:50:52 +00:00
Fred Drake 93adb6918c Change the name of the exception from "pyexpat.error" to
"xml.parsers.expat.error", so it will reflect the public name of the
exception rather than the internal name.

Also change some of the initialization to use the new PyModule_Add*()
convenience functions.
2000-09-23 04:55:48 +00:00
Neil Schemenauer 7760cff294 Fix some long/"l" int/"i" mismatches. Fixes bug #113779. 2000-09-22 22:35:36 +00:00
Guido van Rossum 7f58e2ec76 It's better to test for __hpux rather than __hppa, and hpux or hppa is
unnecessary.  Sez edg@SF
2000-09-22 17:26:14 +00:00
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