Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: TypeError: locals is undefined #2461

Open
moepnse opened this issue Jun 23, 2024 · 0 comments
Open

RuntimeError: TypeError: locals is undefined #2461

moepnse opened this issue Jun 23, 2024 · 0 comments

Comments

@moepnse
Copy link
Contributor

moepnse commented Jun 23, 2024

Hi!

I'm not sure if this is related to the shadow DOM migration I'm currently doing or just a coincidence, but I will find out.

I am currently trying to reproduce the problem in a simplified issue demo. Unfortunately still without success. But maybe this informations will be enough for you and help you to find the bug.
I'm pretty sure I should get a Python exception and not a RuntimeError.

If I find something useful I'll let you know.

Thanks in advance.

Traceback (most recent call last):
  File "?brython-version=snapshot", line 18, in onopen
    import elephas
  File "VFS.elephas/__init__.py", line 73, in <module>
    from. import ui
  File "VFS.elephas.ui/__init__.py", line 6, in <module>
    from. import splash
  File "VFS.elephas.ui.uiplugins.py", line 44, in <module>
    browser.aio.run(load_ui_plugins())
RuntimeError: TypeError: locals is undefined

I think only the first few lines of the JavaScript code are of interest.

// Javascript code generated from ast
var $B = __BRYTHON__,
    _b_ = $B.builtins,
    locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354 = $B.imported["webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354"],
    locals = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354,
    frame = ["webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354", locals, "webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354", locals]
var __file__ = frame.__file__ = 'stermi/web_workers/formatter.py'
locals.__name__ = 'webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354'
locals.__doc__ = _b_.None
locals.__annotations__ = locals.__annotations__ || $B.empty_dict()
frame.$f_trace = $B.enter_frame(frame)
$B.set_lineno(frame, 1)

var _frame_obj = $B.frame_obj
var stack_length = $B.count_frames()
try{
  $B.set_lineno(frame, 4)
  var module = $B.$import_from("collections", ["deque"], {}, 0, locals);
  $B.set_lineno(frame, 6)
  var module = $B.$import_from("sys", ["argv"], {}, 0, locals);
  $B.set_lineno(frame, 7)
  var module = $B.$import_from("os", ["environ"], {}, 0, locals);
  $B.set_lineno(frame, 8)
  $B.$import("html", [], {}, locals, true)
  $B.set_lineno(frame, 10)
  var module = $B.$import_from("browser", ["bind", "self", "console"], {}, 0, locals);
  $B.set_lineno(frame, 11)
  $B.$import("json", [], {}, locals, true)
  $B.set_lineno(frame, 18);
  $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.console, 'debug', [0,0,13]), [0,0,42])('started format web worker')
  $B.set_lineno(frame, 21)
  function format532751527348713(){
    var locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format,
        locals
    locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format = locals = format532751527348713.$args_parser(format532751527348713, arguments)
    var frame = ["format", locals, "webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354", locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354, format532751527348713]
    if(locals.$has_generators){
      frame.$has_generators = true
    }
    frame.__file__ = __file__
    frame.$lineno = 21
    frame.$f_trace = $B.enter_frame(frame)
    try{
      $B.js_this = this
      $B.set_lineno(frame, 22)
      locals.__annotations__ = locals.__annotations__ || $B.empty_dict()
      var ann = $B.$list(['%', '{'])
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_tokens = ann
      $B.set_lineno(frame, 23)
      var ann = $B.$list(['%', '}'])
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens = ann
      $B.set_lineno(frame, 24)
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.stack = $B.$call(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.deque, [12,12,24])($B.$list([]), 2)
      $B.set_lineno(frame, 25)
      var ann = $B.$call($B.$getattr_pep657('', 'join', [30,30,37]), [30,30,51])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_tokens)
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_tokens_chars = ann
      $B.set_lineno(frame, 26)
      var ann = $B.$call($B.$getattr_pep657('', 'join', [28,28,35]), [28,28,47])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens)
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens_chars = ann
      $B.set_lineno(frame, 27)
      var ann = false
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found = ann
      $B.set_lineno(frame, 28)
      var ann = false
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_token_found = ann
      $B.set_lineno(frame, 29)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name = ann
      $B.set_lineno(frame, 30)
      var ann = 'abcdefghijklmnopqrstuvwxyz1234567890_'
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.allowed_chars = ann
      $B.set_lineno(frame, 31)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.last_char = ann
      $B.set_lineno(frame, 32)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token = ann
      $B.set_lineno(frame, 33)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_token = ann
      $B.set_lineno(frame, 34)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string = ann
      frame.$lineno = 35
      var no_break_532751527348714 = true,
          iterator_532751527348714 = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.string
      for(var next_532751527348714 of $B.make_js_iterator(iterator_532751527348714, frame, 35)){
        locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c = next_532751527348714
        if($B.set_lineno(frame, 36) && ($B.$bool((! $B.$bool(locals.$test = ! $B.$bool(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found)) ? locals.$test : $B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_tokens_chars))) || $B.$bool((! $B.$bool(locals.$test = (! $B.$bool(locals.$test = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found) ? locals.$test : $B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens_chars))) ? locals.$test : $B.rich_comp('__ne__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.last_char, '\\'))))){
          $B.set_lineno(frame, 37);
          $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.stack, 'append', [12,12,24]), [12,12,27])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c)
        }else{
          $B.set_lineno(frame, 39);
          $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.stack, 'append', [12,12,24]), [12,12,29])(' ')
        }
        $B.set_lineno(frame, 40)
        locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.token = $B.$call($B.$getattr_pep657('', 'join', [16,16,23]), [16,16,30])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.stack)
        if($B.set_lineno(frame, 41) && $B.$bool(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found)){
          frame.$lineno = 42
          var no_break_532751527348715 = true,
              iterator_532751527348715 = $B.fast_tuple([locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.token])
          for(var next_532751527348715 of $B.make_js_iterator(iterator_532751527348715, frame, 42)){
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.t = next_532751527348715
            if($B.set_lineno(frame, 43) && $B.$bool($B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.t, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens))){
              if($B.set_lineno(frame, 44) && $B.$bool($B.rich_comp('__eq__', $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_tokens, 'index', [23,23,41]), [23,23,54])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token), $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens, 'index', [58,58,74]), [58,58,77])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.t)))){
                $B.set_lineno(frame, 45)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_token = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.t
                $B.set_lineno(frame, 46)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.value = $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.data, 'get', [32,32,40]), [32,32,89])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name, _b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token) + _b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name) + _b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_token))
                if($B.set_lineno(frame, 47) && $B.$bool($B.$call(_b_.isinstance, [27,27,58])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.value, $B.fast_tuple([_b_.list, _b_.dict])))){
                  $B.set_lineno(frame, 48)
                  locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.value = $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.json, 'dumps', [36,36,46]), [36,36,53])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.value)
                }else{
                  $B.set_lineno(frame, 50)
                  locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.value = $B.$call(_b_.str, [36,36,46])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.value)
                }
                $B.set_lineno(frame, 51)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string, '+=', $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.html, 'escape', [38,38,49]), [38,38,56])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.value))
                $B.set_lineno(frame, 52)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found = false
                $B.set_lineno(frame, 53)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_token_found = true
                $B.set_lineno(frame, 54)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name = ''
                no_break_532751527348715 = false
                break
              }else{
                $B.set_lineno(frame, 57);
                $B.$call(_b_.print, [24,24,70])('end token does not match start token!')
                $B.set_lineno(frame, 58)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found = false
                $B.set_lineno(frame, 59)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string, '+=', $B.rich_op('__add__', $B.rich_op('__add__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name, [38,38,60,60]), locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, [38,38,64,64]))
                $B.set_lineno(frame, 60)
                locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name = ''
              }
            }
          }
          if(no_break_532751527348715){
            if($B.set_lineno(frame, 62) && $B.$bool($B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens_chars))){
              $B.set_lineno(frame, 63)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.last_char = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c
              continue
            }
            if($B.set_lineno(frame, 65) && $B.$bool($B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.allowed_chars))){
              $B.set_lineno(frame, 66)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name, '+=', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c)
              continue
            }else{
              $B.set_lineno(frame, 69)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found = false
              $B.set_lineno(frame, 70);
              $B.$call(_b_.print, [20,20,67])(_b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c) + ' is not allowed inside placeholder')
              $B.set_lineno(frame, 71)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string, '+=', $B.rich_op('__add__', $B.rich_op('__add__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name, [34,34,56,56]), locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, [34,34,60,60]))
              $B.set_lineno(frame, 72)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.var_name = ''
            }
            continue
          }
          
          if($B.set_lineno(frame, 74) && $B.$bool(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_token_found)){
            $B.set_lineno(frame, 75)
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.last_char = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c
            $B.set_lineno(frame, 76)
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_token_found = false
            continue
          }
        }
        if($B.set_lineno(frame, 78) && $B.$bool(! $B.$bool(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found))){
          frame.$lineno = 79
          var no_break_532751527348721 = true,
              iterator_532751527348721 = $B.fast_tuple([locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.token])
          for(var next_532751527348721 of $B.make_js_iterator(iterator_532751527348721, frame, 79)){
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.t = next_532751527348721
            if($B.set_lineno(frame, 80) && $B.$bool($B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.t, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_tokens))){
              $B.set_lineno(frame, 81)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found = true
              $B.set_lineno(frame, 82)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.t
              no_break_532751527348721 = false
              break
            }
          }
        }
        if($B.set_lineno(frame, 84) && ($B.$bool((! $B.$bool(locals.$test = ! $B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_tokens_chars)) ? locals.$test : ! $B.$bool((! $B.$bool(locals.$test = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.start_token_found) ? locals.$test : $B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.end_tokens_chars))))) || $B.$bool($B.rich_comp('__eq__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.last_char, '\\')))){
          $B.set_lineno(frame, 85)
          locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string, '+=', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c)
        }
        $B.set_lineno(frame, 86)
        locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.last_char = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.c
      }
      $B.set_lineno(frame, 87)
      var result = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format.new_string
      $B.trace_return_and_leave(frame, result)
      return result
    }catch(err){
      $B.set_exc_and_leave(frame, err)
      throw err
    }
  }
  $B.make_function_infos(format532751527348713, 'webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354', $B.fast_tuple([]), _b_.None, _b_.None, ['string','data'], null, null,
  2, __file__, 21, 3, [], 0, 'format', 19, 0, 'format', ['string','data','start_tokens','end_tokens','stack','start_tokens_chars','end_tokens_chars','start_token_found','end_token_found','var_name','allowed_chars','last_char','start_token','end_token','new_string','c','token','t','value'])
  format532751527348713.$args_parser = $B.make_args_parser_and_parse
  locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.format = format532751527348713
  locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.format.__annotations__ = _b_.dict.$factory([['string', _b_.str]])
  
  $B.set_lineno(frame, 90)
  function format_web532751527348722(){
    var locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web,
        locals
    locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web = locals = format_web532751527348722.$args_parser(format_web532751527348722, arguments)
    var frame = ["format_web", locals, "webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354", locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354, format_web532751527348722]
    if(locals.$has_generators){
      frame.$has_generators = true
    }
    frame.__file__ = __file__
    frame.$lineno = 90
    frame.$f_trace = $B.enter_frame(frame)
    try{
      $B.js_this = this
      $B.set_lineno(frame, 91)
      locals.__annotations__ = locals.__annotations__ || $B.empty_dict()
      var ann = false
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token_found = ann
      $B.set_lineno(frame, 92)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name = ann
      $B.set_lineno(frame, 93)
      var ann = 'abcdefghijklmnopqrstuvwxyz1234567890_'
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.allowed_chars = ann
      $B.set_lineno(frame, 94)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.last_char = ann
      $B.set_lineno(frame, 95)
      var ann = '%'
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token = ann
      $B.set_lineno(frame, 96)
      var ann = '%'
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.end_token = ann
      $B.set_lineno(frame, 97)
      var ann = ''
      locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string = ann
      frame.$lineno = 98
      var no_break_532751527348723 = true,
          iterator_532751527348723 = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.string
      for(var next_532751527348723 of $B.make_js_iterator(iterator_532751527348723, frame, 98)){
        locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c = next_532751527348723
        if($B.set_lineno(frame, 99) && $B.$bool(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token_found)){
          if($B.set_lineno(frame, 100) && $B.$bool($B.rich_comp('__eq__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.end_token))){
            $B.set_lineno(frame, 101)
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.value = $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.data, 'get', [24,24,32]), [24,24,81])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name, _b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token) + _b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name) + _b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.end_token))
            if($B.set_lineno(frame, 102) && $B.$bool($B.$call(_b_.isinstance, [19,19,50])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.value, $B.fast_tuple([_b_.list, _b_.dict])))){
              $B.set_lineno(frame, 103)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.value = $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.json, 'dumps', [29,29,39]), [29,29,46])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.value)
            }else{
              $B.set_lineno(frame, 105)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.value = $B.$call(_b_.str, [28,28,38])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.value)
            }
            $B.set_lineno(frame, 106)
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string, '+=', $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.html, 'escape', [30,30,41]), [30,30,48])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.value))
            $B.set_lineno(frame, 107)
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token_found = false
            $B.set_lineno(frame, 108)
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name = ''
            $B.set_lineno(frame, 109)
            locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.last_char = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c
            continue
          }else{
            if($B.set_lineno(frame, 112) && $B.$bool($B.$is_member(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.allowed_chars))){
              $B.set_lineno(frame, 113)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name, '+=', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c)
              continue
            }else{
              $B.set_lineno(frame, 116)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token_found = false
              $B.set_lineno(frame, 117);
              $B.$call(_b_.print, [20,20,67])(_b_.str.$factory(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c) + ' is not allowed inside placeholder')
              $B.set_lineno(frame, 118)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string, '+=', $B.rich_op('__add__', $B.rich_op('__add__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name, [34,34,56,56]), locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c, [34,34,60,60]))
              $B.set_lineno(frame, 119)
              locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.var_name = ''
            }
            continue
          }
        }else if($B.set_lineno(frame, 122) && ($B.$bool($B.rich_comp('__ne__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.last_char, '\\')) && $B.$bool($B.rich_comp('__eq__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token)))){
          $B.set_lineno(frame, 123)
          locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token_found = true
          $B.set_lineno(frame, 124)
          locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.last_char = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c
          continue
        }
        if($B.set_lineno(frame, 126) && ($B.$bool((! $B.$bool(locals.$test = $B.rich_comp('__ne__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token)) ? locals.$test : ! $B.$bool((! $B.$bool(locals.$test = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.start_token_found) ? locals.$test : $B.rich_comp('__eq__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c, locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.end_token))))) || $B.$bool($B.rich_comp('__eq__', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.last_char, '\\')))){
          $B.set_lineno(frame, 127)
          locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string = $B.augm_assign(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string, '+=', locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c)
        }
        $B.set_lineno(frame, 128)
        locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.last_char = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.c
      }
      $B.set_lineno(frame, 129)
      var result = locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_format_web.new_string
      $B.trace_return_and_leave(frame, result)
      return result
    }catch(err){
      $B.set_exc_and_leave(frame, err)
      throw err
    }
  }
  $B.make_function_infos(format_web532751527348722, 'webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354', $B.fast_tuple([]), _b_.None, _b_.None, ['string','data'], null, null,
  2, __file__, 90, 3, [], 0, 'format_web', 11, 0, 'format_web', ['string','data','start_token_found','var_name','allowed_chars','last_char','start_token','end_token','new_string','c','value'])
  format_web532751527348722.$args_parser = $B.make_args_parser_and_parse
  locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.format_web = format_web532751527348722
  locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.format_web.__annotations__ = _b_.dict.$factory([['string', _b_.str]])
  
  // declare decorators
  $B.set_lineno(frame, 133)
  var decorator532751527348727 = $B.$call(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.bind, [1,1,22])(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.self, 'message')
  $B.set_lineno(frame, 134)
  function message532751527348728(){
    var locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_message,
        locals
    locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_message = locals = message532751527348728.$args_parser(message532751527348728, arguments)
    var frame = ["message", locals, "webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354", locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354, message532751527348728]
    if(locals.$has_generators){
      frame.$has_generators = true
    }
    frame.__file__ = __file__
    frame.$lineno = 134
    frame.$f_trace = $B.enter_frame(frame)
    try{
      $B.js_this = this
      $B.set_lineno(frame, 139);
      $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.console, 'debug', [4,4,17]), [4,4,31])('format_web')
      $B.set_lineno(frame, 140);
      $B.$call($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.self, 'send', [4,4,13]), [4,4,51])($B.$call(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.format_web, [14,14,50])($B.$getitem($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_message.evt, 'data', [25,25,33]), 0,[25,34,35]), $B.$getitem($B.$getattr_pep657(locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354_message.evt, 'data', [38,38,46]), 1,[38,47,48])))
      var result = _b_.None
      $B.trace_return_and_leave(frame, result)
      return result
    }catch(err){
      $B.set_exc_and_leave(frame, err)
      throw err
    }
  }
  $B.make_function_infos(message532751527348728, 'webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354', $B.fast_tuple([]), _b_.None, 'Handle a message sent by the main script.\n\
    evt.data is the message body.\n\
    ', ['evt'], null, null,
  1, __file__, 134, 3, [], 0, 'message', 1, 0, 'message', ['evt'])
  message532751527348728.$args_parser = $B.make_args_parser_and_parse
  var decorated532751527348729 = message532751527348728
  decorated532751527348729.__annotations__ = $B.empty_dict()
  locals_webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354.message = $B.$call(decorator532751527348727)(decorated532751527348729)
  $B.leave_frame({locals, value: _b_.None})
}catch(err){
  $B.set_exc_and_trace(frame, err)
  $B.leave_frame({locals, value: _b_.None})
  throw err
}
brython.js:968:62

It is interesting to note that $B.imported["webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354"] is undefined.

__BRYTHON__.imported["webworker_8303fa65_a44d_4bbf_994b_21dbaac4b354"]
undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant