[ 
https://issues.apache.org/jira/browse/IMPALA-11976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17698508#comment-17698508
 ] 

ASF subversion and git services commented on IMPALA-11976:
----------------------------------------------------------

Commit aa4050b4d9fe3cfc20dde1386c67cea55e9ce3e5 in impala's branch 
refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=aa4050b4d ]

IMPALA-11976: Fix use of deprecated functions/fields removed in Python 3

Python 3 moved several things around or removed deprecated
functions / fields:
 - sys.maxint was removed, but sys.maxsize provides similar functionality
 - long was removed, but int provides the same range
 - file() was removed, but open() already provided the same functionality
 - Exception.message was removed, but str(exception) is equivalent
 - Some encodings (like hex) were moved to codecs.encode()
 - string.letters -> string.ascii_letters
 - string.lowercase -> string.ascii_lowercase
 - string.strip was removed

This fixes all of those locations. Python 3 also has slightly different
rounding behavior from round(), so this changes round() to use future's
builtins.round() to get the Python 3 behavior.

This fixes the following pylint warnings:
 - file-builtin
- long-builtin
- invalid-str-codec
- round-builtin
- deprecated-string-function
- sys-max-int
- exception-message-attribute

Testing:
 - Ran cores tests

Change-Id: I094cd7fd06b0d417fc875add401d18c90d7a792f
Reviewed-on: http://gerrit.cloudera.org:8080/19591
Reviewed-by: Joe McDonnell <[email protected]>
Tested-by: Joe McDonnell <[email protected]>


> Fix use of deprecated functions / packages in Python3 (long, maxint, file, 
> etc)
> -------------------------------------------------------------------------------
>
>                 Key: IMPALA-11976
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11976
>             Project: IMPALA
>          Issue Type: Sub-task
>          Components: Infrastructure
>    Affects Versions: Impala 4.3.0
>            Reporter: Joe McDonnell
>            Priority: Major
>
> Python 3 removed several deprecated functions / types.
>  
> {noformat}
> # 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){noformat}
> 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
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to