You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by "Graham Dumpleton (JIRA)" <ji...@apache.org> on 2005/11/11 06:47:02 UTC

[jira] Created: (MODPYTHON-91) Improve error message when "quit" run in pdb debugger.

Improve error message when "quit" run in pdb debugger.
------------------------------------------------------

         Key: MODPYTHON-91
         URL: http://issues.apache.org/jira/browse/MODPYTHON-91
     Project: mod_python
        Type: Improvement
  Components: core  
    Versions: 3.3    
    Reporter: Graham Dumpleton
    Priority: Minor


If one has enabled PythonEnablePdb and correctly running "httpd" with -DONE_PROCESS option, in the debugger, if you run the "quit" command in the debugger, you get back the result 500 error message reads as:

  Mod_python error: "PythonHandler mptest"

  Traceback (most recent call last):

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
      assert (type(result) == type(int())), \

  AssertionError: Handler 'mptest' returned invalid return code.

It might be nice to have an error response which actually indicates in some way that the debugger was explicitly quit for the request that was being debugged.

The reason that the error above occurs now is that the debugger support uses the call:

  result = pdb.runcall(object, conn)

This ultimately executes bdb.Bdb.runcall();

    def runcall(self, func, *args):
        self.reset()
        sys.settrace(self.trace_dispatch)
        res = None
        try:
            try:
                res = func(*args)
            except BdbQuit:
                pass
        finally:
            self.quitting = 1
            sys.settrace(None)
        return res

As can be seen, the exception BdbQuit indicating that the "quit" command had been run is caught and ignored, with the result that None is then returned as if from the handler itself. This causes the upstream exception to be raised that the result is not an integer.

One possibility is run replace pdb.runcall() invocation with:

                        #result = pdb.runcall(object, req)

                        debugger = pdb.Pdb()
                        debugger.reset()
                        sys.settrace(debugger.trace_dispatch)
                        try:
                            return object(req)
                        finally:
                            debugger.quitting = 1
                            sys.settrace(None)

If this is done, the BdbQuit exception ignored and is propogated up. The error message then at least can be linked better as being related to the debugger.

  Mod_python error: "PythonHandler mptest"

  Traceback (most recent call last):

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 303, in HandlerDispatch
      return object(req)

    File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
      req.content_type = 'text/plain'

    File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
      req.content_type = 'text/plain'

   File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 48, in trace_dispatch
      return self.dispatch_line(frame)

    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 61, in dispatch_line
      if self.quitting: raise BdbQuit

  BdbQuit

Alternatively a special purpose error message could be generated to indicate that the debugging of the handler for that request was explicitly quit.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (MODPYTHON-91) Improve error message when "quit" run in pdb debugger.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-91?page=all ]
     
Graham Dumpleton resolved MODPYTHON-91:
---------------------------------------

    Fix Version: 3.3
     Resolution: Fixed

> Improve error message when "quit" run in pdb debugger.
> ------------------------------------------------------
>
>          Key: MODPYTHON-91
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-91
>      Project: mod_python
>         Type: Improvement

>   Components: core
>     Versions: 3.3
>     Reporter: Graham Dumpleton
>     Assignee: Graham Dumpleton
>     Priority: Minor
>      Fix For: 3.3

>
> If one has enabled PythonEnablePdb and correctly running "httpd" with -DONE_PROCESS option, in the debugger, if you run the "quit" command in the debugger, you get back the result 500 error message reads as:
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
>       assert (type(result) == type(int())), \
>   AssertionError: Handler 'mptest' returned invalid return code.
> It might be nice to have an error response which actually indicates in some way that the debugger was explicitly quit for the request that was being debugged.
> The reason that the error above occurs now is that the debugger support uses the call:
>   result = pdb.runcall(object, conn)
> This ultimately executes bdb.Bdb.runcall();
>     def runcall(self, func, *args):
>         self.reset()
>         sys.settrace(self.trace_dispatch)
>         res = None
>         try:
>             try:
>                 res = func(*args)
>             except BdbQuit:
>                 pass
>         finally:
>             self.quitting = 1
>             sys.settrace(None)
>         return res
> As can be seen, the exception BdbQuit indicating that the "quit" command had been run is caught and ignored, with the result that None is then returned as if from the handler itself. This causes the upstream exception to be raised that the result is not an integer.
> One possibility is run replace pdb.runcall() invocation with:
>                         #result = pdb.runcall(object, req)
>                         debugger = pdb.Pdb()
>                         debugger.reset()
>                         sys.settrace(debugger.trace_dispatch)
>                         try:
>                             return object(req)
>                         finally:
>                             debugger.quitting = 1
>                             sys.settrace(None)
> If this is done, the BdbQuit exception ignored and is propogated up. The error message then at least can be linked better as being related to the debugger.
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 303, in HandlerDispatch
>       return object(req)
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 48, in trace_dispatch
>       return self.dispatch_line(frame)
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 61, in dispatch_line
>       if self.quitting: raise BdbQuit
>   BdbQuit
> Alternatively a special purpose error message could be generated to indicate that the debugging of the handler for that request was explicitly quit.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MODPYTHON-91) Improve error message when "quit" run in pdb debugger.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/MODPYTHON-91?page=comments#action_12357959 ] 

Graham Dumpleton commented on MODPYTHON-91:
-------------------------------------------

Whoops, that should be:

                        #result = pdb.runcall(object, req) 

                        debugger = pdb.Pdb() 
                        debugger.reset() 
                        sys.settrace(debugger.trace_dispatch) 
                        try: 
                            result =  object(req) 
                        finally: 
                            debugger.quitting = 1 
                            sys.settrace(None) 


> Improve error message when "quit" run in pdb debugger.
> ------------------------------------------------------
>
>          Key: MODPYTHON-91
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-91
>      Project: mod_python
>         Type: Improvement
>   Components: core
>     Versions: 3.3
>     Reporter: Graham Dumpleton
>     Priority: Minor

>
> If one has enabled PythonEnablePdb and correctly running "httpd" with -DONE_PROCESS option, in the debugger, if you run the "quit" command in the debugger, you get back the result 500 error message reads as:
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
>       assert (type(result) == type(int())), \
>   AssertionError: Handler 'mptest' returned invalid return code.
> It might be nice to have an error response which actually indicates in some way that the debugger was explicitly quit for the request that was being debugged.
> The reason that the error above occurs now is that the debugger support uses the call:
>   result = pdb.runcall(object, conn)
> This ultimately executes bdb.Bdb.runcall();
>     def runcall(self, func, *args):
>         self.reset()
>         sys.settrace(self.trace_dispatch)
>         res = None
>         try:
>             try:
>                 res = func(*args)
>             except BdbQuit:
>                 pass
>         finally:
>             self.quitting = 1
>             sys.settrace(None)
>         return res
> As can be seen, the exception BdbQuit indicating that the "quit" command had been run is caught and ignored, with the result that None is then returned as if from the handler itself. This causes the upstream exception to be raised that the result is not an integer.
> One possibility is run replace pdb.runcall() invocation with:
>                         #result = pdb.runcall(object, req)
>                         debugger = pdb.Pdb()
>                         debugger.reset()
>                         sys.settrace(debugger.trace_dispatch)
>                         try:
>                             return object(req)
>                         finally:
>                             debugger.quitting = 1
>                             sys.settrace(None)
> If this is done, the BdbQuit exception ignored and is propogated up. The error message then at least can be linked better as being related to the debugger.
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 303, in HandlerDispatch
>       return object(req)
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 48, in trace_dispatch
>       return self.dispatch_line(frame)
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 61, in dispatch_line
>       if self.quitting: raise BdbQuit
>   BdbQuit
> Alternatively a special purpose error message could be generated to indicate that the debugging of the handler for that request was explicitly quit.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Work started: (MODPYTHON-91) Improve error message when "quit" run in pdb debugger.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-91?page=all ]
     
Work on MODPYTHON-91 started by Graham Dumpleton

> Improve error message when "quit" run in pdb debugger.
> ------------------------------------------------------
>
>          Key: MODPYTHON-91
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-91
>      Project: mod_python
>         Type: Improvement
>   Components: core
>     Versions: 3.3
>     Reporter: Graham Dumpleton
>     Assignee: Graham Dumpleton
>     Priority: Minor

>
> If one has enabled PythonEnablePdb and correctly running "httpd" with -DONE_PROCESS option, in the debugger, if you run the "quit" command in the debugger, you get back the result 500 error message reads as:
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
>       assert (type(result) == type(int())), \
>   AssertionError: Handler 'mptest' returned invalid return code.
> It might be nice to have an error response which actually indicates in some way that the debugger was explicitly quit for the request that was being debugged.
> The reason that the error above occurs now is that the debugger support uses the call:
>   result = pdb.runcall(object, conn)
> This ultimately executes bdb.Bdb.runcall();
>     def runcall(self, func, *args):
>         self.reset()
>         sys.settrace(self.trace_dispatch)
>         res = None
>         try:
>             try:
>                 res = func(*args)
>             except BdbQuit:
>                 pass
>         finally:
>             self.quitting = 1
>             sys.settrace(None)
>         return res
> As can be seen, the exception BdbQuit indicating that the "quit" command had been run is caught and ignored, with the result that None is then returned as if from the handler itself. This causes the upstream exception to be raised that the result is not an integer.
> One possibility is run replace pdb.runcall() invocation with:
>                         #result = pdb.runcall(object, req)
>                         debugger = pdb.Pdb()
>                         debugger.reset()
>                         sys.settrace(debugger.trace_dispatch)
>                         try:
>                             return object(req)
>                         finally:
>                             debugger.quitting = 1
>                             sys.settrace(None)
> If this is done, the BdbQuit exception ignored and is propogated up. The error message then at least can be linked better as being related to the debugger.
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 303, in HandlerDispatch
>       return object(req)
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 48, in trace_dispatch
>       return self.dispatch_line(frame)
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 61, in dispatch_line
>       if self.quitting: raise BdbQuit
>   BdbQuit
> Alternatively a special purpose error message could be generated to indicate that the debugging of the handler for that request was explicitly quit.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MODPYTHON-91) Improve error message when "quit" run in pdb debugger.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/MODPYTHON-91?page=all ]

Graham Dumpleton updated MODPYTHON-91:
--------------------------------------

    Assign To: Graham Dumpleton

> Improve error message when "quit" run in pdb debugger.
> ------------------------------------------------------
>
>          Key: MODPYTHON-91
>          URL: http://issues.apache.org/jira/browse/MODPYTHON-91
>      Project: mod_python
>         Type: Improvement
>   Components: core
>     Versions: 3.3
>     Reporter: Graham Dumpleton
>     Assignee: Graham Dumpleton
>     Priority: Minor

>
> If one has enabled PythonEnablePdb and correctly running "httpd" with -DONE_PROCESS option, in the debugger, if you run the "quit" command in the debugger, you get back the result 500 error message reads as:
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
>       assert (type(result) == type(int())), \
>   AssertionError: Handler 'mptest' returned invalid return code.
> It might be nice to have an error response which actually indicates in some way that the debugger was explicitly quit for the request that was being debugged.
> The reason that the error above occurs now is that the debugger support uses the call:
>   result = pdb.runcall(object, conn)
> This ultimately executes bdb.Bdb.runcall();
>     def runcall(self, func, *args):
>         self.reset()
>         sys.settrace(self.trace_dispatch)
>         res = None
>         try:
>             try:
>                 res = func(*args)
>             except BdbQuit:
>                 pass
>         finally:
>             self.quitting = 1
>             sys.settrace(None)
>         return res
> As can be seen, the exception BdbQuit indicating that the "quit" command had been run is caught and ignored, with the result that None is then returned as if from the handler itself. This causes the upstream exception to be raised that the result is not an integer.
> One possibility is run replace pdb.runcall() invocation with:
>                         #result = pdb.runcall(object, req)
>                         debugger = pdb.Pdb()
>                         debugger.reset()
>                         sys.settrace(debugger.trace_dispatch)
>                         try:
>                             return object(req)
>                         finally:
>                             debugger.quitting = 1
>                             sys.settrace(None)
> If this is done, the BdbQuit exception ignored and is propogated up. The error message then at least can be linked better as being related to the debugger.
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 303, in HandlerDispatch
>       return object(req)
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 48, in trace_dispatch
>       return self.dispatch_line(frame)
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 61, in dispatch_line
>       if self.quitting: raise BdbQuit
>   BdbQuit
> Alternatively a special purpose error message could be generated to indicate that the debugging of the handler for that request was explicitly quit.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Closed: (MODPYTHON-91) Improve error message when "quit" run in pdb debugger.

Posted by "Graham Dumpleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MODPYTHON-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Graham Dumpleton closed MODPYTHON-91.
-------------------------------------


> Improve error message when "quit" run in pdb debugger.
> ------------------------------------------------------
>
>                 Key: MODPYTHON-91
>                 URL: https://issues.apache.org/jira/browse/MODPYTHON-91
>             Project: mod_python
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.3
>            Reporter: Graham Dumpleton
>         Assigned To: Graham Dumpleton
>            Priority: Minor
>             Fix For: 3.3
>
>
> If one has enabled PythonEnablePdb and correctly running "httpd" with -DONE_PROCESS option, in the debugger, if you run the "quit" command in the debugger, you get back the result 500 error message reads as:
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 313, in HandlerDispatch
>       assert (type(result) == type(int())), \
>   AssertionError: Handler 'mptest' returned invalid return code.
> It might be nice to have an error response which actually indicates in some way that the debugger was explicitly quit for the request that was being debugged.
> The reason that the error above occurs now is that the debugger support uses the call:
>   result = pdb.runcall(object, conn)
> This ultimately executes bdb.Bdb.runcall();
>     def runcall(self, func, *args):
>         self.reset()
>         sys.settrace(self.trace_dispatch)
>         res = None
>         try:
>             try:
>                 res = func(*args)
>             except BdbQuit:
>                 pass
>         finally:
>             self.quitting = 1
>             sys.settrace(None)
>         return res
> As can be seen, the exception BdbQuit indicating that the "quit" command had been run is caught and ignored, with the result that None is then returned as if from the handler itself. This causes the upstream exception to be raised that the result is not an integer.
> One possibility is run replace pdb.runcall() invocation with:
>                         #result = pdb.runcall(object, req)
>                         debugger = pdb.Pdb()
>                         debugger.reset()
>                         sys.settrace(debugger.trace_dispatch)
>                         try:
>                             return object(req)
>                         finally:
>                             debugger.quitting = 1
>                             sys.settrace(None)
> If this is done, the BdbQuit exception ignored and is propogated up. The error message then at least can be linked better as being related to the debugger.
>   Mod_python error: "PythonHandler mptest"
>   Traceback (most recent call last):
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mod_python/apache.py", line 303, in HandlerDispatch
>       return object(req)
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>     File "/Users/grahamd/Sites/importer/mptest.py", line 5, in handler
>       req.content_type = 'text/plain'
>    File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 48, in trace_dispatch
>       return self.dispatch_line(frame)
>     File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/bdb.py", line 61, in dispatch_line
>       if self.quitting: raise BdbQuit
>   BdbQuit
> Alternatively a special purpose error message could be generated to indicate that the debugging of the handler for that request was explicitly quit.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.