Commit Graph

1186 Commits

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