Issue2284

classification
Title: unassigned variable doesn't throw exception
Type: Severity: normal
Components: Jythonc compiler Versions: Jython 2.7
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: helix84, zyasoft
Priority: Keywords:

Created on 2015-03-09.21:46:14 by helix84, last changed 2015-03-10.04:16:10 by zyasoft.

Messages
msg9597 (view) Author: helix84 (helix84) Date: 2015-03-09.21:46:14
Example code:


from javax.servlet.http import HttpServlet

class hello(HttpServlet):
        def doGet(self, request, response):
                toClient = response.getWriter()
                toClient.println('start')
                toClient.println(unassigned)
                toClient.println('end')


Under jython 2.5.2 this would throw:
NameError: global name 'unassigned' is not defined

Under jython 2.7b4 this fails silently, no stacktrace in HTTP response, no stacktrace in Tomcat log.
msg9598 (view) Author: helix84 (helix84) Date: 2015-03-09.21:49:07
The output under jython 2.7b4 is just 'start', it finishes before it gets to 'end'. Sample telnet session:

Escape character is '^]'.
GET /test/hello.py HTTP/1.0

HTTP/1.1 500 Internal Server Error
Date: Mon, 09 Mar 2015 21:48:08 GMT
Server: Apache/2.4.10 (Debian)
Content-Length: 6
Connection: close
Content-Type: text/x-python

start
Connection closed by foreign host.
msg9599 (view) Author: Jim Baker (zyasoft) Date: 2015-03-09.22:42:51
In general, you don't want stacktraces in an HTTP response.

This sounds like a servlet packaging issue, not one about Jython specifically. NameError will be raised - there's a lot of testing around this aspect of scope.
msg9601 (view) Author: helix84 (helix84) Date: 2015-03-09.23:01:52
Thanks for pointing that out. The difference is not between jython versions, rather this started happening in Tomcat 8 (as packaged in Debian). This issue can be closed as invalid.

Syntax errors still get thrown. Runtime errors (raised exceptions) don't.

I still don't know which Tomcat knob to fiddle to turn stacktraces back on (neither in log nor in HTTP response). If you happen to know, please tell me.
msg9603 (view) Author: Jim Baker (zyasoft) Date: 2015-03-10.04:16:09
I don't have enough experience with Tomcat recently, most of my focus has been on Jetty. Others feel free to chime in of course!

It might be useful to post this question about what configuration "knobs" are available on the jython-users mailing list, which often discusses these sorts of issues.
History
Date User Action Args
2015-03-10 04:16:10zyasoftsetstatus: open -> closed
resolution: invalid
messages: + msg9603
2015-03-09 23:01:53helix84setmessages: + msg9601
2015-03-09 22:42:51zyasoftsetnosy: + zyasoft
messages: + msg9599
2015-03-09 21:49:08helix84setmessages: + msg9598
2015-03-09 21:46:14helix84create