Skip to content

Commit

Permalink
Introduce name "scope" in module browser, alias for globalThis. Relat…
Browse files Browse the repository at this point in the history
…ed to issue #2524.
  • Loading branch information
PierreQuentel committed Jan 6, 2025
1 parent 352a334 commit b17c2ec
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions www/src/brython.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ $B.unicode_bidi_whitespace=[9,10,11,12,13,28,29,30,31,32,133,5760,8192,8193,8194
;
__BRYTHON__.implementation=[3,13,1,'dev',0]
__BRYTHON__.version_info=[3,13,0,'final',0]
__BRYTHON__.compiled_date="2025-01-06 08:17:01.906092"
__BRYTHON__.timestamp=1736147821905
__BRYTHON__.compiled_date="2025-01-06 08:32:01.723747"
__BRYTHON__.timestamp=1736148721723
__BRYTHON__.builtin_module_names=["_ajax","_ast","_base64","_binascii","_io_classes","_json","_jsre","_locale","_multiprocessing","_posixsubprocess","_profile","_random","_sre","_sre_utils","_string","_strptime","_svg","_symtable","_tokenize","_webcomponent","_webworker","_zlib_utils","_zlib_utils1","_zlib_utils_kozh","array","builtins","dis","encoding_cp932","encoding_cp932_v2","hashlib","html_parser","marshal","math","modulefinder","posix","pyexpat","python_re","python_re_new","unicodedata","xml_helpers","xml_parser","xml_parser_backup"]
;

Expand Down Expand Up @@ -11320,7 +11320,7 @@ $B.DOMNode.bind(elt,$.evt,callback)}catch(err){if($B.$isinstance(err,_b_.StopIte
throw err}}}catch(err){if($B.$isinstance(err,_b_.AttributeError)){$B.DOMNode.bind($.elt,$.evt,callback)}
throw err}
return callback}},console:self.console && $B.jsobj2pyobj(self.console),run_script:function(){var $=$B.args("run_script",2,{src:null,name:null},["src","name"],arguments,{name:"script_"+$B.UUID()},null,null)
$B.runPythonSource($.src,$.name)},self:win,win:win,window:win}
$B.runPythonSource($.src,$.name)},scope:globalThis,self:win,win:win,window:win}
browser.__path__=browser.__file__
if($B.isNode){delete browser.window
delete browser.win}else if($B.isWebWorker){browser.is_webworker=true
Expand Down
1 change: 1 addition & 0 deletions www/src/builtin_modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
null, null)
$B.runPythonSource($.src, $.name)
},
scope: globalThis,
self: win,
win: win,
window: win
Expand Down
4 changes: 2 additions & 2 deletions www/src/version_info.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__BRYTHON__.implementation = [3, 13, 1, 'dev', 0]
__BRYTHON__.version_info = [3, 13, 0, 'final', 0]
__BRYTHON__.compiled_date = "2025-01-06 08:17:01.906092"
__BRYTHON__.timestamp = 1736147821905
__BRYTHON__.compiled_date = "2025-01-06 08:32:01.723747"
__BRYTHON__.timestamp = 1736148721723
__BRYTHON__.builtin_module_names = ["_ajax",
"_ast",
"_base64",
Expand Down
4 changes: 2 additions & 2 deletions www/tests/test_jsobjects.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Javascript objects used in this script are in jsobj_tests.js."""

# issue 744: Javascript objects should allow integer attribute names.
from browser import window
from browser import window, scope
import javascript
from tester import assert_raises


a = window.Uint8ClampedArray.new(10)
a = scope.Uint8ClampedArray.new(10)

for i in range(10):
a[i] = i
Expand Down

0 comments on commit b17c2ec

Please sign in to comment.