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

Comments

Projects
None yet
4 participants
@icemac
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@hannosch

hannosch Oct 23, 2017

Member

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.

Member

hannosch commented Oct 23, 2017

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

This comment has been minimized.

Show comment
Hide comment
@jamadden

jamadden Oct 23, 2017

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'>]
>>>
Member

jamadden commented Oct 23, 2017

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 added a commit to zopefoundation/RestrictedPython that referenced this issue Sep 4, 2018

Fix `compile_restricted_function()` called with SyntaxError in functi…
…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 added a commit to zopefoundation/RestrictedPython that referenced this issue Sep 4, 2018

Fix `compile_restricted_function()` called with SyntaxError in functi…
…on body. (#127)

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

Fixes zopefoundation/Products.PythonScripts#11
@tseaver

This comment has been minimized.

Show comment
Hide comment
@tseaver

tseaver Sep 4, 2018

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@icemac

icemac Sep 5, 2018

Contributor

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

Contributor

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 in af62911 Sep 5, 2018

@tseaver

This comment has been minimized.

Show comment
Hide comment
@tseaver

tseaver Sep 5, 2018

Member

@icemac Thanks for fixing the pin!

Member

tseaver commented Sep 5, 2018

@icemac Thanks for fixing the pin!

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