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

Fix SyntaxError handling #11

Closed
icemac opened this issue Oct 23, 2017 · 5 comments
Closed

Fix SyntaxError handling #11

icemac opened this issue Oct 23, 2017 · 5 comments
Assignees
Labels

Comments

@icemac
Copy link
Member

icemac commented Oct 23, 2017

When entering code containing a SyntaxError an error page is shown. Previously a warning was rendered above the text area containing the code.

Before (Zope 2.13):

before

After (Zope 4):

after

Besides the error page shown the changes are not saved!
Maybe this is caused by the changes in RestrictedPython.

@hannosch
Copy link
Contributor

This might also be caused by changing some bare try/except to a try/except Exception. I think SyntaxError is derived from BaseException and thus might not be caught anymore.

@jamadden
Copy link
Member

SyntaxError appears to be an Exception:

Python 2.7.14 (default, Sep 27 2017, 12:15:00)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> SyntaxError.mro()
[<type 'exceptions.SyntaxError'>,
 <type 'exceptions.StandardError'>,
 <type 'exceptions.Exception'>,
 <type 'exceptions.BaseException'>,
 <type 'object'>]
Python 3.4.7 (default, Sep 27 2017, 15:47:41)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> SyntaxError.mro()
[<class 'SyntaxError'>,
 <class 'Exception'>,
 <class 'BaseException'>,
 <class 'object'>]
>>>

icemac pushed a commit to zopefoundation/RestrictedPython that referenced this issue Sep 4, 2018
…on body.

It now also returns a ``CompileResult`` instead of raising a SyntaxError.

Fixes zopefoundation/Products.PythonScripts#11
@icemac icemac self-assigned this Sep 4, 2018
loechel pushed a commit to zopefoundation/RestrictedPython that referenced this issue Sep 4, 2018
…on body. (#127)

It now also returns a ``CompileResult`` instead of raising a SyntaxError.

Fixes zopefoundation/Products.PythonScripts#11
@tseaver
Copy link
Member

tseaver commented Sep 4, 2018

I'd prefer not to close bugs via PR merges in another repository: the bug here won't really be fixed until a new release of RestrictedPython is available.

@tseaver tseaver reopened this Sep 4, 2018
@icemac icemac added this to To do in Zope 4 final release via automation Sep 4, 2018
@icemac
Copy link
Member Author

icemac commented Sep 5, 2018

@tseaver You are right, additionally Products.PythonScripts should depend on the new release to be able to leverage the bug fix here.

@icemac icemac added the bug label Sep 5, 2018
@icemac icemac closed this as completed in af62911 Sep 5, 2018
Zope 4 final release automation moved this from To do to Done Sep 5, 2018
@tseaver
Copy link
Member

tseaver commented Sep 5, 2018

@icemac Thanks for fixing the pin!

gandie pushed a commit to perfact/Products.PythonScripts that referenced this issue Feb 22, 2023
It is now rendered as error message like other errors.

Fixes zopefoundation#11-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Development

No branches or pull requests

4 participants