Nick Coghlan
0447cd6fdc
Correctly restore sys.stdout in test_descr
2009-10-17 06:33:05 +00:00
Benjamin Peterson
6fcf9b50bc
remove the check that classmethod's argument is a callable
2009-09-01 22:27:57 +00:00
Benjamin Peterson
5c8da86f3a
convert usage of fail* to assert*
2009-06-30 22:57:08 +00:00
Benjamin Peterson
39d43b4660
correctly handle descrs with __missing__
2009-05-27 02:43:46 +00:00
Benjamin Peterson
1880d8b823
add a SETUP_WITH opcode
...
It speeds up the with statement and correctly looks up the special
methods involved.
2009-05-25 13:13:44 +00:00
Benjamin Peterson
87e5006d8c
handle errors from _PyObject_LookupSpecial when __get__ fails
2009-05-25 02:40:21 +00:00
Benjamin Peterson
fb6fb062e8
properly lookup __instancecheck__ and __subclasscheck__
2009-05-16 21:44:25 +00:00
Benjamin Peterson
af1692a266
convert some more special methods to use _PyObject_LookupSpecial
2009-05-09 16:36:39 +00:00
Benjamin Peterson
809e22543f
lookup __reversed__ correctly as a special method
2009-05-09 02:07:04 +00:00
Benjamin Peterson
db7ebcf469
fix this test
2009-05-08 17:59:29 +00:00
Benjamin Peterson
399e4c4f8f
add _PyObject_LookupSpecial to handle fetching special method lookup
2009-05-08 03:06:00 +00:00
Benjamin Peterson
5083dc552b
fix a segfault when setting __class__ in __del__ #5283
2009-04-25 00:41:22 +00:00
Benjamin Peterson
accb3d0014
move test to a more appropiate one
2009-04-18 21:03:10 +00:00
Benjamin Peterson
d4d400cb8a
try to initalize all builtin types with PyType_Ready to avoid problems like #5787
2009-04-18 20:12:47 +00:00
Benjamin Peterson
21f6aac633
apply the second part of #4242 's patch; classify all the implementation details in test_descr
2009-03-26 20:17:27 +00:00
Benjamin Peterson
273c233c78
when __getattr__ is a descriptor, call it correctly; fixes #4230
...
patch from Ziga Seilnacht
2008-11-17 22:39:09 +00:00
Armin Rigo
581eb1e498
Fix one of the tests: it relied on being present in an "output test" in
...
order to actually test what it was supposed to test, i.e. that the code
in the __del__ method did not crash. Use instead the new helper
test_support.captured_output().
2008-10-28 17:01:21 +00:00
Nick Coghlan
48361f5cbf
Issue 2235: Py3k warnings are now emitted for classes that will no longer inherit a__hash__ implementation from a parent class in Python 3.x. The standard library and test suite have been updated to not emit these warnings.
2008-08-11 15:45:58 +00:00
Nick Coghlan
53663a695e
Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful
2008-07-15 14:27:37 +00:00
Amaury Forgeot d'Arc
60d6c7f0cc
Issue #2115 : __slot__ attributes setting was 10x slower.
...
Also correct a possible crash using ABCs.
This change is exactly the same as an optimisation
done 5 years ago, but on slot *access*:
http://svn.python.org/view?view=rev&rev=28297
2008-02-15 21:22:45 +00:00
Georg Brandl
4854552f02
Rewrite test_descr as unittest, written for GHOP by Jeff Wheeler.
2008-02-02 10:12:36 +00:00
Guido van Rossum
37edeab778
Fix test67.py from issue #1303614 .
2008-01-24 17:58:05 +00:00
Guido van Rossum
4e3f12486f
Fi debug turd -- a call accidentally left out.
2008-01-24 15:53:22 +00:00
Neal Norwitz
bf839e2efa
Fix the tests by restoring __import__. I think the test is still valid.
2008-01-24 04:14:50 +00:00
Guido van Rossum
9acc387bcf
Turn three recently fixed crashers into regular tests.
2008-01-23 23:23:43 +00:00
Brett Cannon
a6e515b90d
Remove a straggling debugging print line.
2007-12-25 06:44:59 +00:00
Brett Cannon
4e438bcc56
Actually execute the tests for the getter/setter/deleter tests on properties.
...
Also fix the test by having the test classes inherit from object.
Are the getter/setter/deleter attributes supposed to be able to chain? As of
right now they can't as the property tries to call what the property returns,
which is another property when they are chained.
2007-12-25 00:14:34 +00:00
Christian Heimes
636afc52c0
I forgot to fix one occurence of new in test_descr
2007-11-27 23:53:14 +00:00
Christian Heimes
c756d00cf2
Replaced import of the 'new' module with 'types' module and added a deprecation warning to the 'new' module.
2007-11-27 21:34:01 +00:00
Guido van Rossum
d1ef78942a
Issue 1416. Add getter, setter, deleter methods to properties that can be
...
used as decorators to create fully-populated properties.
2007-11-10 22:12:24 +00:00
Brett Cannon
1e534b5425
Fix a crasher where Python code managed to infinitely recurse in C code without
...
ever going back out to Python code in PyObject_Call(). Required introducing a
static RuntimeError instance so that normalizing an exception there is no
reliance on a recursive call that would put the exception system over the
recursion check itself.
2007-09-07 04:18:30 +00:00
Armin Rigo
9790a27065
Fix for #1303614 and #1174712 :
...
- __dict__ descriptor abuse for subclasses of built-in types
- subclassing from both ModuleType and another built-in types
Thanks zseil for the patch.
2007-05-02 19:23:31 +00:00
Neal Norwitz
0d4c06e06e
Whitespace normalization. Ugh, we really need to do this more often.
...
You might want to review this change as it's my first time. Be gentle. :-)
2007-04-25 06:30:05 +00:00
Armin Rigo
c0ba52d3fd
Revert r53997 as per
...
http://mail.python.org/pipermail/python-dev/2007-March/071796.html .
I've kept a couple of still-valid extra tests in test_descr, but didn't
bother to sort through the new comments and refactorings added in r53997
to see if some of them could be kept. If so, they could go in a
follow-up check-in.
2007-04-19 14:44:48 +00:00
Neal Norwitz
cbd9ee69ee
When __slots__ are set to a unicode string, make it work the same as
...
setting a plain string, ie don't expand to single letter identifiers.
2007-04-14 05:25:50 +00:00
Guido van Rossum
ab8802a4f7
Fix warnings about object.__init__() signature.
...
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.
2007-04-02 23:55:37 +00:00
Žiga Seilnacht
6f2d09c949
Patch #1623563 : allow __class__ assignment for classes with __slots__.
...
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.
2007-03-16 11:59:38 +00:00
Žiga Seilnacht
71436f0229
Patch #1680015 : Don't modify __slots__ tuple if it contains an unicode
...
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
2007-03-14 12:24:09 +00:00
Tim Peters
ea5962f86e
Whitespace normalization.
2007-03-12 18:07:52 +00:00
Georg Brandl
0fca97a5fb
Patch #1674228 : when assigning a slice (old-style), check for the
...
sq_ass_slice instead of the sq_slice slot.
2007-03-05 22:28:08 +00:00
Jeremy Hylton
fa955697fa
Add checking for a number of metaclass error conditions.
...
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.
2007-02-27 18:29:45 +00:00
Armin Rigo
b8d6d73121
Fix the line to what is my guess at the original author's meaning.
...
(The line has no effect anyway, but is present because it's
customary call the base class __init__).
2007-02-12 16:23:24 +00:00
Michael W. Hudson
f390442130
a test for an error condition not covered by existing tests
...
(noticed this when writing the equivalent code for pypy)
2006-11-23 13:54:04 +00:00
Georg Brandl
5d59c09834
Patch #1567691 : super() and new.instancemethod() now don't accept
...
keyword arguments any more (previously they accepted them, but didn't
use them).
2006-09-30 08:43:30 +00:00
Georg Brandl
e9462c72bd
Change fix for segfaulting property(), add a NEWS entry and a test.
2006-08-04 18:03:37 +00:00
Martin v. Löwis
d5cfa5491a
Put method-wrappers into trashcan. Fixes #927248 .
2006-07-03 13:47:40 +00:00
Brett Cannon
22565aac3b
An object with __call__ as an attribute, when called, will have that 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.
2006-06-09 22:31:23 +00:00
Armin Rigo
fd01d7933b
(arre, arigo) SF bug #1350060
...
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'.
2006-06-08 10:56:24 +00:00
Tim Peters
171b868195
subclasspropagation(): Squash two more bogus hash(x) == id(x)
...
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.
2006-04-11 01:59:34 +00:00
Tim Peters
85b362f007
specials(): squash another incorrect hash(x) == id(x)
...
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.
2006-04-11 01:21:00 +00:00