You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeErrors in statements split up into multiple linse with \ showing 'wrong' line as being responsible in error message #66763
bpo-12458: Tracebacks should contain the first line of continuation lines
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2014-10-07.01:30:05.880>created_at=<Date2014-10-06.23:53:13.308>labels= ['interpreter-core', 'type-bug']
title="AttributeErrors in statements split up into multiple linse with \\ showing 'wrong' line as being responsible in error message"updated_at=<Date2014-10-07.01:30:05.828>user='https://bugs.python.org/dingodasher'
This code had a bug -> "models.Model.owner_id" in the first line. This was a typo, and Python gave me an AttributeError, just as I would expect. However, this is the error I was given:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1836, in __call__returnself.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1820, in wsgi_app
response =self.make_response(self.handle_exception(e))
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraiseraise value
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1817, in wsgi_app
response =self.full_dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv =self.handle_user_exception(e)
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.4/dist-packages/flask/_compat.py", line 33, in reraiseraise value
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv =self.dispatch_request()
File "/usr/local/lib/python3.4/dist-packages/flask/app.py", line 1461, in dispatch_requestreturnself.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.4/dist-packages/flask_login.py", line 758, in decorated_viewreturn func(*args, **kwargs)
File "/home/dingo/UIM/app/views.py", line 175, in modulesfilter(models.ModuleAccess.write_access ==True)
AttributeError: 'module' object has no attribute 'Model'
It shows me the last line of that long statement, "models.ModuleAccess.write_access == True" as the beginning of the trace. The trace doesn't show the models.Module.whatever line that actually caused the error.
It seems to be like Python here takes the last line of the exception-causing statement and shows that along with the "actual" error message (which was on the money): AttributeError: 'module' object has no attribute 'Model'
This seems to me slightly misleading. I submit that a better behaviour would be to show the line that caused the exception (I assume/hope that is possible since python knew it was accessing the Model attribute of the module object that caused the error).
I classified this as a behaviour bug rather than an enhancement, because I believe this would not be intended behaviour. I don't know if that's the case.
I apologise if this doesn't fit in "Intepreter core", but exceptions are builtins... I didn't know where else to put it.
changed the title [-]AttributeErrors in long lines showing 'wrong' line in error message[/-][+]AttributeErrors in statements split up into multiple linse with \ showing 'wrong' line as being responsible in error message[/+]on Oct 7, 2014
Activity
dingodasher commentedon Oct 6, 2014
I am using Flask, and I had the following code:
This code had a bug -> "models.Model.owner_id" in the first line. This was a typo, and Python gave me an AttributeError, just as I would expect. However, this is the error I was given:
It shows me the last line of that long statement, "models.ModuleAccess.write_access == True" as the beginning of the trace. The trace doesn't show the models.Module.whatever line that actually caused the error.
It seems to be like Python here takes the last line of the exception-causing statement and shows that along with the "actual" error message (which was on the money): AttributeError: 'module' object has no attribute 'Model'
This seems to me slightly misleading. I submit that a better behaviour would be to show the line that caused the exception (I assume/hope that is possible since python knew it was accessing the Model attribute of the module object that caused the error).
I classified this as a behaviour bug rather than an enhancement, because I believe this would not be intended behaviour. I don't know if that's the case.
I apologise if this doesn't fit in "Intepreter core", but exceptions are builtins... I didn't know where else to put it.
[-]AttributeErrors in long lines showing 'wrong' line in error message[/-][+]AttributeErrors in statements split up into multiple linse with \ showing 'wrong' line as being responsible in error message[/+]bitdancer commentedon Oct 7, 2014
This is a duplicate of bpo-12458.