Skip to content

error in paste mode #10298

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

Open
dhalbert opened this issue Apr 28, 2025 · 0 comments
Open

error in paste mode #10298

dhalbert opened this issue Apr 28, 2025 · 0 comments

Comments

@dhalbert
Copy link
Collaborator

dhalbert commented Apr 28, 2025

Reproducible on ESP32-C3 and ESP32-C6:

A code error during paste mode or raw mode causes a hard crash when exiting the mode with ctrl-D.

This does not occur when using the regular REPL input mode.

Simplest example (x is an unassigned variable):

Adafruit CircuitPython 10.0.0-alpha.2 on 2025-04-04; Adafruit QT Py ESP32C3 with ESP32-C3FN4
>>> 
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== x
=== [type ctrl-D here]
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382ab0
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x120
load:0x403cc710,len:0x900
load:0x403ce710,len:0x2178
entry 0x403cc710

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circuitpython/issues.
Press reset to exit safe mode.

Press any key to enter the REPL. Use CTRL-D to reload.

One hypothesis is that the ctrl-D causes an EOF exception during read, and so there is a double exception (the first is due to the code error).

This does not occur on boards with native USB CDC REPL. The only such boards I have to test right now are ESP32-C3 and ESP32-C6, which are RISCV, but that may be a coincidence. Or it may be due to nlr handling on RISCV.

EDITS:

Could not reproduce on ESP32 Feather HUZZAH32 or V2, or micro:bit V2, so it's not just serial-only boards.

1/0 is also a very simple error. Interestingly, raise ValueError or similar does not provoke the crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant