Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-8508 Use Python 3 from toolchain for impala-python
  3. IMPALA-11976

Fix use of deprecated functions / packages in Python3 (long, maxint, file, etc)

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Impala 4.3.0
    • Impala 4.3.0
    • Infrastructure
    • None
    • ghx-label-2

    Description

      Python 3 removed several deprecated functions / types.

       

      # sys.maxint is removed, replace with sys.maxsize
      sys.maxint -> sys.maxsize
      
      # file() is removed, use open()
      file() -> open()
      
      # Long is gone, int is now equivalent to long, can use int from future
      from builtins import int
      long() -> int()
      
      # e.message is gone, replace with str(e) 
      e.message -> str(e)

      There are a grab bag of others like strings.letters becoming string.ascii_letters and codecs moving to a different package.

      This is also a good time to get the new behavior for round().

      See these descriptions:

      https://python-future.org/compatible_idioms.html#file

      https://python-future.org/compatible_idioms.html#long-integers

      This corresponds to these pylint checks:

      file-builtin
      long-builtin
      invalid-str-codec
      round-builtin
      deprecated-string-function
      sys-max-int
      exception-message-attribute

       

      Attachments

        Activity

          People

            joemcdonnell Joe McDonnell
            joemcdonnell Joe McDonnell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: