[GRASS-dev] [GRASS GIS] #3331: ctypes: ValueError: invalid literal for int() with base 8: '08420217248550443400745280086994171'

GRASS GIS trac at osgeo.org
Thu Jun 8 02:47:09 PDT 2017


#3331: ctypes: ValueError: invalid literal for int() with base 8:
'08420217248550443400745280086994171'
--------------------------+----------------------------
  Reporter:  neteler      |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.2.2
 Component:  Python       |    Version:  unspecified
Resolution:               |   Keywords:  ctypes, python
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+----------------------------

Comment (by neteler):

 The relevant difference is that Fedora 26 comes with GCC 7 while F25 comes
 with GCC 6. Probably something changed in the preprocessor?

 Adding some debug output shows where in the lexer the problem occurs:

 {{{
 [root at f1e5cbaaed18 ctypes]# make | grep 084202
 #define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L
 #define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x
 Traceback (most recent call last):
   File "./ctypesgen.py", line 139, in <module>
     descriptions = ctypesgencore.parser.parse(options.headers, options)
   File
 "/root/grass-7.2.svn_src_snapshot_2017_06_03/lib/python/ctypes/ctypesgencore/parser/__init__.py",
 line 22, in parse
     parser.parse()
   File
 "/root/grass-7.2.svn_src_snapshot_2017_06_03/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py",
 line 74, in parse
     ctypesparser.CtypesParser.parse(self, fname, None)
   File
 "/root/grass-7.2.svn_src_snapshot_2017_06_03/lib/python/ctypes/ctypesgencore/parser/cparser.py",
 line 120, in parse
     self.preprocessor_parser.parse(filename)
   File
 "/root/grass-7.2.svn_src_snapshot_2017_06_03/lib/python/ctypes/ctypesgencore/parser/preprocessor.py",
 line 219, in parse
     token = self.lexer.token()
   File
 "/root/grass-7.2.svn_src_snapshot_2017_06_03/lib/python/ctypes/ctypesgencore/parser/preprocessor.py",
 line 63, in token
     result = lex.Lexer.token(self)
   File
 "/root/grass-7.2.svn_src_snapshot_2017_06_03/lib/python/ctypes/ctypesgencore/parser/lex.py",
 line 357, in token
     newtok = func(tok)
   File
 "/root/grass-7.2.svn_src_snapshot_2017_06_03/lib/python/ctypes/ctypesgencore/parser/pplexer.py",
 line 262, in t_ANY_int
     g1 = str(long(g1, 8))
 ValueError: invalid literal for int() with base 8:
 '08420217248550443400745280086994171'
 make[1]: *** [Makefile:102: OBJ.x86_64-pc-linux-gnu/proj.py] Error 1
 make: *** [Makefile:81: default] Error 2
 }}}

 As seen above the '__LDBL_EPSILON__' definition is not parsed properly in
 GCC 7 (or in our ctypesgencore software which seems to come from here:
 https://github.com/davidjamesca/ctypesgen).

 Perhaps we need a sync with the official code repo?

 Interim work-around (also attached):

 {{{
 --- lib/python/ctypes/ctypesgencore/parser/preprocessor.py      (Revision
 71170)
 +++ lib/python/ctypes/ctypesgencore/parser/preprocessor.py
 (Arbeitskopie)
 @@ -150,7 +150,6 @@
          if sys.platform == 'darwin':
              cmd += " -U __BLOCKS__"
          cmd += " -U __GNUC__"
 -        cmd += " -dD"
          for path in self.options.include_search_paths:
              cmd += " -I%s" % path
          for define in self.defines:
 }}}

 The question is: does ctypes still work? How to run the needed testsuite
 parts?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3331#comment:7>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list