Skip to content

Allow table setdefault calls without an explicit default - #710

Open
kushaldave002 wants to merge 1 commit into
python-poetry:masterfrom
kushaldave002:fix/table-setdefault-optional-default
Open

kushaldave002 wants to merge 1 commit into
python-poetry:masterfrom
kushaldave002:fix/table-setdefault-optional-default

Conversation

@kushaldave002

Copy link
Copy Markdown

Summary

Allow Table.setdefault(key) and InlineTable.setdefault(key) to retrieve existing values without requiring an explicit default, matching dict and TOMLDocument behavior.

Missing-key calls still reject unsupported None values without modifying the document.

Add eight regression cases covering falsy values, normal and inline tables, formatting preservation, and failed insertion.

Validation:

  • 1,443 tests pass.
  • All configured pre-commit hooks pass.
  • Mypy reports the same 33 errors as unchanged upstream; no new errors.

Duplicate Check

  • I searched the open PRs and found none that already fixes this issue.
  • Related open PRs (if any, and why this PR is still needed): None found in repository searches for setdefault.

Agent Drafting Metadata

  • Agent: OpenAI Codex
  • Model: Exact deployment identifier unavailable.
  • Notes: Assisted with implementation, regression tests, and verification. The contributor confirmed review and approval.

@human-attestation

human-attestation Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

✅ Human Attestation: @kushaldave002 attested this PR at commit 7caff0d (2026-11-10T15:01:45.544Z).

I confirm the code in this PR was written by a human. / 我确认此 PR 中的代码均由人类编写。

Later pushes to this PR stay attested. Attestation page

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