Skip to content
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
Closed

Incorrect line numbers in error messages #165

sqlalchemy-bot opened this issue Mar 22, 2011 · 2 comments
Labels
bug Something isn't working low priority

Comments

@sqlalchemy-bot
Copy link

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
Copy link
Author

Michael Bayer (@zzzeek) wrote:

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

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added low priority bug Something isn't working labels Nov 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority
Projects
None yet
Development

No branches or pull requests

1 participant