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

Incorrect line numbers in error messages #165

Closed
sqlalchemy-bot opened this Issue Mar 22, 2011 · 2 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Mar 22, 2011

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.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 22, 2011

Michael Bayer (@zzzeek) wrote:

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

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 22, 2011

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