Sjoerd: add separate administration of temporary files created y
URLopener.retrieve() so cleanup can properly remove them. The old
code removed everything in tempcache which was a bad idea if the user
had passed a non-temp file into it. (I added a line to delete the
tempcache in cleanup() -- it still seems to make sense.)
Jack: in basejoin(), interpret relative paths starting in "../". This
is necessary if the server uses symbolic links.
- use the DLL versions of the C runtime (!)
- change path settings so intermediate files go to Debug/temp or Release/temp
- add resource file to python15.dll (can't remember what this does)
- add a separate project to build the parser module
Change [_Py_]re_compile_pattern() to return a char*.
Since it only returns an error message (or NULL) there's no reason
for it to be unsigned char *, and various compilers like this better.
Add the same _keep_alive patch (by Michael Scharff) that was added to
copy.deepcopy() a while ago. Can't reproduce this but it doesn't
break anything and it looks like the code could have the same problem.
Fix the bug Jeremy was experiencing: both the close() and the
dealloc() functions contained code to free/DECREF the buffer
(there were differences between I and O objects but the logic bug was
the same). Fixed this be setting the buffer pointer to NULL and
testing for that. (This also makes it safe to call close() more than
once.)
XXX Worry: what if you try to read() or write() once the thing is
closed?
Guido van Rossum [Fri, 29 Aug 1997 22:36:47 +0000 (22:36 +0000)]
Write out the dynamic OS choice, to avoid exec statements.
Adding support for a new OS is now a bit more work, but I bet that
'dos' or 'nt' will cover most situations...
Guido van Rossum [Fri, 29 Aug 1997 22:32:42 +0000 (22:32 +0000)]
Two independent changes (oops):
- Changed semantics for initialized flag (again); forget the ref
counting, forget the fatal errors -- redundant calls to
Py_Initialize() or Py_Finalize() calls are simply ignored.
- Automatically import site.py on initialization, unless a flag is set
not to do this by main().
Barry Warsaw [Fri, 29 Aug 1997 22:20:16 +0000 (22:20 +0000)]
Swap the sense of the -X option vis-a-vis Py_UseClassExceptionsFlag so
that class based exceptions are enabled by default. -X disables them
in favor of the old-style string exceptions.
Barry Warsaw [Fri, 29 Aug 1997 22:13:51 +0000 (22:13 +0000)]
Removed obsolete exception PyExc_AccessError.
Added PyErr_MemoryErrorInst to hold the pre-instantiated instance when
using class based exceptions.
Simplified the creation of all built-in exceptions, both class based
and string based. Actually, for class based exceptions, the string
ones are still created just in case there's a problem creating the
class based ones (so you still get *some* exception handling!). Now
the init and fini functions run through a list of structure elements,
creating the strings (and optionally classes) for every entry.
initerrors(): the new base class exceptions StandardError,
LookupError, and NumberError are initialized when using string
exceptions, to tuples containing the list of derived string
exceptions. This GvR trick enables forward compatibility! One bit of
nastiness is that the C code has to know the inheritance tree embodied
in exceptions.py.
Barry Warsaw [Fri, 29 Aug 1997 22:07:17 +0000 (22:07 +0000)]
Added Py_UseClassExceptionsFlag, the variable containing the state of
the -X command line option.
Py_Initialize(): Handle the two phase initialization of the built-in
module.
Py_Finalize(): Handle the two phase finalization of the built-in
module.
parse_syntax_error(): New function which parses syntax errors that
PyErr_Print() will catch. This correctly parses such errors
regardless of whether PyExc_SyntaxError is an old-style string
exception or new-fangled class exception.
PyErr_Print(): Many changes:
1. Normalize the exception.
2. Handle SystemExit exceptions which might be class based. Digs
the exit code out of the "code" attribute. String based
SystemExit is handled the same as before.
3. Handle SyntaxError exceptions which might be class based. Digs
the various information bits out of the instance's attributes
(see parse_syntax_error() for details). String based
SyntaxError still works too.
4. Don't write the `:' after the exception if the exception is
class based and has an empty string str() value.
Barry Warsaw [Fri, 29 Aug 1997 21:59:26 +0000 (21:59 +0000)]
New file, which is imported by the built-in module when python is
started with the -X option. This file contains the definitions for
the built-in exception classes.
Barry Warsaw [Fri, 29 Aug 1997 21:56:07 +0000 (21:56 +0000)]
Added externs for three new exceptions PyExc_StandardError,
PyExc_NumberError, and PyExc_LookupError. Also added extern for
pre-instantiated exception instance PyExc_MemoryErrorInst.
Removed extern of obsolete exception PyExc_AccessError.
Barry Warsaw [Fri, 29 Aug 1997 21:54:35 +0000 (21:54 +0000)]
PyErr_NoMemory(): If the pre-instantiated memory exception is non-null
(PyExc_MemoryErrorInst) raise this instead of PyExc_MemoryError. This
only happens when exception classes are enabled (e.g. when Python is
started with -X).
Barry Warsaw [Thu, 28 Aug 1997 22:36:40 +0000 (22:36 +0000)]
eval_code2(), set_exc_info(): Call PyErr_NormalizeException() the
former rather than the latter, since PyErr_NormalizeException takes
PyObject** and I didn't want to change the interface for set_exc_info
(but I did want the changes propagated to eval_code2!).
Guido van Rossum [Thu, 28 Aug 1997 02:38:01 +0000 (02:38 +0000)]
New installation instructions show how to maintain multiple FAQs.
Removed bootstrap script from end of faqwiz.py module.
Added instructions to bootstrap script, too.
Version bumped to 0.8.
Added <html>...</html> feature suggested by Skip Montanaro.
Added leading text for Roulette, default to 'Hit Reload ...'.
Fix typo in default SRCDIR.
Guido van Rossum [Tue, 26 Aug 1997 19:06:40 +0000 (19:06 +0000)]
Explicitly close the socket and temp file in URLopener.retrieve(), so
that multiple retrievals using the same connection will work.
This leaves open the more general problem that after
f = urlopen("ftp://...")
f must be closed before another retrieval from the same host should be
attempted.
Jack Jansen [Tue, 26 Aug 1997 13:20:34 +0000 (13:20 +0000)]
Handle systemclicks ourselves, in stead of passing them to Sioux. This
fixes (or masks?) a bug with Python becoming unreactive during
time.sleep() if you have already switched applications before.
Barry Warsaw [Mon, 25 Aug 1997 22:13:04 +0000 (22:13 +0000)]
eval_code2(): collapsed the implementations of UNPACK_TUPLE and
UNPACK_LIST byte codes and added a third code path that allows
generalized sequence unpacking. Now both syntaxes:
a, b, c = seq
[a, b, c] = seq
can be used to unpack any sequence with the exact right number of
items.
unpack_sequence(): out-lined implementation of generalized sequence
unpacking. tuple and list unpacking are still inlined.
Guido van Rossum [Mon, 25 Aug 1997 21:23:56 +0000 (21:23 +0000)]
Allow assignments to instance.__dict__ and instance.__class__. The
former lets you give an instance a set of new instance vars. The
latter lets you give it a new class. Both are typechecked and
disallowed in restricted mode.
For classes, the check for read-only special attributes is tightened
so that only assignments to __dict__, __bases__, __name__,
__getattr__, __setattr__, and __delattr__ (these could be made to work
as well, but I don't know if that's useful -- let's see first whether
mucking with instances will help).
Guido van Rossum [Mon, 25 Aug 1997 18:36:23 +0000 (18:36 +0000)]
Rename roundup() to roundupsize(), as there's a macro roundup() in the
sys/types.h header on many systems that may get pulled in (through
WANT_SIGFPE_HANDLER which pulls in signal.h).
Normalizes exceptions, and places the normalized values in the
arguments. If type is not a class, this does nothing. If type is a
class, then it makes sure that value is an instance of the class by:
1. if instance is of the type, or a class derived from type, it does
nothing.
2. otherwise it instantiates the class, using the value as an
argument. If value is None, it uses an empty arg tuple, and if
the value is a tuple, it uses just that.
Barry Warsaw [Fri, 22 Aug 1997 21:14:38 +0000 (21:14 +0000)]
Two new built-in functions: issubclass() and isinstance(). Both take
classes as their second arguments. The former takes a class as the
first argument and returns true iff first is second, or is a subclass
of second.
The latter takes any object as the first argument and returns true iff
first is an instance of the second, or any subclass of second.
Also, change all occurances of pointer compares against
PyExc_IndexError with PyErr_ExceptionMatches() calls.
Guido van Rossum [Fri, 22 Aug 1997 20:53:47 +0000 (20:53 +0000)]
Add unsupported variable EXE which can be set to .exe on systems where
the executable must have that suffix. Note that there is no
corresponding support in the top-level Makefile because I'm not sure
that the install targets there make sense under these circumstances.
Fred Drake [Fri, 22 Aug 1997 13:51:31 +0000 (13:51 +0000)]
Changed description of SchedParams() in the following way:
\bar{Besocial} --> \var{besocial}
^--- note case ----^
The fixed version matches the signature. Changed "\bar{Besocial} gives ..."
to "The \var{besocial} flag gives ..." to keep from starting the sentence
with a lowercase token.
(The \bar{} --> \var{} change was required to keep LaTeX happy.)
Barry Warsaw [Thu, 21 Aug 1997 22:36:26 +0000 (22:36 +0000)]
Removed JF's dollar-Log-dollar RCS turd that caused compilation to
crash due to GvR's last check in message :-). Will try to convince JF
to remove all this evilness.