mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bltinmodule.c: added round(x, [n]); coerce() of two class instances
will try to coerce anyway. classobject.c: instance 'nonzero' should first try __nonzero__ only then __len__.
This commit is contained in:
parent
e8a3c28f8d
commit
9e51f9bec8
2 changed files with 32 additions and 3 deletions
|
@ -619,9 +619,9 @@ instance_nonzero(self)
|
|||
object *func, *res;
|
||||
long outcome;
|
||||
|
||||
if ((func = instance_getattr(self, "__len__")) == NULL) {
|
||||
if ((func = instance_getattr(self, "__nonzero__")) == NULL) {
|
||||
err_clear();
|
||||
if ((func = instance_getattr(self, "__nonzero__")) == NULL) {
|
||||
if ((func = instance_getattr(self, "__len__")) == NULL) {
|
||||
err_clear();
|
||||
/* Fall back to the default behavior:
|
||||
all instances are nonzero */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue