Skip to content

Change iter.next() to next(iter) - #9535

Merged
feerrenrut merged 3 commits into
nvaccess:thresholdfrom
jakubl7545:i9086
May 28, 2019
Merged

Change iter.next() to next(iter)#9535
feerrenrut merged 3 commits into
nvaccess:thresholdfrom
jakubl7545:i9086

Conversation

@jakubl7545

Copy link
Copy Markdown
Contributor

Link to issue number:

closes #9086

Summary of the issue:

See issue description.

Description of how this pull request fixes the issue:

As suggested I've changed iter.next() to next(iter).

Testing performed:

Only ran NVDA from source, because I'm not sure whether it needs any special testing scenerios.

Known issues with pull request:

None

Change log entry:

None
cc @josephsl

@josephsl

josephsl commented May 3, 2019

Copy link
Copy Markdown
Contributor

CC @LeonarddeR - let's defer this until speech refactor lands.

Comment thread source/eventHandler.py Outdated
self._gen = self.gen(eventName, obj)
try:
self.next()
next(self)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm afraid this is subject to serious breakage as it is now. You're calling next(self) instead of self.next(). However, next is a method on self. Here, you're not dealing with a real iterator, but with a class that only inherits from object.

I'd like to suggest to revert these changes to eventHandler altogether.

Comment thread source/sayAllHandler.py Outdated
@@ -49,7 +49,7 @@ def readObjects(obj):
_startGenerator(readObjectsHelper_generator(obj))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All changes to this file are going to conflict with #7599. Please revert these as well. They will be addressed during the Python 3 transition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've reverted the changes.

@LeonarddeR LeonarddeR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@feerrenrut: This is now a one liner, so this can be merged into master I think.

I'm sorry that I had to request to strip down the pull request this way.

@jakubl7545

Copy link
Copy Markdown
Contributor Author

Wouldn't be better to wait for merging speech refactor and then check if sayAllHandler still use iter.next()?

@feerrenrut

Copy link
Copy Markdown
Contributor

Wouldn't be better to wait for merging speech refactor and then check if sayAllHandler still use iter.next()?

Yes, I think this makes sense. You will need to change the target of this PR to be the threshold branch, which is where we will be doing the python 3 work.

@LeonarddeR

Copy link
Copy Markdown
Collaborator

I believe that with dropping speechCompat, there is no longer a call of next like this in sayAllHandler.

@jakubl7545
jakubl7545 changed the base branch from master to threshold May 23, 2019 15:36
@jakubl7545

Copy link
Copy Markdown
Contributor Author

I changed target branch to threshold and i found that sayAllHandler uses "reader.next()" in line 40 (readObjects function).
@LeonarddeR should this line be modified to next(reader)?

@LeonarddeR

LeonarddeR commented May 23, 2019 via email

Copy link
Copy Markdown
Collaborator

@jakubl7545

Copy link
Copy Markdown
Contributor Author

So i think it can be merged as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants