Skip to content

Commit bf7972d

Browse files
committed
Merge pull request #1126 from kmod/unicode_iteration
Fix a llvm-tier getiter() bug
2 parents 83f56df + eef06d7 commit bf7972d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/codegen/compvars.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1993,8 +1993,16 @@ class NormalObjectType : public ConcreteCompilerType {
19931993
const std::vector<BoxedString*>* keyword_names) override {
19941994
ExceptionStyle exception_style = info.preferredExceptionStyle();
19951995

1996+
bool no_attribute = false;
1997+
bool* no_attribute_ptr = NULL;
1998+
if (flags.null_on_nonexistent)
1999+
no_attribute_ptr = &no_attribute;
2000+
19962001
CompilerVariable* called_constant = tryCallattrConstant(emitter, info, var, attr, flags.cls_only, flags.argspec,
1997-
args, keyword_names, NULL, exception_style);
2002+
args, keyword_names, no_attribute_ptr, exception_style);
2003+
2004+
if (no_attribute)
2005+
return new ConcreteCompilerVariable(UNKNOWN, getNullPtr(g.llvm_value_type_ptr), 1);
19982006

19992007
if (called_constant)
20002008
return called_constant;

test/tests/unicode_iteration.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def f():
2+
u = u'aoeu'
3+
for c in u:
4+
print repr(c)
5+
f()

0 commit comments

Comments
 (0)