Commit Graph

462 Commits

Author SHA1 Message Date
Barry Warsaw c094ac856f Now that standard exceptions are builtin, we don't need two phase init
or fini of the builtin module.

_PyBuiltin_Init_1 => _PyBuiltin_Init
_PyBuiltin_Init_2 removed
_PyBuiltin_Fini_1 removed
_PyBuiltin_Fini_2 removed

These functions are used to initialize the _exceptions module.

init_exceptions added
fini_exceptions added
2000-05-25 23:05:36 +00:00
Guido van Rossum 98b0404a0e Removing thread.h -- it has been obsolete for quite a while. 2000-05-12 14:21:10 +00:00
Guido van Rossum 71260b846e Added math.rint() -- round according to current IEEE754 mode 2000-05-11 18:19:42 +00:00
Fred Drake cb093fe890 M.-A. Lemburg <mal@lemburg.com>:
Added PyUnicode_GetDefaultEncoding() and
PyUnicode_GetDefaultEncoding() APIs.
2000-05-09 19:51:53 +00:00
Fred Drake 3ac3edcf95 M.-A. Lemburg <mal@lemburg.com>:
Added documentation and the missing PyCodec_StreamWriter API.
2000-05-09 19:51:10 +00:00
Guido van Rossum 7c36ada115 Trent Mick:
Add declaration of PyEval_SliceIndex().
2000-05-08 14:04:54 +00:00
Guido van Rossum 07bd90e92d Andy Dustman: add GNU pth user-space thread support. 2000-05-08 13:41:38 +00:00
Guido van Rossum 3a03d4c4c7 Add two scenarios by Vladimir Marangozov that show how to use your own
allocator.
2000-05-05 15:36:09 +00:00
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