Skip to content

Incorrect line numbers in error messages #165

Description

@sqlalchemy-bot

Migrated issue, originally created by Anonymous

The line numbers shown for runtime error messages are often
slightly too big.

As far as I could see the problem is in exceptions.py in
function _init(self, trcback), line 169. Actual code is:

      for line in module_source.split("\n"):
          match = re.match(r'\s*# SOURCE LINE (\d+)', line)
          if match:
              template_ln = int(match.group(1))
 (*)      else:
 (*)          template_ln += 1
          module_ln += 1
          line_map[module_ln] = template_ln

The two marked lines should be removed. It seems better to take
the line from the last # SOURCE LINE statement. Increasing the
line number for each python code line is not a good idea because
there is more than one python code line for one template source
line.

Activity

  1. sqlalchemy-bot commented on Mar 22, 2011

    @sqlalchemy-bot
    Author

    Michael Bayer (@zzzeek) wrote:

    probably a good idea, thanks for the tip. 266abeb

  2. sqlalchemy-bot commented on Mar 22, 2011

    @sqlalchemy-bot
    Author

    Changes by Michael Bayer (@zzzeek):

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions