Commit Graph

1684 Commits

Author SHA1 Message Date
Guido van Rossum e110dcfa86 I've had complaints about the comparison "where >= 0" before -- on
IRIX, it doesn't even compile.  Added a cast: "where >= (char *)0".
2000-04-10 21:14:05 +00:00
Guido van Rossum 29530886af Remove CRLF line endings.
Fredrik Lundh: add two missing casts.
2000-04-10 17:06:55 +00:00
Guido van Rossum 5db862dd0c Skip Montanaro: add string precisions to calls to PyErr_Format
to prevent possible buffer overruns.
2000-04-10 12:46:51 +00:00
Guido van Rossum fa972c987c In dealloc(), only close the socket if fd != -1. 2000-04-10 12:45:45 +00:00
Guido van Rossum 54b1c0b408 Windows: Since we're not using ZLIB.DLL any more, don't define ZLIB_DLL.
(Mark Hammond.)
2000-04-06 13:20:38 +00:00
Fred Drake 1ef4e2d54e Mark Hammond <mhammond@skippinet.com.au>:
This patch fixes the mmap module on Windows 9x.
2000-04-05 14:15:31 +00:00
Fred Drake 56a87a0905 Patch from Hrvoje Niksic <hniksic@iskon.hr>:
The bug is in mmap_read_line_method(), and its loop that searches for
newlines.  After the loop reaches EOF, eol is incremented and points
after the end of the memory.  This results in readline() method
sometimes picking up and returning a byte after the end of the string.
This is usually a bogus \0, but it could cause SIGSEGV if it's after
the end of the page).

The patch fixes the problem.  Also, it uses memchr() for finding a
character, which is in fact the "strnchr" the comment is asking for.
memchr() is already used in Python sources, so there should be no
portability problems.
2000-04-04 18:17:35 +00:00
Guido van Rossum b49dc75f51 Add warning that multi-arg connect() etc. are deprecated. 2000-04-04 15:09:07 +00:00
Guido van Rossum 527c9bd32a Put back multi-arg capability on connect/connect_ex/bind, for
backwards compatibility, and to avoid a revolution.
2000-04-04 14:10:20 +00:00
Guido van Rossum 8a16054240 Marc-Andre Lemburg: The large unicode database table is broken in
pages of 4k entries each. This should fix compiler problems on some
platforms.
2000-03-31 17:26:12 +00:00
Andrew M. Kuchling 52a644cbda Add '#include <netinet/tcp.h>'
"man tcp" on Solaris says that TCP_NODELAY is defined in
netinet/tcp.h, and the Open Groups Unix98 spec agrees
(http://www.opengroup.org/onlinepubs/009619199/ninettcp.htm).
2000-03-31 17:24:30 +00:00
Guido van Rossum 8de16932d0 This module's name should be linuxaudio*dev*.c 2000-03-31 16:56:32 +00:00
Guido van Rossum d1bda0ce88 Added some clarifications to pyexpat. 2000-03-31 16:39:02 +00:00
Guido van Rossum 5961f5a06d Make it compile on Windows. 2000-03-31 16:18:11 +00:00
Andrew M. Kuchling b7f105371f Added Python interface to Expat XML parser.
The Setup.in entry is sort of a lie; it links with -lexpat, but
    Expat's Makefile doesn't actually build a libexpat.a.  I'll send
    Expat's author a patch to do that; if he doesn't accept it, this
    rule will have to list Expat's object files (ick!), or have a
    comment explaining how to build a .a file.
2000-03-31 15:43:31 +00:00
Guido van Rossum 325942adb4 Removed three unused variables from the Windows code. 2000-03-31 15:04:26 +00:00
Guido van Rossum e56793557c Added the _sre module. It is always on. 2000-03-31 15:01:27 +00:00
Guido van Rossum b700df9824 Adding Fredrik Lundh's _sre.c module and its header files.
NOTE: THIS IS VERY ROUGH ALPHA CODE!
2000-03-31 14:59:30 +00:00
Guido van Rossum 64231e5c39 Add back an obscure "feature" to the Obj version of Tkapp_Call(): a
None in an argument list *terminates* the argument list: further
arguments are *ignored*.  This isn't kosher, but too much code relies
on it, implicitly.  For example, IDLE was pretty broken.
2000-03-31 03:29:39 +00:00
Guido van Rossum ef40e77ac5 Sigh. On Windows, (mode_t)i fails. Assume that there's a prototype
in scope on systems where mode_t isn't the same size as int...
2000-03-31 01:26:23 +00:00
Guido van Rossum 09fdf07315 Hacked for Win32 by Mark Hammond.
Reformatted for 8-space tabs and fitted into 80-char lines by GvR.

Mark writes:

* the Win32 version now accepts the same args as the Unix version.
The win32 specific "tag" param is now optional.  The end result is
that the exact same test suite runs on Windows (definately a worthy
goal!).

* I changed the error object.  All occurences of the error, except
for 1, corresponds to an underlying OS error.  This one was changed
to a ValueError (a better error for that condition), and the module
error object is now simply EnvironmentError.  All win32 error
routines now call the new Windows specific error handler.
2000-03-31 01:17:07 +00:00
Guido van Rossum a1f0a8f4a4 Don't use the object call interface in Tk 8.0 -- the EvalObj* API
changed from 8.0 to 8.1 and I see no big reason to use objects in 8.0.
At least now it works again with all versions from 8.0 - 8.3.
2000-03-31 00:51:37 +00:00
Guido van Rossum 49679b40b9 Oops, the previous patch contained a bug in chmod. Fixed now. 2000-03-31 00:48:21 +00:00
Guido van Rossum ffd15f5255 Two robustness patches:
(1) In opendir(), don't call the lock-release macros; we're
manipulating list objects and that shouldn't be done in unlocked
state.

(2) Don't use posix_strint() for chmod() -- the mode_t arg might be a
64 bit int (reported by Nick Maclaren).
2000-03-31 00:47:28 +00:00
Guido van Rossum aaf0ab26ed Add linuxaudio module. 2000-03-30 23:27:44 +00:00
Guido van Rossum b130dc7419 Audio module for Linux, contributed by Peter Bosch.
Careful, this has had zero testing (except by Peter)!
2000-03-30 23:25:49 +00:00
Andrew M. Kuchling 1ed7d2d2b8 Added mmap module -- map a view of a file into memory on Win32 and Unix.
(Needs testing on Win32.)
2000-03-30 21:14:30 +00:00
Guido van Rossum 632de27021 The Tcl_Obj patch discussed on the patches list.
This was originally submitted by Martin von Loewis as part of his
Unicode patch; all I did was add special cases for Python int and
float objects and rearrange the object type tests somewhat to speed up
the common cases (string, int, float, tuple, unicode, object).
2000-03-29 00:19:50 +00:00
Guido van Rossum 24bdb0474f Marc-Andre Lemburg:
The attached patch set includes a workaround to get Python with
Unicode compile on BSDI 4.x (courtesy Thomas Wouters; the cause
is a bug in the BSDI wchar.h header file) and Python interfaces
for the MBCS codec donated by Mark Hammond.

Also included are some minor corrections w/r to the docs of
the new "es" and "es#" parser markers (use PyMem_Free() instead
of free(); thanks to Mark Hammond for finding these).

The unicodedata tests are now in a separate file
(test_unicodedata.py) to avoid problems if the module cannot
be found.
2000-03-28 20:29:59 +00:00
Guido van Rossum a80649b357 Patch by Neil Schemenauer to remove support for Tcl/Tk versions before
8.0.  There really is no excuse, and for who really still wants those,
they can go back to Python 1.5.2.
2000-03-28 20:07:05 +00:00
Guido van Rossum e187b0eb20 Add a call to Tcl_FindExecutable(). This was inspired by a patch by
Martin von Loewis (whose more elaborate patch to use objects is still
under review).
2000-03-27 21:46:29 +00:00
Guido van Rossum 27fc3c05e1 Fix all routines to use PyArg_ParseTuple(), and add ":name" to the
argument format strings.

THIS WILL PROBABLY BREAK LOTS OF CODE!!!

Also fixed a bogus string in an error message in getsockaddrlen().
2000-03-24 20:56:56 +00:00
Andrew M. Kuchling c24ca4b192 Fix probable bug; if errno == EINTR, floatsleep() doesn't break out of
a Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS block, but it
   calls Py_BLOCK_THREADS anyway. The change moves Py_BLOCK_THREADS
   to inside the if, so it's only executed when the function
   actually returns unexpectedly.
2000-03-24 20:35:20 +00:00
Barry Warsaw 51ac58039f On 17-Mar-2000, Marc-Andre Lemburg said:
Attached you find an update of the Unicode implementation.

    The patch is against the current CVS version. I would appreciate
    if someone with CVS checkin permissions could check the changes
    in.

    The patch contains all bugs and patches sent this week and also
    fixes a leak in the codecs code and a bug in the free list code
    for Unicode objects (which only shows up when compiling Python
    with Py_DEBUG; thanks to MarkH for spotting this one).
2000-03-20 16:36:48 +00:00
Jeremy Hylton 7ceab65468 Fix bogus error reporting on strptime: let PyArg_ParseTuple set exception.
Also, wrap long line.
2000-03-14 21:17:16 +00:00
Guido van Rossum e141fd84e9 Marc-Andre Lemburg: add new Unicode-related files. 2000-03-10 23:12:33 +00:00
Guido van Rossum c7de91bf9c Marc-Andre Lemburg: Add _codecs and unicodedata modules. 2000-03-10 23:12:08 +00:00
Guido van Rossum 5fccb7c58e Marc-Andre Lemburg: support pickling Unicode objects, both in text
mode ('V') and in binary mode ('X').
2000-03-10 23:11:40 +00:00
Guido van Rossum 2a70a3a8fc Module unicodedata -- Provides access to the Unicode 3.0 data base.
Written by Marc-Andre Lemburg.
2000-03-10 23:10:21 +00:00
Guido van Rossum e2d67f98d1 Internal module _codecs -- Provides access to the codec registry and
the builtin codecs.  Written by Marc-Andre Lemburg.
2000-03-10 23:09:23 +00:00
Guido van Rossum 5bfc2eb697 Marc-Andre-Lemburg: The Unicode Database. 2000-03-10 23:08:04 +00:00
Fred Drake e066134f48 Fixed inet_ntoa() docstring. 2000-03-07 14:05:16 +00:00
Greg Ward b48bc17d10 Second attempt to fix the ctermid_r/tmpnam_r warnings: define USE_CTERMID_R
and USE_TMPNAM_R at the top of the file and refer to them later; this
catches a second reference to 'tmpnam_r' that I didn't spot first time around.
2000-03-01 21:51:56 +00:00
Greg Ward 9217fcbb38 Fix compiler warning: only use "_r" form of 'ctermid()' and 'tmpnam()' when
building a threaded Python.
2000-03-01 18:59:47 +00:00
Guido van Rossum 61b705a570 Patch by Fred Gansevles (the module's original author).
This patch fixes 3 small problems.
1) If a map is used which is generated with 'makedbm -a',
   the trailing '\0' is now handled correctely.
2) The nis.maps() function skipped the first map in the output list.
3) The library '-lnsl' is added in Setup.in (needed on Linux glibc2 and
   Solaris systems. Maybe on other systems too?)

[I note that this still doesn't work when you are using NIS+ --GvR]
2000-02-29 15:52:40 +00:00
Guido van Rossum 43713e5a28 Massive patch by Skip Montanaro to add ":name" to as many
PyArg_ParseTuple() format string arguments as possible.
2000-02-29 13:59:29 +00:00
Andrew M. Kuchling b6f6e95ed2 Better fix for mpzmodule problem reported by Peter Funk: just use
mp_bits_per_limb with GMP 2.0
2000-02-25 22:23:31 +00:00
Guido van Rossum 4985e40939 Delete references to _SC_AIO_LIST_MAX; it appears that that symbol was
just a typo in some Linux header; the real symbol is
_SC_AIO_LISTIO_MAX.
2000-02-25 17:51:00 +00:00
Guido van Rossum e7ef74dbf8 Peter Funk:
This patch allows building the Python 'mpzmodule' under SuSE Linux
without having to install the source package of the GMP-libary.
The gmp-mparam.h seems to be an internal header file.  The patch
shouldn't hurt any other platforms.
2000-02-24 15:26:30 +00:00
Fred Drake 0dd7507e51 What used to be tp_xxx4 is now tp_flags; set it to Py_TPFLAGS_DEFAULT. 2000-02-21 18:19:06 +00:00
Andrew M. Kuchling fc9d2252af Patch from Vladimir Marangozov <marangoz@python.inrialpes.fr>
The same problem (mixed mallocs) exists for the pcre stack.
	The buffers md->... are allocated via PyMem_RESIZE in grow_stack(),
	while in free_stack() they are released with free() instead of
	PyMem_DEL().
2000-02-18 19:16:45 +00:00
Andrew M. Kuchling 0c7822e832 Patch from Vladimir Marangozov <marangoz@python.inrialpes.fr>:
The buffers self->regex and self->regex_extra are allocated in
	pcre_compile() and pcre_study() via pcre_malloc, but are released
	via free() instead of pcre_free.
2000-02-18 18:30:01 +00:00
Guido van Rossum 7d47c9e38a Patch by Jim Ahlstrom to add crc32, a useful checksum function
(e.g. used for ZIP files).

The patch includes code that says:
+  Copyright (C) 1986 Gary S. Brown.  You may use this program, or
+  code or tables extracted from it, as desired without restriction.

My interpretation (and Jim's) is that Gary S Brown has no claims under
copyright, patent or other rights or interests.  Lawyers might disagree.
2000-02-16 21:11:52 +00:00
Fred Drake da8d216eb2 Protect against core dumps in gdbm: don't allow access by key once the
database is closed.  Raise gdbm.error instead.

Bug report #198 submitted by Barry Haddow <bhaddow@orbism.com>.
2000-02-07 17:19:41 +00:00
Fred Drake 0d40ba4cdf Patch from Paul Sokolovsky <Paul.Sokolovsky@technologist.com>:
Attached is patch (against 1.5.2 release) to allow some modules
to be buildable as pyd's (usual &PyType_Type stuff).
2000-02-04 20:33:49 +00:00
Fred Drake a664dbbff8 Added docstring to crypt.crypt() based on the documentation. 2000-02-01 20:12:39 +00:00
Guido van Rossum b3d3956e01 The initialization of posix_putenv_garbage should only be done when it
is defined...
2000-01-31 18:41:26 +00:00
Guido van Rossum bffd683f73 The rest of the changes by Trent Mick and Dale Nagata for warning-free
compilation on NT Alpha.  Mostly added casts etc.
2000-01-20 22:32:56 +00:00
Guido van Rossum 947a0fa4f9 According to Ron Bickers, and with apparent approval of Chris
Herborth, the code in list2set() that sets max unconditionally to 0
should not be used on BeOS.  So be it.  Anybody using BeOS, please
test!
2000-01-14 16:33:09 +00:00
Guido van Rossum b2b42ddcb1 The functions asctime() and mktime() are documented to take a 9-tuple
only.  Through some mysterious interaction, they would take 9 separate
arguments as well.  This misfeature is now disabled (to end a
difference with JPython).
2000-01-12 16:38:20 +00:00
Fred Drake e1a79b9b42 setup_confname_table(): Use size_t instead of int for an index when
building the dicts used to inform the user about the defined
        constants when using the *conf*() APIs.

Thanks to Mark Hammond <mhammond@skippinet.com.au>.
1999-12-30 18:05:43 +00:00
Fred Drake 8972dfd58e For ZlibError and ZLIB_VERSION, only attempt to add entry to the
module dict if the inserted object isn't NULL (basic defensive
programming!).
1999-12-22 16:13:54 +00:00
Andrew M. Kuchling 313a3e36e7 Fix typo in docstring: wbites -> wbits 1999-12-20 22:13:38 +00:00
Guido van Rossum 4e08379891 Patch and new file by Geoff Furnish for C++ compilation. 1999-12-16 17:52:08 +00:00
Fred Drake bec628d4bc Rip out the code to check the ordering of the tables used to map
strings to integers for the *conf*() functions.

Added code to sort the tables at module initialization.  Three
dictionaries, confstr_names, sysconf_names, and pathconf_names, are
added to the module as well.  These map known configuration setting
names to the numeric value which is used to represent the setting in
the system call.  This code is always called.

Updated related comments.
1999-12-15 18:31:10 +00:00
Fred Drake d86ed29f44 Added table entries for Irix 6.5 names for confstr()/sysconf()/
pathconf() names, from Sjoerd.

Added code to verify that these tables are properly ordered, only
included and used when CHECK_CONFNAME_TABLES is defined.  This is only
needed to test the tables, so I haven't enabled this by default.
1999-12-15 15:34:33 +00:00
Fred Drake 12c6e2d497 Added support for getlogin(); does *not* use getlogin_r() where
available since the interface is poorly defined on at least one major
platform (Solaris).

Moved table of constant names for fpathconf() & pathconf() into the
conditional that defines the conv_path_confname() helper; Mark Hammond
reported that defining the table when none of the constants were
defined causes the compiler to complain (won't allow 0-length array,
imagine that!).

In posix_fpathconf(), use conv_path_confname() as the O& conversion
function, instead of the conv_confname() helper, which has the wrong
signature (posix_pathconf() already used the right thing).
1999-12-14 21:25:03 +00:00
Fred Drake 71f00fb6df Removed debugging prints. 1999-12-13 16:55:24 +00:00
Fred Drake c968092d5c Added bindings for getgroups(), fpathconf(), pathconf(), confstr(),
and sysconf().

*Lots* of tables to define names used by *conf*(); explanation to go
in message to python-dev list.
1999-12-13 16:37:25 +00:00
Guido van Rossum 09ac088152 The call to PyArg_ParseTuple in al_Connect had one too few arguments.
This fixes PR#157.
1999-12-10 15:12:11 +00:00
Fred Drake 5ab8eaf0bb Added support for abort(), ctermid(), tmpfile(), tempnam(), tmpnam(),
and TMP_MAX.

Converted all functions that used PyArg_Parse() or PyArg_NoArgs() to
use PyArg_ParseTuple() and specified all function names using the
:name syntax in the format strings, to allow better error messages
when TypeError is raised for parameter type mismatches.
1999-12-09 21:13:07 +00:00
Guido van Rossum cbdff766d2 OpenSSL support. This is based on patches for a version of SSLeay by
Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by
Laszlo Kovacs of HP.  Both have kindly given permission to include
the patches in the Python distribution.  Final formatting by GvR.
1999-12-07 21:47:09 +00:00
Guido van Rossum 09c8b6c3e4 OpenSSL support. This is based on patches for a version of SSLeay by
Brian E Gallew, which were improved and adapted to OpenSSL 0.9.4 by
Laszlo Kovacs of HP.  Both have kindly given permission to include
the patches in the Python distribution.  Final formatting by GvR.
1999-12-07 21:37:17 +00:00
Fred Drake bf27298364 Correct the docstring for byteswap(); error noted by Bernhard Reiter
<bernhard@uwm.edu>.

Added a check that no parameters were passed to byteswap(); previously
allowed any parameters you happened to pass.
1999-12-03 17:15:30 +00:00
Guido van Rossum b960e7a797 Patches by Kannan Vijayan:
new:
readline.get_begidx() -> int
	gets the beginning index in the command line string
	delimiting the tab-completion scope.  This would
	probably be used from within a tab-completion
	handler

readline.get_endidx() -> int
	gets the ending index in the command line string
	delimiting the tab-completion scope.  This would
	probably be used from within a tab-compeltion
	handler

readline.set_completer_delims(string) -> None
	sets the delimiters used by readline as word breakpoints
	for tab-completion

readline.get_completer_delims() -> string
	gets the delimiters used by readline as word breakpoints
	for tab-completion

fixed:
readline.get_line_buffer() -> string
	doesnt cause a debug message every other call
1999-11-18 17:51:02 +00:00
Guido van Rossum 09cbb01989 Jack Jansen: Mac has no EINTR. 1999-11-08 15:32:27 +00:00
Guido van Rossum e168c65603 Patch by Dieter Maurer to make things work for Tcl/Tk 8.1. This
simply moves the call to Tk_MainWindow() after the Tcl/Tk
initialization calls.  The patch is unconditional, it works with
earlier and later versions as well.
1999-11-05 18:11:23 +00:00
Guido van Rossum 6b26a06037 Patch by Dieter Maurer to make things work for Tcl/Tk 8.1 (tested with
8.1.1).  His approach doesn't work with Tcl/Tk 8.2, so I've placed it
inside #if TKMAJORMINOR == 8001 and #endif.  See also his patch for
tkappinit.c.
1999-11-05 18:09:56 +00:00
Fred Drake e4f13660f8 split() docstring: Made signature and description for the first
parameter match.  Error pointed out by François
                    Pinard <pinard@iro.umontreal.ca> on c.l.py.
1999-11-04 19:19:48 +00:00
Guido van Rossum 1b6e463bd5 Bugfix by Jack Jansen for Macintosh (for the inet_ntoa/aton changes):
<arpa/inet.h> doesn't exist and isn't needed; and inet_addr() returns
a structure containing a long rather than a long.
1999-11-04 18:22:29 +00:00
Guido van Rossum 2db4f47fdd Patch by Jason Trowbridge. (Followup to his PR#110.) (Slightly
reformatted.)

- Illegal padding is now ignored.  (Recommendation by GvR.)

- Padding no longer removes characters from data string (resulting in
lost data/strings with negative lengths).

- Illegal characters outside the ASCII range are now ignored, instead
of possibly being remapped to a valid character.
1999-10-19 19:05:14 +00:00
Guido van Rossum d5753e15e2 John DuBois tells us that SCO OpenServer 5.0 and later requires _SVID3
before it reveals the needed definitions in sys/statvfs.h.
1999-10-19 13:29:23 +00:00
Guido van Rossum eba24bb920 Fix PR#110 -- bad input ("====") for a2b_base64() caused it to call
_PyString_Resize() with a negative size.
1999-10-19 04:47:13 +00:00
Fred Drake 2a6875e172 parser__pickler(): Don't drop the third argument to
parser_ast2tuple().  Create an temporary empty dictionary to
        use.  Bug reported by Mark Favas <m.favas@per.dem.csiro.au>.

Fix a couple of comments.
1999-09-20 22:32:18 +00:00
Guido van Rossum 675e994a2e Added comment with web location of bsddb windows port. 1999-09-20 13:28:18 +00:00
Guido van Rossum 9376b74c42 (1) On Linux, we really need to trust the configure script to select
the right variant of gethostbyname_r for us, since not all Linuxes are
equal in this respect.  Reported by Laurent Pointal.

(2) On BeOS, Chris Herborth reports that instead of arpa/inet.h you
must include net/netdb.h to get the inet_ntoa() and inet_addr()
prototypes.
1999-09-15 22:01:40 +00:00
Guido van Rossum a2e48552d2 It appears that inet_aton() doesn't really exist except in libresolv;
the proper function to call is inet_addr().  Since we already had code
to do that (for MS-Windows), this simplifies things a lot!
1999-09-09 15:42:59 +00:00
Fred Drake 7a15ba595a Added keyword parameter support to all public interfaces; keyword
names match the documentation.

Removed broken code that supports the __methods__ attribute on ast
objects; the right magic was added to Py_FindMethod() since this was
originally written.  <ast-object>.__methods__ now works, so dir() and
rlcompleter are happy.
1999-09-09 14:21:52 +00:00
Guido van Rossum 65bb328f67 Fixed memory leak in ratecv, in response to PR#72. By Sjoerd Mullender. 1999-09-07 14:24:05 +00:00
Guido van Rossum ff7e83d606 Patch by Mark Hammond to avoid certain header files on Windows/CE. 1999-08-27 20:39:37 +00:00
Guido van Rossum 7f1de832a2 Tiny patch by Mark Hammond to avoid sys/types.h if we don't have it
(for Windows/CE).
1999-08-27 20:33:52 +00:00
Fred Drake 762e206706 posix_putenv(): Constrain memory leakage when setting the same
environment variable repeatedly.  I posted this to the list
        some time ago, but only now got around to asking g--d- what he
        thought about it.
1999-08-26 17:23:54 +00:00
Guido van Rossum c6a164b8bc Port inet_ntoa and inet_aton to Windows:
- fix unescaped newline in string literal
- removed unused err variable
- Windows doesn't have inet_aton; use inet_addr instead
1999-08-20 19:11:27 +00:00
Guido van Rossum 5c9eb21729 Patch by Ben Gertzfield to add inet_aton() and inet_ntoa() calls. 1999-08-20 18:21:51 +00:00
Guido van Rossum a5456d5042 In floatsleep(), when using select(), ignore EINTR error. 1999-08-19 14:40:27 +00:00
Guido van Rossum 09be409220 Patch by Marc-Andre Lemburg to add a bunch more symbols. 1999-08-09 14:40:40 +00:00
Guido van Rossum 6a619f44c5 It turns out that modifying the environment strings is not safe.
Treat them as read-only, and make a copy as appropriately.  This was
first reported by Bill Janssend and later by Craig Rowland and Ron
Sedlmeyer.  This fix is mine.
1999-08-03 19:41:10 +00:00
Guido van Rossum 2f80d96c04 Patch by Stephen Turner, who writes:
"""
It fixes a memory corruption error resulting from BadPickleGet
exceptions in load_get, load_binget and load_long_binget.  This was
initially reported on c.l.py as a problem with Cookie.py; see the thread
titled "python core dump (SIGBUS) on Solaris" for more details.

If PyDict_GetItem(self->memo, py_key) call failed, then py_key was being
Py_DECREF'd out of existence before call was made to
PyErr_SetObject(BadPickleGet, py_key).

The bug can be duplicated as follows:

import cPickle
cPickle.loads('garyp')

This raises a BadPickleGet exception whose value is a freed object.  A
core dump will soon follow.
"""

Jim Fulton approves of the patch.
1999-07-13 15:18:58 +00:00
Guido van Rossum 9068da4b6d Milton L. Hankin reports that on Windows it is possible to have two
different values in the environ dict with the same key (although he
couldn't explain exactly how this came to be).  Since getenv() uses
the first one, Python should do too. (Some doubts about case
sensitivity, but for now this at least seems the right thing to do
regardless of platform.)
1999-07-02 02:54:02 +00:00
Guido van Rossum c3be1a3ca1 New version from Jim:
- Don't call Py_FatalError() when initialization fails.

- Fix bogus use of return value from PyRun_String().

- Fix misc. compiler errors on some platforms.
1999-06-15 14:36:59 +00:00
Guido van Rossum 17d53ecd8b New version from Jim: don't call Py_FatalError() when initialization fails. 1999-06-15 14:35:48 +00:00
Guido van Rossum c03158bfc7 Jim Fulton writes:
I've updated cPickle.c to use class exceptions:

Changed pickle error types to classes:

  PickleError
     PicklingError
        UnpickleableError
     UnpicklingError

And change the handling of unpickleable objects so that an UnpickleableError
is raised with the unpickleable object as the argument.  UnpickleableError
has a reasonable string representation and provides access to the problem
object, which is useful during debugging.

[I'm still waiting for patches to do the same to pickle.py.]
1999-06-09 15:23:31 +00:00
Barry Warsaw f63b8cc07c posix_listdir(): When an error occurs, call
posix_error_with_filename() instead of posix_error(), passing in the
name argument, so you get information on which directory was being
listed.
1999-05-27 23:13:21 +00:00
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
Guido van Rossum 50f385c197 Fix two small bugs; add DL_EXPORT() to initcPickle decl. 1998-12-04 18:48:44 +00:00
Guido van Rossum 3b5330ef2d Bernard Herzog pointed out that rl_parse_and_bind modifies its
argument string (bad function!), so we make a temporary copy.
1998-12-04 15:34:39 +00:00
Guido van Rossum 053b8dfcde New version from Jim Fulton:
- New copyright. (Open source)

  - Added new protocol for binary string pickles that
    takes out unneeded puts:

      p=Pickler()
      p.dump(x)
      p.dump(y)
      thePickle=p.getvalue()

    This has little or no impact on pickling time, but
    often reduces unpickling time and pickle size, sometimes
    significantly.

  - Changed unpickler to use internal data structure instead
    of list to reduce unpickling times by about a third.

  - Many cleanups to get rid of obfuscated error handling
    involving 'goto finally' and status variables.

  - Extensive reGuidofication. (formatting :)

  - Fixed binary floating-point pickling bug. 0.0 was not
    pickled correctly.

  - Now use binary floating point format when saving
    floats in binary mode.

  - Fixed some error message spelling error.
1998-11-25 16:18:00 +00:00
Guido van Rossum 7d9b4133eb New version from Jim Fulton:
- New copyright. (Open source)

  - Fixed problem in seek method.  The seek method should (and now does)
    fill with nulls when seeking past the end of the "file".
1998-11-25 16:17:32 +00:00
Guido van Rossum 185ead6f37 Doc strings by Chris Petrilli. 1998-11-23 15:32:55 +00:00
Guido van Rossum e9bc62d993 RajGopal Srinivasan noted that the latest code doesn't work when
running in a non-threaded environment.  He added some #ifdefs that fix
this.
1998-11-17 03:45:24 +00:00
Barry Warsaw b0d1b068d9 audio(7I) suggests that applications do the following to get the
device and control pseudo-device:

- first look for the device filename in the environment variable
  AUDIODEV.

- if not found, use /dev/audio

- calculate the control device by tacking "ctl" onto the base device
  name.

We now do this.  Also, if the open fails, we call
PyErr_SetFromErrnoWithFilename() to give a more informative error
message.

Added a fileno() method to the audio object returned from open().
This returns the file descriptor which can be used by applications to
set up SIGPOLL notification, as per the manpage.
1998-10-31 22:52:54 +00:00
Guido van Rossum 3f200d76df Add note about compiling FORMS with -Dclear=__GLclear.
(The GLHACK variable isn't really needed since the change to
glmodule.c, but I'm too busy to remove it.  It's harmless.)
1998-10-21 17:03:36 +00:00
Guido van Rossum 89733a8bd6 Check in the changed version after running the stubber again -- this
solves the conflict with curses over the 'clear' entry point much
nicer.  (Jack had checked in the changes to cstubs eons ago, but I
never regenrated glmodule.c :-( )
1998-10-21 16:10:40 +00:00
Guido van Rossum 605b93dee2 On a recommendation from Sjoerd Mullender, add -Dclear=__GLclear to
the compilation flags for the gl, fl and fm modules.  This avoids a
name conflict with the curses module (both gl and curses have an entry
point called 'clear').
1998-10-21 15:08:40 +00:00
Guido van Rossum bf338300ff Add a missing DECREF in an error exit. Submitted by Jonathan Giddy. 1998-10-19 13:38:36 +00:00
Guido van Rossum d3a6a14330 Doc strings by Chris Petrilli.
Also added MD5Type object.
1998-10-14 13:46:57 +00:00
Guido van Rossum a0deb64024 No need to issue a fatal error if the PyDict_SetItemString fails; the
caller (in import.c) will test for errors and take appropriate action.
1998-10-14 13:45:06 +00:00
Guido van Rossum fc6aba5008 ACK! There was still an unescaped newline in a docstring. 1998-10-14 02:52:31 +00:00
Guido van Rossum b39b90dda2 Doc strings by Chris Petrilli. 1998-10-13 14:27:22 +00:00
Guido van Rossum 41f0a98f8f Looks like I didn't test this interactively. The EventHook() code was
broken; it asked for the current thread state when there was none.
Fixed by using the saved event_tstate.
1998-10-12 16:26:22 +00:00
Guido van Rossum dc1adabcb8 Patch by Jonathan Giddy (with some cleanup by me) to always use the
thread state of the thread calling mainloop() (or another event
handling function) rather than the thread state of the function that
created the client data structure.
1998-10-09 20:51:18 +00:00
Guido van Rossum 215193bd93 There's no need to declare Tk_GetNumMainWindows() (and it breaks
something in the latest win342 build).
1998-10-08 02:27:41 +00:00
Guido van Rossum 7e48898d86 Use the t# format where appropriate. Greg Stein. 1998-10-08 02:25:24 +00:00
Guido van Rossum 2a570049ac Changes to deal with the sigcheck+intrcheck vs. signalmodule controversy. 1998-10-07 22:51:56 +00:00
Guido van Rossum d076c73cc8 Changes to support other object types besides strings
as the code string of code objects, as long as they support
the (readonly) buffer interface.  By Greg Stein.
1998-10-07 19:42:25 +00:00
Guido van Rossum c501583dfa Make gcc -Wall happy. 1998-10-07 16:36:14 +00:00
Guido van Rossum 89bae99c5d Make gcc -Wall happy:
Remove unused decls of getloclock() and is_lockobject().
1998-10-07 16:35:54 +00:00
Guido van Rossum c20687355b Make gcc -Wall happy:
(1) add dummy decl for strptime();
(2) move the code to set accept2dyear to the front of inittime().
1998-10-07 16:35:25 +00:00
Guido van Rossum e7adf3eb6d Documented PYTHONOPTIMIZE; by Marc Lemburg. 1998-10-07 14:50:06 +00:00
Guido van Rossum d5f6c223a9 Make the version variable static (it has no business being exported). 1998-10-07 14:48:53 +00:00
Guido van Rossum 7fef86ea71 Clarify sharedinstall comment 1998-10-07 14:41:54 +00:00
Guido van Rossum d5bcf9a343 Andrew Dalke's implementation of string.count(). 1998-10-06 19:43:14 +00:00
Guido van Rossum 573788eef1 No need for (char *) cast from gdbm_strerror(). 1998-10-03 05:15:07 +00:00
Guido van Rossum b6e2a99aa6 Win32 port. Patches by Milton L. Hankins. 1998-10-03 05:13:27 +00:00
Guido van Rossum 49b560698b Renamed thread.h to pythread.h. 1998-10-01 20:42:43 +00:00
Guido van Rossum 2645241add Fixes for OS/2 by Jeff Rush. 1998-09-28 22:07:11 +00:00
Guido van Rossum be70450f03 Removed some OS/2 #defines (now in the OS/2 specific config.h).
Patch by Jeff Rush.
1998-09-28 21:55:25 +00:00
Guido van Rossum 469067800b Get rid of the test for non-NULL thread state in EventHook; it can be
triggered in situations that are not an error.
1998-09-21 14:47:16 +00:00
Guido van Rossum 1b236768e7 When we have siginterrupt(), use it to disable restarting interrupted
system calls.
1998-09-21 14:46:00 +00:00
Guido van Rossum 0db4c94d09 Enable the 'new' module by default. 1998-09-21 14:45:22 +00:00
Guido van Rossum 78694d970f Patches from Greg Stein to support 'P' format in struct module's
native format, as void* (translated to Python int or long).
Also adds PyLong_FromVoidPtr and PyLong_AsVoidPtr to longobject.c.
1998-09-18 14:14:13 +00:00
Guido van Rossum ce11393136 Remove some unused variables from gethostbyaddr_ex and gethostbyaddr,
discovered by Marc Lemburg.
1998-09-13 15:52:13 +00:00
Guido van Rossum 76d1f96fe2 Michael P. Reilly suggested this fix: makesetup wants to prepend
"$(srcdir)/" before all source files even when is starts with "/".
1998-09-09 14:04:51 +00:00
Guido van Rossum 164543607c Now that we have standard (optional) long long support, the long long
support in this module can go.  The patch only deletes code
(PyLong_FromLongLong() and PyLong_AsLongLong()).  By Sjoerd Mullender.
1998-08-31 14:14:09 +00:00
Guido van Rossum cfbaecc546 Y2K fix affecting asctime(), mktime(), strftime().
2-digit years are now converted using rules that are (according to
Fredrik Lundh) recommended by POSIX or X/Open: 0-68 mean 2000-2068,
69-99 mean 1969-1999.

2-digit years are now only accepted if time.accept2dyear is set to a
nonzero integer; if it is zero or not an integer or absent, only year
values >= 1900 are accepted.  Year values 100-1899 and negative year
values are never accepted.

The initial value of time.accept2dyear depends on the environment
variable PYTHONY2K: if PYTHONY2K is set and non-empty,
time.accept2dyear is initialized to 0; if PYTHONY2K is empty or not
set, time.accept2dyear is initialized to 0.
1998-08-25 14:51:12 +00:00
Jeremy Hylton ce616e4009 Enter Jim Fulton's latest version. He writes:
I had to make a slight diddle to work with Python 1.4, which
we and some of our customers are still using. :(

I've also made a few minor enhancements:

  - You can now both get and set the memo using a 'memo'
    attribute.  This is handy for certain advanced applications
    that we have.

  - Added a 'binary' attribute to get and set the binary
    mode for a pickler.

  - Added a somewhat experimental 'fast' attribute.  When this
    is set, objects are not placed in the memo during pickling.
    This should lead to faster pickling and smaller pickles in
    cases where:

      o you *know* there are no circular references, and

      o either you've:

        - preloaded the memo with class information
          by pickling classes in non-fast mode or by
          manipilating the memo directly, or

        - aren't pickling instances.
1998-08-13 23:13:52 +00:00
Guido van Rossum 541f241132 Need mytime.h for Sleep(). 1998-08-13 13:29:22 +00:00
Jeremy Hylton d10552379d Two fixes to find_class:
1. Only DECREF the class's module when the module is retrieved via
PyImport_Import.  If it is retrieved from the modules dictionary with
PyDict_GetItem, it is using a borrowed reference.

2. If the module doesn't define the desired class, raise the same
SystemError that pickle.py does instead of returning an AttributeError
(which is cryptic at best).

Also, fix the PyArg_ParseTuple in cpm_loads (the externally visible
loads) function:  Use "S" instead of "O" because cStringIO will croak
with a "bad arguments to internal function" if passed anything other
than a string.
1998-08-11 19:52:51 +00:00
Guido van Rossum 549cb6ea03 Added a module docstring (that's all this module needs). 1998-08-11 17:50:22 +00:00
Guido van Rossum be10c20adf Now include Python.h 1998-08-08 20:01:22 +00:00
Guido van Rossum e2d81cd4d7 Jim Fulton's patches to get rid of the class_map(). 1998-08-08 19:40:10 +00:00
Guido van Rossum 617bc19e3d In Win32 version of listdir(), when FindFirstFile() returns
ERROR_FILE_NOT_FOUND, return an empty list instead of raising an
exception.
1998-08-06 03:23:32 +00:00
Guido van Rossum 954e3cab0a Removed unused variables. 1998-08-06 03:21:15 +00:00
Guido van Rossum 227cf764b2 Undo a silly effect of a global substitution: the macintosh panic()
function had a reference to vPySys_WriteStderr(...) -- turn it back
into fprintf(stder, ...).
1998-08-05 13:53:32 +00:00
Guido van Rossum bcc207484a Changes for BeOS, QNX and long long, by Chris Herborth. 1998-08-04 22:53:56 +00:00
Guido van Rossum 7d896ab1bb Added gethostbyname_ex(), which returns the same kind of data as
gethostbyaddr().  (Plain gethostbyname() returns only the IP address.)
This moves the code shared by gethostbyaddr() and gethostbyname_ex()
to a subroutine.

Original patch by Dan Stromberg; some tweaks by GvR.
1998-08-04 22:16:43 +00:00
Fred Drake 7f875ef749 parser__pickler(): Use Py_DECREF() when reference is known to be non-NULL. 1998-08-04 15:58:10 +00:00
Guido van Rossum c96417980c Patch by Jody Winston (with my changes) to add some of the "wait
status inspection" macros as functions: WEXITSTATUS(), WIFEXITED(),
WIFSIGNALED(), WIFSTOPPED(), WSTOPSIG(), WTERMSIG().
1998-08-04 15:26:23 +00:00
Guido van Rossum 923fece5bd Better error messages when raising ValueError for int literals. (The
previous version of this code would not show the offending input, even
though there was code that attempted this.)
1998-08-04 15:04:52 +00:00
Guido van Rossum 76310fcc47 Make sure that at least one digit has been consumed in atoi(). 1998-07-25 04:14:37 +00:00
Guido van Rossum 2a502d8304 Use 'S' format character for the optional constructor argument, so we
get a decent error message when it's not a string (instead of
confusing errors when trying to use the thing).
1998-07-24 19:53:54 +00:00
Barry Warsaw d58d7647f3 Several changes to support inclusion of filename in relevent
exceptions:

posix_error_with_filename(): New function which calls
PyErr_SetFromErrnoWithFilename()

The following methods have been changed to call
posix_error_with_filename():

    posix_1str()
    posix_strint()
    posix_strintint()
    posix_do_stat()
    posix_mkdir()
    posix_utime()
    posix_readlink()
    posix_open()

INITFUNC(): os.error (nee PosixError) is PyExc_OSError
1998-07-23 16:14:40 +00:00
Barry Warsaw 1ee36ffca0 (pause_doc): Sun CC complains about newline in string literal 1998-07-21 22:41:18 +00:00
Guido van Rossum 1a78553093 Add test for failure of the getattr call in pcre_expand() -- it used
to core dump if the first argument did not have a "group" attribute.
1998-07-17 20:19:48 +00:00
Fred Drake 7589b71c4a I_getattr(),
O_getattr():  Added read-only access to the closed attribute, based on comment
	from Michael Scharf <Michael.Scharf@Rhein-Neckar.de>.
1998-07-17 14:30:58 +00:00
Guido van Rossum 43ff8683fe Temporarily get rid of the registration of Tcl_Finalize() as a
low-level Python exit handler.  This can attempt to call Python code
at a point that the interpreter and thread state have already been
destroyed, causing a Bus Error.  Given the intended use of
Py_AtExit(), I'm not convinced that it's a good idea to call it
earlier during Python's finalization sequence...  (Although this is
the only use for it in the entire distribution.)
1998-07-14 18:02:13 +00:00
Guido van Rossum 7859f87fdb Marc-Andre Lemburg's patch to support instance methods with other
callable objects than regular Pythonm functions as their im_func.
1998-07-08 14:58:16 +00:00
Guido van Rossum c821d1ecc0 Add a cast that a picky SGI compiler found was necessary. 1998-07-07 22:25:47 +00:00
Guido van Rossum 9f29990a90 Fix a benign problem found by a picky SGI compiler (unreachable break
after a return).
1998-07-07 22:23:22 +00:00
Guido van Rossum 04e00a4cf4 Fix benign problems found by a picky SGI compiler (unreachable break
after a return or goto).
1998-07-07 22:22:22 +00:00
Guido van Rossum c69bac539c Fix benign problems found by a picky SGI compiler (unreachable break
after a return).
1998-07-07 22:21:45 +00:00
Guido van Rossum eaa1ed6b42 Fix some problems that a picky SGI compiler reported. Two were benign
(unreachable break after a return) but one was a real bug:
ReadFrames() was getting a bogus framecount because of a missing '&'.
1998-07-07 22:19:27 +00:00
Guido van Rossum 82a5c66a51 Added copious docstrings, plus two minor layout tweaks. 1998-07-07 20:45:43 +00:00
Guido van Rossum d20781b518 On Windows, put the select file descriptor arrays on the heap.
This is because they are huge and the stack is limited on Windows.
Other platforms keep declaring it on the stack.
1998-07-02 02:53:36 +00:00
Guido van Rossum 39ef2274a3 Unsigned 1 and 2 byte sized formats shouldn't result in long integer values! 1998-06-29 04:00:40 +00:00
Guido van Rossum 911ec188c8 # Added missing semicolon (was #ifdef'ed out in edit on Windows). 1998-06-28 17:00:19 +00:00
Guido van Rossum 1d8fb2d894 Added doc strings. 1998-06-28 16:54:49 +00:00
Guido van Rossum 0ef577b966 Added doc strings. 1998-06-27 20:38:36 +00:00
Guido van Rossum d2264bb5c3 # Remove an extra blank line from a doc string. 1998-06-27 19:45:17 +00:00
Guido van Rossum 75e9fc31d3 Added doc strings. Also export LockType from the modoule, and give it
a doc string.
1998-06-27 18:21:06 +00:00
Guido van Rossum 5cd70f4f66 Added <ctype.h>, needed for Windows. 1998-06-19 04:33:30 +00:00
Guido van Rossum f766e23f63 There was an error check in a loop in PythonCmd which called
PythonCmd_Error() but failed to return.  The error wasn't very likely
(only when we run out of memory) but since the check is there we might
as well return the error.  (I think that Barry introduced this buglet
when he added error checks everywhere.)
1998-06-19 04:28:10 +00:00
Guido van Rossum 5e97783c8f # Note: a previous checkin message was lost because I can now use CVS
# from my PC at home, but it can't send email :-(

Add a clarifying comment about the new ENTER_OVERLAP and
LEAVE_OVERLAP_TCL macros; get rid of all the bogus tests for deleted
interpreters (Tcl already tests for this; they were left over from an
earlier misguided attempt to fix the threading).
1998-06-15 14:03:52 +00:00
Guido van Rossum 62320c9b9b # (My first checkin from Windows NT using remote CVS!)
There were some serious problem with the thread-safety code.
The basic problem was that often the result was gotten out of
the Tcl interpreter object after releasing the Tcl lock.
Of course, another thread might have changed the return value
already, and this was indeed happening.  (Amazing what trying
it on a different thread implementation does!)

The solution is to grab the Python lock without releasing the
Tcl lock, so it's safe to create a string object or set the
exceptions from the Tcl interpreter.  Once that's done, the
Tcl lock is released.

Note that it's now legal to acquire the Python lock while the
the Tcl lock is held; but the reverse is not true: the Python
lock must be released before the Tcl lock is acquired.  This
in order to avoid deadlines.  Fortunately, there don't seem to
be any problems with this.
1998-06-15 04:36:09 +00:00
Guido van Rossum ad4db17552 Fixed the EventHook() code so that it also works on Windows, sort of.
(The "sort of" is because it uses kbhit() to detect that the user
starts typing, and then no events are processed until they hit
return.)

Also fixed a nasty locking bug: EventHook() is called without the Tcl
lock set, so it can't use the ENTER_PYTHON and LEAVE_PYTHON macros,
which manipulate both the Python and the Tcl lock.  I now only acquire
and release the Python lock.

(Haven't tested this on Unix yet...)
1998-06-13 13:56:28 +00:00
Guido van Rossum b3f9f4b729 On Windows, make the pipe() call return Unix file descriptors instead
of Windows file handles.  Now it is at least compatible with itself on
Unix!
1998-06-12 15:05:15 +00:00
Guido van Rossum e7c4193755 In tcsetattr(), first initialize the mode structure by calling
tcgetattr().  This seems to be the only correct way to cope with
platform-specific structure members...
1998-06-12 14:26:18 +00:00
Guido van Rossum 87ce7bbc39 Added strptime, if it exists. Modified after a patch by Jesse Hallio. 1998-06-09 16:30:31 +00:00
Guido van Rossum 3c8c5981b1 Sorry, the initializer for ob_type must really be NULL,
else the damn thing won't compile on Windows :-(
1998-05-29 02:58:20 +00:00
Guido van Rossum 2a5119b680 On Windows, need #include <windows.h>; and it's MS_WINDOWS, not MS_WIN32. 1998-05-29 01:28:40 +00:00
Guido van Rossum 00d93066b0 Changes to make it possible to write multi-threaded programs using
Tkinter.  This adds a separate lock -- read the comments.  (This was
also needed for Mark Hammond's attempts to make PythonWin
Tkinter-friendly.)

The changes have affected the EventHook slightly, too; and I've done
some more cleanup of the code that deals with the different versions
of Tcl_CreateFileHandler().
1998-05-28 23:06:38 +00:00
Guido van Rossum 578de30fd7 Some systems (e.g. Linux) use enums for some symbols (like IPPROTO_IP)
so that our #ifdef test has the wrong effect.  Substitute hardcoded
values for some important symbols (but not for the whole range -- some
are pretty obscure so it's not worth it).
1998-05-28 20:18:18 +00:00
Fred Drake d3dbb38e98 get_long(): Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred(...). 1998-05-28 04:35:49 +00:00
Fred Drake bebc97fcd7 t_bootstrap(): Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred(...). 1998-05-28 04:35:12 +00:00
Fred Drake 764b984db5 Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred() == ... in two
places.
1998-05-28 04:33:37 +00:00
Guido van Rossum 7bf15648a4 Use a different implementation of EventHook(). The new version
registers an input file handler for stdin with Tcl and handles Tcl
events until something is available on stdin; it then deletes the
handler and returns from EventHook().

This works with or without GNU readline, and doesn't busy-wait.

It still doesn't work for Mac or Windows :-(
1998-05-22 18:28:17 +00:00
Guido van Rossum 832f6d2890 Add an alias (and preferred name) "contains" for "sequenceIncludes".
Rationalized the doc strings.

Also simplify the module initialization -- we don't need a __version__
which is set to "$Rev" :-) and we don't need a fatal error when the
initialization fails.
1998-05-22 18:12:59 +00:00
Guido van Rossum b88679b2a4 I think there was a tiny bug in new_function() -- the 'defaults'
argument was initialized to Py_None, but later checked for NULL.
Consistently use Py_None.
1998-05-22 00:57:31 +00:00
Guido van Rossum b1ed9c5295 PySequence_In() -> PySequence_Contains(). 1998-05-22 00:54:16 +00:00
Guido van Rossum 7df115de65 Make sure that no use of a function pointer gotten from a
tp_as_sequence or tp_as_mapping structure is made without checking it
for NULL first.
1998-05-22 00:53:47 +00:00
Guido van Rossum a88c5f30c7 Correct bug doc string (discovered by Berthold Hoellmann):
get_line_buffer() does not take an optional argument.
1998-05-20 15:50:56 +00:00