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

Web version locks up on Python syntax errors #2297

Closed
Tracked by #2315
nsxdavid opened this issue Sep 7, 2023 · 4 comments
Closed
Tracked by #2315

Web version locks up on Python syntax errors #2297

nsxdavid opened this issue Sep 7, 2023 · 4 comments

Comments

@nsxdavid
Copy link

nsxdavid commented Sep 7, 2023

When coding in Python, any syntax error will lock up on run.

For example, this line:

if btn(0) == 1: x+=1

On the exe version, will result in a proper error:

run
error while running TIC

Traceback (most recent call last):
File "", line 22
if btn(0) == 1: x+=4
TypeError: expected 'bool', but got
'int'

But when running on the Web version (on the create page), this will simply lock up the app and the page has to be refreshed to start using it again.

Version: 1.1.2736

@sogaiu
Copy link

sogaiu commented Sep 10, 2023

That happens for me too at https://tic80.com/create.

It doesn't necessarily lock up for other languages. I only tested janet and lua though.

@blueloveTH
Copy link
Contributor

I can reproduce. Will look at it.

@blueloveTH
Copy link
Contributor

After some investigation, I've found the reason of this locking up.

image

pocketpy needs c++ exceptions to be enabled to handle errors. According to emscripten's docs:

First, you can enable exceptions via Emscripten’s JavaScript-based support. To enable it, pass -fexceptions at both compile time and link time.

Although pocketpy itself always use -fexceptions flag, it is missing when linking with tic80's executable. So the exceptions won't be enabled in web platform.

The Solution

In CMakeLists.txt, add -fexceptions as a linker flags to the executable.

image

@nesbox nesbox self-assigned this Oct 8, 2023
@nesbox nesbox removed their assignment Oct 8, 2023
@nesbox
Copy link
Owner

nesbox commented Oct 8, 2023

fixed with #2315

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

No branches or pull requests

4 participants