| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
name. Remove a reference leak that happened if the name could not be
converted to string. Will backport.
|
| |
|
|
|
|
| |
sq_ass_slice instead of the sq_slice slot.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
(The line has no effect anyway, but is present because it's
customary call the base class __init__).
|
|
|
|
| |
(noticed this when writing the equivalent code for pypy)
|
|
|
|
|
| |
keyword arguments any more (previously they accepted them, but didn't
use them).
|
| |
|
| |
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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'.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
didn't commit it.
|
|
|
|
|
| |
no "doc" argument given. This makes it possible to legitimately use
property() as a decorator to produce a read-only property.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
| |
A patch by mwh to check that user-defined mro's are reasonable
enough.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
'[].__add__', to match what the other internal descriptor types provide:
'__objclass__' attribute, '__self__' member, and reasonable repr and
comparison.
Added a test.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
as discussed on IRC. The equivalent tests for the new behavior are in
test_builtin.py.
|
| |
|
|
|
|
| |
From SF patch #852334.
|
| |
|
|
|
|
|
|
|
|
|
| |
[ 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.
|
|
|
|
| |
Include a test case that failed for one of my efforts to repair this.
|
|
|
|
| |
* Added unittest that fails before, but not after Neil's fix to ceval.c.
|
|
|
|
|
|
| |
Check the argument to classmethod for callability.
Backport candidate.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
the thread started at
http://mail.python.org/pipermail/python-dev/2003-April/034338.html
|
| |
|
| |
|
|
|
|
|
| |
mwh pointed out that the error message did not
make sense if obtained by rearranging the bases.
|
|
|
|
| |
Clarify error message for mro conflicts.
|
| |
|
| |
|
|
|
|
|
|
|
| |
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__.
|
|
|
|
| |
now be a proxy for an X instance, as long as issubclass(x.__class__, X).
|
|
|
|
|
| |
instance, as long as x.__class__ is X or a subclass thereof.
Did a little cleanup of PyObject_IsInstance() too.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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. :-)
|
|
|
|
|
|
| |
When subclassing from an int but not overriding __new__,
long values were not converted properly. Try to convert
longs into an int.
|