Skip to content

PYTHON-6146 Fix the rewrap_many_data_key example - #3139

Merged
NoahStapp merged 1 commit into
mongodb:mainfrom
GoldenEmperor1177:PYTHON-6146
Oct 22, 2026
Merged

NoahStapp merged 1 commit into
mongodb:mainfrom
GoldenEmperor1177:PYTHON-6146

Conversation

@GoldenEmperor1177

@GoldenEmperor1177 GoldenEmperor1177 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

PYTHON-6146

Changes in this PR

The example in the docstring of ClientEncryption.rewrap_many_data_key passed the provider inside master_key, which raises ConfigurationError ("A provider must be given if a master_key is given"). The provider is now its own argument and master_key uses the fields of an Azure master key (keyVaultEndpoint, keyName) as documented in create_data_key. Docstring only. The synchronous copy was regenerated with tools/synchro.py. No changelog entry, as for earlier docstring fixes.

AI disclosure: I used an AI assistant (Claude Code) to help find the cause and write the fix. I read the change and I understand it.

Test Plan

Docs only, so no new test. I checked that the old example raises ConfigurationError and that the new one binds to the real signature and passes the argument checks. sphinx -W builds without warnings and the rendered example is correct. ruff, ruff format, the pre-commit hooks and the synchro self-test pass, and running tools/synchro.py again leaves a clean tree. The encryption tests that need KMS credentials cannot run in my environment, and the rewrap tests fail identically on main there.

Checklist

Checklist for Author

  • Did you update the changelog (if necessary)?
  • Is there test coverage?
  • Is any followup work tracked in a JIRA ticket? If so, add link(s).

Checklist for Reviewer

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Is all relevant documentation (README or docstring) updated?

The example in the docstring of ClientEncryption.rewrap_many_data_key
passed the provider inside master_key, which raises a
ConfigurationError because no provider is given. Pass the provider as
its own argument and use the fields of an Azure master key.
@GoldenEmperor1177
GoldenEmperor1177 requested a review from a team as a code owner October 22, 2026 16:46
@NoahStapp
NoahStapp merged commit 1c29e76 into mongodb:main Oct 22, 2026
79 of 80 checks passed
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