GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Believe more __new__ return types by hauntsaninja · Pull Request #16020 · python/mypy

Believe more __new__ return types #16020

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.

Sign up for GitHub

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

Closed
hauntsaninja wants to merge 8 commits into python:master from hauntsaninja:abide-by-new

Uh oh!

There was an error while loading. Please reload this page.

Closed

Believe more __new__ return types #16020

Changes from 1 commit
Commits
Show all changes
8 commits
Select commit Hold shift + click to select a range
4616fa2
Believe arbitrary __new__ return types
hauntsaninja Sep 2, 2023
e2d3a5e
changes
hauntsaninja Sep 2, 2023
2bd91d5
more changes
hauntsaninja Sep 2, 2023
393b303
hacks
hauntsaninja Sep 4, 2023
7b7d76d
fix instantiate
hauntsaninja Sep 4, 2023
aa5df74
clarify comment
hauntsaninja Sep 4, 2023
59a5aee
clarify comment
hauntsaninja Sep 5, 2023
cdccffa
Merge branch 'master' into abide-by-new
JelleZijlstra Jul 5, 2024
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
clarify comment
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@hauntsaninja
hauntsaninja committed Sep 4, 2023
commit aa5df74a2e35d6ed44d18288a1580333e7396fdc

There are no files selected for viewing

2 changes: 1 addition & 1 deletion 2 mypy/checkmember.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def analyze_type_callable_member_access(name: str, typ: FunctionLike, mx: Member
# Unfortunately, generic arguments have already been determined for us. We need these,
# see e.g. testGenericClassMethodUnboundOnClass. So just copy them over to our type.
# This does the wrong thing with custom __new__, see testNewReturnType15, but is
# a lesser evil.
# no worse than previous behaviour.
ret_type = bound_arg.copy_modified(args=ret_type.args)
Comment thread

@ikonst ikonst Sep 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Maybe you can

Suggested change
ret_type = bound_arg.copy_modified(args=ret_type.args)
ret_type = bound_arg.copy_modified()

if you change checkexpr.py's apply_generic_arguments to expand bound_args (not sure if it's correct to do...):

 return callable.copy_modified(
     ret_type=expand_type(callable.ret_type, id_to_type),
+    bound_args=[
+        expand_type(ba, id_to_type) if ba is not None else None
+        for ba in callable.bound_args
+    ],
     variables=remaining_tvars,
     type_guard=type_guard,
 )

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
self_type = TypeType(ret_type)

Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.