Repository navigation
Updated dict .keys() and .values() indexed calls for py3 - #56243
Conversation
|
Yeah good call, i think most of these are zero indexed so i will update. Thanks!
Sent from ProtonMail mobile
…-------- Original Message --------
On Feb 25, 2020, 2:09 AM, Pedro Algarvio wrote:
@s0undt3ch commented on this pull request.
Hmm, generating a whole list just to get one value seems like a bad performance move(if the list gets big enough).
next
(
iter
(
dict
.keys()))
```
?
This only works
for
the zero indexed
list
accesses.
—
You are receiving this because you authored the thread.
Reply to this email directly, [view it on GitHub](#56243?email_source=notifications&email_token=ABTCBHQOKVHHM3DDDLVOXTTRETN5FA5CNFSM4K24ZIY2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCWY4MLQ#pullrequestreview-363972142), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ABTCBHWIHMWGBCH5Y53HDQTRETN5FANCNFSM4K24ZIYQ).
|
|
OK I made that change anywhere on the codebase it seemed relevant except for the tests. I only saw exception handling in 2 locations and those were both updated from IndexError to StopIteration |
|
If this is approved it can deprecate #53433 as this fixes the same issue across all modules not just napalm beacons. I KNEW I wasn't going crazy.. at least not yet anyway. This felt like total deja vu |
|
Hmm.. #56232 brings up the point that this is also relevant for |
|
Not many occurrences of that actually, hopefully that last commit covers it |
|
Is there any way we could get this in to 3000.1? |
|
I've set up a key for signing future commits now, can we skip this error here or is there a way to sign past commits? |
8e9b7b6
|
well that wasn't as effective as I had hoped, will revert and then resolve manually |
8e9b7b6 to
d585259
Compare
raddessi
left a comment
There was a problem hiding this comment.
one more possible change
|
@DmitryKuzmenko how does this look now? |
|
re-run all full |
|
No need to apologize, the comments look good. I'll try to get this up to date tomorrow. Thanks! |
|
Good call, I completely missed one of the loops before. Latest requested changes should be in now @DmitryKuzmenko |
|
Perfect! Thank you! |
|
Has anyone validated there is test coverage for the methods changing in this PR? |
|
@dwoz not yet. Last I spoke with @DmitryKuzmenko we were both going to try to get that done so this could get in. I have not had any spare time yet unfortunately. |
|
Merging this since @DmitryKuzmenko has no easy way of verifying the test coverage. For the record I'm not a huge fan of the precedence this sets. |
)" This reverts commit f41cda1.
What does this PR do?
Update all indexed dict .keys() and .values() calls I could find to be compatible with python 3, since both
dict_keysanddict_valuesobjects are not subscriptable in python 3.What issues does this PR fix or reference?
I found this from napalm beacons not working when running in py3.
Previous Behavior
Napalm beacons would fail to run on py3.
New Behavior
Napalm beacons work as expected
Tests written?
No
Commits signed with GPG?
No