Skip to content

Commit 2834595

Browse files
committed
patch for transcrypt __getdefault__
1 parent ac282c2 commit 2834595

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎js-transcrypt/transcrypt_runtime_patches.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ __pop__ = function (aKey, aDefault) {
5959
}
6060
return aDefault;
6161
}
62+
//
63+
// Similar bug in __getdefault__() for dictionaries' .get() method
64+
//
65+
__getdefault__ = function (aKey, aDefault) {
66+
var result = this [aKey];
67+
if (result === undefined) {
68+
result = this ['py_' + aKey]
69+
}
70+
if (result !== undefined) {
71+
return result;
72+
}
73+
if (aDefault === undefined) {
74+
return null;
75+
}
76+
return aDefault;
77+
}
6278

6379
//
6480
// Check that a is not null, too, otherwise we get errors with "'__eq__' in a".

0 commit comments

Comments
 (0)