bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[python3 only] when use "--gtagslabel=pygements", gtags don't output (C


From: ishigane
Subject: [python3 only] when use "--gtagslabel=pygements", gtags don't output (C language) function names into GTAGS
Date: Thu, 9 Mar 2017 22:16:47 +0900
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

Dear all,

It might be a bug? I send a report.
Target is "*.c"(C language file).

When run "gtags" with "--gtagslabel=pygments" option, GTAGS file don't have any function names. CTagsParser (at "share/gtags/script/pygments_parser.py") failed to initialize, gtags only use pygments.

This issue occurs only using python3. In the case of python 2.7.13, no problem.

environments:
   Windows10 Pro x64
   global 6.5.6 (http://adoxa.altervista.org/global/)
   python 3.6.0 x64 + pygments 2.2.0
exuberant ctags 5.8 (patched, http://hp.vector.co.jp/authors/VA025040/ctags/)

Instructions:
1. I prepared "test.c". Content is like below.
----------
#include <stdio.h>

void test() {
}

int main(int argc, **char argv) {
        return 0;
}
-----------

2. gtags --gtagslabel=pygments
3. gtags -d GTAGS

expected result(same as python2):
  __.COMPNAME     __.COMPNAME
  __.COMPRESS     __.COMPRESS ddefine ttypedef
  __.VERSION      __.VERSION 6
main    1 @n 6 int @n(int argc, **char argv) {
test    1 @n 3 void @n() {

actual result(python3):
  __.COMPNAME     __.COMPNAME
  __.COMPRESS     __.COMPRESS ddefine ttypedef
  __.VERSION      __.VERSION 6

cause:
"share/gtags/script/pygments_parser.py".

At handle_requests(), CtagsParser failed to initialize.
At CtagsParser.__init__, subprocess.Popen() failed.

Because of "ctags_command"(argument of CtagsParser.__init__) is byte type.

patch:
--- pygments_parser.py.orig     2017-01-13 12:32:06 +0900
+++ pygments_parser.py  2017-03-09 18:44:25 +0900
@@ -239,6 +239,8 @@
                  stdout=subprocess.PIPE, stderr=subprocess.PIPE)
      if p.wait() == 0:
          path = p.stdout.readline().rstrip()
+    if sys.version_info >= (3, ):
+        path = path.decode()
      return path

  def main():

I don't know well about python(is checking/converting really ok?), it might be exists more better way.

Regards,
Seigo Ishigane

Attachment: decode_path.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]