Skip to content

panic in re matching with lookbehind assertion  #2427

Closed
@birkenfeld

Description

@birkenfeld

I'm trying out RustPython to see if I can at some point replace the currently Pyodide based setup (which is monstrous to build) of https://pygments.org/demo/ with RustPython.

Unfortunately one of the first tests (rustpython -m pygments setup.py in a checkout of https://github.com/pygments/pygments) leads to:

Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 🖖
>>>>> import re
>>>>> rx = re.compile(r'(?<!\.)x\b')
>>>>> rx.match('test')
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', vm/src/stdlib/sre/interp.rs:530:64
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/core/src/panicking.rs:50:5
   3: <rustpython_vm::stdlib::sre::interp::OpTwice<F1,F2> as rustpython_vm::stdlib::sre::interp::OpcodeExecutor>::next
   4: rustpython_vm::stdlib::sre::interp::OpcodeDispatcher::dispatch
   5: rustpython_vm::stdlib::sre::interp::State::pymatch
   6: rustpython_vm::function::IntoPyNativeFunc::into_func::{{closure}}
   7: rustpython_vm::slots::Callable::tp_call
   8: rustpython_vm::vm::VirtualMachine::_invoke
   9: <rustpython_vm::builtins::function::PyBoundMethod as rustpython_vm::slots::Callable>::call
  10: rustpython_vm::slots::Callable::tp_call
  11: rustpython_vm::vm::VirtualMachine::_invoke
  12: rustpython_vm::frame::ExecutingFrame::run
  13: rustpython_vm::frame::<impl rustpython_vm::pyobjectrc::PyRef<rustpython_vm::frame::Frame>>::run
  14: rustpython_vm::vm::VirtualMachine::run_frame
  15: rustpython_vm::vm::VirtualMachine::run_code_obj
  16: rustpython::shell::run_shell
  17: rustpython::run_rustpython
  18: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  19: std::thread::local::LocalKey<T>::with
  20: rustpython::run
  21: rustpython::main

This is with the pip-merg branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions