Skip to content

fix(trace): return removed row from pop()#6901

Open
Dev-X25874 wants to merge 2 commits into
wandb:masterfrom
Dev-X25874:fix/table-pop-return-value
Open

fix(trace): return removed row from pop()#6901
Dev-X25874 wants to merge 2 commits into
wandb:masterfrom
Dev-X25874:fix/table-pop-return-value

Conversation

@Dev-X25874
Copy link
Copy Markdown

Description

Both Table.pop() in weave/trace/table.py and WeaveTable.pop() in
weave/trace/vals.py were declared -> None and discarded the return
value of the underlying list.pop() call. Python's list.pop() removes
and returns the element at the given index; these implementations
silently broke that contract, meaning any caller doing:

row = my_table.pop(0)

would always receive None instead of the removed dict.

Fix: capture and return the result of the inner list.pop() in both
methods, and update their return type annotations from -> None to
-> dict.

Testing

Verified by code inspection that both call sites previously discarded
the list.pop() return value. No existing tests cover Table.pop() or
WeaveTable.pop() (confirmed via grep), so no tests were broken. Manual
smoke-test of the corrected behaviour:

t = Table([{"a": 1}, {"b": 2}])
row = t.pop(0)
assert row == {"a": 1}   # was None before the fix
assert len(t) == 1

@Dev-X25874 Dev-X25874 requested a review from a team as a code owner May 20, 2026 05:19
@wandbot-3000
Copy link
Copy Markdown

wandbot-3000 Bot commented May 20, 2026

This PR requires manual approval from a wandb user to run all CI checks.

To see the current diff, click here.

To approve CI for this PR as of this commit, comment:

/approve 5af9c473616ef48fe74fb8f08a6b9512c8cddfd1

@github-actions
Copy link
Copy Markdown
Contributor

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request

@Dev-X25874
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@Dev-X25874 Dev-X25874 changed the title trace/table: return removed row from Table.pop() and WeaveTable.pop() fix(trace): return removed row from pop() May 20, 2026
@wandbot-3000
Copy link
Copy Markdown

wandbot-3000 Bot commented May 20, 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.

1 participant