[py2py3] Migration at level scr/python/A/B/C - slice 26 #10150
Labels
Has Internal Dependency
Medium Priority
New Feature
py2py3 slice
Issue related to slicing the modernization to py2py3
Python3
Intro
Our purpose is to
continue withcomplete the gradual migration.This is the 26-th and last slice in which the migration has been divided into.
We have split migration units at level
src/python/A/B/C
.Unless the plan is changedThe plan did not change, so this is the last slice in which the migration is split into! 🎉Impact of the new feature
I run
pylint --py3k -d W1618
on whole dmwm/WMCore and I will paste here its report, so that we have a todo list with the last things requiredsrc/
[1]test/
[2]setup_*.py
,bin/
,tools/
,standards/
,etc/
,doc/
,deploy/
are okKeep in mind
W1618
, because it complains about absolute imports, which is not a problem for us now.Is your feature request related to a problem? Please describe.
The end goal is to have WMCore py2 and py3 compatible.
Describe the solution you'd like
We should fix the report from pylint
other info
[1]
src/python/WMCore/Configuration.py:74:0: W1641: Implementing __eq__ without also implementing __hash__ (eq-without-hash)
. [3]src/python/WMCore/Configuration.py:143:33: W1612: unicode built-in referenced (unicode-builtin)
. protected byif not PY3
[2]
if PY2
[3]
Module src.python.WMCore.Configuration src/python/WMCore/Configuration.py:74:0: W1641:
Implementing __eq__ without also implementing __hash__ (eq-without-hash)
.__eq__
without also implentnting__hash__
pylint-dev/pylint#1115 and at https://gist.github.com/rowillia/c0feed97c1863b2d8e5a3ed73712df65Py2 tries to be smart and uses
object.__hash__
by default if the user does not define__hash__
in his class. This makes classes with potential mutable attributes to be hashable, which is not what we want. Python3 returns aTypeError: unhashable type
as soon as possible.With this is mind, I would not change
Configuration.py:ConfigSection
. I do not expect dmwm/WMCore to contain bugs related to this, since i am confident that we would have noticed such a strange behavior in all these years. However, in the remote possibility that we have such a bug, if we do not change anything, then py3 will return aTypeError
when we try to hash an unhashable type, which is all we want.References:
The text was updated successfully, but these errors were encountered: