GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Boolean methods cause interpreter panic when presented with the wrong type · Issue #5460 · RustPython/RustPython

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

New issue
Copy link
New issue
Copy link
Closed
#5461
Closed
Boolean methods cause interpreter panic when presented with the wrong type#5460
#5461
Copy link
Labels
C-bugSomething isn't workingSomething isn't working

Description

@Masterchef365
Masterchef365
opened on Dec 19, 2024
Issue body actions

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

Reacted by Jeong, YunWon and Lee Dogeon

Activity

  1. Masterchef365
    added
    C-bugSomething isn't workingSomething isn't working
    on Dec 19, 2024
  2. theshubhamp commented on Dec 26, 2024

    @theshubhamp
    theshubhamp
    on Dec 26, 2024
    Contributor
    More actions

    Looks like the or, and & xor operators implemented in bool builtin were missing type check to int.

    Sent a PR including tests.

    Reacted by Duncan Freeman
  3. youknowone
    closed this as completedin #5461on Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.