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

Option to show full path in cythonize error output? #2873

Open
ihnorton opened this Issue Mar 1, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@ihnorton
Copy link

ihnorton commented Mar 1, 2019

Currently cythonize prints error line numbers with relative paths:

Error compiling Cython file:
------------------------------------------------------------
...
------------------------------------------------------------

lib/foo.pyx:123:45: Cannot convert Python object to X

However, some environments do not support recognition/auto-hyperlinking of relative paths in external tool command output (e.g. JetBrains). I've made the following local change to get a full path in error messages (now: /path/to/lib/foo.pyx:123:45: Cannot convert Python object to X).

diff --git a/Compiler/Errors.py b/Compiler/Errors.py
index 9761b52..c2fcf8a 100644
--- a/Compiler/Errors.py
+++ b/Compiler/Errors.py
@@ -42,7 +42,7 @@ def context(position):

 def format_position(position):
     if position:
-        return u"%s:%d:%d: " % (position[0].get_error_description(),
+        return u"%s:%d:%d: " % (position[0].filename,
                                 position[1], position[2])
     return u''

This works for my immediate needs, however, it would be nice to have available as a config option. I can make the change at some point, but wanted (a) get approval first (b) suggest as a potential starter/good-first-issue (if you have a tag like that) until I can get to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.