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

Fix "Failing to pass a value to the type_params parameter of typing._eval_type" #3692

Merged
merged 2 commits into from
Nov 8, 2024

Conversation

patrick91
Copy link
Member

@patrick91 patrick91 commented Nov 8, 2024

Closes #3690

Summary by Sourcery

Bug Fixes:

  • Fix the issue where the 'type_params' parameter was not being passed to the '_eval_type' function in 'strawberry/utils/typing.py'.

Copy link
Contributor

sourcery-ai bot commented Nov 8, 2024

Reviewer's Guide by Sourcery

This PR fixes a bug in the type evaluation functionality by explicitly passing None as the type_params parameter to the _eval_type function call. The change ensures proper handling of forward references in type evaluation.

Sequence diagram for type evaluation with _eval_type

sequenceDiagram
    participant eval_type
    participant _eval_type

    eval_type->>_eval_type: Call _eval_type(type_, globalns, localns, type_params=None)
    _eval_type-->>eval_type: Return evaluated type

    note right of eval_type: Explicitly passing None to type_params
Loading

File-Level Changes

Change Details Files
Added missing type_params parameter in _eval_type function call
  • Updated _eval_type function call to include type_params=None parameter
  • Fixed potential error when evaluating ForwardRef types
strawberry/utils/typing.py

Assessment against linked issues

Issue Objective Addressed Explanation
#3690 Fix the DeprecationWarning about missing type_params parameter in typing._eval_type

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @patrick91 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@botberry
Copy link
Member

botberry commented Nov 8, 2024

Thanks for adding the RELEASE.md file!

Here's a preview of the changelog:


This release fixes the following deprecation warning:

Failing to pass a value to the 'type_params' parameter of 'typing._eval_type' is deprecated,
as it leads to incorrect behaviour when calling typing._eval_type on a stringified annotation
that references a PEP 695 type parameter. It will be disallowed in Python 3.15.

This was only trigger in Python 3.13 and above.

Here's the tweet text:

🆕 Release (next) is out! Thanks to @patrick91 for the PR 👏

Get it here 👉 https://strawberry.rocks/release/(next)

Copy link

codecov bot commented Nov 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.01%. Comparing base (04936fd) to head (e03b32c).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3692   +/-   ##
=======================================
  Coverage   97.01%   97.01%           
=======================================
  Files         502      502           
  Lines       33568    33571    +3     
  Branches     5634     5635    +1     
=======================================
+ Hits        32565    32568    +3     
  Misses        796      796           
  Partials      207      207           

Copy link

codspeed-hq bot commented Nov 8, 2024

CodSpeed Performance Report

Merging #3692 will not alter performance

Comparing feature/fix-deprecation (e03b32c) with main (04936fd)

Summary

✅ 15 untouched benchmarks

@patrick91 patrick91 merged commit 7c2482e into main Nov 8, 2024
109 checks passed
@patrick91 patrick91 deleted the feature/fix-deprecation branch November 8, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning: Failing to pass a value to the type_params parameter of typing._eval_type
2 participants