Browse Source

[pythong] fix accessing `length` on a string stored into `Dynamic` variable (#6276)

Alexander Kuzmenko 8 years ago
parent
commit
1e843f7064
2 changed files with 8 additions and 2 deletions
  1. 2 0
      .gitignore
  2. 6 2
      std/python/Boot.hx

+ 2 - 0
.gitignore

@@ -105,3 +105,5 @@ Makefile.modules
 tests/benchs/mandelbrot/bin/
 tests/server/test/cases/
 tests/server/test.js
+
+tests/unit/pypy3-*

+ 6 - 2
std/python/Boot.hx

@@ -355,8 +355,12 @@ class Boot {
 			case "splice" if (isArray(o)):
 				createClosure(o, ArrayImpl.splice);
 			default:
-				var field = handleKeywords(field);
-				if (UBuiltins.hasattr(o, field)) UBuiltins.getattr(o, field) else null;
+				if(isString(o)) {
+					(o:String).length;
+				} else {
+					var field = handleKeywords(field);
+					if (UBuiltins.hasattr(o, field)) UBuiltins.getattr(o, field) else null;
+				}
 		}
 	}