Skip to content

Commit b09dfc2

Browse files
DinoVfacebook-github-bot
authored andcommitted
Generators get the is_method bit as well
Summary: CPython marks generator expressions as methods as well, so we need to too. Reviewed By: mpage Differential Revision: D82077058 fbshipit-source-id: a69679f2e605728aee352bbb0da7e55438b4bf0c
1 parent 15bebd5 commit b09dfc2

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

cinderx/PythonLib/cinderx/compiler/symbols.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,9 @@ def visit_gen_impl(
536536
):
537537
scope.nested = True
538538

539+
if isinstance(parent, ClassScope):
540+
scope.is_method = True
541+
539542
parent.comp_iter_expr += 1
540543
self.visit(node.generators[0].iter, parent)
541544
parent.comp_iter_expr -= 1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# pyre-ignore-all-errors
2+
class C:
3+
locals().update((name, getattr(x, name))
4+
for name in dir(x))

0 commit comments

Comments
 (0)