The Wayback Machine - https://web.archive.org/web/20220826014239/https://github.com/pydantic/pydantic/pull/4187
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch Exceptions in smart_deepcopy #4187

Merged

Conversation

coneybeare
Copy link
Contributor

@coneybeare coneybeare commented Jun 27, 2022

Change Summary

This PR comes from an issue where a sqlalchemy column definition was raising when not obj was called in smart_deepcopy. Whether or not the raise is warranted is a question for sqlalchemy, but catching the error here and falling back to deepcopy on seems to be a decent approach as a raise of this nature prevents application import and load.

Related issue number

Closes #4184

Checklist

  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100% (coverage is 99.08, but only because of unrelated files missed coverage)
  • Documentation reflects the changes where applicable
  • changes/<pull request or issue id>-<github username>.md file added describing change
    (see changes/README.md for details)
  • My PR is ready to review, please add a comment including the phrase "please review" to assign reviewers

@coneybeare
Copy link
Contributor Author

coneybeare commented Jun 27, 2022

please review @samuelcolvin

Copy link
Collaborator

@samuelcolvin samuelcolvin left a comment

Looking good, just one thing to change.

pydantic/utils.py Outdated Show resolved Hide resolved
tests/test_utils.py Outdated Show resolved Hide resolved
pydantic/utils.py Show resolved Hide resolved
@samuelcolvin
Copy link
Collaborator

samuelcolvin commented Aug 8, 2022

please update.

@samuelcolvin
Copy link
Collaborator

samuelcolvin commented Aug 11, 2022

LGTM, @coneybeare is this complete?

@coneybeare
Copy link
Contributor Author

coneybeare commented Aug 11, 2022

@samuelcolvin I believe it is, yes

@samuelcolvin samuelcolvin enabled auto-merge (squash) Aug 11, 2022
@samuelcolvin
Copy link
Collaborator

samuelcolvin commented Aug 11, 2022

great, thanks so much.

In future, it's safest to use the magic comment "please review" to assign the PR to me and make sure I know the PR needs my attention.

@samuelcolvin samuelcolvin merged commit b8a6957 into pydantic:master Aug 12, 2022
31 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.

4 participants