Commit Graph

276 Commits

Author SHA1 Message Date
Andrew M. Kuchling
e0235ae1a9 [Backport r42951 | guido.van.rossum]
Fix three nits found by Coverity, adding null checks and comments.

[This commit only makes two changes.  One change in the original patch
 is just adding a comment, and another adds a 'base != NULL' check to
 silence Coverity, but a comment adds that that base is never going to
 be NULL.  I didn't backport that change. --amk]
2006-10-09 18:19:01 +00:00
Andrew M. Kuchling
8a28c16430 [Backport r50743 | neal.norwitz]
Handle allocation failures gracefully.  Found with failmalloc.
Many (all?) of these could be backported.
2006-10-05 18:08:58 +00:00
Georg Brandl
adf8a1d0cb Patch #1567691: super() and new.instancemethod() now don't accept
keyword arguments any more (previously they accepted them, but didn't
use them).
 (backport from rev. 52058)
2006-09-30 08:43:35 +00:00
Fred Drake
588b0e26db SF patch #1534048 (bug #1531003): fix typo in error message 2006-08-04 05:16:04 +00:00
Armin Rigo
53730fe64c Backport of r47061. 2006-06-21 22:11:16 +00:00
Georg Brandl
d9ca66f2b2 Backport: Fix missing NULL checks after PyTuple_New, PyList_New, PyDict_New 2006-03-17 19:04:15 +00:00
Armin Rigo
0b61a45223 Backported from r41842. 2006-02-20 10:21:14 +00:00
Guido van Rossum
b693c1cea0 - On 64-bit platforms, when __len__() returns a value that cannot be
represented as a C int, raise OverflowError.
(Will forward-port.)
2005-09-20 16:36:07 +00:00
Anthony Baxter
d855c5888e fix int.__divmod__.__doc__ 2005-06-03 14:13:47 +00:00
Raymond Hettinger
ace3f61994 Convert "__init__ should return None" from an exception to a warning. 2005-03-04 04:47:04 +00:00
Raymond Hettinger
2a06df6258 SF bug #1155938: Missing None check for __init__(). 2005-03-03 16:55:53 +00:00
Tim Peters
f4aca755bc A static swapped_op[] array was defined in 3 different C files, & I think
I need to define it again.  Bite the bullet and define it once as an
extern, _Py_SwappedOp[].
2004-09-23 02:39:37 +00:00
Martin v. Löwis
bf608750ad Patch #980082: Missing INCREF in PyType_Ready. 2004-08-18 13:16:54 +00:00
Michael W. Hudson
3f3b66823f Repair the same thinko in two places about handling of _Py_RefTotal in
the case of __del__ resurrecting an object.
This makes the apparent reference leaks in test_descr go away (which I
expected) and also kills off those in test_gc (which is more surprising
but less so once you actually think about it a bit).
2004-08-03 10:21:03 +00:00
Raymond Hettinger
8d726eef96 Cosmetic spacing fix. 2004-06-25 22:24:35 +00:00
Raymond Hettinger
d56cbe57b8 Fix leak found by Eric Huss. 2004-06-25 22:17:39 +00:00
Anthony Baxter
3ecdb250af Fix for bug #966623 - classes created with type() in an exec(, {}) don't
have a __module__. Test for this case.

Bugfix candidate, will backport.
2004-06-11 14:41:18 +00:00
Hye-Shik Chang
ff365c931b Get rid of gcc warning. 2004-03-25 16:37:03 +00:00
Phillip J. Eby
91a968af76 Ensure super() lookup of descriptor from classmethod works (SF #743627) 2004-03-25 02:19:34 +00:00
Jim Fulton
8a1a594590 Fixed a bug in object.__reduce_ex__ (reduce_2) when using protocol
2.  Failure to clear the error when attempts to get the __getstate__
  attribute fail caused intermittent errors and odd behavior.
2004-02-08 04:21:26 +00:00
Raymond Hettinger
6a8bbdbe7b Improve argument checking speed. 2003-12-13 15:21:55 +00:00
Raymond Hettinger
8f5cdaa784 * Added a new method flag, METH_COEXIST.
* Used the flag to optimize set.__contains__(), dict.__contains__(),
  dict.__getitem__(), and list.__getitem__().
2003-12-13 11:26:12 +00:00
Tim Peters
0bd743cee1 subtype_dealloc(): Simplified overly contorted retracking logic. With
this change, I think subtype_dealloc is actually a smidgen less obscure
than it was in 2.3 -- we got rid of a negation in an "if" <wink>.
2003-11-13 22:50:00 +00:00
Tim Peters
f7f9e9966b subtype_dealloc(): A more complete fix for critical bug 840829 +
expanded the test case with a piece that needs the more-complete fix.

I'll backport this to 2.3 maint.
2003-11-13 21:59:32 +00:00
Tim Peters
add09b4149 SF bug 840829: weakref callbacks and gc corrupt memory.
subtype_dealloc():  This left the dying object exposed to gc, so that
if cyclic gc triggered during the weakref callback, gc tried to delete
the dying object a second time.  That's a disaster.  subtype_dealloc()
had a (I hope!) unique problem here, as every normal dealloc routine
untracks the object (from gc) before fiddling with weakrefs etc.  But
subtype_dealloc has obscure technical reasons for re-registering the
dying object with gc (already explained in a large comment block at
the bottom of the function).

The fix amounts to simply refraining from reregistering the dying object
with gc until after the weakref callback (if any) has been called.

This is a critical bug (hard to predict, and causes seemingly random
memory corruption when it occurs).  I'll backport it to 2.3 later.
2003-11-12 20:43:28 +00:00