Commit Graph

1381 Commits

Author SHA1 Message Date
Guido van Rossum 8bfefce75e On HP-UX, -rpath is another option taking an argument that needs to go
to the libs variable.  Reported by Albert Chin-A-Young.
1999-05-21 19:18:49 +00:00
Guido van Rossum ea424e19f1 Apparently __GNU_LIBRARY__ is defined for glibc as well as for libc5.
The test really wanted to distinguish between the two.  So now we test
for __GLIBC__ instead.  I have confirmed that this works for glibc and
I have an email from Christian Tanzer confirming that it works for
libc5, so it should be fine.
1999-04-23 20:59:05 +00:00
Guido van Rossum 1b9e0aae6e Jim Fulton writes:
I have attached a new cPickle that adds a new control attribute
to unpicklers:

  Added new Unpickler attribute, find_global.  If set to None, then
  global and instance pickles are disabled.  Otherwise, it should be set to
  a callable object that takes two arguments, a module name and an
  object name, and returns an object.  If the attribute is unset, then
  the default mechanism is used.

  This feature provides an additional mechanism for controlling which
  classes can be used for unpickling.
1999-04-19 17:58:18 +00:00
Guido van Rossum dc8b569155 Patch from Tim Peters to repare a the problem that tracebacks are off
by a line when Python is run with -x.
1999-04-19 17:54:19 +00:00
Guido van Rossum ae84e8d0f6 Patch by Drew Csillag for FreeBSD's sh, which doesn't automatically
join \-terminated lines.
1999-04-19 17:16:12 +00:00
Guido van Rossum a7379d9a34 Avoid triggering Alpha OSF/1 specific code on Alpha NT or Linux. 1999-04-19 16:50:26 +00:00
Guido van Rossum 7a1229991d Put back __osf__ support for gethostbyname_r(); the real bug was that
it was being used even without threads.  This of course might be an
all-platform problem so now we only use the _r variant when we are
using threads.
1999-04-13 04:07:32 +00:00
Guido van Rossum 761fcd03aa Fix accidentally reversed NULL test in load_mark(). Suggested by
Tamito Kajiyama.  (This caused a bug only on platforms where malloc(0)
returns NULL.)
1999-04-12 22:51:20 +00:00
Guido van Rossum d4b8b09a73 'clean' target should remove hassignal. 1999-04-12 16:42:13 +00:00
Guido van Rossum aee9bb2d0b Cast added by Jack Jansen (for Mac port). 1999-04-12 14:35:48 +00:00
Guido van Rossum ff1ccbfc21 casts for picky compilers. 1999-04-10 15:48:23 +00:00
Guido van Rossum cbf8906f5d 3-arg gethostbyname_r doesn't really work on OSF/1. 1999-04-10 15:46:01 +00:00
Guido van Rossum b729a1d0a8 Patch by Andrew Kuchling to unflush() (flush() for deflating).
Without this, if inflate() returned Z_BUF_ERROR asking for more output
space, we would report the error; now, we increase the buffer size and
try again, just as for Z_OK.
1999-04-07 20:23:17 +00:00
Guido van Rossum 8c67e4e8c9 Add extern decl for fsync() for SunOS 4.x. 1999-04-07 15:49:41 +00:00
Guido van Rossum 0ffdd05cc3 Jonathan Giddy notes, and Chris Lawrence agrees, that some comments on
#else/#endif are wrong, and that #if HAVE_TM_ZONE should be #ifdef.
1999-04-05 21:54:14 +00:00
Guido van Rossum c91fcaa43b Protection against picling to/from closed (real) file.
The problem was reported by Moshe Zadka.
1999-03-29 20:00:14 +00:00
Guido van Rossum 4958f9af97 #$@%! Forgot to remove a #error directive used for testing. Sorry. 1999-03-29 19:12:41 +00:00
Guido van Rossum 57731607c3 Chris Lawrence writes:
"""
The GNU folks, in their infinite wisdom, have decided not to implement
altzone in libc6; this would not be horrible, except that timezone
(which is implemented) includes the current DST setting (i.e. timezone
for Central is 18000 in summer and 21600 in winter).  So Python's
timezone and altzone variables aren't set correctly during DST.

Here's a patch relative to 1.5.2b2 that (a) makes timezone and altzone
show the "right" thing on Linux (by using the tm_gmtoff stuff
available in BSD, which is how the GLIBC manual claims things should
be done) and (b) should cope with the southern hemisphere.  In pursuit
of (b), I also took the liberty of renaming the "summer" and "winter"
variables to "july" and "jan".  This patch should also make certain
time calculations on Linux actually work right (like the tz-aware
functions in the rfc822 module).

(It's hard to find DST that's currently being used in the southern
hemisphere; I tested using Africa/Windhoek.)
"""
1999-03-29 19:12:04 +00:00
Guido van Rossum cf95b0f44a Avoid warnings from AIX compiler. Reported by Vladimir (AIX is my
middlename) Marangozov, patch coded by Greg Stein.
1999-03-29 14:57:59 +00:00
Andrew M. Kuchling b95227db4f Add an .unused_data attribute to decompressor objects. If .unused_data
is not an empty string, this means that you have arrived at the
end of the stream of compressed data, and the contents of .unused_data are
whatever follows the compressed stream.
1999-03-25 21:21:08 +00:00
Guido van Rossum 29d2acc170 Added Greg Stein and Andrew Kuchling's sha module.
Fix comments about zlib version and URL.
1999-03-24 19:03:59 +00:00
Guido van Rossum e7de2061b4 Implement two suggestions by Jonathan Giddy: (1) in AIX, clear the
data struct before calling gethostby{name,addr}_r(); (2) ignore the
3/5/6 args determinations made by the configure script and switch on
platform identifiers instead:

AIX, OSF have 3 args
Sun, SGI have 5 args
Linux has 6 args

On all other platforms, undef HAVE_GETHOSTBYNAME_R altogether.
1999-03-24 17:24:33 +00:00
Guido van Rossum 7b6c71f5a4 Vladimir Marangozov implements the AIX 3-arg gethostbyname_r code. 1999-03-24 17:20:40 +00:00
Guido van Rossum 8ad22c8153 Add $(EXE) to various occurrences of python so it will work on Cygwin
with egcs (after setting EXE=.exe).  Patch by Norman Vine.
1999-03-23 19:00:55 +00:00
Guido van Rossum 3baaa1375b Clean up pass for the previous patches.
- Use HAVE_GETHOSTBYNAME_R_6_ARG instead of testing for Linux and
glibc2.

- If gethostbyname takes 3 args, undefine HAVE_GETHOSTBYNAME_R --
don't know what code should be used.

- New symbol USE_GETHOSTBYNAME_LOCK defined iff the lock should be used.

- Modify the gethostbyaddr() code to also hold on to the lock until
after it is safe to release, overlapping with the Python lock.

(Note: I think that it could in theory be possible that Python code
executed while gethostbyname_lock is held could attempt to reacquire
the lock -- e.g. in a signal handler or destructor.  I will simply say
"don't do that then.")
1999-03-22 21:44:51 +00:00
Guido van Rossum 955becc3d9 Jonathan Giddy writes:
Here's a patch to fix the race condition, which wasn't fixed by Rob's
patch.  It holds the gethostbyname lock until the results are copied out,
which means that this lock and the Python global lock are held at the same
time.  This shouldn't be a problem as long as the gethostbyname lock is
always acquired when the global lock is not held.
1999-03-22 20:14:53 +00:00
Andrew M. Kuchling 173156fa32 Fixed the flush() method of compression objects; the test for
the end of loop was incorrect, and failed when the flushmode != Z_FINISH.
    Logic cleaned up and commented.
1999-03-22 19:25:30 +00:00
Guido van Rossum 481ac8811e Use an unsigned cast to avoid a warning in VC++. 1999-03-19 21:50:11 +00:00
Fred Drake 0e11c49f04 Docstring fix: acosh() returns the hyperbolic arccosine, not the
hyperbolic cosine.  Problem report via David Ascher by one of his
students.
1999-03-16 14:17:48 +00:00
Guido van Rossum e9cd07b47f Patch by Rob Riggs for Linux -- glibc2 has a different argument
converntion for gethostbyname_r() etc. than Solaris!
1999-03-15 21:40:14 +00:00
Guido van Rossum d3eb5774ad Patch by Chris Herborth for BeOS code.
He writes:

I had an off-by-1000 error in floatsleep(),
and the problem with time.clock() is that it's not implemented properly
on QNX... ANSI says it's supposed to return _CPU_ time used by the
process, but on QNX it returns the amount of real time used... so I was
confused.
1999-03-09 16:07:23 +00:00
Guido van Rossum 3366d1c7e6 # Typo in docstring (Retrun -> Return). 1999-02-23 18:34:43 +00:00
Guido van Rossum 3791b0de36 Carefully check for overflow when allocating the memory for fromfile
-- someone tried to pass in sys.maxint and got bitten by the bogus
calculations.
1999-02-23 18:05:22 +00:00
Guido van Rossum c222ec28a5 Patch by Tadayoshi Funaba (with some changes) to be smarter about
guessing what happened when strftime() returns 0.  Is it buffer
overflow or was the result simply 0 bytes long?  (This happens for an
empty format string, or when the format string is a single %Z and the
timezone is unknown.)  if the buffer is at least 256 times as long as
the format, assume the latter.
1999-02-23 00:00:10 +00:00
Guido van Rossum b71c570f01 Document *static* -- in two places! 1999-02-22 18:11:18 +00:00
Guido van Rossum 360eb9f278 We don't support leap seconds, so the seconds field of a time 9-tuple
should be in the range [0-59].  Noted by Tadayoshi Funaba.
1999-02-22 16:19:52 +00:00
Guido van Rossum 5bd69db9f0 In atoi(), don't use isxdigit() to test whether the last character
converted was a "digit" -- use isalnum().  This test is there only to
guard against "+" or "-" being interpreted as a valid int literal.
Reported by Takahiro Nakayama.
1999-02-22 16:18:44 +00:00
Guido van Rossum 61eeb044d7 The docstring for ttyname(..) claims a second "mode" argument. The
actual code does not allow such an argument.  (Finn Bock.)
1999-02-22 15:29:15 +00:00
Fred Drake 1a566ff2e8 When the parameter to PyInt_AsLong() has already been checked with
PyInt_Check(), use PyInt_AS_LONG() instead (two places).
1999-02-17 17:35:53 +00:00
Fred Drake 6724835959 Use the portable form of initializing the ob_type field for new types. 1999-02-16 22:15:42 +00:00
Guido van Rossum 7d385294a4 The symbols P_* (for spawn*(), MS specific) should not have a leading
underscore after all, for consistency with the O_* symnbols.
1999-02-16 19:38:04 +00:00
Guido van Rossum b8c3cbdd50 Fixed totally bogus conversion factors used in the Win32 version of
os.times().
1999-02-16 14:37:28 +00:00
Barry Warsaw ca74da4e2c Got rid of the file-global PosixError. This was redundant since it
was just an alias for PyExc_OSError and the way we were doing it was
causing a (small) memory leak anyway.  Just use PyExc_OSError
everywhere.
1999-02-09 19:31:45 +00:00
Guido van Rossum 01b7ced834 On Windows, -i shouldn't call set[v]buf(stdin, ...) because it screws
up the _tkinter main loop.  Not clear why; the _kbhit() call _tkinter
makes probably confuses the stdio library when buffering isn't set to
whatever it is by default.
1999-02-09 18:36:51 +00:00
Guido van Rossum d1f66dc198 Fix buglet in load_put -- the test for bad readline result tested the
wrong variable.
1999-02-08 22:38:25 +00:00
Guido van Rossum 7d83a5e6f8 The variable TESTPATH should be initialized to empty.
The test code is now accessed as a package.
1999-02-08 21:49:22 +00:00
Guido van Rossum 68de0641ce The writelines() function was never tested and contained numerous bugs
(including a docstring saying "blah").  Fixed all this.

(Please review for potential memory leaks!)
1999-02-08 17:03:27 +00:00
Guido van Rossum f9ffb03c35 Jim Fulton: this fixes seg faults with bad pickles like "c". 1999-02-04 14:54:04 +00:00
Guido van Rossum 0c9608cf1b Portability fix for [f]statvfs() return tuple: no longer return the
f_fsid field, since it's not a scalar on all systems supporting this
call (in particular, it's a tuple of two longs on AIX).  Since it's
not particularly useful, just nuke it.  Adapted the doc strings too.
1999-02-03 16:32:37 +00:00
Guido van Rossum 579ed77a51 Never mind, this belongs in the PC subdirectory,
and besides Toby Dickenson sent me a more functional
(if lower level) wrapper around PlaySound.
1999-02-02 23:41:44 +00:00
Fred Drake 7e3535cbbd Added documentation to the docstrings for the W*() functions that take
a process exit status as a parameter.
1999-02-02 16:37:11 +00:00
Guido van Rossum 2cc340d122 Windows sound playing module, by Fredrik Lundh. 1999-02-02 15:14:37 +00:00
Guido van Rossum 246bc17a8b Add _P_WAIT etc. for NT. 1999-02-01 23:54:31 +00:00
Fred Drake a6dff3e772 spawnv, spawnve docstrings: added mode parameter; this is required! 1999-02-01 22:24:40 +00:00
Barry Warsaw 6aa42579be PyPcre_expand(): Fixed two memory leaks, where a PyString_FromString()
was appended to a list.  Lists are reference count neutral, so the
string must be DECREF'd.  Also added some checks for the return value
of PyList_Append().

Note: there are still some memory problems reported by Purify (I get
two Array Bounds Reads still and an Unitialized Memory Read).  Also,
in scanning the code, there appears to be some potential problems
where return values aren't checked.  To much to attack now though.
1999-02-01 17:09:00 +00:00
Guido van Rossum e6a3aa6066 Oops, the patch for NeXT always replaced waitpid() with wait4() --
this doesn't exist everywhere, so go back to using #ifdef NeXT.
1999-02-01 16:15:30 +00:00
Barry Warsaw f761287e0a setup_readline(): Added a comment about memory leak (reported by
Purify) being caused by a bug in the readline library.  Nothing we can
do about it.

Cause: readline_initialize_everything() throws away the return value
from rl_read_init_file(), but that happens to be the last reference to
a dynamically allocated char*.
1999-01-29 21:55:03 +00:00
Andrew M. Kuchling 1c7aaa2d73 Added missing DECREF's in the error branches when creating a compressor or
decompressor object.  This required adding a flag to the struct which is
    true if initialisation was completed; on object destruction, deflateEnd()
    is only called if the flag is true.
1999-01-29 21:49:34 +00:00
Barry Warsaw 30aa1e7d31 PyInit_zlib(): Plug a small memory leak. Jeremy is looking into the
more severe ones.
1999-01-28 19:40:05 +00:00
Guido van Rossum 6b86a42c7f Document -OO; "unsafe" optimization that removes docstrings.
Marc-Andre Lemburg.
1999-01-28 15:07:47 +00:00
Barry Warsaw b80667d5f3 pcre_exec(): Andrew Kuchling's patch for pcre memory leak. 1999-01-27 21:41:08 +00:00
Barry Warsaw 105906ff6e initerrno(): Nailed a not-so-tiny memory leak. The de dictionary is
put into the module dict, but is never DECREF'd in this function, so
it and all its contents leak.
1999-01-27 18:04:05 +00:00
Guido van Rossum 54ecc3d24f Patches by William Lewis for Nextstep descendants. 1999-01-27 17:53:11 +00:00
Barry Warsaw 5b97716caf expandtabs__doc__: blank line which was not terminated with \n\ caused
the SunPro C compiler to choke.  Removed this redundant line.
1999-01-26 02:15:50 +00:00
Guido van Rossum a106568eed Add spawnv and spawnve functions for Win32 platforms. 1999-01-25 23:20:23 +00:00
Guido van Rossum 54ec2884b8 A gift from Fredrik Lundh: fast C implementation of expandtabs().
I've reformatted it, added a few comments, a test for tabsize <= 0,
and used the AS_STRING macro.
1999-01-25 22:36:24 +00:00
Guido van Rossum aa8d16761b Make sure not to call realloc() with a NULL pointer -- call malloc()
in that case.  Tamito Kajiyama.
1999-01-25 21:43:51 +00:00
Guido van Rossum 11801859e0 Include myselect.h -- needed on some platforms. 1999-01-25 21:39:03 +00:00
Guido van Rossum 8bf6dc77d1 Rearrange the -I flags for compiling _tkinter.c so that
/usr/local/include comes before /usr/X11R1/include.  On some Linux
distributions the latter apparently contains (standard!) a bad tcl.h
or tk.h.
1999-01-25 21:38:29 +00:00
Guido van Rossum d371ff17a1 Only do ttyname() when HAVE_TTYNAME is defined.
Also define F_OK etc. when not already defined, when doing access().
1999-01-25 16:12:23 +00:00
Guido van Rossum ca6954a979 Should include "Python.h", not <Python.h> -- it's not a standard
header file (yet :-).
1999-01-14 19:31:42 +00:00
Guido van Rossum 11a5071ed6 Jim Ahlstrom patch: Watcom chokes on a long expression in c_asinh().
Break it up.
1999-01-14 19:11:11 +00:00
Guido van Rossum 5d00b6d459 Need extern decl. for fdatasync() in case it exists but isn't declared
anywhere (or, more likely, the declaration requires a magical
combination of _POSIX defines).
1999-01-08 21:28:05 +00:00
Guido van Rossum 21142a09f3 Added fsync() and fdatasync(). Patches by Scott Cotton. Requires
HAVE_* macros set by configure script.
1999-01-08 21:05:37 +00:00
Guido van Rossum 446ccfe1ac The doc string for strptime had the arguments reversed -- the string
comes first, the format second!  Scott Cotton discovered this.
1999-01-07 18:29:26 +00:00
Jeremy Hylton 6892aa372d fix bug in PyZlib_flush.
patch from Grzegorz Makarewicz & Rafal Smotrzyk.
1999-01-06 22:56:24 +00:00
Guido van Rossum 015f22a0fa Change the access() code to return 1 if granted, 0 if not granted.
Patch (again) by Sean Reifschneider.
1999-01-06 22:52:38 +00:00
Guido van Rossum 763737be52 Changes for long file support by Steve Clift. 1999-01-06 18:44:57 +00:00
Guido van Rossum 056bad993c Changes for long file support by Steve Clift.
He also fixes thread-related evil that caused core dumps.
1999-01-06 18:44:23 +00:00
Guido van Rossum 94f6f72c05 Changes for long file support by Steve Clift.
Also added access() and ttyname() by Sean Reifschneider.
1999-01-06 18:42:14 +00:00
Guido van Rossum 716a89c606 Patch by Charles Waldman to implement an optional nlines argument to
w.scroll().  (It then calls wscrl(win, nlines) instead of scoll(win).)
1999-01-05 17:16:46 +00:00
Guido van Rossum 0a6363d7e1 Get rid of the strptype() declaration -- on some BSD systems, it's a
conflict, and it should be declared in time.h anyway.
(Too bad if gcc -Wall won't be happy if it isn't declared...)
1999-01-03 13:00:34 +00:00
Guido van Rossum 11847896ed Chris Herborth discovered a typo in the arrow key symbols. 1998-12-23 04:45:04 +00:00
Guido van Rossum 65d5b5763c Thanks to Chris Herborth, the thread primitives now have proper Py*
names in the source code (they already had those for the linker,
through some smart macros; but the source still had the old, un-Py names).
1998-12-21 19:32:43 +00:00
Guido van Rossum 95864d35c6 Add dummy variable to avoid optimizer bug on OS/2 -- patch by Jeff Rush.
(AMK: you should probably copy this into your patch set for pcre.)
1998-12-21 18:35:49 +00:00
Jeremy Hylton 5bc4abe006 replace missing zalloc initialization (test_zlib now runs
successfully)
1998-12-21 17:15:00 +00:00
Jeremy Hylton 36252022ec remove debugging fprintf (should have checked this before previous
checkin)
1998-12-21 16:40:21 +00:00
Jeremy Hylton a37e244536 patches from Andrew
NOTE: There is still a bug of some sort in the behavior of zlib.  In
at least one case, inflate returns Z_OK (which is typically
interpreted to mean that more output space is needed) when it has
finished inflating a buffer.  This has been reported as a bug to the
zlib maintainers; we may need to change the Python interface.
1998-12-18 22:13:11 +00:00
Fred Drake 6de7d0c338 When _PyString_Resize() reports failure, the variable referring to the
string we wanted to resize is set to NULL.  Don't Py_DECREF() those
variables!  (5 places)
1998-12-18 19:46:59 +00:00
Guido van Rossum 476e49f055 Jim Fulton writes:
This fixes a bug that can cause core dumps when doing seeks in input
StringIO objects. This has a number of other clean-ups.
1998-12-15 21:43:15 +00:00
Andrew M. Kuchling 4c07f81d60 Fixed bug reported to Gregor Hoffleit:
> mpz.mpz('\xff') should return mpz(255).  Instead it returns
> mpz(4294967295L). Looks like the constructor doesn't work with strings
> containing characters above chr(128).
Caused by using just 'char' where 'unsigned char' should have been used.
1998-12-14 19:36:14 +00:00
Guido van Rossum 21ef088265 Need to initialize self->safe_constructors early on to prevent crash
in early dealloc.  Patch by Andrew Dalke.
1998-12-11 03:20:00 +00:00
Guido van Rossum 732aa2f987 Gregor Hoffleit writes:
But IMHO, this problem really reveals an annoyance in Python's
makesetup. makesetup puts the global include directories "$(INCLUDEPY)
$(EXECINCLUDEPY)" in front of the directories defined by the module in
Setup. Therefore global (potentially older) header files are preferred
over the ones set by the module, which makes it hard to compile new
versions of modules when the old versions are installed. AFAIK, the
other way around is common practice for most other software.

This patch to makesetup would be an potential fix for this problem,
though I don't know if it breaks anything else.
1998-12-11 01:10:29 +00:00
Guido van Rossum 46e9705eca Remove prototypes for PyOS_strto[u]l -- Chris Herborth. 1998-12-10 16:57:44 +00:00
Guido van Rossum 5de54208a5 Needed to add DL_EXPORT to (redundant?) extern decl of module init function. 1998-12-10 16:49:28 +00:00
Guido van Rossum e94e3fbb72 Make VC++ 5.0 compiler happy. 1998-12-08 17:37:19 +00:00
Guido van Rossum b057dd8efa Correctly document atan2. 1998-12-08 16:27:10 +00:00
Guido van Rossum 9c1201fe39 Py_Main() must be DL_EXPORT too. 1998-12-07 14:28:47 +00:00
Guido van Rossum c6e22902ad Added Doc strings -- by Chris Petrilli. 1998-12-04 19:26:43 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00