Skip to content

Raise TypeError for invalid Dataset instance#649

Open
koteshyelamati wants to merge 1 commit into
jazzband:masterfrom
koteshyelamati:patch-1
Open

Raise TypeError for invalid Dataset instance#649
koteshyelamati wants to merge 1 commit into
jazzband:masterfrom
koteshyelamati:patch-1

Conversation

@koteshyelamati

Copy link
Copy Markdown

Problem

stack() and stack_cols() silently return None when passed a non-Dataset argument:

ds = tablib.Dataset()
result = ds.stack("not a dataset")
print(result)  # None — caller has no idea the operation failed

This makes bugs very hard to diagnose: callers receive None without any indication that the argument was invalid.

Fix

Raise TypeError with a clear message instead of silently returning None.

ds = tablib.Dataset()
ds.stack("not a dataset")
# TypeError: 'other' must be a Dataset instance

stack() and stack_cols() currently return None silently when passed a non-Dataset argument. This can hide bugs since callers get None back and may not notice the operation failed.

This commit raises TypeError with a clear message instead.
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.

1 participant