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

BUG: declare "gfk" variable before call of terminate() in newton-cg #8248

Merged
merged 1 commit into from Dec 22, 2017

Conversation

dlax
Copy link
Member

@dlax dlax commented Dec 22, 2017

In _minimize_newtoncg(), the first call to terminate() might occur
before the "gfk" variable has been declared, leading to:

NameError: free variable 'gfk' referenced before assignment in enclosing scope

This happens for instance if maxiter is negative as demonstrated in
added test case.

Closes #8241.

In _minimize_newtoncg(), the first call to terminate() might occur
before the "gfk" variable has been declared, leading to:

    NameError: free variable 'gfk' referenced before assignment in enclosing scope

This happens for instance if maxiter is negative as demonstrated in
added test case.

Closes scipy#8241.
@pv pv merged commit 723e0a3 into scipy:master Dec 22, 2017
@pv pv added this to the 1.1.0 milestone Dec 22, 2017
@pv pv added the backport-candidate This fix should be ported by a maintainer to previous SciPy versions. label Dec 22, 2017
@dlax dlax deleted the optimize/fix-name-error-in-ncg branch December 23, 2017 10:58
@rgommers rgommers modified the milestones: 1.1.0, 1.0.1 Mar 17, 2018
@rgommers rgommers mentioned this pull request Mar 17, 2018
@rgommers rgommers removed the backport-candidate This fix should be ported by a maintainer to previous SciPy versions. label Mar 23, 2018
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.

None yet

3 participants