summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve the message about metatype/metaclass conflicts.Guido van Rossum2003-04-231-1/+4
|
* Sigh. The crucial change was still missing from the previousGuido van Rossum2003-04-161-1/+1
| | | | checkin. :-(
* - super() no longer ignores data descriptors, except __class__. SeeGuido van Rossum2003-04-161-4/+10
| | | | | the thread started at http://mail.python.org/pipermail/python-dev/2003-April/034338.html
* Fix three (!) object leaks in the code for assignment to __bases__.Guido van Rossum2003-04-151-1/+3
|
* Ouch, it's Carlo Verre, not Verre Carlo.Guido van Rossum2003-04-151-1/+1
|
* Close off the "Verre Carlo hack" as discussed on python-dev.Guido van Rossum2003-04-141-0/+22
|
* super_getattro(): kill some dead code; explain a mystery.Guido van Rossum2003-04-141-18/+4
|
* Missing DECREF.Jeremy Hylton2003-04-091-0/+1
|
* SF bug #699934: Obscure error messageRaymond Hettinger2003-04-061-4/+2
| | | | | mwh pointed out that the error message did not make sense if obtained by rearranging the bases.
* Refactoring: rename update_these_slots() into update_subclasses() andGuido van Rossum2003-03-241-47/+68
| | | | | generalize to take a callback function and a void * data argument. This might come in handy later... :-)
* Improved new Py_TRACE_REFS gimmicks.Tim Peters2003-03-231-4/+1
| | | | | | | | | | | Arranged that all the objects exposed by __builtin__ appear in the list of all objects. I basically peed away two days tracking down a mystery leak in sys.gettotalrefcount() in a ZODB app (== tons of code), because the object leaking the references didn't appear in the sys.getobjects(0) list. The object happened to be False. Now False is in the list, along with other popular & previously missing leak candidates (like None). Alas, we still don't have a choke point covering *all* Python objects, so the list of all objects may still be incomplete.
* slot_sq_contains(): This leaked a reference to the result of callingTim Peters2003-03-231-11/+12
| | | | | | __contains__(). Bugfix candidate.
* Refactored some of the Py_TRACE_REFS code. New private API functionTim Peters2003-03-231-0/+12
| | | | | | | _Py_AddToAllObjects() that simply inserts an object at the front of the doubly-linked list of all objects. Changed PyType_Ready() (the closest thing we've got to a choke point for type objects) to call that.
* SF bug #699934: Obscure error messageRaymond Hettinger2003-03-121-1/+4
| | | | Clarify error message for mro conflicts.
* - The extended type structure used for heap types (new-styleGuido van Rossum2003-03-071-49/+34
| | | | | classes defined by Python code using a class statement) is now exported from object.h as PyHeapTypeObject. (SF patch #696193.)
* Implementing the salient parts of __reduce_ex__ in C.Guido van Rossum2003-02-211-6/+229
| | | | | | | This still falls back to helpers in copy_reg for: - pickle protocols < 2 - calculating the list of slot names (done only once per class) - the __newobj__ function (which is used as a token but never called)
* Introducing __reduce_ex__, which is called with a protocol number argumentGuido van Rossum2003-02-181-4/+10
| | | | | if it exists in preference over __reduce__. Now Tim can go implement this in cPickle.c.
* Removed unreferenced label.Tim Peters2003-02-181-2/+1
|
* The recent changes to super(), in particular supercheck(), broke whenGuido van Rossum2003-02-181-9/+7
| | | | | | | | using super() for an instance in a metaclass situation. Because the class was a metaclass, the instance was a class, and hence the PyType_Check() branch was taken. But this branch didn't apply. Make it so that if this branch doesn't apply, the other branch is still tried. All tests pass.
* SF patch #685738 by Michael Stone.Guido van Rossum2003-02-131-1/+19
| | | | | | | This changes the default __new__ to refuse arguments iff tp_init is the default __init__ implementation -- thus making it a TypeError when you try to pass arguments to a constructor if the class doesn't override at least __init__ or __new__.
* Implement another useful feature for proxies: in super(X, x), x mayGuido van Rossum2003-02-121-17/+83
| | | | now be a proxy for an X instance, as long as issubclass(x.__class__, X).
* Fix from SF #681367: inherit tp_as_buffer. This only applies to CGuido van Rossum2003-02-111-0/+2
| | | | types -- Python types already inherited this.
* Inline create_specialmethod() -- since METH_CLASS is done differentlyGuido van Rossum2003-02-111-15/+5
| | | | | now, it was only called once, and its existence merely obfuscates the control flow.
* Add basic arg sanity checking to wrap_descr_get(). This is calledGuido van Rossum2003-02-111-0/+9
| | | | | | | when Python code calls a descriptor's __get__ method. It should translate None to NULL in both argument positions, and insist that at least one of the argument positions is not NULL after this transformation.
* Get rid of the "bozo" __getstate__ that was inserted when __slots__Guido van Rossum2003-02-101-32/+0
| | | | | | was used. This simplifies some logic in copy_reg.py (used by pickling). It also broke a test, but this was rewritten to test the new feature. :-)
* Comment typo fixAndrew M. Kuchling2003-02-061-1/+1
|
* Fix for SF #668433. I'm not explaining it here; ample comments are inGuido van Rossum2003-02-051-0/+93
| | | | the code.
* Fix for SF bug #642358: only provide a new with a __dict__ orGuido van Rossum2003-01-071-4/+24
| | | | | __weaklist__ descriptor if we added __dict__ or __weaklist__, respectively. With unit test.
* Add a refinement to SLOT1BINFULL() that fixes the problem reported inGuido van Rossum2003-01-061-1/+36
| | | | | SF bug #623669: only try (e.g.) __rdiv__ before __div__ if the right class actually overrides it.
* Fix an out-of-bound index in pmerge() discovered by Zooko (SF bugGuido van Rossum2002-12-311-1/+2
| | | | | | | 645404). I'm not 100% sure this is the right fix, so I'll keep the bug report open for Samuele, but this fixes the index error and passes the test suite (and I can't see why it *shouldn't* be the right fix :-).
* Punctuation fix.Raymond Hettinger2002-12-141-2/+2
|
* Tighten the tests for assignment to __bases__: disallow empty tuple.Guido van Rossum2002-12-131-0/+6
|
* SF 548651: Fix the METH_CLASS implementation.Tim Peters2002-12-091-1/+1
| | | | | | | Most of these patches are from Thomas Heller, with long lines folded by Tim. The change to test_descr.py is from Guido. See the bug report. Not a bugfix candidate -- METH_CLASS is new in 2.3.
* slot_nb_nonzero(): Another leak uncovered by the sandbox datetimeTim Peters2002-12-071-28/+27
| | | | | | | tests. I found the logic too confusing to follow here, so rewrote more than was likely absolutely necessary. Bugfix candidate.
* slot_tp_hash(): In the normal path, this leaked a reference to theTim Peters2002-12-061-3/+3
| | | | | | integer hash object returned by __hash__(). This accounts for some of the "mystery leaks" in the sandbox datetime tests, but probably not all of them.
* Nudge getting __module__ and __name__ for new-style classes so thatMichael W. Hudson2002-11-271-17/+24
| | | | | | | the results of *setting* __name__ are not so surprising. If people can suggest more tests, that'd be grand, or is what's there sufficient?
* I don't know why staring at the email to python-checkins made meMichael W. Hudson2002-11-271-9/+14
| | | | | | | see problems with my code that I didn't see before the checkin, but: When a subtype .mro() fails, we need to reset the type whose __bases__ are being changed, too. Fix + test.
* Readjustments to the way we cope with exceptions from subclasses'Michael W. Hudson2002-11-271-10/+32
| | | | | | mro() methods. Now any exception aborts the whole __bases__ change. And more tests.
* I had the inheritance cycle stuff backwards. Oops!Michael W. Hudson2002-11-271-4/+6
|
* Initialize a variable. Hope this makes things work for Guido.Michael W. Hudson2002-11-261-1/+1
| | | | It's odd that gcc on my ibook didn't complain about this.
* This is my patch:Michael W. Hudson2002-11-261-34/+277
| | | | | | | | | | | | [ 635933 ] make some type attrs writable Plus a couple of extra tests beyond what's up there. It hasn't been as carefully reviewed as it perhaps should, so all readers are encouraged, nay exhorted, to give this a close reading. There are still a couple of oddities related to assigning to __name__, but I intend to solicit python-dev's opinions on these.
* A tweaked version of Jeremy's patch #642489, to produce better errorGuido van Rossum2002-11-251-4/+138
| | | | | | messages about MRO conflicts. (The tweaks include correcting spelling errors, some refactoring to get the name of classic classes, and a style nit or two.)
* Repaired illegal syntax most compilers probably let slide (but MSVCTim Peters2002-11-141-1/+1
| | | | treats as a fatal error).
* Use the new C3 MRO algorithm, implemented by Samuele Pedroni (SF patchGuido van Rossum2002-11-141-74/+105
| | | | | | | | | | 619475; also closing SF bug 618704). I tweaked his code a bit for style. This raises TypeError for MRO order disagreements, which is an improvement (previously these went undetected) but also a degradation: what if the order disagreement doesn't affect any method lookups? I don't think I care.
* Fix SF # 624982, Potential AV in slot_sq_item, by Greg ChapmanNeal Norwitz2002-10-181-1/+5
| | | | Don't crash when getting value of a property raises an exception
* Sigh. That wasn't a memory leak, that was Guido committing beforeGuido van Rossum2002-10-181-5/+2
| | | | running tests. Withdraw 2.183 and its backport.
* Fix memory leak in add_subclass() found by NealN with valgrind.Guido van Rossum2002-10-181-2/+5
| | | | Will backport.
* For some reason (probably cut and paste), __ipow__ for new-styleGuido van Rossum2002-10-151-2/+2
| | | | | | | | | | | | | | classes was called with three arguments. This makes no sense, there's no way to pass in the "modulo" 3rd argument as for __pow__, and classic classes don't do this. [SF bug 620179] I don't want to backport this to 2.2.2, because it could break existing code that has developed a work-around. Code in 2.2.2 that wants to use __ipow__ and wants to be forward compatible with 2.3 should be written like this: def __ipow__(self, exponent, modulo=None): ...
* Don't drop old slots if _unicode_to_string did not change anything.Martin v. Löwis2002-10-141-2/+4
|
* Allow Unicode strings in __slots__, converting them to byte strings.Martin v. Löwis2002-10-141-0/+39
|