Commit Graph

8809 Commits

Author SHA1 Message Date
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 52ddc0e756 PyFile_FromString(): If an exception occurs, pass in the filename that
was used so it's reflected in the IOError.  Call
PyErr_SetFromErrnoWithFilename().
1998-07-23 16:07:02 +00:00
Barry Warsaw 97d951533e PyErr_SetFromErrnoWithFilename(): New function which supports setting
an exception from errno, with a supplied filename (primarily used by
IOError and OSError).  If class exceptions are used then the exception
is instantiated with a 3-tuple: (errno, strerror, filename).  For
backwards compatibility reasons, if string exceptions are used,
filename is ignored.

PyErr_SetFromErrno(): Implement in terms of
PyErr_SetFromErrnoWithFilename().
1998-07-23 16:05:56 +00:00
Barry Warsaw 2dfe4de614 Added support for including the filename in IOErrors and OSErrors that
involve a filesystem path.  To that end:

- Changed IOError to EnvironmentError and added a hack which checks
  for arg of len 3.  When constructed with a 3-tuple, the third item
  is the filename and this is squirreled away in the `filename'
  attribute.   However, for in-place unpacking backwards
  compatibility, self.args still only gets the first two items.  Added
  a __str__() which prints the filename if it is given.

- IOError now inherits from EnvironmentError

- New class OSError which also inherits from EnvironmentError and is
  used by the posix module.
1998-07-23 16:03:46 +00:00
Barry Warsaw d086a1a864 Added support for two new standard errors: EnvironmentError and
OSError.  The EnvironmentError serves primarily as the (common
implementation) base class for IOError and OSError.  OSError is used
by posixmodule.c

Also added tuple definition of EnvironmentError when using string
based exceptions.
1998-07-23 15:59:57 +00:00
Barry Warsaw 62a21a2ebe New global variables: PyExc_EnvironmentError and PyExc_OSError
New function: PyErr_SetFromErrnoWithFilename(PyObject* char*)
1998-07-23 15:57:34 +00:00
Guido van Rossum be260101cb # Oops, correct Latex errors. 1998-07-22 21:51:41 +00:00
Guido van Rossum 0af2f63056 Document how to make a POST request with urlopen().
Change the argument name for quote() and quote_plus() to safe (which
matches the implementation).

Add doc for the *new* function urlencode().
1998-07-22 21:34:21 +00:00
Guido van Rossum 810a3396d1 Speed up the implementation of quote().
Fix the implementation of quote_plus().  (It wouldn't treat '+' in the
original data right.)

Add urlencode(dict) which is handy to create the data for sending a
POST request with urlopen().
1998-07-22 21:33:23 +00:00
Jack Jansen d81fc3cd64 - Added a function MoviesTask, which is the same as the method but
with a null movie (giving time to all active movies)
- Made the graphics world parameter to SetMovieGWorld optional.
1998-07-22 13:37:37 +00:00
Jack Jansen 2116bcaec0 Remove the MOOV filetype from the StandardGetFile call, so we can also
open MPEG files, etc.
1998-07-22 13:35:31 +00:00
Guido van Rossum 1f00eed8b5 Feature added by Harri Pasanen (at my suggestion): .py suffix on
filename may be omitted.
1998-07-22 13:35:21 +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 b4db1944c4 When comparing objects, always check that tp_compare is not NULL
before calling it.  This check was there when the objects were of the
same type *before* coercion, but not if they initially differed but
became the same *after* coercion.
1998-07-21 21:56:41 +00:00
Guido van Rossum 052969a602 Don't use calculations on values gotten from tell(). Also use a
slightly different way to test for the existence of unread.
1998-07-21 14:24:04 +00:00
Guido van Rossum 897b9f0b0d Add new syntax for specifying filenames on break and clear commands. 1998-07-20 23:29:10 +00:00
Guido van Rossum 136a112bf1 Untabified. 1998-07-20 23:22:51 +00:00
Guido van Rossum f60e8e8108 Update the documentation. Get rid of the section "how it works"
(which is not very relevant when you're in the debugger :-).
1998-07-20 23:21:21 +00:00
Guido van Rossum b5699c7240 Added support for specifying a filename for a breakpoint, roughly
according to an idea by Harri Pasanen (but with different syntax).
This affects the 'break' and 'clear' commands and their help
functions.  Also added a helper method lookupmodule().

Also:

- Try to import readline (important when pdb is used from/as a script).
- Get rid of reference to ancient __privileged__ magic variable.
- Moved all import out of functions to the top.
- When used as a script, check that the script file exists.
1998-07-20 23:13:54 +00:00
Guido van Rossum c612681b20 Fix another bug in ESR's changes. In order to work properly,
onecmd(line) must return the value returned by emptyline() or
default(line).
1998-07-20 21:22:08 +00:00
Guido van Rossum d623d20e7d Complete the addition of libthreading.tex. (Isn't it annoying that
you need to edit four files in order to add one section to the manual?)
1998-07-20 17:34:50 +00:00
Guido van Rossum 0aec9fb183 Add missing initializer for self._backupfilename. Due to Ralph Butler. 1998-07-20 15:49:28 +00:00
Guido van Rossum 3a8d1f5a6b Modest speed improvement to escape() by Piet van Oostrum. 1998-07-20 15:46:13 +00:00
Guido van Rossum 7333c4cafc Patch by Piet van Oostrum to avoid calculating with the result of
fp.tell() -- that won't work on Windows.

(A patch for rfc822 is still needed for one case where it finds a bad
header line and wants to back up.)
1998-07-20 15:24:01 +00:00
Fred Drake a9f445cd8d Add libthreading.tex to LIBFILES. 1998-07-20 14:01:20 +00:00
Andrew M. Kuchling 16440e63be Added libthreading.tex ; this is mostly the contents of threading_api.py,
with LaTeX markup added, and some small rewrites to improve the prose.
1998-07-20 13:46:10 +00:00
Guido van Rossum bd9f093fcd Measure performance of sub(), split(), findall(). 1998-07-17 21:10:42 +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
Guido van Rossum 0e5ab17ad3 Get a 3- to 4-fold speedup for sub()/subn(), split() and findall() by
not calling self.search(); instead, call self.code.match() directly
and interpret the list of registers it returns directly.  This saves
the overhead of instantiating a MatchObject for each hit, basically
inlining search() as well as group().  When a MatchObject is still
needed, one is allocated and reused for the duration of the scan.
1998-07-17 20:18:49 +00:00
Guido van Rossum c364cf8228 Added tests for findall().
Added test for m.groups() with default.
Added a few prints announcing various tests in verbose mode.
1998-07-17 20:05:02 +00:00
Guido van Rossum dfba2fbfd0 Eric Raymond documents two already-existing functions (bmp, png). 1998-07-17 19:01:29 +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 7f1d3aa3d9 Add tests for array self-assigns. (This one has no relevance to JPython.) 1998-07-16 15:31:43 +00:00
Guido van Rossum affd77f71e Add tests for list self-assigns. (Sorry, this should have been here
before JPython 1.0 came out.)
1998-07-16 15:29:06 +00:00
Guido van Rossum 0fd00334c6 Avoid using calloc(). This triggered an obscure bug on multiprocessor
Sparc Solaris 2.6 (fully patched!) that I don't want to dig into, but
which I suspect is a bug in the multithreaded malloc library that only
shows up when run on a multiprocessor.  (The program wasn't using
threads, it was just using the multithreaded C library.)
1998-07-16 15:06:13 +00:00
Guido van Rossum 93d1fe1c56 From: Nicolas CHAUVAT <nico@caesium.fr>
In the bbox method of Group (Canvas.py file), you should read

	return self.canvas._getints(self._do('bbox'))

instead of

	return self._getints(self._do('bbox'))
1998-07-16 13:43:05 +00:00
Guido van Rossum 98c92c83a5 Show how to do switchable panels. 1998-07-15 14:58:05 +00:00
Fred Drake 182c590869 Tk.__init__(): In computing baseName, add ".pyo" to list of dropped
extensions, and include the "." in ".pyc".  Still need to get
	_tkinter.c:Tkapp_New() to use baseName....
1998-07-15 04:36:56 +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 69a79bca68 Better RFC 821 compliance (MAIL and RCPT, and CRLF in data)
by Carey Evans <c.evans@clear.net.nz>, for picky mail servers.
1998-07-13 15:18:49 +00:00
Jack Jansen 5c44027d8a Added a delete() method to menu entries. Only the last entry of a menu
can be deleted, but that's good enough for things like a "Windows"
menu with the dynamic list of open windows at the end of the menu.
1998-07-13 13:41:02 +00:00
Jack Jansen f22e67dcb5 Added prototypes for the code resource routines, and for Pstring
(which was missing, for some reason).
1998-07-13 13:39:34 +00:00
Jack Jansen ac82b6a041 If the preference filename resource is empty don't try to open or
create the preferences file. This is so that frozen programs don't
interfere with an existing Python installation, or leave turds in the
Preferences folder.
1998-07-13 13:38:29 +00:00
Jack Jansen 1e2260fcb4 All import-related code has moved to macimport.c.
There's also new support for importing code fragments: if a file on
sys.path contains a PYD resource with resourcename equal to the name
of the module to be imported this PYD resource should contain a
(pascal) string with the name of a code fragment to load. This allows
freezing Python programs without access to source or a development
environment.
1998-07-13 13:37:12 +00:00
Jack Jansen f2f3e9bc43 Added macimport.c to various files 1998-07-13 13:34:06 +00:00
Jack Jansen eefc1a3f97 Add an empty PYTHONPREFSFILE STR resource, so frozen applications
don't try to open/create the preferences file.
1998-07-13 13:33:09 +00:00
Guido van Rossum 5dba9e8aef Add special case to PySequence_List() so that list() of a list is
faster (using PyList_GetSlice()).  Also added a test for a NULL
argument, as with PySequence_Tuple().  (Hmm...  Better names for these
two would be PyList_FromSequence() and PyTuple_FromSequence().  Oh well.)
1998-07-10 18:03:50 +00:00
Guido van Rossum fa4ac71dd6 Small changes to map() and filter():
(1) If a sequence S is shorter than len(S) indicated, don't fail --
just use the shorter size.  (I.e, len(S) is just a hint.)

(2) Implement the special case map(None, S) as list(S) -- it's faster.
1998-07-10 17:37:30 +00:00
Guido van Rossum bfc725bf64 Changed PySequence_List() and PySequence_Tuple() to support
"indefinite length" sequences.  These should still have a length, but
the length is only used as a hint -- the actual length of the sequence
is determined by the item that raises IndexError, which may be either
smaller or larger than what len() returns.  (This is a novelty; map(),
filter() and reduce() only allow the actual length to be larger than
what len() returns, not shorter.  I'll fix that shortly.)
1998-07-10 16:22:44 +00:00
Jack Jansen df901dfdea Added a function SetUserItemHandler: this takes a function(dialog,
item) as parameter and returns a handle suitable for passing to
SetDialogItem as a user-item redraw routine. Note that you can
only make one of these, for now.
1998-07-10 15:47:48 +00:00