mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-19 19:10:17 +00:00
...
This commit is contained in:
parent
ff6970101e
commit
0ffea55fa0
@ -37,4 +37,5 @@ The easiest way to test a feature is to [try it on your browser](https://pocketp
|
||||
6. A `Tab` is equivalent to 4 spaces. You can mix `Tab` and spaces in indentation, but it is not recommended.
|
||||
7. `%`, `&`, `//`, `^` and `|` for `int` behave the same as C, not python.
|
||||
8. `str.split` and `str.splitlines` will remove all empty entries.
|
||||
9. A return, break, continue in try/except block will make the finally block not executed.
|
||||
|
||||
|
@ -3,7 +3,7 @@ output: .retype
|
||||
url: https://pocketpy.dev
|
||||
branding:
|
||||
title: pocketpy
|
||||
label: v2.0.0
|
||||
label: v2.0.1
|
||||
logo: "./static/logo.png"
|
||||
favicon: "./static/logo.png"
|
||||
meta:
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: pocketpy
|
||||
description: A lightweight Python interpreter for game engines. It supports Android/iOS/Windows/Linux/MacOS.
|
||||
version: 2.0.1+6
|
||||
version: 2.0.1+7
|
||||
homepage: https://pocketpy.dev
|
||||
repository: https://github.com/pocketpy/pocketpy
|
||||
|
||||
|
@ -2466,6 +2466,19 @@ static Error* compile_try_except(Compiler* self) {
|
||||
Ctx__emit_(ctx(), OP_TRY_ENTER, BC_NOARG, prev()->line);
|
||||
check(compile_block_body(self, compile_stmt));
|
||||
|
||||
// https://docs.python.org/3/reference/compound_stmts.html#finally-clause
|
||||
/* If finally is present, it specifies a ‘cleanup’ handler. The try clause is executed,
|
||||
* including any except and else clauses. If an exception occurs in any of the clauses and is
|
||||
* not handled, the exception is temporarily saved. The finally clause is executed. If there is
|
||||
* a saved exception it is re-raised at the end of the finally clause. If the finally clause
|
||||
* raises another exception, the saved exception is set as the context of the new exception. If
|
||||
* the finally clause executes a return, break or continue statement, the saved exception is
|
||||
* discarded.
|
||||
*/
|
||||
|
||||
// known issue:
|
||||
// A return, break, continue in try/except block will make the finally block not executed
|
||||
|
||||
bool has_finally = curr()->type == TK_FINALLY;
|
||||
if(!has_finally) {
|
||||
patches[patches_length++] = Ctx__emit_(ctx(), OP_JUMP_FORWARD, BC_NOARG, BC_KEEPLINE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user