Skip to content

fix: remove imports that are not needed#5651

Merged
westonpace merged 1 commit intolance-format:mainfrom
westonpace:fix/remove-excess-imports
Jan 7, 2026
Merged

fix: remove imports that are not needed#5651
westonpace merged 1 commit intolance-format:mainfrom
westonpace:fix/remove-excess-imports

Conversation

@westonpace
Copy link
Copy Markdown
Member

There is already an import warnings at the top of the file. Having the import inside the if branches actually causes errors because if you have something like this...

import warnings

def some_function():
  if something:
    import warnings
  warnings.warn("blah")

You will get an error because the inner import creates a function-local variable named warnings which is undefined when the function starts and you will get an UnboundLocalError. This is currently causing the benchmarks to fail.

@github-actions github-actions Bot added bug Something isn't working python labels Jan 7, 2026
@westonpace westonpace merged commit c44384c into lance-format:main Jan 7, 2026
12 of 15 checks passed
jackye1995 pushed a commit to jackye1995/lance that referenced this pull request Jan 21, 2026
There is already an `import warnings` at the top of the file. Having the
import inside the if branches actually causes errors because if you have
something like this...

```
import warnings

def some_function():
  if something:
    import warnings
  warnings.warn("blah")
```

You will get an error because the inner import creates a function-local
variable named `warnings` which is undefined when the function starts
and you will get an `UnboundLocalError`. This is currently causing the
benchmarks to fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants