Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deprecated access of collections members. #26173

Merged
merged 2 commits into from Jul 31, 2019
Merged

Fixed deprecated access of collections members. #26173

merged 2 commits into from Jul 31, 2019

Conversation

NeilGirdhar
Copy link
Contributor

Changed the access of the abstract base classes to use collections.abc.
This prevents warnings in Python 3.7, and runtime errors in Python 3.8+.

@NeilGirdhar
Copy link
Contributor Author

Closes #26095

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@NeilGirdhar
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@NeilGirdhar
Copy link
Contributor Author

If there are problems importing collections.abc on older Python, it would be helpful to either push this through (benjaminp/six#241) or else use this:

try:
    import collections.abc as collections_abc # only works on python 3.3+
except ImportError:
    import collections as collections_abc

@rthadur rthadur added this to Assigned Reviewer in PR Queue via automation Feb 27, 2019
@rthadur rthadur self-assigned this Feb 27, 2019
@alextp
Copy link
Contributor

alextp commented Mar 4, 2019

@NeilGirdhar can you change the pull request to do your proposed workaround for older python versions? TensorFlow still has to support python 2.7 and 3.5

@alextp alextp added the kokoro:force-run Tests on submitted change label Mar 4, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Mar 4, 2019
@NeilGirdhar
Copy link
Contributor Author

NeilGirdhar commented Mar 4, 2019

@alextp can we rely on six if they push through this pull request? benjaminp/six#241

3.5 is no problem. collections.abc exists there.

@alextp
Copy link
Contributor

alextp commented Mar 4, 2019 via email

@NeilGirdhar
Copy link
Contributor Author

I don't understand these build errors. It seems to be totally unrelated to my change. Any ideas?

@NeilGirdhar
Copy link
Contributor Author

@rthadur Could these errors have something to do with how the tests were run?

@rthadur
Copy link
Contributor

rthadur commented Jul 23, 2019

@NeilGirdhar i believe you need to update the test cases which are associated with the files.

@NeilGirdhar
Copy link
Contributor Author

@rthadur I don't see that? I see errors like "Broken by missing target @com_google_absl//absl/base:base" ? I don't see how this relates...

@rthadur
Copy link
Contributor

rthadur commented Jul 24, 2019

@alextp any thoughts why this tests are failing ?

@alextp alextp added the kokoro:force-run Tests on submitted change label Jul 24, 2019
@alextp
Copy link
Contributor

alextp commented Jul 24, 2019

@rthadur Looked like a tool failure, retrying

@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jul 24, 2019
@rthadur
Copy link
Contributor

rthadur commented Jul 24, 2019

@rthadur Looked like a tool failure, retrying

@alextp thank you, seems like most of the test failures are gone, can you please approve again.

alextp
alextp previously approved these changes Jul 24, 2019
@tensorflow-bot tensorflow-bot bot added kokoro:force-run Tests on submitted change ready to pull PR ready for merge process labels Jul 24, 2019
PR Queue automation moved this from Reviewer Requested Changes to Approved by Reviewer Jul 24, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jul 24, 2019
Copy link
Contributor

@rthadur rthadur left a comment

Choose a reason for hiding this comment

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

can you please above error

@@ -72,6 +71,8 @@ def testXXX(self):
from google.protobuf import message
from google.protobuf import text_format

from tensorflow.python.util.compat import collections_abc

Copy link
Contributor

Choose a reason for hiding this comment

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

tensorflow/python/util/protobuf/compare.py", line 75, in
from tensorflow.python.util.compat import collections_abc
ImportError: No module named tensorflow.python.util.compat

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've replaced this line with a relative import, and fixed some merge conflicts.

PR Queue automation moved this from Approved by Reviewer to Reviewer Requested Changes Jul 26, 2019
Changed the access of the abstract base classes to use a collections_abc compatibility stub.
* This prevents warnings in Python 3.7, and runtime errors in Python
  3.8+.
* The compatibility stub bridges the gap between Python 3.3+ where
  collections.abc was factored out of collections.
@rthadur rthadur requested a review from alextp July 30, 2019 15:34
@tensorflow-bot tensorflow-bot bot added the kokoro:force-run Tests on submitted change label Jul 30, 2019
@kokoro-team kokoro-team removed the kokoro:force-run Tests on submitted change label Jul 30, 2019
@rthadur rthadur added ready to pull PR ready for merge process and removed ready to pull PR ready for merge process labels Jul 30, 2019
@tensorflow-copybara tensorflow-copybara merged commit 435e0be into tensorflow:master Jul 31, 2019
PR Queue automation moved this from Reviewer Requested Changes to Merged Jul 31, 2019
tensorflow-copybara pushed a commit that referenced this pull request Jul 31, 2019
PiperOrigin-RevId: 260814539
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes comp:ops OPs related issues ready to pull PR ready for merge process size:M CL Change Size: Medium
Projects
PR Queue
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

7 participants