Skip to content

Boolean methods cause interpreter panic when presented with the wrong type #5460

Closed
@Masterchef365

Description

@Masterchef365

Summary

You can cause the latest version of the interpreter (01f7536) to panic with:

thread 'main' panicked at [...]rustpython-vm/src/builtins/bool.rs:212:28:
called `Option::unwrap()` on a `None` value

By running the following (invalid) code:

x = min # Some type which isn't a boolean
x |= True # Perform a boolean operation

Expected

I was hoping for an exception to be thrown, which I could possibly catch! Python 3 does this.

Actual

Panics, see above

Python Documentation

TypeError exception

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions