Commit Graph

604 Commits

Author SHA1 Message Date
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Guido van Rossum e326b1efe2 At last, this backward compatibility file bites the dust.
If you still haven't updated your extension since the Grand Renaming,
you don't deserve Python 1.6. :-)
2000-05-02 19:09:40 +00:00
Guido van Rossum b16d197d66 Marc-Andre Lemburg:
Added Py_UnicodeFlag for use by the -U command line option.
2000-05-01 17:55:15 +00:00
Guido van Rossum e92e610a9e Christian Tismer -- total rewrite on trashcan code.
Improvements:
- does no longer need any extra memory
- has no relationship to tstate
- works in debug mode
- can easily be modified for free threading (hi Greg:)

Side effects:
Trashcan does change the order of object destruction.
Prevending that would be quite an immense effort, as
my attempts have shown. This version works always
the same, with debug mode or not. The slightly
changed destruction order should therefore be no problem.

Algorithm:
While the old idea of delaying the destruction of some
obejcts at a certain recursion level was kept, we now
no longer aloocate an object to hold these objects.
The delayed objects are instead chained together
via their ob_type field. The type is encoded via
ob_refcnt. When it comes to the destruction of the
chain of waiting objects, the topmost object is popped
off the chain and revived with type and refcount 1,
then it gets a normal Py_DECREF.

I am confident that this solution is near optimum
for minimizing side effects and code bloat.
2000-04-24 15:40:53 +00:00
Guido van Rossum ddc3b63bf6 Jack Jansen: The GUSI 2.0 I/O library (which is used on the Mac)
doesn't use the special header file for select anymore.
2000-04-24 15:12:54 +00:00
Jeremy Hylton 4a3dd2dcc2 Fix PR#7 comparisons of recursive objects
Note that comparisons of deeply nested objects can still dump core in
extreme cases.
2000-04-14 19:13:24 +00:00
Guido van Rossum 004d64f362 Marc-Andre Lemburg:
Changed PyUnicode_Splitlines() maxsplit argument to keepends.
The maxsplit functionality was replaced by the keepends
functionality which allows keeping the line end markers together
with the string.
2000-04-11 15:39:46 +00:00
Guido van Rossum 52c2359a59 Marc-Andre Lemburg: New exported API PyUnicode_Resize(). 2000-04-10 13:41:41 +00:00
Guido van Rossum 08df3ac066 Bump version to 1.6a2 -- to be released one of these days. 2000-04-06 15:01:30 +00:00
Guido van Rossum 9e896b37c7 Marc-Andre's third try at this bulk patch seems to work (except that
his copy of test_contains.py seems to be broken -- the lines he
deleted were already absent).  Checkin messages:


New Unicode support for int(), float(), complex() and long().

- new APIs PyInt_FromUnicode() and PyLong_FromUnicode()
- added support for Unicode to PyFloat_FromString()
- new encoding API PyUnicode_EncodeDecimal() which converts
  Unicode to a decimal char* string (used in the above new
  APIs)
- shortcuts for calls like int(<int object>) and float(<float obj>)
- tests for all of the above

Unicode compares and contains checks:
- comparing Unicode and non-string types now works; TypeErrors
  are masked, all other errors such as ValueError during
  Unicode coercion are passed through (note that PyUnicode_Compare
  does not implement the masking -- PyObject_Compare does this)
- contains now works for non-string types too; TypeErrors are
  masked and 0 returned; all other errors are passed through

Better testing support for the standard codecs.

Misc minor enhancements, such as an alias dbcs for the mbcs codec.

Changes:
- PyLong_FromString() now applies the same error checks as
  does PyInt_FromString(): trailing garbage is reported
  as error and not longer silently ignored. The only characters
  which may be trailing the digits are 'L' and 'l' -- these
  are still silently ignored.
- string.ato?() now directly interface to int(), long() and
  float(). The error strings are now a little different, but
  the type still remains the same. These functions are now
  ready to get declared obsolete ;-)
- PyNumber_Int() now also does a check for embedded NULL chars
  in the input string; PyNumber_Long() already did this (and
  still does)

Followed by:

Looks like I've gone a step too far there... (and test_contains.py
seem to have a bug too).

I've changed back to reporting all errors in PyUnicode_Contains()
and added a few more test cases to test_contains.py (plus corrected
the join() NameError).
2000-04-05 20:11:21 +00:00
Guido van Rossum a14253d4f8 Make it version 1.6a1. 2000-03-30 22:59:20 +00:00
Jeremy Hylton a12c7a7620 Add PyDict_Copy() function to C API for dicts. It returns a new
dictionary that contains the same key/value pairs as p.
2000-03-30 22:27:31 +00:00
Guido van Rossum 21a50bd078 Version updated to 1.6; API version to 1009. 2000-03-29 01:46:45 +00:00
Jeremy Hylton a403d7d390 remove reference to CALL_FUNCTION_STAR in comment 2000-03-29 00:10:03 +00:00
Jeremy Hylton 7690151c7e slightly modified version of Greg Ewing's extended call syntax patch
executive summary:
Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'.
Some file-by-file details follow.

Grammar/Grammar:
    simplify varargslist, replacing '*' '*' with '**'
    add * & ** options to arglist

Include/opcode.h & Lib/dis.py:
    define three new opcodes
        CALL_FUNCTION_VAR
        CALL_FUNCTION_KW
        CALL_FUNCTION_VAR_KW

Python/ceval.c:
    extend TypeError "keyword parameter redefined" message to include
        the name of the offending keyword
    reindent CALL_FUNCTION using four spaces
    add handling of sequences and dictionaries using extend calls
    fix function import_from to use PyErr_Format
2000-03-28 23:49:17 +00:00
Guido van Rossum 24bdb0474f Marc-Andre Lemburg:
The attached patch set includes a workaround to get Python with
Unicode compile on BSDI 4.x (courtesy Thomas Wouters; the cause
is a bug in the BSDI wchar.h header file) and Python interfaces
for the MBCS codec donated by Mark Hammond.

Also included are some minor corrections w/r to the docs of
the new "es" and "es#" parser markers (use PyMem_Free() instead
of free(); thanks to Mark Hammond for finding these).

The unicodedata tests are now in a separate file
(test_unicodedata.py) to avoid problems if the module cannot
be found.
2000-03-28 20:29:59 +00:00
Guido van Rossum efec1158c1 Prototypes added for MBCS codecs. (Win32 only.) 2000-03-28 02:01:15 +00:00
Fred Drake 0e12bcd243 Updated comment: in PyTypeObject:
/* More standard operations (at end for binary compatibility) */

should now be:

	/* More standard operations (here for binary compatibility) */

since they're no longer at the end!
2000-03-21 16:14:47 +00:00
Barry Warsaw 51ac58039f On 17-Mar-2000, Marc-Andre Lemburg said:
Attached you find an update of the Unicode implementation.

    The patch is against the current CVS version. I would appreciate
    if someone with CVS checkin permissions could check the changes
    in.

    The patch contains all bugs and patches sent this week and also
    fixes a leak in the codecs code and a bug in the free list code
    for Unicode objects (which only shows up when compiling Python
    with Py_DEBUG; thanks to MarkH for spotting this one).
2000-03-20 16:36:48 +00:00
Guido van Rossum d0d366b5e6 Marc-Andre Lemburg: add declaration for PyUnicode_Contains(). 2000-03-13 23:22:24 +00:00
Guido van Rossum d724b23420 Christian Tismer's "trashcan" patch:
Added wrapping macros to dictobject.c, listobject.c, tupleobject.c,
frameobject.c, traceback.c that safely prevends core dumps
on stack overflow. Macros and functions in object.c, object.h.
The method is an "elevator destructor" that turns cascading
deletes into tail recursive behavior when some limit is hit.
2000-03-13 16:01:29 +00:00
Guido van Rossum fd9eed33aa Marc-Andre Lemburg: added declarations for PyObject_AsCharBuffer,
PyObject_AsReadBuffer, PyObject_AsWriteBuffer.
2000-03-10 22:35:06 +00:00
Guido van Rossum bd7dfbc146 Marc-Andre Lemburg: include unicodeobject.h and codecs.h 2000-03-10 22:34:00 +00:00
Guido van Rossum 99cc97109e Marc-Andre Lemburg: add PyExc_UnicodeError 2000-03-10 22:33:32 +00:00
Guido van Rossum d822518fa8 Unicode implementation by Marc-Andre Lemburg based on original code by Fredrik Lundh. 2000-03-10 22:33:05 +00:00
Guido van Rossum 3094484106 Python Codec Registry and support functions, by Marc-Andre Lemburg. 2000-03-10 22:32:23 +00:00
Guido van Rossum c6e87a2925 Got rid of silly "123456789-..." lines in comments. 2000-03-01 15:06:53 +00:00
Guido van Rossum cecb27a49c Patch by Mozhe Zadka, for __contains__ (overloading 'in'). This adds
a new proc type (objobjproc), a new slot sq_contains to
PySequenceMethods, and a new flag Py_TPFLAGS_HAVE_SEQUENCE_IN to
Py_TPFLAGS_DEFAULT.  More to follow.
2000-02-28 15:00:40 +00:00
Guido van Rossum db0c9f7f5b Declarations related to new WindowsError exception. 2000-02-17 15:17:18 +00:00
Guido van Rossum bffd683f73 The rest of the changes by Trent Mick and Dale Nagata for warning-free
compilation on NT Alpha.  Mostly added casts etc.
2000-01-20 22:32:56 +00:00
Barry Warsaw 226ae6ca12 Mainlining the string_methods branch. See branch revision log
messages for specific changes.
1999-10-12 19:54:53 +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 8f3e15058c Set PATCHLEVEL and PY_VERSION (string version only) to 1.5.2+ to
indicate to those that are using the CVS access that they are using a
newer-than-1.2.5 version, without committing to a particular version
number or patch level.
1999-06-09 15:16:18 +00:00
Guido van Rossum 9e47859963 Prepare for final release. 1999-04-13 14:47:26 +00:00
Guido van Rossum 6d0de99d8d Release 1.5.2c1 1999-04-08 20:23:44 +00:00
Guido van Rossum bd341fa82a Add the possibility of a gamma release (release candidate).
Add '+' to string version number to indicate we're beyond b2 now.
1999-04-07 16:00:20 +00:00
Guido van Rossum d023a78f59 Conform to standard boilerplate. 1999-03-24 19:02:09 +00:00
Guido van Rossum d709b48706 Adding thread.h -- unused but for b/w compatibility.
As requested by Bill Janssen.
1999-03-22 22:25:39 +00:00
Guido van Rossum 8368453249 Add DLL level b/w compat for PySequence_In and PyEval_CallObject 1999-03-17 18:44:39 +00:00
Guido van Rossum e784f1efec Add PyModule_GetFilename(). 1999-02-15 14:43:11 +00:00
Guido van Rossum 7999bfb235 There's a macro PycString_IMPORT which the documentation listed as
PycStringIO_IMPORT.  While arguably the name used in the documentation
is more consistent, I think it's probably safer not to change the
macro definition and instead fix the doco.
1999-01-25 21:36:13 +00:00
Guido van Rossum 2e6e7d4b7a Changes for long file support by Steve Clift. 1999-01-06 18:39:42 +00:00
Guido van Rossum d3b0921f57 Chris Herborth writes:
Donn Cave tells me the PyImport_BeImageID() function isn't needed anymore.
1999-01-04 16:39:38 +00:00
Guido van Rossum f1176c4815 New version identification scheme.
The version numbers are now exported by Python.h.
Also rolled back the API version change -- it's back to 1007!
1999-01-03 12:40:24 +00:00
Guido van Rossum a8b47fe5c6 I can't seem to do anything right :-)
As Chris H. points out, I should have added 'extern' to the
declaration of _PyThreadState_Current.  Here it is.
1998-12-21 20:21:19 +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 275ea67e6b Add macro version of PyThreadState_GET(). This uses
_PyThreadState_Current, defined in pystate.c.
1998-12-21 18:28:10 +00:00
Guido van Rossum cc34faaf14 Add prototypes for PyOS_strto[u]l -- Chris Herborth. 1998-12-10 16:54:17 +00:00
Guido van Rossum f0f3600d0b Undo the change here -- there's no point in declaring a static
function as DL_IMPORT()!
1998-12-08 13:23:22 +00:00
Guido van Rossum 43466ec7b0 Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
Guido van Rossum 7531d507c1 New API version (enough has changed!). 1998-12-03 18:18:12 +00:00
Barry Warsaw d052ff0e57 Added PyExc_NotImplementedError 1998-12-01 18:34:01 +00:00
Guido van Rossum 446fd04009 Metrowerks PRO4 finally fixes the hypot snafu. (Jack Jansen) 1998-11-02 16:21:39 +00:00
Guido van Rossum d1f2d7eede Bump the patch level to 1.5.2b2, just in case I feel like releasing
next week. :-)
1998-10-24 19:47:34 +00:00
Guido van Rossum 36eef3c173 Changes by Greg Stein (code) and GvR (design).
Add a new member to the PyBufferProcs struct, bf_getcharbuffer.  For
backward compatibility, this member should only be used (this includes
testing for NULL!) when the flag Py_TPFLAGS_HAVE_GETCHARBUFFER is set
in the type structure, below.  Note that if its flag is not set, we
may be looking at an extension module compiled for 1.5.1, which will
have garbage at the bf_getcharbuffer member (because the struct wasn't
as long then).  If the flag is one, the pointer may still be NULL.
The function found at this member is used in a similar manner as
bf_getreadbuffer, but it is known to point to 8-bit character data.
(See discussion in getargs.c checked in later.)

As a general feature for extending the type structure and the various
structures that (may) hang off it in a backwards compatible way, we
rename the tp_xxx4 "spare" slot to tp_flags.  In 1.5.1 and before,
this slot was always zero.  In 1.5.1, it may contain various flags
indicating extra fields that weren't present in 1.5.1.  The only flag
defined so far is for the bf_getcharbuffer member of the PyBufferProcs
struct.

Note that the new spares (tp_xxx5 - tp_xxx8), once they become used,
should also be protected by a flag (or flags) in tp_flags.
1998-10-08 02:10: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 2e19bd7cc7 Add Greg Stein's buffer object API. 1998-10-07 14:36:10 +00:00
Guido van Rossum b7c61318d8 Up version to 1.5a2 -- we're close enough (even though I'm still
expecting some contributions).
1998-10-02 03:17:29 +00:00
Guido van Rossum 6e5b301b02 Renamed thread.h to pythread.h. 1998-10-01 20:59:37 +00:00
Guido van Rossum 2c69336507 On second though, NEXITFUNCS should be defined in pythonrun.c and not
here; pystate.h doesn't use it (I thought I wanted to move the array
there but that won't work).
1998-10-01 16:02:31 +00:00
Guido van Rossum 03dc5384d7 Move the #include of <sys/select> to *after* mytime.h (or <time.h>),
as this is the logical order of dependencies.  Suggested by Jeff Rush.
1998-09-28 22:05:22 +00:00
Guido van Rossum 78694d970f Patches from Greg Stein to support 'P' format in struct module's
native format, as void* (translated to Python int or long).
Also adds PyLong_FromVoidPtr and PyLong_AsVoidPtr to longobject.c.
1998-09-18 14:14:13 +00:00
Guido van Rossum 1d2e9d19fe Duplicate the decls for PySys_WriteStd{out,err} here so the VC++
compiler doesn't grumble.  Greg Stein's suggestion.
1998-09-17 14:00:22 +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 f1536db2e7 Move an indented #define to column 1. 1998-08-23 22:06:59 +00:00
Guido van Rossum 3d109a0e6d Add missing prototypes for PyEval_CallFunction() and PyEval_CallMethod(). 1998-08-08 20:53:36 +00:00
Guido van Rossum b2395ebd51 Upgrade patchlevel to 1.5.2a1. 1998-08-05 21:16:18 +00:00
Guido van Rossum 1a8791e0b8 Changes for BeOS, QNX and long long, by Chris Herborth. 1998-08-04 22:46:29 +00:00
Barry Warsaw 62a21a2ebe New global variables: PyExc_EnvironmentError and PyExc_OSError
New function: PyErr_SetFromErrnoWithFilename(PyObject* char*)
1998-07-23 15:57:34 +00:00
Guido van Rossum ba0d0611e7 Add macros for direct access to the members of CFunction objects. 1998-07-10 15:47:08 +00:00
Guido van Rossum d4ba73c75b Move the definition of PyMethodObject to classobject.h, so it can define
macros for more efficient access to the fields.
1998-07-10 15:46:33 +00:00
Guido van Rossum 9223351617 Marc-Andre Lemburg's patch to move the typedef for PyCFunctionObject
to the .h file and add macros there for inlined access to the fields.
1998-07-10 15:21:55 +00:00
Guido van Rossum 9d865e1a30 Get rid of some obsolete opcodes. 1998-07-07 14:58:39 +00:00
Guido van Rossum 16926bd75e Add PyImport_AppendInittab() an PyImport_ExtendInittab(). 1998-06-29 20:34:46 +00:00
Guido van Rossum a70d160095 Define new macro Py_InitModule3(name, methods, doc) which calls
Py_InitModule4() with appropriate arguments.
1998-06-27 18:21:59 +00:00
Guido van Rossum 90ce848848 On SGI, we need to define _SGI_MP_SOURCE before including errno.h when
we are threading, otherwise accessing errno doesn't work right.
1998-05-26 18:38:07 +00:00
Guido van Rossum 44e4d5a6fd Renamed PySequence_In() to PySequence_Contains(). 1998-05-22 00:47:25 +00:00
Guido van Rossum bf6a9b165a Add
PySys_WriteStdout(format, ...)
   PySys_WriteStderr(format, ...)
1998-05-12 14:58:52 +00:00
Guido van Rossum 50cc04ee03 Mac CodeWarrior has faulty declaration for hypot, which we hide with a
#define.
(Jack)
1998-04-28 16:02:29 +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 a9c2d7a87c Add new spares to the end of the type object struct. 1998-04-23 19:16:44 +00:00
Guido van Rossum ee0a63bec5 Move 'dict' struct member to end of struct. This ensures binary
compatibility for shared libraries.

*** WARNING -- IF YOU BUILT 1.5.1BETA1, DO A "MAKE CLEAN" ***
1998-04-13 20:24:05 +00:00
Guido van Rossum 26d4ac30be Add prototypes for Py_Repr{Enter,Leave}.
(Jeremy will hardly recognize his patch :-)
1998-04-10 22:32:24 +00:00
Guido van Rossum 204751b127 Add dict struct member and PyThreadState_GetDict() prototype. 1998-04-10 20:19:01 +00:00
Guido van Rossum c9ea7572e9 Set the patch level to 1.5.1. (I'm not going to release this as a
beta -- if there are bugs, I'll post a patch page and release 1.5.2
sooner.)
1998-04-10 18:08:06 +00:00
Guido van Rossum 4d856ee652 Added Tabcheck flag. 1998-04-10 17:59:44 +00:00
Guido van Rossum e77a992a0d Add E_INDENT -- new error to check for bad indentation 1998-04-09 21:37:20 +00:00
Guido van Rossum c3d3f9692d Add PyObject_Not(). 1998-04-09 17:53:59 +00:00
Guido van Rossum f1dc0615e9 Add internal routine _PyModule_Clear(), which does approximately what
clear_carefully() used to do in import.c.  Differences: leave only
__builtins__ alone in the 2nd pass; and don't clear the dictionary (on
the theory that as long as there are references left to the
dictionary, those might be destructors that might expect __builtins__
to be alive when they run; and __builtins__ can't normally be part of
a cycle).
1998-02-19 20:51:52 +00:00
Guido van Rossum fccb68ef2a Added PyImport_ExecCodeModuleEx(), which adds an extra parameter to pass
it the true file.
1998-02-11 05:47:24 +00:00
Guido van Rossum 66d4b90791 - 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:28:05 +00:00
Guido van Rossum 95c745b5fc - Add Py_FrozenFlag, intended to suppress error messages fron
getpath.c in frozen binaries.
1998-02-06 22:27:46 +00:00
Guido van Rossum d8a0be775f Set the patch level to 1.5. 1997-12-30 04:29:49 +00:00
Guido van Rossum d5559576c9 Start calling it 1.5b2 1997-12-10 05:51:13 +00:00
Guido van Rossum cd8732a482 Remove the last bits of log from the leading comments. 1997-12-08 15:16:08 +00:00
Guido van Rossum 60aff2c0a6 Use the proper OS2 test symbol: PYOS_OS2. 1997-12-05 21:39:25 +00:00
Guido van Rossum 36facb086e Merge between my version and Jim Fulton's version; removed RCS keywords
but otherwise unchanged.
1997-12-04 01:14:08 +00:00
Guido van Rossum 7bf22de753 Patch for QNX, by Chris Herborth. 1997-12-02 20:34:19 +00:00
Guido van Rossum 8e9ebfd337 os2 patch by Jeff Rush 1997-11-22 21:53:48 +00:00
Guido van Rossum ee6fd1c392 Add declaration for _Py_PackageContext -- needed to fix importing
of shared libraries from inside packages.
1997-11-19 18:51:35 +00:00
Guido van Rossum 127b8dd8d4 Add declaration for PyNumber_CoerceEx(). 1997-11-19 16:04:54 +00:00
Guido van Rossum 33635f818a start numbering things 1.5b1 now 1997-11-18 19:21:47 +00:00
Guido van Rossum 359bcaa539 This fix (across 4 files in 3 directories) solves a subtle problem with
signal handlers in a fork()ed child process when Python is compiled with
thread support.  The bug was reported by Scott <scott@chronis.icgroup.com>.

What happens is that after a fork(), the variables used by the signal
module to determine whether this is the main thread or not are bogus,
and it decides that no thread is the main thread, so no signals will
be delivered.

The solution is the addition of PyOS_AfterFork(), which fixes the signal
module's variables.  A dummy version of the function is present in the
intrcheck.c source file which is linked when the signal module is not
used.
1997-11-14 22:24:28 +00:00
Guido van Rossum 66959aff68 Remove the declaration of "internal" table _PyImport_Inittab[]; add
new "official" pointer *PyImport_Inittab.
1997-10-31 18:36:47 +00:00
Guido van Rossum 1f84449fd8 New CObject from Jim Fulton, adds PyCObject_FromVoidPtrAndDesc() and
PyCObject_GetDesc().
1997-10-21 19:48:35 +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 eec6ef1aa2 Use K&R function prototypes. 1997-10-07 14:44:48 +00:00
Guido van Rossum b4cfdfa077 Removed special Windows defines, at Mark Hammond's request. 1997-09-29 23:29:08 +00:00
Guido van Rossum 2d2c34445b New API PyErr_NewException(name, base, dict) to create simple new exceptions. 1997-09-16 21:50:37 +00:00
Barry Warsaw 65349a3936 [Py_Exc]NumberError => [Py_Exc]ArithmeticError 1997-09-16 21:50:36 +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 7ca65abb2f Set it to 1.5a4, now we have dotted-name import... 1997-09-08 02:17:31 +00:00
Guido van Rossum 114c1eabbb #Added prototype for PyObject_HasAttr() -- must've been an oversight. 1997-09-06 18:44:59 +00:00
Fred Drake 49bb0e32a0 Fix in trailing comment: PyDict_SetItemString() does *not* consume a reference
count, PyList_SetItem() does.  Very confusing!
1997-09-05 17:53:53 +00:00
Guido van Rossum 026de19906 Added PyImport_ImportModuleEx(name, globals, locals, fromlist); this
is like PyImport_ImporModule(name) but receives the globals and locals
dict and the fromlist arguments as well.  (The name is a char*; the
others are PyObject*s).
1997-09-05 07:11:32 +00:00
Guido van Rossum d7ed683a7e Inline PyObject_CallObject (Marc-Andre Lemburg). 1997-08-30 15:02:50 +00:00
Guido van Rossum 3d90af967d Added NoSite flag. 1997-08-29 22:34:00 +00:00
Barry Warsaw d5a0ff972d Added extern definition for -X flag variable. 1997-08-29 22:01:11 +00:00
Barry Warsaw 0596c2ac28 Declarations for two phase initialization and finalization functions
for the built-in module.
1997-08-29 21:57:07 +00:00
Barry Warsaw 392d8272bf Added externs for three new exceptions PyExc_StandardError,
PyExc_NumberError, and PyExc_LookupError.  Also added extern for
pre-instantiated exception instance PyExc_MemoryErrorInst.

Removed extern of obsolete exception PyExc_AccessError.
1997-08-29 21:56:07 +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
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 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 ef3138f9ad Moved assert.h to ../Parser directory 1997-08-19 12:07:22 +00:00
Guido van Rossum 9faabb8d23 Added prototype for PyImport_Import(). 1997-08-14 19:52:09 +00:00
Guido van Rossum 142eeb8339 cPickle release 0.3 from Jim Fulton 1997-08-13 03:14:41 +00:00
Guido van Rossum 3fb1aea0ae Added decls for stuff from myreadline. 1997-08-12 15:14:22 +00:00
Guido van Rossum 8e5e4461a8 Added prototype for various finalizers. 1997-08-12 14:57:21 +00:00
Guido van Rossum bb301c53ed Added prototype for PyGrammar_RemoveAccelerators(). 1997-08-12 14:57:08 +00:00
Guido van Rossum 15974ad5e6 Bump MS_DLL_ID to 1.5.0. 1997-08-12 14:48:03 +00:00
Guido van Rossum 1d529d1ecd Add a cast to the call to _Py_Dealloc in the expanded version of
Py_DECREF, to reduce the warnings when compiling with reference count
debugging on.  (There are still warnings for each call to
_Py_NewReference -- too bad.)
1997-08-05 02:30:44 +00:00
Guido van Rossum d085e88d3c Added Py_Malloc and friends as well as PyMem_Malloc and friends. 1997-08-05 01:59:22 +00:00
Guido van Rossum 29e46a9a12 Mass checkin (more to follow for other directories).
Introduce truly separate (sub)interpreter objects.  For now, these
must be used by separate threads, created from C.  See Demo/pysvr for
an example of how to use this.  This also rationalizes Python's
initialization and finalization behavior:

Py_Initialize() -- initialize the whole interpreter
Py_Finalize() -- finalize the whole interpreter

tstate = Py_NewInterpreter() -- create a new (sub)interpreter
Py_EndInterpreter(tstate) -- delete a new (sub)interpreter

There are also new interfaces relating to threads and the interpreter
lock, which can be used to create new threads, and sometimes have to
be used to manipulate the interpreter lock when creating or deleting
sub-interpreters.  These are only defined when WITH_THREAD is defined:

PyEval_AcquireLock() -- acquire the interpreter lock
PyEval_ReleaseLock() -- release the interpreter lock

PyEval_AcquireThread(tstate) -- acquire the lock and make the thread current
PyEval_ReleaseThread(tstate) -- release the lock and make NULL current

Other administrative changes:

- The header file bltinmodule.h is deleted.

- The init functions for Import, Sys and Builtin are now internal and
  declared in pythonrun.h.

- Py_Setup() and Py_Cleanup() are no longer declared.

- The interpreter state and thread state structures are now linked
  together in a chain (the chain of interpreters is a static variable
  in pythonrun.c).

- Some members of the interpreter and thread structures have new,
  shorter, more consistent, names.

- Added declarations for _PyImport_{Find,Fixup}Extension() to import.h.
1997-08-02 02:56:48 +00:00
Guido van Rossum 7a2d6112d9 Add cast to PyInt_AS_LONG macro, as suggested by Marc Lemburg. 1997-08-02 02:41:13 +00:00
Guido van Rossum 2981bc7a65 Add cast to PyFloat_AS_DOUBLE macro, as suggested by Marc Lemburg. 1997-08-02 02:40:58 +00:00
Guido van Rossum 766118525a Changed the patch level to 1.5a3, to avoid confusion with a2 (I'm not
ready for a release yet).
1997-07-19 23:46:59 +00:00
Guido van Rossum 57d8e3f1c7 Added declarations for Py_{Set,Get}ProgramName() and a bunch of other
Py_Get*() functions.
1997-07-19 19:50:52 +00:00
Guido van Rossum 5617f32c5c Added decl for PyInt_GetMax(). 1997-07-19 19:49:11 +00:00
Guido van Rossum a847889607 Moved PyEval_InitThreads to inside WITH_THREAD, where it belongs. 1997-07-19 19:27:30 +00:00
Guido van Rossum e6fb2043ce Got rid of "suppres printing" flag. 1997-07-19 19:26:38 +00:00
Guido van Rossum 618af4b3ef Include pystate.h earlier so it can be referenced by ceval.h. 1997-07-18 23:59:26 +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 4b11c74f7c Only add 1 byte to all malloc calls when it is known that malloc(0) or
realloc(p, 0) returns NULL.  See changes to configure script to be
checked in later.
1997-07-10 22:40:54 +00:00
Guido van Rossum 745b8cff08 flushline and writestring can now return an error 1997-05-22 22:23:46 +00:00
Guido van Rossum 59943ba718 Added Py_PROTO macros for SunOS 4.x /bin/cc. 1997-05-20 22:07:46 +00:00
Guido van Rossum c23ef0a6e8 Workaround for bug in Metrowerks MSL headers on 68K Macs (Jack) 1997-05-20 15:58:15 +00:00
Guido van Rossum d0c87ee6c4 Oops, another forgotten renaming: varobject -> PyVarObject. 1997-05-15 21:31:03 +00:00
Guido van Rossum 4346716962 Bump level to 1.5a2. 1997-05-14 21:41:46 +00:00
Guido van Rossum 2ec9031b55 Subsumed mappingobject.h in dictobject.h. 1997-05-13 21:23:32 +00:00
Guido van Rossum 6a33de9526 Get rid of obsolete ACCESS_MODE opcode. 1997-05-09 00:39:04 +00:00
Guido van Rossum 6778f257b7 Oops, rename2.h was included by some other headers. 1997-05-07 23:50:40 +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 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 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 4a43cc67db Remove sys_* defines that are internal only and about to disappear 1997-05-05 20:46:18 +00:00
Guido van Rossum 84bf42531c Finally deleted this obsolete crud. 1997-05-02 04:01:08 +00:00
Guido van Rossum d27b4f2a3f Several oopsies -- Py_ALLOBJECTS_H -> Py_PYTHON_H, temporarily removed
pystate.h (to be restored later when that code is debugged), removed
accessobject.h.
1997-05-02 04:00:11 +00:00
Guido van Rossum 174f95adf7 Moved allobjects.h to Python.h (without rename2.h).
allobjects.h disappears -- old-style extensions must include Python.h
and rename2.h.
1997-05-02 03:55:52 +00:00
Guido van Rossum 87490eb3b0 Renamed inittab. 1997-04-29 20:31:59 +00:00
Guido van Rossum e601c0f55d Added new name for inittab! 1997-04-29 16:23:44 +00:00
Guido van Rossum 63c35e5407 Remove macros that are only used for cgensupport.[ch].
Fixed typo in PyArg_VaParse (not PyArgs_*).
1997-04-29 16:21:39 +00:00
Guido van Rossum 92e8782217 Moved cgensupport.h to Modules (awaiting oblivion). 1997-04-29 16:08:53 +00:00
Guido van Rossum 1818b7702b Moved rename2's macros relevant to this module here and added comment
about the file's obsolescence.
1997-04-29 15:35:28 +00:00
Guido van Rossum 45c3aaba56 Got rid of the static decl of PyCObject_Import, which was a 1.4
compatibility hack.
1997-04-09 18:04:08 +00:00
Guido van Rossum 0a73dd5f35 Changed the way the C API was exported. Jim Fulton. 1997-04-09 17:34:28 +00:00
Guido van Rossum 8ecd1ad785 Added assert grammar. 1997-04-02 05:24:08 +00:00
Guido van Rossum 6fa4466cec Added AssertionError. 1997-04-02 05:22:53 +00:00
Guido van Rossum 94dbd99483 Remove ConflictError (which was also removed from bltinmodule.c, even
though the checkin message failed to note that).
1997-03-31 17:19:40 +00:00
Guido van Rossum e053c67780 Remove err_input -- there is no such global! 1997-03-14 05:09:30 +00:00
Guido van Rossum f0958064f9 Remove redundant references to thread stuff -- long, long ago, there
was some locking code in this file that needed it...
1997-03-14 04:25:22 +00:00
Guido van Rossum 74277916a9 Add Macros defining new names for all external symbols. 1997-03-14 04:24:08 +00:00
Guido van Rossum 1f06beeedd Change PyFPE_END_PROTECT to PyFPE_END_PROTECT(v). v should be the
last variable to which a floating point expression is assigned.  The
macro passes its address to a dummy function so that the optimizer
can't delay calculating its value until after the macro.
1997-03-14 04:23:42 +00:00
Guido van Rossum f39fc43f31 A few comment alignment and clarifications. 1997-03-04 18:31:47 +00:00
Guido van Rossum e9e47796c8 Add global Py_OptimizeFlag. 1997-03-03 19:13:54 +00:00
Guido van Rossum 7d4266ed5a Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.h, new exception FloatingPointError.
1997-02-14 22:53:12 +00:00
Guido van Rossum 1ca407f3e4 Fix the comments for bitwise and/or. 1997-02-14 22:51:40 +00:00
Guido van Rossum 5c4998b236 Added decl for Py_FdIsInteractive. 1997-02-14 19:51:34 +00:00
Guido van Rossum 3f3a2686b8 Added decl for Py_InteractiveFlag. 1997-02-14 19:51:09 +00:00
Guido van Rossum c4193f1547 Added prototype for PyErr_Format(exception, formatstring, ...) -> NULL. 1997-02-14 17:10:25 +00:00
Guido van Rossum 36280a7772 Added PyArg_ParseTupleAndKeywords() prototype. 1997-02-14 16:36:35 +00:00
Guido van Rossum fb76f1af9b djgpp support. 1997-02-14 16:36:08 +00:00
Guido van Rossum 767579854c Add co_firstlineno and co_lnotab, for the line number table generated
by the compiler (in lieu of SET_LINENO instructions).
1997-01-24 03:41:09 +00:00
Guido van Rossum e0e696282f Added PyCObject_Import. 1997-01-22 20:48:48 +00:00
Guido van Rossum c1ef39f795 Bump version to 1.5a1. 1997-01-22 03:46:13 +00:00
Guido van Rossum cdf578ebaf New lay-out of frame object, for fewer mallocs.
See frameobject.c checkin message.
1997-01-20 04:16:40 +00:00
Guido van Rossum ee5cf9b672 Bump API version due to the various speedup hacks. 1997-01-18 07:54:03 +00:00
Guido van Rossum 1e6e9a2368 Two speedup hacks. Caching the hash saves recalculation of a string's
hash value.  Interning strings (which requires hash caching) tries to
ensure that only one string object with a given value exists, so
equality tests are one pointer comparison.  Together, these can speed
the interpreter up by as much as 20%.  Each costs the size of a long
or pointer per string object.  In addition, interned strings live
until the end of times.  If you are concerned about memory footprint,
simply comment the #define out here (and rebuild everything!).
1997-01-18 07:53:23 +00:00
Guido van Rossum 3f6e408a31 Add co_stacksize field to codeobject structure, and stacksize argument
to PyCode_New() argument list.  Also add CO_MAXBLOCKS constant
indicating the maximum static nesting supported by the compiler.
1997-01-17 20:59:26 +00:00
Guido van Rossum d81a1baa5f Jim's latest version 1997-01-06 22:50:12 +00:00
Barry Warsaw 9c5494a1b9 added PyTuple_GET_SIZE macro 1997-01-06 22:44:27 +00:00
Barry Warsaw accfb849f9 added PyString_GET_SIZE macro
for both PyString_GET_SIZE and PyString_AS_STRING, cast first argument
to a PyStringObject*
1997-01-06 22:42:50 +00:00
Barry Warsaw 1f2bd07aed added PyList_GET_SIZE macro
for both PyList_GET_SIZE and PyList_GET_ITEM, cast first argument to a
PyListObject*
1997-01-06 22:42:00 +00:00
Guido van Rossum 53756b1097 Added PyLong_FromUnsignedLong() and PyLong_AsUnsignedLong(). 1997-01-03 17:14:46 +00:00
Barry Warsaw f3f41a9e57 Added declaration for PyErr_SetInterrupt. 1997-01-03 00:15:03 +00:00
Guido van Rossum 408027ea46 Rename DEBUG macro to Py_DEBUG 1996-12-30 16:17:54 +00:00
Guido van Rossum caf783793d Added remaining declarations needed/used in glmodule.c; keeps gcc -Wall happy. 1996-12-10 15:41:19 +00:00
Guido van Rossum 067998f35e Add const to error and newstring functions 1996-12-10 15:33:34 +00:00
Guido van Rossum 049cd90b93 Jim F's brainchild 1996-12-05 23:30:48 +00:00
Guido van Rossum 2adf06b04c Added missing for PySequence_List. 1996-12-05 21:48:50 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00