-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
tools: make test.py Queue part Python 3 compatible #25701
Conversation
This patch failed the python linter… /cc @nodejs/python |
Just reverse the try except and change the exception to ImportError. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with @cclauss's suggested change.
I can change it. But the root cause is the lint bug. |
The linter is not wrong ModuleNotFoundError does not exist in Python < 3.6 thus it is an undefined name. Please replace it with ImportError. |
I see, thanks for the info. |
tools/test.py
Outdated
try: | ||
from Queue import Queue, Empty # Python 2 | ||
except ModuleNotFoundError: | ||
from queue import Queue, Empty # Python 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try:
from queue import Queue, Empty # Python 3
except ImportError:
from Queue import Queue, Empty # Python 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will push again when I got home :) |
Signed-off-by: gengjiawen <technicalcute@gmail.com>
8dc295a
to
d30502d
Compare
Landed in 08100bf |
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: #25701 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: #25701 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: #25701 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: #25701 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Signed-off-by: gengjiawen <technicalcute@gmail.com> PR-URL: #25701 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
make -j4 test
(UNIX), orvcbuild test
(Windows) passescc @nodejs/python @cclauss