Skip to content

__bool__ = __nonzero__ not detected #453

Open
@spaceone

Description

@spaceone

Code like:

class Foo(object):
    def __nonzero__(self):
        return True
    __bool__ = __nonzero__

results in

from builtins import object
class Foo(object):
    def __bool__(self):
        return True
    __bool__ = __nonzero__

and therefore raises in Python3:

  File "test.py", line 2, in <module>
    class Foo(object):
  File "test.py", line 5, in Foo
    __bool__ = __nonzero__
NameError: name '__nonzero__' is not defined


Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions