Visitar URL original
Checking unmatched "raiseregex" leads to rustpython panicked · Issue #4312 · RustPython/RustPython · GitHub
The Wayback Machine - https://web.archive.org/web/20221223074245/https://github.com/RustPython/RustPython/issues/4312
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking unmatched "raiseregex" leads to rustpython panicked #4312

Open
xiaxinmeng opened this issue Dec 8, 2022 · 1 comment
Open

Checking unmatched "raiseregex" leads to rustpython panicked #4312

xiaxinmeng opened this issue Dec 8, 2022 · 1 comment
Labels
good first issue Good for newcomers

Comments

@xiaxinmeng
Copy link

xiaxinmeng commented Dec 8, 2022

In the following example, we instance a object of unittest, then the unmatched error is collected by the assertRaisesRegex, rustpython get panicked.

test.py:

import unittest

class uTest(unittest.TestCase):
	pass

uTest = uTest()

with uTest.assertRaisesRegex(Exception, 'aaa'):
     aab

Behavior on rustpython(rustpython 0.1.2):

thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', vm/src/suggestion.rs:55:22
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior(behavior on CPython 3.9.1):
NameError: name 'aab' is not defined

Step to reproduce:
type "cargo run --release test.py" on the console of Ubuntu 18.04 and MacOS Big Sur 11.7.1
rust version: rustc 1.65.0

@DimitrisJim DimitrisJim added the good first issue Good for newcomers label Dec 17, 2022
@DimitrisJim
Copy link
Member

DimitrisJim commented Dec 17, 2022

If a traceback doesn't exist when looking for suggestions, None should just be returned instead of unwraping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants