Skip to content

Fix python2 and python 3 compatibility found by lint.#13140

Closed
Yangqing wants to merge 2 commits intopytorch:masterfrom
Yangqing:export-D10858804
Closed

Fix python2 and python 3 compatibility found by lint.#13140
Yangqing wants to merge 2 commits intopytorch:masterfrom
Yangqing:export-D10858804

Conversation

@Yangqing
Copy link
Copy Markdown
Contributor

Summary:
This is an example about the benefit of proper facebook linter. The old code
was not python 2.x (actually, pre-python 3.3) compatible. Note that FileExistsError
is added in Python 3.3:

https://stackoverflow.com/questions/20790580/python-specifically-handle-file-exists-exception

Differential Revision: D10858804

Yangqing Jia added 2 commits October 25, 2018 14:08
Summary: This is an example diff to show what lint rules are being applied.

Differential Revision: D10858478

fbshipit-source-id: fc405fc76c44aca031a7720ebccd649993d356b7
Summary:
This is an example about the benefit of proper facebook linter. The old code
was not python 2.x (actually, pre-python 3.3) compatible. Note that FileExistsError
is added in Python 3.3:

https://stackoverflow.com/questions/20790580/python-specifically-handle-file-exists-exception

Differential Revision: D10858804

fbshipit-source-id: 7ab6bccdd6e22e8014004748c250ceb74eafdd95
Copy link
Copy Markdown
Contributor

@huitseeker huitseeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread torch/utils/__init__.py
@@ -0,0 +1 @@
from __future__ import absolute_import, division, print_function, unicode_literals

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary:
Pull Request resolved: pytorch#13140

This is an example about the benefit of proper facebook linter. The old code
was not python 2.x (actually, pre-python 3.3) compatible. Note that FileExistsError
is added in Python 3.3:

https://stackoverflow.com/questions/20790580/python-specifically-handle-file-exists-exception

Reviewed By: mingzhe09088

Differential Revision: D10858804

fbshipit-source-id: a4c995aef9f720cb8b0ce463f0a51db667fc42f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants