Commit Graph

6156 Commits

Author SHA1 Message Date
Guido van Rossum
b2173c3146 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).
1997-08-25 21:23:56 +00:00
Guido van Rossum
a27d112213 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).
1997-08-25 18:36:23 +00:00
Guido van Rossum
81e479a11f Removed some colons that shouldn't be there (probably leftovers from
docstring conversion).
1997-08-25 18:28:03 +00:00
Guido van Rossum
27e4aa3168 Arbitrary point checkpoint commit. Take no notice. 1997-08-25 15:37:59 +00:00
Guido van Rossum
bff110f3f1 Examples of metaprogramming in pure Python. 1997-08-23 21:14:37 +00:00
Barry Warsaw
558f66ff53 Added a few more tests of exception class raising 1997-08-22 21:28:05 +00:00
Barry Warsaw
ac405ce3f9 generated output for new tests 1997-08-22 21:27:40 +00:00
Barry Warsaw
d543077aa6 Added tests of the new builtin functions issubclass() and isinstance() 1997-08-22 21:27:03 +00:00
Barry Warsaw
4249f54b28 cmp_exception gets promoted (essentially) to the C API function
PyErr_GivenExceptionMatches().

set_exc_info(): make sure to normalize exceptions.

do_raise(): Use PyErr_NormalizeException() if type is a class.

loop_subscript(): Use PyErr_ExceptionMatches() instead of raw pointer
compare for PyExc_IndexError.
1997-08-22 21:26:19 +00:00
Barry Warsaw
c0dc92af7d Three new C API functions:
- int PyErr_GivenExceptionMatches(obj1, obj2)

  Returns 1 if obj1 and obj2 are the same object, or if obj1 is an
  instance of type obj2, or of a class derived from obj2

- int PyErr_ExceptionMatches(obj)

  Higher level wrapper around PyErr_GivenExceptionMatches() which uses
  PyErr_Occurred() as obj1.  This will be the more commonly called
  function.

- void PyErr_NormalizeException(typeptr, valptr, tbptr)

  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.
1997-08-22 21:22:58 +00:00
Barry Warsaw
cde8b1ba0c 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.
1997-08-22 21:14:38 +00:00
Guido van Rossum
21c5c8fa5b Correct off-by-two-pixels error. 1997-08-22 20:56:07 +00:00
Guido van Rossum
d14c06819e 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.
1997-08-22 20:53:47 +00:00
Guido van Rossum
1171ee6aaf Added configuration tests for presence of alarm(), pause(), and getpwent() 1997-08-22 20:42:00 +00:00
Fred Drake
5de31fc094 Oops, don't suppress echo of the rm command in l2hclean! 1997-08-22 18:20:33 +00:00
Fred Drake
03ff6f7474 Simplify LaTeX2HTML targets && support re-use of output directories (which
saves re-generation of images).

Add l2hclean target.
1997-08-22 18:18:54 +00:00
Guido van Rossum
cd649654d7 Reverse the search order for the Don Beaudry hook so that the first
class wins.  Makes more sense.
1997-08-22 16:56:16 +00:00
Fred Drake
289f97d0ea 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.)
1997-08-22 13:51:31 +00:00
Fred Drake
2999607e59 Added missing "\end{funcdesc}" after FindFolder documentation. 1997-08-22 13:45:13 +00:00
Guido van Rossum
e3c0d5eb34 Added new Py_IsInitalized() API function to test the 'initialized' flag. 1997-08-22 04:20:13 +00:00
Barry Warsaw
779133c707 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.
1997-08-21 22:36:26 +00:00
Guido van Rossum
d7a7100c99 Remove redundant decl for PyOS_InputHook. 1997-08-21 17:26:04 +00:00
Guido van Rossum
ab589b945e Completely disable the declarations for malloc() and friends. Use
#ifdef though, so if you still need these for a really backwards
compiler you know what to do.
1997-08-21 16:13:37 +00:00
Guido van Rossum
0078aaf950 Add warning about dumb SGI make. 1997-08-21 03:05:11 +00:00
Guido van Rossum
36f8e2d1db Use lseek instead of ftell; compensate by adding BUFSIZE 1997-08-21 02:31:25 +00:00
Guido van Rossum
c6ef204830 Added /**/ around #end tags 1997-08-21 02:30:45 +00:00
Guido van Rossum
bae6523a75 Must remove conflicting files from archive
*before* adding signalmodule.o, because some ar programs
are too smart for us...
1997-08-21 02:30:20 +00:00
Guido van Rossum
08157f8db6 mention cPickle and cStringIO 1997-08-21 02:29:19 +00:00
Guido van Rossum
24b1e75c1f the usual 1997-08-21 02:29:16 +00:00
Guido van Rossum
b904629f75 Fix some badly botched prototypes for PyRun* c.s. 1997-08-21 02:28:57 +00:00
Guido van Rossum
8b523f9bd8 Added reop 1997-08-21 02:28:40 +00:00
Guido van Rossum
5f896a4de0 Added missing newline to warning msg 1997-08-21 02:28:19 +00:00
Guido van Rossum
8456161fcd Richard Jones: I think we can be confident in using 'CC="-Aa
-D_HPUX_SOURCE"' on HP 9.x and 10.x platforms.
1997-08-21 00:08:11 +00:00
Guido van Rossum
1bf0bf40b4 Got rid of HP-UX comments (which seem to be out of date -- one should
use -Ae).

Added Cray T3E comments.
1997-08-20 23:50:51 +00:00
Guido van Rossum
6b9fdf529a Globally renamed join() to joinpath() to avoid compilation error on Cray. 1997-08-20 23:48:16 +00:00
Guido van Rossum
725d941f0f Renamed strndup to pystrndup, to avoid conflicting prototype
in GNU libc on some platforms.
1997-08-20 23:38:57 +00:00
Guido van Rossum
b6784dc53f Interpret three slashes in file: URL as local file (for Netscape on
Windows/Mac).
1997-08-20 23:34:01 +00:00
Guido van Rossum
4f46fc6d57 When we have signalmodule.o, remove intrcheck.o as well as sigcheck.o. 1997-08-20 22:45:52 +00:00
Guido van Rossum
aa61505fd2 Use a counter instead of a Boolean to check for initialized; n calls
to Py_Initialize will be undone by n calls to Py_Uninitialize.
1997-08-20 22:40:18 +00:00
Guido van Rossum
558be283bf Make sure the objects returned by __getinitargs__() are kept alive (in
the memo) to avoid a certain kind of nasty crash.  (Not easily
reproducable because it requires a later call to __getinitargs__() to
return a tuple that happens to be allocated at the same address.)
1997-08-20 22:26:19 +00:00
Guido van Rossum
86c052e83a Use 'buildno1' instead of '@buildno' for temp file since DJGPP's bash
doesn't seem to grok @buildno.
1997-08-20 22:13:15 +00:00
Guido van Rossum
5aadaf5a8e Need to define AR since it is used, and not all Makes define it by default. 1997-08-19 14:40:11 +00:00
Jack Jansen
d0417ecce5 Removed support_print docs. 1997-08-19 14:01:35 +00:00
Jack Jansen
3261719848 Docs on new tcl/tk, new build tree layout 1997-08-19 14:01:16 +00:00
Jack Jansen
f10786baca Very sketchy preliminary docs on new applescripting functionality. 1997-08-19 14:00:56 +00:00
Jack Jansen
97de10cacf Added reop 1997-08-19 13:59:59 +00:00
Jack Jansen
78c3cc4f0c MkPluginAliases now knows about fat PythonCore (and all resource files
got binhexed again)
1997-08-19 13:58:57 +00:00
Jack Jansen
03a00a8081 PythonCore is now a fat shared library, the plugin modules aren't fat,
unfortunately, this turned out to be too difficult.

Plugins.prj now builds all plugin modules, and all the
interdependencies between the projects are correct. One exception:
plugins don't attempt to build PythonCore (PythonFAT and PythonApplet do).
1997-08-19 13:58:00 +00:00
Guido van Rossum
ef3138f9ad Moved assert.h to ../Parser directory 1997-08-19 12:07:22 +00:00
Guido van Rossum
5b02078e31 Alas, the thread support for Tk didn't work. Withdraw it, until I
figure out how to do this right.
1997-08-19 01:00:50 +00:00