Commit Graph

809 Commits

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