summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_descr.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix warnings about object.__init__() signature.Guido van Rossum2007-04-021-1/+0
| | | | | | Two (test_array and test_descr) were bug IMO; the third (copy_reg) is a work-around which recognizes that object.__init__() doesn't do anything.
* Patch #1623563: allow __class__ assignment for classes with __slots__.Žiga Seilnacht2007-03-161-0/+45
| | | | | The old and the new class are still required to have the same slot names, but the order in which they are specified is not relevant.
* Patch #1680015: Don't modify __slots__ tuple if it contains an unicodeŽiga Seilnacht2007-03-141-0/+23
| | | | | name. Remove a reference leak that happened if the name could not be converted to string. Will backport.
* Whitespace normalization.Tim Peters2007-03-121-2/+2
|
* Patch #1674228: when assigning a slice (old-style), check for theGeorg Brandl2007-03-051-0/+14
| | | | sq_ass_slice instead of the sq_slice slot.
* Add checking for a number of metaclass error conditions.Jeremy Hylton2007-02-271-45/+103
| | | | | | | | | | | | | | | | | | | | | | | We add some new rules that are required for preserving internal invariants of types. 1. If type (or a subclass of type) appears in bases, it must appear before any non-type bases. If a non-type base (like a regular new-style class) occurred first, it could trick type into allocating the new class an __dict__ which must be impossible. 2. There are several checks that are made of bases when creating a type. Those checks are now repeated when assigning to __bases__. We also add the restriction that assignment to __bases__ may not change the metaclass of the type. Add new tests for these cases and for a few other oddball errors that were no previously tested. Remove a crasher test that was fixed. Also some internal refactoring: Extract the code to find the most derived metaclass of a type and its bases. It is now needed in two places. Rewrite the TypeError checks in test_descr to use doctest. The tests now clearly show what exception they expect to see.
* Fix the line to what is my guess at the original author's meaning.Armin Rigo2007-02-121-1/+1
| | | | | (The line has no effect anyway, but is present because it's customary call the base class __init__).
* a test for an error condition not covered by existing testsMichael W. Hudson2006-11-231-0/+7
| | | | (noticed this when writing the equivalent code for pypy)
* Patch #1567691: super() and new.instancemethod() now don't acceptGeorg Brandl2006-09-301-0/+7
| | | | | keyword arguments any more (previously they accepted them, but didn't use them).
* Change fix for segfaulting property(), add a NEWS entry and a test.Georg Brandl2006-08-041-0/+10
|
* Put method-wrappers into trashcan. Fixes #927248.Martin v. Löwis2006-07-031-0/+8
|
* An object with __call__ as an attribute, when called, will have that ↵Brett Cannon2006-06-091-0/+16
| | | | | | attribute checked for __call__ itself, and will continue to look until it finds an object without the attribute. This can lead to an infinite recursion. Closes bug #532646, again. Will be backported.
* (arre, arigo) SF bug #1350060Armin Rigo2006-06-081-1/+14
| | | | | | Give a consistent behavior for comparison and hashing of method objects (both user- and built-in methods). Now compares the 'self' recursively. The hash was already asking for the hash of 'self'.
* subclasspropagation(): Squash two more bogus hash(x) == id(x)Tim Peters2006-04-111-2/+2
| | | | | | | tests. Alas, because only the "x86 OpenBSD trunk" buildbot fails these tests, and test_descr stops after the first failure, there's no sane way for me to fix these short of fixing one and then waiting for the buildbot to reveal the next one.
* specials(): squash another incorrect hash(x) == id(x)Tim Peters2006-04-111-1/+6
| | | | | | test. Add some lines that at least invoke the default __hash__, although there's nothing to check there beyond that they don't blow up.
* Huh. This belonged with the last checkin -- no idea why svnTim Peters2006-04-111-1/+0
| | | | didn't commit it.
* Patch #1434038: property() now uses the getter's docstring if there isGeorg Brandl2006-03-081-0/+12
| | | | | no "doc" argument given. This makes it possible to legitimately use property() as a decorator to produce a read-only property.
* PEP 352 implementation. Creates a new base class, BaseException, which has anBrett Cannon2006-03-011-26/+0
| | | | | | | | | added message attribute compared to the previous version of Exception. It is also a new-style class, making all exceptions now new-style. KeyboardInterrupt and SystemExit inherit from BaseException directly. String exceptions now raise DeprecationWarning. Applies patch 1104669, and closes bugs 1012952 and 518846.
* Add test for classmethod ./. keyword args.Georg Brandl2006-02-211-0/+8
|
* Whitespace normalization.Tim Peters2005-12-301-1/+1
|
* SF bug #1153075: "PyXxx_Check(x) trusts x->ob_type->tp_mro".Armin Rigo2005-12-291-0/+31
| | | | | A patch by mwh to check that user-defined mro's are reasonable enough.
* SF patch #1390657:Armin Rigo2005-12-291-0/+72
| | | | | | | | | | | | | | | | | * set sq_repeat and sq_concat to NULL for user-defined new-style classes, as a way to fix a number of related problems. See test_descr.notimplemented()). One of these problems was fixed in r25556 and r25557 but many more existed; this is a general fix and thus reverts r25556-r25557. * to avoid having PySequence_Repeat()/PySequence_Concat() failing on user-defined classes, they now fall back to nb_add/nb_mul if sq_concat/sq_repeat are not defined and the arguments appear to be sequences. * added tests. Backport candidate.
* Added proper reflection on instances of <type 'method-wrapper'>, e.g.Armin Rigo2005-11-071-0/+13
| | | | | | | | '[].__add__', to match what the other internal descriptor types provide: '__objclass__' attribute, '__self__' member, and reasonable repr and comparison. Added a test.
* Fix tests dependent on the exception raised by non-settable descriptors.Barry Warsaw2005-04-201-1/+1
|
* SF bug #1155938: Missing None check for __init__().Raymond Hettinger2005-03-031-0/+13
|
* Use descriptors.Guido van Rossum2005-01-161-2/+2
|
* Removing tests that fail because of changes in PyString_InternInPlace(),Armin Rigo2004-08-071-16/+0
| | | | | as discussed on IRC. The equivalent tests for the new behavior are in test_builtin.py.
* Ensure super() lookup of descriptor from classmethod works (SF #743627)Phillip J. Eby2004-03-251-0/+14
|
* Replace backticks with repr() or "%r"Walter Dörwald2004-02-121-14/+14
| | | | From SF patch #852334.
* Whitespace normalization.Tim Peters2004-01-181-1/+1
|
* Fix forMichael W. Hudson2003-08-151-0/+31
| | | | | | | | | [ 784825 ] fix obscure crash in descriptor handling Should be applied to release23-maint and in all likelyhood release22-maint, too. Certainly doesn't apply to release21-maint.
* Repair refcounting on error return from type_set_bases.Michael W. Hudson2003-08-071-0/+7
| | | | Include a test case that failed for one of my efforts to repair this.
* SF bug #762455: Python segfaults when sys.stdout is changed in getattrRaymond Hettinger2003-06-291-0/+15
| | | | * Added unittest that fails before, but not after Neil's fix to ceval.c.
* SF bug #753451: classmethod abuse --> SystemErrorRaymond Hettinger2003-06-181-0/+8
| | | | | | Check the argument to classmethod for callability. Backport candidate.
* Add test for bug #751998.Neal Norwitz2003-06-161-0/+16
|
* Remove debug code from weakref_segfault().Guido van Rossum2003-05-291-2/+0
|
* Add testcase for SF 742911.Guido van Rossum2003-05-291-0/+24
|
* - super() no longer ignores data descriptors, except __class__. SeeGuido van Rossum2003-04-161-1/+16
| | | | | the thread started at http://mail.python.org/pipermail/python-dev/2003-April/034338.html
* Ouch, it's Carlo Verre, not Verre Carlo.Guido van Rossum2003-04-151-5/+5
|
* Close off the "Verre Carlo hack" as discussed on python-dev.Guido van Rossum2003-04-141-0/+17
|
* SF bug #699934: Obscure error messageRaymond Hettinger2003-04-061-3/+2
| | | | | mwh pointed out that the error message did not make sense if obtained by rearranging the bases.
* SF bug #699934: Obscure error messageRaymond Hettinger2003-03-121-3/+7
| | | | Clarify error message for mro conflicts.
* Use floor division (// and __[r]floordiv__ in right-dispatch test.Guido van Rossum2003-02-271-23/+23
|
* Whitespace normalization.Tim Peters2003-02-191-1/+1
|
* SF patch #685738 by Michael Stone.Guido van Rossum2003-02-131-8/+8
| | | | | | | 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-0/+39
| | | | now be a proxy for an X instance, as long as issubclass(x.__class__, X).
* SF #532767: isinstance(x, X) should work when x is a proxy for an XGuido van Rossum2003-02-121-1/+29
| | | | | instance, as long as x.__class__ is X or a subclass thereof. Did a little cleanup of PyObject_IsInstance() too.
* Put proper tests in classmethod_get(). Remove the type argument toGuido van Rossum2003-02-111-0/+40
| | | | | | descr_check(); it wasn't useful. Change the type argument of the various _get() methods to PyObject * because the call signature of tp_descr_get doesn't guarantee its type.
* Get rid of the "bozo" __getstate__ that was inserted when __slots__Guido van Rossum2003-02-101-18/+17
| | | | | | 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. :-)
* Fix SF bug #683467, 'int' ability to generate longs not inheritedNeal Norwitz2003-02-101-0/+8
| | | | | | When subclassing from an int but not overriding __new__, long values were not converted properly. Try to convert longs into an int.