Comments (7)
There is currently no memory manager (no garbage collection) for the unix version, so that's why it eats memory. But it's certainly a bug that it runs an infinite loop.
from micropython.
Added proper nested exception handling, and basic exception type matching. Above code should now work.
from micropython.
Thanks for quick response, hope it doesn't steal cycles from hardware hacking ;-). (Though this particular issue is important enough, so I really appreciate looking into it).
Well, exception-throwing path now works (including on x86/32bit, will submit patch once cleaned up), but exception-free path leads to:
a = {1:2}
try:
a[1]
except KeyError:
print("caught")
./py exc.py
py: ../py/vm.c:308: mp_execute_byte_code_2: Assertion `0' failed.
Aborted
Corresponding opcode doesn't appear to be implemented.
from micropython.
Yep, it's not fully implemented. Micro Python doesn't use reference counting (like CPython) so the action of push/pop blocks in the interpreter is a bit simpler for Micro Python. Thus, the byte code POP_BLOCK is probably only needed when exiting an exception handling block.
from micropython.
Okay, it should now work. There will still be issues with "finally" and "with" blocks.
from micropython.
Yes, confirmed working. Let's close and track finally/with somewhere else then. (Note that I didn't try to find which Python features don't work, just read that "It works only for 64-bit machines due to a small piece of x86-64 assembler for
the exception handling.", so after building for x86, I proceeded to test exactly exception handling ;-) ).
from micropython.
By "exception handling" I actually meant the underlying C exception handling that I'm using (nlr_jump). You don't see it, but it's working when you get a Python error, eg at the command line just type "foo" and it'll give you a NameError. That's using nlr_jump, written in assembler.
from micropython.
Related Issues (20)
- ISR latency affected by BLE, unable to interface with 2kHz sample rate ADC. HOT 2
- Include a WASM interpreter as part of micropython or its standard library? HOT 3
- Renesas-RA: Pin-IRQ does not behave as expected. HOT 5
- MQTTS fail on ESP32-S3 but works in ESP32
- Cannot instantiate FrameBuffer from a bytes object HOT 9
- Build errors when building RPI_PICO for debug HOT 1
- mpremote cannot cat with recent MP on pyboard HOT 4
- asyncio module seems missing in self built firmware for ESP8266 board HOT 6
- nimble compile errors HOT 2
- ESP32-S3 Linking errors HOT 5
- esp32 wroom - guru meditation - socket accept (?) HOT 1
- esp32 - mDNS not working HOT 1
- rp2 - mDNS not working HOT 1
- rp2: Nonsense REPL input on Linux due to tty serial input echo race HOT 16
- docs: WLAN module, undocumented methods
- mpremote mount chdir() in mount fails after second call HOT 5
- STM32F407+MII+DP83848 not working properly HOT 20
- ESP32 SPIRAM IRAM overflow
- ESP32 Outputting Garbage in REPL HOT 1
- ValueError: incompatible .mpy file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micropython.