Commit Graph

1128 Commits

Author SHA1 Message Date
Guido van Rossum 2adac0a637 Tim Peters discovered a bug in the Python-supplied getopt():
it doesn't recognize a lone dash as a non-flag argument.
Now it does.
1999-09-13 13:45:32 +00:00
Barry Warsaw f6202635f9 call_trace(): A fix for PR#73, if an exception occurred in the
tracefunc (or profilefunc -- we're not sure which), zap the global
trace and profile funcs so that we can't get into recursive loop when
instantiating the resulting class based exception.
1999-09-08 16:26:33 +00:00
Guido van Rossum 933c91ebcf Vladimir Marangozov fixes an AIX-specific problem, writing:
"""
Following up Robin Dunn's troubles with freeze, here's a patch that
fixes an oddity regarding the import logic of shared modules on AIX.

Symbol resolution of shared modules is now handled properly for the cases
when the python library is linked to a binary with an arbitrary name.
This includes the standard python[version] executable, but also applications
that are embedding the python core (i.e. linked with libpython[version].a,
the latter being static or shared).
"""
1999-08-04 18:00:12 +00:00
Fred Drake 3d587442f9 Fixed order of parameters in slice() docstring. The Library Reference
had it right!  Reported by Tim Hochberg <tim.hochberg@ieee.org>.
1999-07-19 15:21:16 +00:00
Guido van Rossum 7c85ab829d Marc-Andre Lemburg discovered that the switch from .pyc to .pyo files,
done by _PyImport_Init(), comes to late to affect the import of
exceptions.py by _PyBuiltin_Init_2().  Move  _PyImport_Init() up few lines.
1999-07-08 17:26:56 +00:00
Guido van Rossum 8746082175 Patch by Tim Peters:
Introduce a new builtin exception, UnboundLocalError, raised when ceval.c
tries to retrieve or delete a local name that isn't bound to a value.
Currently raises NameError, which makes this behavior a FAQ since the same
error is raised for "missing" global names too:  when the user has a global
of the same name as the unbound local, NameError makes no sense to them.
Even in the absence of shadowing, knowing whether a bogus name is local or
global is a real aid to quick understanding.

Example:

D:\src\PCbuild>type local.py
x = 42

def f():
    print x
    x = 13
    return x

f()

D:\src\PCbuild>python local.py
Traceback (innermost last):
  File "local.py", line 8, in ?
    f()
  File "local.py", line 4, in f
    print x
UnboundLocalError: x

D:\src\PCbuild>

Note that UnboundLocalError is a subclass of NameError, for compatibility
with existing class-exception code that may be trying to catch this as a
NameError.  Unfortunately, I see no way to make this wholly compatible
with -X (see comments in bltinmodule.c):  under -X, [UnboundLocalError
is an alias for NameError --GvR].

[The ceval.c patch differs slightly from the second version that Tim
submitted; I decided not to raise UnboundLocalError for DELETE_NAME,
only for DELETE_LOCAL.  DELETE_NAME is only generated at the module
level, and since at that level a NameError is raised for referencing
an undefined name, it should also be raised for deleting one.]
1999-06-22 14:47:32 +00:00
Guido van Rossum 1d5ad90c1c CRITICAL PATCH!
We occasionally received reports from people getting "invalid tstate"
crashes (this is a fatal error in PyThreadState_Delete()).  Finally
several people were able to reproduce it reliably and Tim Peters
discovered that there is a race condition when multiple threads are
calling this function without holding the global interpreter lock (the
function may be called without holding that).

Solved the race condition by adding a lock around the mutating uses of
interp->tstate_head.  Tim and Jonathan Giddy have run tests that make
it likely that this fixes the crashes -- although Tim hasn't heard
from the person who reported the original problem.
1999-06-18 14:22:24 +00:00
Guido van Rossum 7f85186921 # Darn! Local variable l declared but not used in abstract_issubclass(). 1999-06-17 19:12:39 +00:00
Guido van Rossum 668213d3b8 Patch by Jim Fulton (code style tweaked a bit) to support
ExtensionClasses in isinstance() and issubclass().

  - abstract instance and class protocols are used *only* in those
    cases that would generate errors before the patch.  That is, there's
    no penalty for the normal case.

  - instance protocol: an object smells like an instance if it
    has a __class__ attribute that smells like a class.

  - class protocol: an object smells like a class if it has a
    __bases__ attribute that is a tuple with elements that
    smell like classes (although not all elements may actually get
    sniffed ;).
1999-06-16 17:28:37 +00:00
Guido van Rossum eda232fdac Allow longer strings (up to 80 chars each) for version, build,
compiler info.
1999-04-22 12:03:40 +00:00
Guido van Rossum 743007d2fe Patch by Christian Tismer for Win32, to use FormatMessage() instead of
strerror().  This improves the quality of the error messages.
1999-04-21 15:27:31 +00:00
Guido van Rossum 495894ee66 While I can't really test this thoroughly, Pat Knight and the Solaris
man pages suggest that the proper thing to do is to add THR_NEW_LWP to
the flags on thr_create(), and that there really isn't a downside, so
I'll do that.
1999-04-13 14:32:12 +00:00
Guido van Rossum b738d26e2d Win/CE thread support by Mark Hammond. 1999-04-08 13:57:06 +00:00
Guido van Rossum b6987b13fe Alas, get rid of the Win specific hack to ask the user to press Return
before exiting when an error happened.  This didn't work right when
Python is invoked from a daemon.
1999-04-07 18:32:51 +00:00
Guido van Rossum 2571cc8bf5 Changes by Mark Hammond for Windows CE. Mostly of the form
#ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
1999-04-07 16:07:23 +00:00
Guido van Rossum 99fb7c70f4 Remove unused variable from complex_from_string() code. 1999-04-07 16:05:47 +00:00
Guido van Rossum 1195023b89 Patch by Nick and Stephanie Lockwood to implement complex() with a string
argument.  This closes TODO item 2.19.
1999-03-25 21:16:07 +00:00
Guido van Rossum 0daf022225 New builtin buffer() creates a derived read-only buffer from any
object that supports the buffer interface (e.g. strings, arrays).
1999-03-19 19:07:19 +00:00
Guido van Rossum 701f25ef9d Rob Riggs wrote:
"""
Spec says that on success pthread_create returns 0. It does not say
that an error code will be < 0. Linux glibc2 pthread_create() returns
ENOMEM (12) when one exceed process limits. (It looks like it should
return EAGAIN, but that's another story.)

For reference, see:
http://www.opengroup.org/onlinepubs/7908799/xsh/pthread_create.html
"""

[I have a feeling that similar bugs were fixed before; perhaps someone
could check that all error checks no check for != 0?]
1999-03-15 20:27:53 +00:00
Guido van Rossum eb894ebd0a Always test for an error return (usually NULL or -1) without setting
an exception.
1999-03-09 16:16:45 +00:00
Barry Warsaw 72b715d979 (initerrors): Make sure that the exception tuples ("base-classes" when
string-based exceptions are used) reflect the real class hierarchy,
i.e. that SystemExit derives from Exception not StandardError.
1999-02-24 00:35:43 +00:00
Guido van Rossum 124eff0225 Patch by Tim Peters to improve the range checks for range() and
xrange(), especially for platforms where int and long are different
sizes (so sys.maxint isn't actually the theoretical limit for the
length of a list, but the largest C int is -- sys.maxint is the
largest Python int, which is actually a C long).
1999-02-23 16:11:01 +00:00
Guido van Rossum 66368ccc55 Patch by Tommy Burnette to accept an arbitrary sequence when "(...)"
is used in the format string, instead of requiring a tuple.  This is
in line with the general trend towards accepting arbitrary sequences.
1999-02-17 23:16:43 +00:00
Barry Warsaw 3d05b1a0ae initmain(): Nailed a memory leak. bimod must be DECREF'd! 1999-01-29 21:30:22 +00:00
Barry Warsaw 7890203f49 bltin_exc[]: EnvironmentError is not a "leaf exception", so set it's
leaf_exc flag to zero otherwise the name leaks memory.
1999-01-29 20:29:49 +00:00
Barry Warsaw fa77e09dd0 builtin_map(): A better fix for the previous leak plug (remember
PyList_Append steals a reference even if it fails).

builtin_filter(): Had the same leak problem as builtin_map().
1999-01-28 18:49:12 +00:00
Guido van Rossum 541563ec7e Implement -OO; "unsafe" optimization that removes docstrings.
Marc-Andre Lemburg.
1999-01-28 15:08:09 +00:00
Barry Warsaw 2133287c3e builtin_map(): Nailed memory leak. PyList_Append() borrows a
reference, so you have to DECREF the appended value.  This was a fun
one!
1999-01-28 04:21:35 +00:00
Barry Warsaw f988e687a1 builtin_complex(): Nailed memory leak. This one's in the instance
test for classes with a __complex__() method.  The attribute is pulled
out of the instance with PyObject_GetAttr() but this transfers
ownership and the function object was never DECREF'd.
1999-01-27 23:13:59 +00:00
Barry Warsaw 3879333b9e PyImport_ReloadModule(): Nailed a small memory leak. In the
else-clause of the subname test, the parentname object was never
DECREF'd.
1999-01-27 17:54:20 +00:00
Guido van Rossum 54ecc3d24f Patches by William Lewis for Nextstep descendants. 1999-01-27 17:53:11 +00:00
Barry Warsaw c80baa3365 err_input(): Nailed a small memory leak. If the error is E_INTR, the
v temporary variable was never decref'd.  Test this by starting up the
interpreter, hitting C-c, then immediately exiting.

Same potential leak can occur if error is E_NOMEM, since the return is
done in the case block.  Added Py_XDECREF(v); to both blocks, just
before the return.
1999-01-27 16:39:40 +00:00
Barry Warsaw 54892c4b2c _PySys_Init(): Nailed small memory leak. The stringobject created for
sys.version was missing a Py_XDECREF().
1999-01-27 16:33:19 +00:00
Guido van Rossum 3dbba6ec3a Change rare occurrences of #if HAVE_LONG_LONG to #ifdef. 1999-01-25 21:48:56 +00:00
Guido van Rossum a71b5f4e1d Jim Ahlstrom patch: the module doc string is too long for 16-bit VC
1.5.  Omit the second part.
1999-01-14 19:07:00 +00:00
Guido van Rossum e23cde2f8d Avoid overflow if possible in calculations for range(); report
unavoidable overflow as OverflowError.
1999-01-12 05:07:47 +00:00
Guido van Rossum 2c1f6be38e Hack for Windows so that if (1) the exit status is nonzero and (2) we
think we have our own DOS box (i.e. we're not started from a command
line shell), we print a message and wait for the user to hit a key
before the DOS box is closed.

The hacky heuristic for determining whether we have our *own* DOS box
(due to Mark Hammond) is to test whether we're on line zero...
1999-01-08 15:56:28 +00:00
Guido van Rossum df69365f5f Ty Sarna writes:
The following patches (relative to 1.5.2b1) enable Python dynamic
loading to work on NetBSD platforms that use ELF (presnetly mips and
alpha systems).  They automaticly determine wether the system is ELF or
a.out rather than using astatic list of platforms so that when other
NetBSD platforms move to ELF, python will continue to work without
change.
1999-01-07 21:50:41 +00:00
Guido van Rossum cad3d47f1e Chris Herborth writes:
Donn Cave tells me the PyImport_BeImageID() function isn't needed anymore.
1999-01-04 16:45:59 +00:00
Guido van Rossum e0d7dae3b8 Add sys.hexversion, which is an integer encoding the version in hexadecimal.
In other words, hex(sys.hexversion) == 0x010502b2 for Python 1.5.2b2.
This is derived from the new variable PY_VERSION_HEX defined in patchlevel.h.
(Cute, eh?)
1999-01-03 12:55:39 +00:00
Guido van Rossum 6e0a3499ab Use PY_VERSION instead of PATCHLEVEL. 1999-01-03 12:41:50 +00:00
Guido van Rossum 47ae028071 Call PyInitFrozenExtensions() as requested by Mark Hammond (his patch). 1999-01-02 21:42:48 +00:00
Guido van Rossum c38e7d4c4b Oops, forgot a pair of {}'s. (Greg Couch) 1998-12-23 19:53:45 +00:00
Guido van Rossum d341500d8f Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.
Patch and suggestion by Greg Couch.
1998-12-23 05:01:38 +00:00
Guido van Rossum 6058eb49ee Improve comment for PyImport_Import() as suggested by Bill Tutt. 1998-12-21 19:51:00 +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 885553e8d3 Use PyThreadState_GET() macro. 1998-12-21 18:33:30 +00:00
Guido van Rossum 18bc7c2276 Make current_tstate a global, _PyThreadState_Current. This is to
support a macro in pystate.h.
1998-12-21 18:27:28 +00:00
Guido van Rossum 1924a0677d Chris H. writes:
If we're going to put the PyOS_strtol() proto in intobject.h we should
include it here or the symbol isn't exported on PowerPC.
1998-12-18 22:02:37 +00:00
Guido van Rossum 0e1d0e95ea Patch by Chris Herborth:
have to use a const-correct prototype on BeOS or the compiler gets uppity.
1998-12-17 18:03:10 +00:00
Guido van Rossum 2edcf0d71c Move the prototype for dump_counts() to before where it is used.
(This only applies when COUNT_ALLOCS is defined.)
1998-12-15 16:12:00 +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 ca90605678 Add more SET_LINENO instructions in long argument lists 1998-12-10 16:56:22 +00:00
Guido van Rossum 926f7b6615 Adding thread support for BeOS by Chris Herborth. 1998-12-07 21:56:59 +00:00
Guido van Rossum cf183acf15 Use PyInt_AS_LONG macro instead of explicit inlining. 1998-12-04 18:51:36 +00:00
Guido van Rossum f261526423 Need to add default decl of DL_IMPORT, for mymalloc.h 1998-12-04 18:50:20 +00:00
Barry Warsaw 344864fcfb Added new builtin standard exception: NotImplementedError (its C
counterpart is PyExc_NotImplementedError).
1998-12-01 18:52:06 +00:00
Guido van Rossum df12a59305 Fix cosmetic bug in delattr docstring discovered by JvR. 1998-11-23 22:13:04 +00:00
Guido van Rossum 014518f66c Whoops! One the "redundant" initializations removed by Vladimir in
the previous patch wasn't -- there was a path through the code that
bypassed all initializations.  Thanks to Just for reporting the bug!
1998-11-23 21:09:51 +00:00
Guido van Rossum 50cd34888b Remove some redundant initializations -- patch by Vladimir Marangozov. 1998-11-17 17:02:51 +00:00
Guido van Rossum 66468568df Jim Fulton writes:
"""
I had originally not realized that PyEval_GetGlobals did not
INCREF it's return value.  The fix is to add the INCREF,
as shown below.
"""
1998-10-22 15:46:50 +00:00
Guido van Rossum e0e59829e0 When errno is zero, avoid calling strerror() and use "Error" for the
message.
1998-10-14 20:38:13 +00:00
Guido van Rossum 2f3667a7b9 Replace fprintf(stderr, ...) with PySys_WriteStderr(...). 1998-10-12 18:23:55 +00:00
Guido van Rossum 8442af35fe Patches for mywrite() by Marc Lemburg: save/restore the error state
reliably; check return value of vsprintf().
1998-10-12 18:22:10 +00:00
Guido van Rossum b317f8aa0d Implement new format character 't#'. This is like s#, accepting an
object that implements the buffer interface, but requires a buffer
that contains 8-bit character data.  Greg Stein.
1998-10-08 02:21:21 +00:00
Guido van Rossum 5bd893b1ea The previous checkin contained an experiment of Greg Stein's that wasn't
meant for checkin, and which broke marshal.loads().
1998-10-08 01:45:47 +00:00
Guido van Rossum 0f8b30f8ce On Win32, use
LoadLibraryEx(pathname, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)
to search dependent DLLs in the directory of the pathname.
1998-10-08 01:44:41 +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 9e46e56264 BSDI specific patches, inspired by Nigel Head and otto@mail.olympus.net.
Also (non-BSDI specific):

- Change the CHECK_STATUS() macro so it tests for nonzero error codes
instead of negative error codes only (this was needed for BSDI, but
appears to be correct according to the PTHREADS spec).

- use memset() to zero out the allocated lock structure.  Again, this
was needed for BSDI, but can't hurt elsewhere either.
1998-10-07 16:39:47 +00:00
Guido van Rossum 562f5b1480 Support PYTHONOPTIMIZE variable; by Marc Lemburg. 1998-10-07 14:50:42 +00:00
Guido van Rossum dfede31c7f Eh, better error message for the previous change. It now says
"non-default argument follows default argument".
1998-10-02 14:06:56 +00:00
Guido van Rossum 29d38cd088 Treat def f(a, b=1, c): ... as an error (missing default for c)
instead of silently supplying a default of None fore c.
1998-10-02 13:41:54 +00:00
Guido van Rossum e364b7d46a Renamed thread.h to pythread.h.
(Also removed whitespace after # in some BEOS related cpp directives.)
1998-10-01 20:43:23 +00:00
Guido van Rossum 49b560698b Renamed thread.h to pythread.h. 1998-10-01 20:42:43 +00:00
Guido van Rossum 2dcfc9618d On second though, NEXITFUNCS should be defined here and not in
pystate.h; pystate.h doesn't use it (I thought I wanted to move the
array there but that won't work).
1998-10-01 16:01:57 +00:00
Barry Warsaw 968f8cbace builtin_apply(): Second argument type check is relaxed to allow any sequence. 1998-10-01 15:33:12 +00:00
Guido van Rossum 566373e974 While scalling sys.modules, skip entries that don't have string keys,
to protect us from jokers who put items with non-string keys in
sys.modules.  Reported by Greg Stein.
1998-10-01 15:24:50 +00:00
Guido van Rossum 65f15d435e In FreeBSD when using ELF, an underscore is needed in front of the
function name.  (Vladimir Kushnir by way of Thomas Gellekum.)
1998-09-30 14:34:52 +00:00
Guido van Rossum 93d27547d0 Remove redundant definition of NEXITFUNCS.
(Reported by Jeff Rush.)
1998-09-28 22:15:37 +00:00
Barry Warsaw 98b6246c0c Several changes that Python carry on in the face of errors in the
initialization of class exceptions.  Specifically:

init_class_exc(): This function now returns an integer status of the
class exception initialization.  No fatal errors in this method now.
Also, use PySys_WriteStderr() when writing error messages.  When an
error occurs in this function, 0 is returned, but the partial creation
of the exception classes is not undone (this happens elsewhere).

Things that could trigger the fallback:

    - exceptions.py fails to be imported (due to syntax error, etc.)

    - one of the exception classes is missing (e.g. due to library
      version mismatch)

    - exception class can't be inserted into __builtin__'s dictionary

    - MemoryError instance can't be pre-allocated

    - some other PyErr_Occurred

newstdexception(): Changed the error message.  This is still a fatal
error because if the string based exceptions can't be created, we
really can't continue.

initerrors(): Be sure to xdecref the .exc field, which might be
non-NULL if class exceptions init was aborted.

_PyBuiltin_Init_2(): If class exception init fails, print a warning
message and reinstate the string based exceptions.
1998-09-14 18:51:11 +00:00
Guido van Rossum a0f0a33d05 Mac-specific mod to enable aliases on import paths.
(Jack Jansen and/or Just van Rossum)
1998-09-14 13:40:53 +00:00
Guido van Rossum d21744a1dd Apparently on AIX when using gcc you need to call pthread_init()
(which is not a POSIX threads call!).  Reported and confirmed by Brad
Howes.
1998-09-10 03:04:40 +00:00
Guido van Rossum a74d0e4c55 Correct typo in #ifdef: PY_THREAD_D4, should be PY_PTHREAD_D4.
Reported by Jonathan Giddy.
1998-09-04 13:38:32 +00:00
Guido van Rossum 746340d989 Should no longer surround PyOS_Readline() call with
Py_{BEGIN,END}_ALLOW_THREADS macros.  Also get rid of the declaration
for it (it's now in pythonrun.h).
1998-09-03 22:25:05 +00:00
Guido van Rossum 44ee479427 Add a 'volatile' to the declaration of threadid in get_thread_ident().
According to Vladimir Marangozov, this is necessary for AIX, where
high optimization levels inline this function and then get it wrong :-(
1998-08-27 19:21:53 +00:00
Guido van Rossum 53195c1a83 Don't release the interpreter lock around PyParser_ParseFile().
It is needed so that tokenizer.c can use PySys_WriteStderr().
1998-08-27 19:14:49 +00:00
Guido van Rossum afd3daedde __file__ used to be always set to the .pyc (or .pyo) file, even if
that file in fact did not exist or at least was not used.  Change this
so that __file__ is *only* set to the .pyc/.pyo file when it actually
read the code object from it; otherwise __file__ is set to the .py
file.
1998-08-25 18:44:34 +00:00
Guido van Rossum 90f827c67e Comment out the print statement about underflow. (This only seems to
happen when you use a non-keyword argument after a keyword argument,
and in this case you also get a syntax error.  I fully suspect that
the underflow is caused by the code that stops generating code when it
detects the syntax error, but I can't find the culprit right now.  I
know, I know.)
1998-08-25 18:22:17 +00:00
Guido van Rossum 2d1ad39b81 Add the type of the object to the error message about calling a non-function. 1998-08-25 18:16:54 +00:00
Guido van Rossum d0dc5b06a2 Restructure the file so that it is never empty. No longer needs
Metrowerks specific #ifdef.
1998-08-25 17:48:25 +00:00
Guido van Rossum 3293b07df5 Patch by Mark Hammond to support 64-bit ints on MS platforms.
The MS compiler doesn't call it 'long long', it uses __int64,
so a new #define, LONG_LONG, has been added and all occurrences
of 'long long' are replaced with it.
1998-08-25 16:07:15 +00:00
Guido van Rossum ab076fdb6f Ted Horst writes in psa-members@python.org:
This is a patch that Bill Bummgarner did for 1.4 that hasn't made its
way into the distribution yet.  This is important if you want to use
the ObjC module.
1998-08-24 14:15:44 +00:00
Guido van Rossum 0ba353608f Add DebugBreak() call to Py_FatalError() for Mark Hammond (only on
Win32 in Debug mode).
1998-08-13 13:33:16 +00:00
Guido van Rossum 0506a431d5 Patch by Just van Rossum that changes how we search for submodules of
frozen packages.  (I *think* this means that we can now have a
built-in module bar that's a submodule of a frozen package foo, by
registering the built-in module with a name "foo.bar" in the table of
builtin modules.)
1998-08-11 15:07:39 +00:00
Guido van Rossum c4099e6b3c # Fix strange type (methonname instead of methodname). 1998-08-08 20:51:26 +00:00
Guido van Rossum 9c241ba014 Added declarations for Mac code resource modules (Jack Jansen). 1998-08-06 13:36:43 +00:00
Guido van Rossum 0f84a349bb Added handling for Mac code resource modules (Jack Jansen). 1998-08-06 13:36:01 +00:00
Guido van Rossum 40552d0857 Gack. The module doc string is too long for VC++ 5.0.
However two string literals concatenated are fine!
Hope this doesn't break other platforms.
1998-08-06 03:34:39 +00:00
Fred Drake d807879b31 Make getversion.o dependent on ../Include/patchlevel.h as well. 1998-08-05 21:33:54 +00:00
Guido van Rossum 1a8791e0b8 Changes for BeOS, QNX and long long, by Chris Herborth. 1998-08-04 22:46:29 +00:00
Guido van Rossum 5053efc2c4 In BUILD_LIST, use PyList_SET_ITEM() instead of PyList_SetItem(); and
get rid of redundant error check.
1998-08-04 15:27:50 +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 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
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 fa00e958fd # In case BINARY_SUBSCR, use proper PyList_GET* macros instead of inlining. 1998-07-08 15:02:37 +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 bb71ab68f9 Reindented some OS/2 and hpux code that looked ugly or at least
inconsistent.
1998-07-08 13:47:12 +00:00
Guido van Rossum 233f4b54d3 Two error messages still used the old name of the functio mkvalue() --
which is now Py_BuildValue().
1998-07-07 22:32:19 +00:00
Guido van Rossum e32d1537f0 Sigh. The hack to enable special treatment for errno on SGI machines
must be enabled here, otherwise the errno we set on overflows is not
the errno that's being read by compile.c.  Wonder how many other files
that do their own "#include config.h" need this too :-(

(Because of the structure of autoconf, it's not so simple to get this
into config.h...)
1998-07-07 21:32:53 +00:00
Guido van Rossum b68cd421e1 Fix two smal memory leaks discovered by Vadim Chugunov. 1998-07-01 17:36:26 +00:00
Guido van Rossum 8ea9f4d10a Fix a stupid little bug: len() of an unsized returns -1 and leaves an
exception waiting to happen next...
1998-06-29 22:26:50 +00:00
Guido van Rossum 950ff2923a Experimental feature: add default argument to getattr(). 1998-06-29 13:38:57 +00:00
Guido van Rossum a5e1b008a9 Windows-specific hack to make sure that when LoadLibrary() is called,
the filename contains at least a rudimentary pathname.
(The bad part is that we need to call getcwd() because only a prefix
of ".\\" is not enough -- we prefix the drive letter.)
1998-06-27 21:53:17 +00:00
Guido van Rossum c3bc31e249 Added doc strings. Maybe the doc string for the module itself is a bit
long, but it sure helps!
1998-06-27 19:43:25 +00:00
Guido van Rossum f9d9c6c5d2 Added doc strings. 1998-06-26 21:23:49 +00:00
Guido van Rossum d9b5208e90 In raw_input(prompt), make sure that str(prompt) really a string
object before using it.
1998-06-26 18:25:38 +00:00
Guido van Rossum 323bf5e1f7 Ignore Windows case check for ALL CAPS 8.3 files 1998-06-24 03:54:06 +00:00
Guido van Rossum a45cb45965 When unmarshalling, add test for negative lengths on strings, tuples
and lists; if the size is negative, raise an exception.  Also raise an
exception when an undefined type is found -- all this to increase the
chance that garbage input causes an exception instead of a core dump.
1998-06-08 20:27:29 +00:00
Guido van Rossum 9396673a58 Remove a few unused locals (I love VC++ for this!). 1998-05-29 02:59:00 +00:00
Guido van Rossum 7e33c6e896 Moved cmp_member() to abstract.c, as PySequence_Contains() [with
swapped arguments].

Also 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:52:29 +00:00
Guido van Rossum 09df08a105 A bunch of functions are now properly implemented in abstract.c, and
the code here becomes much simpler.  In particular: abs(), divmod(),
pow(), int(), long(), float(), len(), tuple(), list().

Also 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.

A few other cosmetic things, such as properly reindenting slice().
1998-05-22 00:51:39 +00:00
Guido van Rossum adf0e437cb Trivial little change: when setting a member to an object, hold the
old value in a temporary and XDECREF it only after then new value has
been set.  This prevents the (unlikely) case where the destructor of
the member uses the containing object -- it would find it in an
undefined state.
1998-05-20 22:25:32 +00:00
Guido van Rossum 9c0afe5dc7 Fix a curious bug: statements like "import sys.time" would succeed,
because the path through the code would notice that sys.__path__ did
not exist and it would fall back to the default path (builtins +
sys.path) instead of failing).  No longer.
1998-05-19 15:09:05 +00:00
Guido van Rossum 6b077878a5 Remove use of RTLD_GLOBAL. 1998-05-18 13:42:45 +00:00
Guido van Rossum fccfe89753 Another veeeeeery old patch...
Date:    Thu, 14 Sep 1995 12:18:20 -0400
From:    Alan Morse <alan@dvcorp.com>
To:      python-list@cwi.nl
Subject: getargs bug in 1.2 and 1.3 BETA

We have found a bug in the part of the getargs code that we added
and submitted, and which was incorporated into 1.1.

The parsing of "O?" format specifiers is not handled correctly;
there is no "else" for the "if" and therefore it can never fail.
What's worse, the advancing of the varargs pointer is not
handled properly, so from then on it is out of sync, wreaking
all sorts of havoc. (If it had failed properly, then the out-of-sync
varargs would not have been an issue.)

Below is the context diff for the change.

Note that I have made a few stylistic changes beyond adding the
else case, namely:

1) Making the "O" case follow the convention established by the other
format specifiers of getting all their vararg arguments before
performing the test, rather than getting some before and some after
the test passes.

2) Making the logic of the tests parallel, so the "if" part indicates
that the format is accepted and the "else" part indicates that the
format has failed. They were inconsistent with each other and with the
the other format specifiers.

-Alan Morse (amorse@dvcorp.com)
1998-05-15 22:04:07 +00:00
Guido van Rossum 859b16c847 In debug mode on MS Windows, DLLs are called foo_d.pyd or foo_d.dll. 1998-05-15 20:22:08 +00:00
Guido van Rossum 532246ef55 Improved version of patch for HPUX from David Arnold. 1998-05-14 21:01:27 +00:00
Guido van Rossum 09cae1f8cd New APIs for embedding applications that want to add their own entries
to the table of built-in modules.  This should normally be called
*before* Py_Initialize().  When the malloc() or realloc() call fails,
-1 is returned and the existing table is unchanged.

After a similar function by Just van Rossum.

int PyImport_ExtendInittab(struct _inittab *newtab);
int PyImport_AppendInittab(char *name, void (*initfunc)());
1998-05-14 02:32:54 +00:00
Guido van Rossum ba7cc0cfba Remove unnecessary PyErr_Clear(). 1998-05-14 02:31:26 +00:00
Guido van Rossum 234e260d5e Since PyDict_GetItem() can't raise an exception any more, there's no
need to call PyErr_Clear() when it returns NULL.
1998-05-14 02:16:20 +00:00
Guido van Rossum 2e4c899e2d DELETE_FAST should issue an exception when the local variable is undefined. 1998-05-12 20:27:36 +00:00
Guido van Rossum a890e68807 New APIs to write to sys.stdout or sys.stderr using a printf-like interface.
Adapted from code submitted by Just van Rossum.

   PySys_WriteStdout(format, ...)
   PySys_WriteStderr(format, ...)

      The first function writes to sys.stdout; the second to sys.stderr.  When
      there is a problem, they write to the real (C level) stdout or stderr;
      no exceptions are raised (but a pending exception may be cleared when a
      new exception is caught).

      Both take a printf-style format string as their first argument followed
      by a variable length argument list determined by the format string.

      *** WARNING ***

      The format should limit the total size of the formatted output string to
      1000 bytes.  In particular, this means that no unrestricted "%s" formats
      should occur; these should be limited using "%.<N>s where <N> is a
      decimal number calculated so that <N> plus the maximum size of other
      formatted text does not exceed 1000 bytes.  Also watch out for "%f",
      which can print hundreds of digits for very large numbers.
1998-05-12 14:59:24 +00:00
Guido van Rossum 1e162d3753 Implement round() slightly different, so that for negative ndigits no
additional errors happen in the last step.  The trick is to avoid
division by 0.1**n -- multiply by 10.0**n instead.
1998-05-09 14:42:25 +00:00
Guido van Rossum 89df70bfbb Support HPUX 10.20 DCE threads. 1998-05-07 13:28:23 +00:00
Guido van Rossum a937d14898 Fred's right -- we need PyList_SET_ITEM(). 1998-04-24 18:22:02 +00:00
Guido van Rossum 507338e5ca In-line the code in range() to set the list items; there's really no
need to call PyList_SetItem(v,i,w) when PyList_GET_ITEM(v,i)=w {sic}
will do.
1998-04-23 21:46:19 +00:00
Guido van Rossum 1f74016735 Support for OpenBSD :-( 1998-04-13 15:27:21 +00:00
Guido van Rossum 111c20b992 Reject empty module names -- otherwise __import__("") does something
weird!
1998-04-11 17:38:22 +00:00
Guido van Rossum cecadc469b Move #include <sys/param.h> to before osdefs.h (Donn Cave). 1998-04-10 23:45:14 +00:00
Guido van Rossum 8766a7797e Comment out a label on an #endif. 1998-04-10 23:44:32 +00:00
Guido van Rossum 730806d3d9 Make new gcc -Wall happy 1998-04-10 22:27:42 +00:00
Guido van Rossum 39b0f8976c Address warnings issued by the MSVC++ compiler 1998-04-10 21:52:06 +00:00
Guido van Rossum ede0439cd8 /* An extension mechanism to store arbitrary additional per-thread state.
PyThreadState_GetDict() returns a dictionary that can be used to hold such
   state; the caller should pick a unique key and store its state there.  If
   PyThreadState_GetDict() returns NULL, an exception has been raised (most
   likely MemoryError) and the caller should pass on the exception. */

PyObject *
PyThreadState_GetDict()
1998-04-10 20:18:25 +00:00
Guido van Rossum 560e8adef7 Translate E_INDENT to the clearest error message I can think of. 1998-04-10 19:43:42 +00:00
Guido van Rossum d295f120ae Make first raise argument optional 1998-04-09 21:39:57 +00:00
Guido van Rossum bf02fb28d9 Make sure that the message "Error in sys.exitfunc:" goes to sys.stderr
and not to C's stderr.
1998-04-03 21:12:12 +00:00
Guido van Rossum 6deac7a105 Make calls into ../PC/frozen_dllmain.c on MS_WIN32. 1998-04-03 21:11:15 +00:00
Guido van Rossum f015e18d9d Add primitive test for frozen package. 1998-04-03 21:10:36 +00:00
Guido van Rossum 8f74571596 Use a faster way to check for null bytes in the string argument for
int(), long(), float().
1998-03-13 21:30:14 +00:00
Guido van Rossum a5568d349b Support for frozen packages, matching the revamped Tools/freeze.
Frozen packages are indicated by a negative size (the code string
is the __import__.py file).  A frozen package module has its __path__
set to a string, the package name.
1998-03-05 03:45:08 +00:00
Guido van Rossum d65911b3f3 Oops -- overuse of dabbrev-expand introduced a strange bug, where
instead of 'locals' I was passing 'lock_import' to import_module_ex().
1998-03-03 22:33:27 +00:00
Guido van Rossum 75acc9ca1c Add a single Python-wide (!) lock on import. Only one thread at a
time can be in PyImport_ImportModuleEx().  Recursive calls from the
same thread are okay.

Potential problems:

- The lock should really be part of the interpreter state rather than
global, but that would require modifying more files, and I first want
to figure out whether this works at all.

- One could argue that the lock should be per module -- however that
would be complicated to implement.  We would have to have a linked
list of locks per module name, *or* invent a new object type to
represent a lock, so we can store the locks in the module or in a
separate dictionary.  Both seem unwarranted.  The one situation where
this can cause problems is when loading a module takes a long time,
e.g. when the module's initialization code interacts with the user --
during that time, no other threads can run.  I say, "too bad."
1998-03-03 22:26:50 +00:00
Guido van Rossum 0829c754bb Fix the handling of errors in Py_FlushLine() in a few places.
(Basically, the error is cleared...  Like almost everywhere else...)
1998-02-28 04:31:39 +00:00
Guido van Rossum 05f9dce34f Moved clear_carefully() to _PyModule_Clear() in moduleobject.c
(modified) and use that.

Some differences in the cleanup algorithm:

- Clear __main__ before the other modules.

- Delete more sys variables: including ps1, ps2, exitfunc, argv, and
even path -- this will prevent new imports!

- Restore stdin, stdout, stderr from __stdin__, __stdout__,
__stderr__, effectively deleting hooks that the user might have
installed -- so their (the hooks') destructors will run.
1998-02-19 20:58:44 +00:00
Guido van Rossum bd36dbaaa5 Make backup copies of stdin, stdout, stderr as __stdin__, __stdout__,
__stderr__.  These will be used by the import cleanup.
1998-02-19 20:53:06 +00:00
Guido van Rossum aeca79b0f6 Small patches to the DJGPP version of check_case(). 1998-02-18 16:21:00 +00:00
Guido van Rossum 4d1b3b921d Added DJGPP version of check_case(), by Pit Scrorpion (Hans Nowak).
(BTW, the Mac version was by Jack Jansen.)
1998-02-13 23:27:59 +00:00
Guido van Rossum 0980bd9233 Add case checking feature on import.
This is an option for OS-es with case-insensitive but case-preserving
filesystems.  It is currently supported for Win32 and MacOS.  To
enable it, #define CHECK_IMPORT_CASE in your platform specific
config.h.  It is enabled by default on those systems where it is
supported.  On Win32, it can be disabled at runtime by setting the
environment variable PYTHONCASEOK (to any value).

When enabled, the feature checks that the case of the requested module
name matches that of the filename found in the filesystem, and raises
a NameError exception when they don't match.
1998-02-13 17:18:36 +00:00
Guido van Rossum e32bf6ead2 Added PyImport_ExecCodeModuleEx(), which adds an extra parameter to
pass it the true file.  This is used to set __file__ properly, instead
of believing what the code object carries with it.  (If the pointer
is NULL, the code object's co_filename is still used.)
1998-02-11 05:53:02 +00:00
Guido van Rossum 919b83d522 Set Py_FrozenFlag, to suppress error messages from getpath.c. 1998-02-06 22:30:29 +00:00
Guido van Rossum a61691e4e9 Ehm, three unrelated changes.
- Add Py_FrozenFlag, intended to suppress error messages fron
getpath.c in frozen binaries.

- Add Py_GetPythonHome() and Py_SetPythonHome(), intended to allow
embedders to force a different PYTHONHOME.

- Add new interface PyErr_PrintEx(flag); same as PyErr_Print() but
flag determines whether sys.last_* are set or not.  PyErr_Print()
now simply calls PyErr_PrintEx(1).
1998-02-06 22:27:24 +00:00
Guido van Rossum a0fec2b5df Two more refinements of the cleanup process.
(1) Explicitly clear __builtin__._ and sys.{last,exc}_* before
clearing anything else.  These are common places where user values
hide and people complain when their destructors fail.  Since the
modules containing them are deleted *last* of all, they would come too
late in the normal destruction order.  Sigh.

(2) Add some debugging aid to cleanup (after a suggestion by Marc
Lemburg) -- print the names of the modules being cleaned, and (when
-vv is used) print the names of the variables being cleared.
1998-02-06 17:16:02 +00:00
Guido van Rossum 42e8e5d164 Protect PyErr_Format format string argument from overflow. 1998-01-19 22:23:08 +00:00
Guido van Rossum 0d6b49eff2 Protect PyErr_Format format string argument from overflow (ironically,
the error was about a bad format string :-).
1998-01-19 22:22:44 +00:00
Guido van Rossum 73bacfc3d7 Add unistd.h for isatty(). 1998-01-19 22:05:22 +00:00
Guido van Rossum 15af20a337 Better #ifdefs for NetBSD, taking into account that at least on netBSD
1.3, dlopen() etc. are fully implemented, including dlerror().
From Jaromir Dolecek and Ty Sarna.
1998-01-19 22:03:52 +00:00
Guido van Rossum 4cc462e85b It seems obvious that when Py_Finalize() decides that there's nothing
to do, it should not call sys.exitfunc either...
1998-01-19 22:00:38 +00:00
Guido van Rossum 758eec0172 Rewritten PyImport_Cleanup() and its helper, clear_carefully(). They
now implement the following finalization strategy.

1. Whenever this code deletes a module, its directory is cleared
   carefully, as follows:
   - set all names to None that begin with exactly one underscore
   - set all names to None that don't begin with two underscores
   - clear the directory

2. Modules are deleted in the following order:
   - modules with a reference count of 1, except __builtin__ or __sys__
   - repeat until no more are found with a reference count of 1
   - __main__ if it's still there
   - all remaining modules except __builtin__ or sys
   - sys
   _ __builtin__
1998-01-19 21:58:26 +00:00
Guido van Rossum 8f18320270 Last-minute fix for Jim H: don't die after del sys.stdout 1997-12-31 05:53:15 +00:00
Guido van Rossum aa06b0ede5 Plug the most annoying recursive printing problem -- reset '_' to None
before printing and set it to the printed variable *after* printing
(and only when printing is successful).
1997-12-26 22:15:57 +00:00
Guido van Rossum 7d4f68c15f Oops -- '(' is also a legal start character of a new format... 1997-12-19 04:25:23 +00:00
Guido van Rossum e8c27bb3ea Oops! Should've renamed dos_8x3 to dos-8x3 here, too. 1997-12-17 18:57:16 +00:00
Guido van Rossum 330aafb0c2 For base 10, cast unsigned long to long before testing overflow.
This prevents 4294967296 from being an acceptable way to spell zero!
1997-12-15 17:27:35 +00:00
Guido van Rossum d6af46d4ae Need a cast when comparing type object in isinstance() 1997-12-10 05:51:47 +00:00
Guido van Rossum 231a41e708 Add explicit check for correct next character in format at end of
format.  This will complain about illegal formats like "O#" instead of
ignoring the '#'.
1997-12-09 20:36:39 +00:00
Guido van Rossum 19b55f2d17 Fix subtle bug in cleanup code in PyErr_NormalizeException(), detected
by Marc Lemburg.  There's a path through the code where *val is NULL,
but value isn't, and value should be DECREF'ed.
1997-12-09 14:11:39 +00:00
Guido van Rossum 1707aad27c Changed the finalization order again so that the reference count
printing (when Py_DEBUG is defined) happens while there's still a
current thread...
1997-12-08 23:43:45 +00:00
Guido van Rossum 595d7ba069 Jeff Rush: add definition for S_IFMT for VisualAge C/C++ under OS2. 1997-12-05 21:45:29 +00:00
Guido van Rossum 08052c7bb6 Add the flag RTLD_GLOBAL to the dlopen() options.
This exports symbols defined by the loaded extension to other
extensions (loaded later).

(I'm not quite sure about this but suppose it can't hurt...)
1997-12-02 20:43:18 +00:00
Guido van Rossum c425d2f87b Make stdin unbuffered too, when PYTHONUNBUFFERED is specified. 1997-12-02 20:41:39 +00:00
Guido van Rossum f5dd914196 Support type objects in isinstance().
E.g. isinstance('',types.StringType) will return true now instead of
raising a TypeError exception.  This is for JPython compatibility.
1997-12-02 19:11:45 +00:00
Guido van Rossum ddc3fb5734 Apply str() to sys.ps1 or sys.ps2 before using them as a prompt, so
you can assign an object whose str() evaluates to the current
directory (or whatever).
1997-11-25 20:58:13 +00:00
Guido van Rossum 8e9ebfd337 os2 patch by Jeff Rush 1997-11-22 21:53:48 +00:00
Guido van Rossum db847bd9ea Plug memory leak in Py_BuildValue when using {...} to construct dictionaries. 1997-11-20 20:35:45 +00:00
Guido van Rossum 2e58ff3ef5 Fix importing of shared libraries from inside packages.
This is a bit of a hack: when the shared library is loaded, the module
name is "package.module", but the module calls Py_InitModule*() with just
"module" for the name.  The shared library loader squirrels away the true
name of the module in _Py_PackageContext, and Py_InitModule*() will
substitute this (if the name actually matches).
1997-11-19 18:53:33 +00:00
Guido van Rossum 858cb73bb2 Two changes (here we go again :-( ).
1) The __builtins__ variable in the __main__ module is set to the
__builtin__ module instead of its __dict__.

2) Get rid of the SIGHUP and SIGTERM handlers.  They can't be made to
work reliably when threads may be in use, they are Unix specific, and
Python programmers can now program this functionality is a safer way
using the signal module.
1997-11-19 16:15:37 +00:00
Guido van Rossum df9db1ea18 Give more detailed error message when the argument count isn't right. 1997-11-19 16:05:40 +00:00
Guido van Rossum dfed725e2c Fix memory leak in exec statement with code object -- the None returned
by PyEval_EvalCode() on success was never DECREF'ed.

Fix by Bernhard Herzog.
1997-11-11 16:29:38 +00:00
Guido van Rossum 4a1f39a26b Undo half of the previous change :-(
Setting interp->builtins to the __builtin__ module instead of to its
dictionary had the unfortunate side effect of always running in
restricted execution mode :-(

I will check in a different way of setting __main__.__builtins__ to
the __builtin__ module later.

Also, there was a typo -- a comment was unfinished, and as a result
some finalizations were not being executed.

In Bart Simpson style,

I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
I Will Not Check In Untested Changes.
1997-11-04 19:36:18 +00:00
Guido van Rossum 25c649fdf2 Get rid of another reference to _PyImport_Inittab (now a static array)
that should be PyImport_Inittab (a new pointer initialized to point to
the array).
1997-11-04 17:04:34 +00:00
Guido van Rossum 22348dc0e1 The warning about thread still having a frame now only happens in
verbose mode.
1997-11-03 22:08:36 +00:00
Guido van Rossum 3a44e1b9fb Two independent changes (alas):
- The interp->builtins variable (and hence, __main__.__builtins__) is
once again initialized to the built-in *module* instead of its
dictionary.

- The finalization order is once again changed.  Signals are finalized
relatively early, because (1) it DECREF's the signal handlers, and if
a signal handler happens to be a bound method, deleting it could cause
problems when there's no current thread around, and (2) we don't want
to risk executing signal handlers during finalization.
1997-11-03 21:58:47 +00:00
Guido van Rossum 197346fafe New policy for package imports: only a directory containing
__init__.py (or __init__.pyc/.pyo, whichever applies) is considered a
package.  All other subdirectories are left alone.  Should make Konrad
Hinsen happy!
1997-10-31 18:38:52 +00:00
Guido van Rossum 771c6c8f7a Instead of using _PyImport_Inittab[] directly, use the new "official"
pointer *PyImport_Inittab which is initialized to _PyImport_Inittab.
1997-10-31 18:37:24 +00:00
Guido van Rossum e85da651dd Some patches to Lee Busby's fpectl mods that accidentally didn't make it
into 1.5a4.
1997-10-20 23:50:01 +00:00
Guido van Rossum ed1100f3b6 Don't use sscanf(s, "%x", &c) to parse \xX... escapes; hardcode it. 1997-10-20 23:24:07 +00:00
Guido van Rossum 3b31cd2fe7 Shared libraries didn't quite work under AIX because of the change in
status of the GNU readline interface.  Here's a patch, by Vladimir
Marangozov.
1997-10-10 17:40:00 +00:00
Guido van Rossum 9a61dc90e2 Moved mac-specific speedup to a different place (Jack) 1997-10-08 15:25:08 +00:00
Guido van Rossum ac1fc95c3c Fixed for WITHOUT_COMPLEX compilation (Jack) 1997-10-08 15:23:55 +00:00
Guido van Rossum 2ac650f385 New version of PyErr_NewException() that is compatible with -X option. 1997-10-03 19:50:55 +00:00
Guido van Rossum 999e5e921e Initialize Py_UseClassExceptionsFlag to 1. 1997-10-03 19:46:02 +00:00
Guido van Rossum a7f2e813c9 Remove unreachable "return 1" at end of ensure_fromlist(). 1997-10-03 15:33:32 +00:00
Guido van Rossum aa9606f45a Fix small omission: with all the new code, sys.exit(None) would print
"None"; this should be equivalent to sys.exit(0).
1997-10-03 13:53:28 +00:00
Guido van Rossum b74eca9349 Change PyEval_SaveThread() and PyEval_RestoreThread() to always do the
tstate swapping.  Only the acquiring and releasing of the lock is
conditional (twice, under ``#ifdef WITH_THREAD'' and inside ``if
(interpreter_lock)'').
1997-09-30 22:03:16 +00:00
Guido van Rossum b4102bf5f8 Fix a bug in this code that made it do the wrong thing when an option
was a single '-'.  Thanks to Andrew Kuchling.
1997-09-30 22:00:13 +00:00
Barry Warsaw 3a74993118 PyErr_NormalizeException(): If the exception's type is a class and the
instance's class is a subclass of this, then use the instance's class
as the exception type.
1997-09-30 15:00:18 +00:00
Guido van Rossum 6c1e5f2033 Get DLL version from a variable. 1997-09-29 23:34:23 +00:00
Guido van Rossum ee81af8977 Release interpreter lock around readline call in [raw_]input(). 1997-09-26 21:47:43 +00:00
Barry Warsaw 963b871e86 Py_Initialize(): move the call to _PyImport_FixupExtension() to after
the phase 2 init of the __builtin__ module, so that multiple
interpreters will get the right exceptions.
1997-09-18 16:42:02 +00:00
Barry Warsaw b01a7fa5f8 initerrors(): Eliminate circular reference which was causing a small
but annoying memory leak.  This was introduced when PyExc_Exception
was added; the loop above populating the PyExc_StandardError exception
tuple started at index 1 in bltin_exc, but PyExc_Exception was added
at index 0, so PyExc_StandardError was getting inserted in itself!
How else can a tuple include itself?!

Change the loop to start at index 2.

This was a *fun* one! :-)
1997-09-18 03:44:38 +00:00
Barry Warsaw 412cdc2284 [Py_Exc]NumberError => [Py_Exc]ArithmeticError 1997-09-16 21:51:14 +00:00
Barry Warsaw 2f5f6a2595 PyErr_Print(): When printing a class exception, try to dig out the
__module__ string and if found, print <module>.<class>, unless
<module> == "exceptions".
1997-09-16 21:42:03 +00:00
Guido van Rossum 7617e05a9b New API PyErr_NewException(name, base, dict) to create simple new exceptions. 1997-09-16 18:43:50 +00:00
Guido van Rossum 0474832d9c Introduce PyExc_Exception as the conceptual root class for all exceptions. 1997-09-16 18:43:15 +00:00
Guido van Rossum 0207e6de38 Added docstrings. Not for the obsolete functions though. 1997-09-09 22:04:42 +00:00
Guido van Rossum c172f26861 Deleted find_module_in_package and find_module_in_directory -- they
aren't needed and it was a mistake to add them.
1997-09-09 20:54:35 +00:00
Guido van Rossum a86f77d4dd Crrected a flow control error that caused the wrong error message when
load-module() didn't find a built-in or frozen module.  Also got rid
of is_frozen(), which duplicated the functionality of
find_frozen()!=NULL.
1997-09-09 18:53:47 +00:00
Guido van Rossum 9905ef9669 Added support for __all__, which should be a list of modules to be
imported when the user says "from package import *".
1997-09-08 16:07:11 +00:00
Guido van Rossum 0c81945808 Bugfix: import A.B from inside package was busted by mark_miss optimization. 1997-09-07 06:16:57 +00:00
Guido van Rossum f5f5fdbdd0 Significant speedup -- when a submodule imports a global module, add a
dummy entry to sys.modules, marking the absence of a submodule by the
same name.

Thus, if module foo.bar executes the statement "import time",
sys.modules['foo.time'] will be set to None, once the absence of a
module foo.time is confirmed (by looking for it in foo's path).

The next time when foo.bar (or any other submodule of foo) executes
"import time", no I/O is necessary to determine that there is no
module foo.time.

(Justification: It may seem strange to pollute sys.modules.  However,
since we're doing the lookup anyway it's definitely the fastest
solution.  This is the same convention that 'ni' uses and I haven't
heard any complaints.)
1997-09-06 20:29:52 +00:00
Guido van Rossum 222ef56bbf Fix reload() for package submodules. 1997-09-06 19:41:09 +00:00
Guido van Rossum 17fc85f2f5 Phase two of package import. "import a.b.c" and all variants now do the
right thing.

Still to do:

- Make reload() of a submodule work.

- Performance tweaks -- currently, a submodule that tries to import a
global module *always* searches the package directory first, even if
the global module was already imported.  Not sure how to solve this
one; probably need to record misses per package.

- Documentation!
1997-09-06 18:52:03 +00:00
Guido van Rossum d6bf45bcf6 Fixed some details of printing the str() of an exception. This fixes
a core dump when __str__() returns a non-string, and plugs a memory
leak as well: the result of PyObject_Str() was never DECREFed.
1997-09-05 19:11:53 +00:00
Guido van Rossum aee0bad0a5 First part of package support.
This doesn't yet support "import a.b.c" or "from a.b.c import x", but
it does recognize directories.  When importing a directory, it
initializes __path__ to a list containing the directory name, and
loads the __init__ module if found.

The (internal) find_module() and load_module() functions are
restructured so that they both also handle built-in and frozen modules
and Mac resources (and directories of course).  The imp module's
find_module() and (new) load_module() also have this functionality.
Moreover, imp unconditionally defines constants for all module types,
and has two more new functions: find_module_in_package() and
find_module_in_directory().

There's also a new API function, PyImport_ImportModuleEx(), which
takes all four __import__ arguments (name, globals, locals, fromlist).
The last three may be NULL.  This is currently the same as
PyImport_ImportModule() but in the future it will be able to do
relative dotted-path imports.

Other changes:

- bltinmodule.c: in __import__, call PyImport_ImportModuleEx().

- ceval.c: always pass the fromlist to __import__, even if it is a C
function, so PyImport_ImportModuleEx() is useful.

- getmtime.c: the function has a second argument, the FILE*, on which
it applies fstat().  According to Sjoerd this is much faster.  The
first (pathname) argument is ignored, but remains for backward
compatibility (so the Mac version still works without changes).

By cleverly combining the new imp functionality, the full support for
dotted names in Python (mini.py, not checked in) is now about 7K,
lavishly commented (vs. 14K for ni plus 11K for ihooks, also lavishly
commented).

Good night!
1997-09-05 07:33:22 +00:00
Guido van Rossum d7ed683a7e Inline PyObject_CallObject (Marc-Andre Lemburg). 1997-08-30 15:02:50 +00:00
Guido van Rossum dcc0c13f74 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().
1997-08-29 22:32:42 +00:00
Barry Warsaw 757af0e7bb 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.

Added the two phase init and fini functions.
1997-08-29 22:13:51 +00:00
Barry Warsaw 035574d755 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.
1997-08-29 22:07:17 +00:00
Barry Warsaw 2d8adff10a 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).
1997-08-29 21:54:35 +00:00
Guido van Rossum beef8aa719 Cprrect stuoid tyops -- was comparing variabes with themselves because
of co/cp mixup.
1997-08-29 17:12:43 +00:00
Barry Warsaw eaedc7ce32 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!).
1997-08-28 22:36:40 +00:00
Barry Warsaw 36b8f945e7 PyErr_Print(): Use PyErr_GivenExceptionMatches() instead of pointer
compares to test for SystemExit and SyntaxError.
1997-08-26 18:09:48 +00:00
Barry Warsaw 910105515e unpack_sequence(): In finally clause, watch out for Py_DECREF
evaluating its arguments twice.
1997-08-25 22:30:51 +00:00
Barry Warsaw e42b18f9d1 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.
1997-08-25 22:13:04 +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 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
Guido van Rossum e3c0d5eb34 Added new Py_IsInitalized() API function to test the 'initialized' flag. 1997-08-22 04:20:13 +00:00
Guido van Rossum 5f896a4de0 Added missing newline to warning msg 1997-08-21 02:28:19 +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 54dec59b56 set sharedlib extensions properly for NeXT (Ted Horst) 1997-08-16 14:38:09 +00:00
Guido van Rossum 7c14103d77 Keep gcc -Wall happy 1997-08-15 02:52:08 +00:00
Guido van Rossum 49b1226781 Use _beginthread() and _endthread() in favor of CreateThread() and
ExitThread().  As discussed in c.l.p, this takes care of
initialization and finalization of thread-local storage allocated by
the C runtime system.  Not sure whether non-MS compilers grok this
though (but who cares :-).
1997-08-14 20:12:58 +00:00
Guido van Rossum d47a0a86b4 Added Jim Fulton's PyImport_Import(), which calls whatever
__import__() hook is currently installed.
1997-08-14 20:11:26 +00:00
Guido van Rossum 741689d5f3 Use string interning and caching to get speedups on the mac (Jack). 1997-08-12 14:53:39 +00:00
Guido van Rossum e5b4026881 Use strerror on the mac if using MSL (Jack). 1997-08-12 14:51:52 +00:00
Guido van Rossum 622f73f188 Remove unised variable 1997-08-07 19:22:48 +00:00
Guido van Rossum cc283f56a7 Merge Py_Cleanup() into Py_Finalize(). Call the various small Fini()
functions.
1997-08-05 02:22:03 +00:00
Guido van Rossum 085d269f1d New rules for deleting modules. Rather than having an elaborate
scheme based on object's types, have a simple two-phase scheme based
on object's *names*:

	/* To make the execution order of destructors for global
	   objects a bit more predictable, we first zap all objects
	   whose name starts with a single underscore, before we clear
	   the entire dictionary.  We zap them by replacing them with
	   None, rather than deleting them from the dictionary, to
	   avoid rehashing the dictionary (to some extent). */
1997-08-05 02:20:51 +00:00
Guido van Rossum f9c90c533e Renamed a local label that was accidentally grandly renamed to
'Py_Cleanup' back to 'cleanup'.
1997-08-05 02:18:01 +00:00
Guido van Rossum 25ce566661 The last of the mass checkins for separate (sub)interpreters.
Everything should now work again.

See the comments for the .h files mass checkin (e.g. pystate.h) for
more detail.
1997-08-02 03:10:38 +00:00
Guido van Rossum 40b33c648a Removed fatal errors from Py_Initmodule4() (and thus from
Py_Initmodule(), which is a macro wrapper around it).

The return value is now a NULL pointer if the initialization failed.
This may make old modules fail with a SEGFAULT, since they don't
expect this kind of failure.  That's OK, since (a) it "never" happens,
and (b) they would fail with a fatal error otherwise, anyway.

Tons of extension modules should now check the return value of
Py_Initmodule*() -- that's on my TODO list.
1997-08-02 03:07:46 +00:00
Guido van Rossum 55b9ab5bdb Extend the "Don Beaudry hack" with "Guido's corollary" -- if the base
class has a __class__ attribute, call that to create the new class.
This allows us to write metaclasses purely in C!
1997-07-31 03:54:02 +00:00
Guido van Rossum 6fc06e770f Plugged a leak. (The same as the one plugged in compile.c -- forgot
to free lnotab).
1997-07-26 23:30:18 +00:00
Guido van Rossum 275558cb9f Plug a leak in code_dealloc() (and reordered the deallocs to match the
order of the variables in the declarations).

Also removed an entry in the TODO list that's done.
1997-07-25 20:13:49 +00:00
Guido van Rossum ef3d02ebb9 Removed some variables that are used to exchange data between import.c and
importdl.c: the MAXSUFFIXSIZE macro is now defined in importdl.h, and
the modules dictionary is now passed using PyImport_GetModuleDict().

Also undefine USE_SHLIB for AIX -- in AIX 4.2 and up, dlfcn.h exists
but we don't want to use it.
1997-07-21 14:54:36 +00:00
Guido van Rossum a94145118a frozenmain.c is now also in the library,
with entry point Py_FrozenMain().
1997-07-19 21:59:47 +00:00
Guido van Rossum 019db5d73e Oops -- this contains frozen bytecode, but it was Python 1.4 bytecode! 1997-07-19 21:54:24 +00:00
Guido van Rossum 9cc8a20cd2 Moved PyEval_{Acquire,Release}Thread() to within the same #ifdef
WITH_THREAD as PyEval_InitThreads().

Removed use of Py_SuppressPrintingFlag.
1997-07-19 19:55:50 +00:00
Guido van Rossum 534ac094f9 Removed a bunch of extern declarations of functions that are now
properly declared in Python.h.
1997-07-19 19:51:43 +00:00
Guido van Rossum 8fb26ede51 Make it return a _const_ char*. 1997-07-19 19:48:41 +00:00
Guido van Rossum f6ca6aa869 New build procedure. 1997-07-19 19:39:57 +00:00
Guido van Rossum 3768fb1097 Tracking changes to Py_Main():
- Got rid of inspection of some environment variables.

- Got rid of Py_GetProgramName() and related logic.

- Print the version header *after* successful initialization.
1997-07-19 19:24:41 +00:00
Guido van Rossum ad6dfda9af Moved some stuff here from main.c (part of a big restructuring - wait
for more!).

- The global flags that can be set from environment variables are now
set in Py_Initialize (except the silly Py_SuppressPrint, which no
longer exists).  This saves duplicate code in frozenmain.c and main.c.

- Py_GetProgramName() is now here; added Py_SetProgramName().  An
embedding program should no longer provide Py_GetProgramName(),
instead it should call Py_SetProgramName() *before* calling
Py_Initialize().
1997-07-19 19:17:22 +00:00
Guido van Rossum 0c88e1fd96 Remove confusing usage comments at end. 1997-07-19 00:02:22 +00:00
Guido van Rossum 2fca21f762 PyEval_SaveThread() and PyEval_RestoreThread() now return/take a
PyThreadState pointer instead of a (frame) PyObject pointer.  This
makes much more sense.  It is backward incompatible, but that's no
problem, because (a) the heaviest users are the Py_{BEGIN,END}_
ALLOW_THREADS macros here, which have been fixed too; (b) there are
very few direct users; (c) those who use it are there will probably
appreciate the change.

Also, added new functions PyEval_AcquireThread() and
PyEval_ReleaseThread() which allows the threads created by the thread
module as well threads created by others (!) to set/reset the current
thread, and at the same time acquire/release the interpreter lock.

Much saner.
1997-07-18 23:56:58 +00:00
Guido van Rossum c12da6980f Huge speedup by inlining some common integer operations:
int+int, int-int, int <compareop> int, and list[int].
(Unfortunately, int*int is way too much code to inline.)

Also corrected a NULL that should have been a zero.
1997-07-17 23:12:42 +00:00
Guido van Rossum b65e85cb73 Fix problem discovered by Greg McFarlane: when an imported module
replaces its own entry in sys.module, reference count errors ensue;
even if there is no reference count problem, it would be preferable
for the import to yield the new thing in sys.modules anyway (if only
because that's what later imports will yield).  This opens the road to
an official hack to implement a __getattr__ like feature for modules:
stick an instance in sys.modules[__name__].
1997-07-10 18:00:45 +00:00
Guido van Rossum db9e20f418 Fix bug reported by Just: anonymous arguments used for tuples should
have a unique name, otherwise they get squished by locals2fast (or
fast2locals, I dunno) when the debugger is invoked before they have
been transferred to real locals.
1997-07-10 01:06:53 +00:00
Guido van Rossum 46ff1903a3 Add default case (standard conformance) to avoid piling up
system specific #ifdefs.
1997-06-02 22:25:45 +00:00
Guido van Rossum 296b4751e1 Can't return 0 from void function... 1997-05-23 00:19:20 +00:00
Guido van Rossum c8b6df9004 PyObject_Compare can raise an exception now. 1997-05-23 00:06:51 +00:00
Guido van Rossum 7e8d26d78c PyFile_WriteString now returns an error indicator instead of calling
PyErr_Clear().  Add checking of those errors.
1997-05-22 22:35:47 +00:00
Guido van Rossum 78a1ed3d70 Py_FlushLine and PyFile_WriteString now return error indicators
instead of calling PyErr_Clear().  Add checking of those errors.
1997-05-22 22:35:04 +00:00
Guido van Rossum be27026c09 Py_FlushLine and PyFile_WriteString now return error indicators
instead of calling PyErr_Clear().  Add checking of those errors.
1997-05-22 22:26:18 +00:00
Guido van Rossum 64f9105fb7 DG/UX thread patches (Ross Andrus) 1997-05-22 20:41:59 +00:00
Guido van Rossum b2c8ec4b75 Set sys.executable to full path of python (from argv[0]). 1997-05-22 20:41:20 +00:00
Guido van Rossum 23c9446d9a Added a space in an error message 1997-05-22 20:21:30 +00:00
Guido van Rossum f9cba090f9 Don't use function prototypes in function definition headers. 1997-05-20 22:23:34 +00:00
Guido van Rossum 2f75b29630 Indent the #error directives so a classic K&R cpp doesn't see them. 1997-05-20 22:18:48 +00:00
Guido van Rossum df4c308f5a Plug leak of stack frame object in exception handling code.
Also delay DECREF calls until after the structures have been updated
(for reentrancy awareness).
1997-05-20 17:06:11 +00:00
Guido van Rossum df0d00e29b Logic for enabling mac-specific signal handling fixed (Jack) 1997-05-20 15:57:49 +00:00
Guido van Rossum 1254d79dfa Use #ifdef in stead of #if (Jack) 1997-05-20 15:57:25 +00:00
Guido van Rossum c8fba8ee14 Add pthred-std define for Linux. 1997-05-15 12:24:53 +00:00
Guido van Rossum af5dfb4ceb One last rename glitch: import_modules -> _PyImport_Modules. 1997-05-14 17:36:12 +00:00
Guido van Rossum d6353e2c0e Support for various versions of the pthread draft. 1997-05-13 17:51:13 +00:00
Guido van Rossum 5f15b96c36 (int) cast for strlen() to keep picky compilers happy. 1997-05-13 17:50:01 +00:00
Guido van Rossum b6a7f77c9f Oops -- missed FloatingPointError in renaming. 1997-05-09 03:03:23 +00:00
Guido van Rossum 9a0f04d4cd Get rid of obsolete support for access statement. 1997-05-09 00:58:02 +00:00
Guido van Rossum ee2373b930 Oops, missed some renamings. 1997-05-07 23:51:07 +00:00
Guido van Rossum b05a5c7698 Instead of importing graminit.h whenever one of the three grammar 'root'
symbols is needed, define these in Python.h with a Py_ prefix.
1997-05-07 17:46:13 +00:00
Guido van Rossum 666b17a280 New dir() function --
- uses abstract interface where possible
- uses __members__ and __methods__
- returns [] when an object has no info available
1997-05-06 16:36:57 +00:00
Guido van Rossum 478e718aca Keep MS compiler happy: use (int)strlen() when comparing; make sure
not to use kill().
1997-05-06 15:24:59 +00:00
Guido van Rossum fc49073cd0 Used operators from abstract.h where possible (arithmetic operators,
get/set/del item).  This removes a pile of duplication.  There's no
abstract operator for 'not' but I removed the function call for it
anyway -- it's a little faster in-line.
1997-05-06 15:06:49 +00:00
Guido van Rossum fdf95dd525 Checkin of Jack's buffer mods.
Not really checked, but didn't fail any tests either...
1997-05-05 22:15:02 +00:00
Guido van Rossum 13454c3f9c Fix old typo PyArgs_VaParse -> PyArg_VaParse.
(Redoing the checking without merging in Jack's buffer mods.)
1997-05-05 21:57:29 +00:00
Guido van Rossum a027efa5bf Massive changes for separate thread state management.
All per-thread globals are moved into a struct which is manipulated
separately.
1997-05-05 20:56:21 +00:00
Guido van Rossum 73237c54b4 Only use PyCode_Addr2Line to get tb_lineno when Py_OptimizeFlag is set. 1997-05-05 20:53:25 +00:00