Remove (most) Python 2 support from Python code#35615
Remove (most) Python 2 support from Python code#35615dreiss wants to merge 7 commits intogh/dreiss/32/basefrom
Conversation
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI
💊 Build failures summary and remediationsAs of commit e049414 (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions on the GitHub issue tracker. This comment has been revised 45 times. |
| print(np.max(np.abs(Y2 - Y0))) | ||
| self.assertTrue(False) | ||
|
|
||
| @unittest.skipIf(sys.version_info.major > 2, "broken in python 3") |
There was a problem hiding this comment.
Probably shouldn't delete this, just mark it as expected broken or something? Or maybe the code is moribund and we don't care anyway... I guess probably that is true.
|
|
||
| if not PY2: | ||
| ops.append(truediv) | ||
| ops.append(truediv) |
There was a problem hiding this comment.
nit: can be moved to the list (don't do it in this PR if everything else is ok)
| from torch.testing._internal.common_utils import TEST_WITH_ROCM, shell | ||
| import torch.distributed as dist | ||
| PY2 = sys.version_info <= (3,) | ||
| PY33 = sys.version_info >= (3, 3) |
There was a problem hiding this comment.
We can probably axe this one too
| self.assertExpected(str(ast)) | ||
|
|
||
| @unittest.skipIf(PY2, "Requires python 3") | ||
| def test_python_frontend_py3(self): |
There was a problem hiding this comment.
nit: should probably rename the test, but whatever
| except ImportError: | ||
| return False | ||
| elif not PY34: # Python [3, 3.4) | ||
| if not PY34: # Python [3, 3.4) |
There was a problem hiding this comment.
Probably can get rid of this one (we don't support 3.4)
There was a problem hiding this comment.
Would you be comfortable with me adding a check like #35611 for 3.5+?
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI Differential Revision: [D20842886](https://our.internmc.facebook.com/intern/diff/D20842886)
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI Differential Revision: [D20842886](https://our.internmc.facebook.com/intern/diff/D20842886)
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI Differential Revision: [D20842886](https://our.internmc.facebook.com/intern/diff/D20842886) [ghstack-poisoned]
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI Differential Revision: [D20842886](https://our.internmc.facebook.com/intern/diff/D20842886) [ghstack-poisoned]
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI Differential Revision: [D20842886](https://our.internmc.facebook.com/intern/diff/D20842886) [ghstack-poisoned]
Summary: Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI ghstack-source-id: c491b81 Pull Request resolved: pytorch/pytorch#35615
Summary: Pull Request resolved: pytorch#35615 Python 2 has reached end-of-life and is no longer supported by PyTorch. Now we can clean up a lot of cruft that we put in place to support it. These changes were all done manually, and I skipped anything that seemed like it would take more than a few seconds, so I think it makes sense to review it manually as well (though using side-by-side view and ignoring whitespace change might be helpful). Test Plan: CI Differential Revision: D20842886 Pulled By: dreiss fbshipit-source-id: 8cad4e87c45895e7ce3938a88e61157a79504aed
Stack from ghstack:
Summary:
Python 2 has reached end-of-life and is no longer supported by PyTorch.
Now we can clean up a lot of cruft that we put in place to support it.
These changes were all done manually, and I skipped anything that seemed
like it would take more than a few seconds, so I think it makes sense to
review it manually as well (though using side-by-side view and ignoring
whitespace change might be helpful).
Test Plan:
CI
Differential Revision: D20842886