Skip to content

Quality: Built-in name shadowing in jsonsplit signature#780

Closed
tomaioo wants to merge 1 commit into
simonw:mainfrom
tomaioo:improve/quality/built-in-name-shadowing-in-jsonsplit-sig
Closed

Quality: Built-in name shadowing in jsonsplit signature#780
tomaioo wants to merge 1 commit into
simonw:mainfrom
tomaioo:improve/quality/built-in-name-shadowing-in-jsonsplit-sig

Conversation

@tomaioo

@tomaioo tomaioo commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Quality: Built-in name shadowing in jsonsplit signature

Problem

Severity: Medium | File: sqlite_utils/recipes.py:L55

The jsonsplit function in recipes.py uses type as a parameter name, shadowing the Python built-in type. This can cause subtle bugs if the built-in is needed within the function scope or in nested calls, and it reduces code clarity for readers.

Solution

Rename the parameter to type_ or value_type to avoid shadowing the built-in type. Update all call sites accordingly.

Changes

  • sqlite_utils/recipes.py (modified)

📚 Documentation preview 📚: https://sqlite-utils--780.org.readthedocs.build/en/780/

The `jsonsplit` function in `recipes.py` uses `type` as a parameter name, shadowing the Python built-in `type`. This can cause subtle bugs if the built-in is needed within the function scope or in nested calls, and it reduces code clarity for readers.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@simonw

simonw commented Jul 7, 2026

Copy link
Copy Markdown
Owner

I'm willing to take this risk. If I need to use type() inside that function later on I'll address the problem then.

@simonw simonw closed this Jul 7, 2026
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.

2 participants