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

[python] remove workaround for UnboundLocalError in early stopping callback for Python 2 #4855

Merged
merged 1 commit into from
Dec 5, 2021

Conversation

StrikerRUS
Copy link
Collaborator

@StrikerRUS StrikerRUS commented Dec 5, 2021

Python 2 support was dropped for this project in #3581.

With Python 3 we can use nonlocal statement instead of wrapping variables into lists as a workaround for UnboundLocalError in nested function scopes.

This workaround was introduced in #1895 (comment) when we had to support Python 2.

Found this during investigating the failures in #4846.

Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

oh interesting! First time I've seen nonlocal before, but your explanation makes sense to me.

@jameslamb jameslamb merged commit aa413f7 into master Dec 5, 2021
@jameslamb jameslamb deleted the early_stop_workaround branch December 5, 2021 05:11
@StrikerRUS StrikerRUS mentioned this pull request Jan 6, 2022
13 tasks
@jameslamb jameslamb mentioned this pull request Oct 7, 2022
40 tasks
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants