Commit Graph

92 Commits

Author SHA1 Message Date
Thomas Wouters 7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Vladimir Marangozov 8dc19f672b Propagate the current exception in get_inprogress_dict() -- it doesn't
need to be cleared.
2000-07-12 23:39:38 +00:00
Jeremy Hylton 6253f83b0a change abstract size functions PySequence_Size &c.
add macros for backwards compatibility with C source
2000-07-12 12:56:19 +00:00
Jack Jansen 28fc880e9a Include macglue.h on the macintosh, so function prototypes are in scope. 2000-07-11 21:47:20 +00:00
Fred Drake 100814dc44 ANSI-fication of the sources. 2000-07-09 15:48:49 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Fredrik Lundh 2a1e060619 - changed __repr__ to use "unicode escape" encoding for unicode
strings, instead of the default encoding.
  (see "minidom" thread for discussion, and also patch #100706)
2000-07-08 17:43:32 +00:00
Skip Montanaro 4cbc9f7650 delete unused local variable from _PyTrash_deposit_object 2000-07-08 12:06:36 +00:00
Marc-André Lemburg 891bc65486 If auto-conversion fails, the Unicode codecs will return NULL.
This is now checked and the error passed on to the caller.
2000-07-03 09:57:53 +00:00
Fredrik Lundh efecc7d05b changed repr and str to always convert unicode strings
to 8-bit strings, using the default encoding.
2000-07-01 14:31:09 +00:00
Guido van Rossum 4cc6ac7b87 Neil Schemenauer: small fixes for GC 2000-07-01 01:00:38 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Fred Drake a44d353e2b Trent Mick <trentm@activestate.com>:
The common technique for printing out a pointer has been to cast to a long
and use the "%lx" printf modifier. This is incorrect on Win64 where casting
to a long truncates the pointer. The "%p" formatter should be used instead.

The problem as stated by Tim:
> Unfortunately, the C committee refused to define what %p conversion "looks
> like" -- they explicitly allowed it to be implementation-defined. Older
> versions of Microsoft C even stuck a colon in the middle of the address (in
> the days of segment+offset addressing)!

The result is that the hex value of a pointer will maybe/maybe not have a 0x
prepended to it.


Notes on the patch:

There are two main classes of changes:
- in the various repr() functions that print out pointers
- debugging printf's in the various thread_*.h files (these are why the
patch is large)


Closes SourceForge patch #100505.
2000-06-30 15:01:00 +00:00
Jeremy Hylton c5007aa5c3 final patches from Neil Schemenauer for garbage collection 2000-06-30 05:02:53 +00:00
Fred Drake 13634cf7a4 This patch addresses two main issues: (1) There exist some non-fatal
errors in some of the hash algorithms. For exmaple, in float_hash and
complex_hash a certain part of the value is not included in the hash
calculation. See Tim's, Guido's, and my discussion of this on
python-dev in May under the title "fix float_hash and complex_hash for
64-bit *nix"

(2) The hash algorithms that use pointers (e.g. func_hash, code_hash)
are universally not correct on Win64 (they assume that sizeof(long) ==
sizeof(void*))

As well, this patch significantly cleans up the hash code. It adds the
two function _Py_HashDouble and _PyHash_VoidPtr that the various
hashing routine are changed to use.

These help maintain the hash function invariant: (a==b) =>
(hash(a)==hash(b))) I have added Lib/test/test_hash.py and
Lib/test/output/test_hash to test this for some cases.
2000-06-29 19:17:04 +00:00
Guido van Rossum ad89bbcd88 Trent Mick: change a few casts for Win64 compatibility. 2000-06-28 21:57:18 +00:00
Jeremy Hylton 99a8f90874 raise TypeError when PyObject_Get/SetAttr called with non-string name 2000-06-23 14:36:32 +00:00
Jeremy Hylton a251ea0680 the PyDict_SetItem does not borrow a reference, so we need to decref
reported by Mark Hammon
2000-06-09 16:20:39 +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 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
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 b244f6950b Marc-Andre Lemburg:
* TypeErrors during comparing of mixed type arguments including
  a Unicode object are now masked (just like they are for all
  other combinations).
2000-04-10 13:42:33 +00:00
Guido van Rossum 5db862dd0c Skip Montanaro: add string precisions to calls to PyErr_Format
to prevent possible buffer overruns.
2000-04-10 12:46:51 +00:00
Guido van Rossum 13ff8eb493 Christian Tismer:
Added "better safe than sorry" patch to the new
trashcan code in object.c, to ensure that tstate
is not touched when it might be undefined.
2000-03-25 18:39:19 +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 4c08d554b9 Many changes for Unicode, by Marc-Andre Lemburg. 2000-03-10 22:55: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
Guido van Rossum 687ef6e70b On Linux, one sometimes sees spurious errors after interrupting
previous output.  Call clearerr() to prevent past errors affecting our
ferror() test later, in PyObject_Print().  Suggested by Marc Lemburg.
2000-01-12 16:28:58 +00:00
Guido van Rossum b4db1944c4 When comparing objects, always check that tp_compare is not NULL
before calling it.  This check was there when the objects were of the
same type *before* coercion, but not if they initially differed but
became the same *after* coercion.
1998-07-21 21:56:41 +00:00
Guido van Rossum cd5a5f627a When comparing objects of different types (which is done by comparing
the type names), make sure that numeric objects are considered smaller
than all other objects, by forcing their name to "".
1998-06-09 18:58:44 +00:00
Guido van Rossum 1c4f458099 In PyObject_IsTrue(), don't call function pointers that are NULL
(nb_nonzero, mp_length, sq_length).
1998-05-22 00:53:24 +00:00
Guido van Rossum 9b00dfae75 If USE_STACKCHECK is defined use PyOS_CheckStack() in the repr and str
routines. This catches a slightly different set of crashes than the
recursive-repr fix.
(Jack)
1998-04-28 16:06:54 +00:00
Guido van Rossum 565798d493 Be less naive about null characters in an object's repr(). 1998-04-21 22:25:01 +00:00
Guido van Rossum eb90946978 Some robustness checks in Py_ReprLeave() in the unlikely event someone
has messed with the dictionary or list.
1998-04-11 15:17:34 +00:00
Guido van Rossum 8661036cb8 Add implementations of Py_Repr{Enter,Leave}.
(Jeremy will hardly recognize his patch :-)
1998-04-10 22:32:46 +00:00
Guido van Rossum c3d3f9692d Add PyObject_Not(). 1998-04-09 17:53:59 +00:00
Guido van Rossum db9351643d Instead of "attribute-less object", issue an error message that
contains the type of the object and name of the attribute.
1998-01-19 22:16:36 +00:00
Guido van Rossum 242c64256c Add a new function PyNumber_CoerceEx() which works just like
PyNumber_Coerce() except that when the coercion can't be done and no
other exceptions happen, it returns 1 instead of raising an
exception.

Use this function in PyObject_Compare() to avoid raising an exception
simply because two objects with numeric behavior can't be coerced to a
common type; instead, proceed with the non-numeric default comparison.

Note that this is a somewhat questionable practice -- comparisons for
numeric objects shouldn't default to random behavior like this, but it
is required for backward compatibility.  (Case in point, it broke
comparison of kjDict objects to integers in Aaron Watters' kjbuckets
extension.)  A correct fix (for python 2.0) should involve a different
definiton of comparison altogether.
1997-11-19 16:03:17 +00:00
Guido van Rossum ea46e4d93c Fix mixup about PyErr_NoMemory() prototype. 1997-08-12 14:54:54 +00:00
Guido van Rossum e09fb55f29 Added _Py_ResetReferences(), if tracing references.
In _Py_PrintReferences(), no longer suppress once-referenced string.

Add Py_Malloc and friends and PyMem_Malloc and friends (malloc
wrappers for third parties).
1997-08-05 02:04:34 +00:00
Guido van Rossum c8b6df9004 PyObject_Compare can raise an exception now. 1997-05-23 00:06:51 +00:00
Guido van Rossum 98ff96adba Moved PyObject_{Get,Set}Attr here (from dictobject) and add PyObject_HasAttr. 1997-05-20 18:34:44 +00:00
Guido van Rossum d0c87ee6c4 Oops, another forgotten renaming: varobject -> PyVarObject. 1997-05-15 21:31:03 +00:00
Guido van Rossum c0b618a2cc Quickly renamed the last directory. 1997-05-02 03:12:38 +00:00
Guido van Rossum c6d0670f1b Intern the strings created in getattr() and setattr(). 1997-01-18 07:57:16 +00:00
Guido van Rossum da9c2710c7 Make gcc -Wall happy 1996-12-05 21:58:58 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum b7fc304109 Correct typo in setattr: return -1 for error, not NULL 1996-09-11 22:51:25 +00:00
Guido van Rossum aacdc9da75 Define reference count admin debug functions to return void. 1996-08-12 21:32:12 +00:00