-
Notifications
You must be signed in to change notification settings - Fork 24.9k
[dict] Raise TypeError in dict methods #154003
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
[dict] Raise TypeError in dict methods #154003
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/154003
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 Cancelled JobsAs of commit 18fa49f with merge base 524e827 ( CANCELLED JOBS - The following jobs were cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torch/_dynamo/variables/dicts.py
Outdated
@@ -567,9 +602,10 @@ def call_method( | |||
elif name == "__or__": | |||
assert len(args) == 1 | |||
if not isinstance(args[0], ConstDictVariable): | |||
raise TypeError( | |||
msg = ConstantVariable.create( | |||
f"unsupported operand type(s) for |: 'dict' and '{args[0].python_type().__name__}'" |
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.
Use python_type_name()
instead
msg = ConstantVariable.create( | ||
"fromkeys expected at least 1 arguments, got 0" | ||
) | ||
raise_observed_exception(TypeError, tx, args=[msg]) |
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.
I think you added the exception raising stuff after I last worked on Dynamo. that's really cool!
Starting merge as part of PR stack under #154943 |
Pull Request resolved: #154793 Approved by: https://github.com/mlazos, https://github.com/zou3519 ghstack dependencies: #154003
…#154794) Pull Request resolved: #154794 Approved by: https://github.com/mlazos ghstack dependencies: #154003, #154793
Pull Request resolved: #154942 Approved by: https://github.com/zou3519 ghstack dependencies: #154003, #154793, #154794
Stack from ghstack (oldest at bottom):
dict.update()
with no args #158061fromkeys
classmethod #155608bool(OrderedDict)
#155503hasattr(..., IteratorVariable)
#155501__eq__
for dict_items #155154OrderedDict.popitem(last=...)
#155153OrderedDict.move_to_end(key, last=False)
#155152Raise TypeError in the following scenarios:
cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames