[
https://issues.apache.org/jira/browse/IMPALA-11977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17698509#comment-17698509
]
ASF subversion and git services commented on IMPALA-11977:
----------------------------------------------------------
Commit 0c7c6a335ef06dcd123804803f4d34fafcf4c9a8 in impala's branch
refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=0c7c6a335 ]
IMPALA-11977: Fix Python 3 broken imports and object model differences
Python 3 changed some object model methods:
- __nonzero__ was removed in favor of __bool__
- func_dict / func_name were removed in favor of __dict__ / __name__
- The next() function was deprecated in favor of __next__
(Code locations should use next(iter) rather than iter.next())
- metaclasses are specified a different way
- Locations that specify __eq__ should also specify __hash__
Python 3 also moved some packages around (urllib2, Queue, httplib,
etc), and this adapts the code to use the new locations (usually
handled on Python 2 via future). This also fixes the code to
avoid referencing exception variables outside the exception block
and variables outside of a comprehension. Several of these seem
like false positives, but it is better to avoid the warning.
This fixes these pylint warnings:
bad-python3-import
eq-without-hash
metaclass-assignment
next-method-called
nonzero-method
exception-escape
comprehension-escape
Testing:
- Ran core tests
- Ran release exhaustive tests
Change-Id: I988ae6c139142678b0d40f1f4170b892eabf25ee
Reviewed-on: http://gerrit.cloudera.org:8080/19592
Reviewed-by: Joe McDonnell <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> Fix broken imports on Python 3 and Python 3 object model differences
> --------------------------------------------------------------------
>
> Key: IMPALA-11977
> URL: https://issues.apache.org/jira/browse/IMPALA-11977
> Project: IMPALA
> Issue Type: Sub-task
> Components: Infrastructure
> Affects Versions: Impala 4.3.0
> Reporter: Joe McDonnell
> Priority: Major
>
> Several libraries moved in Python 3. For example, urllib2, httplib, Queue,
> and several others. See:
> [https://python-future.org/compatible_idioms.html#urllib-module]
> [https://python-future.org/compatible_idioms.html#http-module]
> This is also a good time to fix several warnings about object model
> differences. __nonzero__ is now __bool__, metaclasses are specified
> differently, iterator next() method is deprecated, objects that implement
> __eq__ should also implement __hash__, etc.
> The pylint checks that could be fixed by this would be:
> bad-python3-import
> eq-without-hash
> metaclass-assignment
> next-method-called
> nonzero-method
> comprehension-escape
> exception-escape
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]