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

Bugfix for generic types with parameterized generic fields #672

merged 4 commits into from Jul 24, 2019


Copy link

commented Jul 17, 2019

Change Summary

Fixes a bug where a generic parameter exists alongside a fully-parameterized generic parameter in the model.

Related issue number

Fixes a bug discovered while answering #668


  • Unit tests for the changes exist
  • Tests pass on CI and coverage remains at 100%
  • Documentation reflects the changes where applicable
  • HISTORY.rst has been updated
    • if this is the first change since a release, please add a new section
    • include the issue number or this pull request number #<number>
    • include your github username @<whomever>
return type_.__origin__[new_args]
new_args = tuple([typevars_map[x] for x in type_.__parameters__])
return type_[new_args]
if hasattr(type_, '__origin__') and getattr(type_, '__parameters__', None):

This comment has been minimized.

Copy link

dmontagu Jul 17, 2019

Author Collaborator

This is closer to the way typing handles determining whether a type is generic than the prior implementation (in addition to being simpler).


This comment has been minimized.

Copy link

commented Jul 17, 2019

Codecov Report

Merging #672 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##           master   #672   +/-   ##
  Coverage     100%   100%           
  Files          15     15           
  Lines        2712   2712           
  Branches      537    537           
  Hits         2712   2712

@dmontagu dmontagu force-pushed the dmontagu:genericfix branch from 86300f6 to 9f3de92 Jul 23, 2019

David Montague and others added some commits Jul 17, 2019

David Montague

@samuelcolvin samuelcolvin merged commit b09e697 into samuelcolvin:master Jul 24, 2019

6 of 9 checks passed

Header rules No header rules processed
Pages changed 2 new files uploaded
Redirect rules No redirect rules processed
Mixed content No mixed content detected
continuous-integration/travis-ci/pr The Travis CI build passed
deploy/netlify Deploy preview ready!
samuelcolvin.pydantic Build #20190724.8 succeeded
samuelcolvin.pydantic (Job Python36) Job Python36 succeeded
samuelcolvin.pydantic (Job Python37) Job Python37 succeeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.