GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bpython crashed after executing `nonlocal` in interactive. · Issue #1051 · bpython/bpython

Bpython crashed after executing nonlocal in interactive. #1051

New issue
Copy link
New issue
Copy link
Closed
#1058
Closed
Bpython crashed after executing nonlocal in interactive.#1051
#1058
Copy link

Description

@XiJet-Gary
XiJet-Gary
opened on Apr 3, 2026
Issue body actions

Version:

bpython version 0.26 on top of Python 3.14.3 /usr/bin/python

Excute:

nonlocal a

Then:

~> bpython
bpython version 0.26 on top of Python 3.14.3 /usr/bin/python
>>> nonlocal a
Traceback (most recent call last):
  File "/usr/lib/python3.14/code.py", line 64, in runsource
    code = self.compile(source, filename, symbol)
  File "/usr/lib/python3.14/codeop.py", line 154, in __call__
    return _maybe_compile(self.compiler, source, filename, symbol, flags=self.compiler.flags)
  File "/usr/lib/python3.14/codeop.py", line 75, in _maybe_compile
    return compiler(source, filename, symbol, incomplete_input=False)
  File "/usr/lib/python3.14/codeop.py", line 117, in __call__
    codeob = compile(source, filename, symbol, flags, True)
  File "<bpython-input-3>", line 1
SyntaxError: nonlocal declaration not allowed at module level

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/bpython", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsies.py", line 249, in main
    repl.mainloop(True, paste)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsies.py", line 173, in mainloop
    self.process_event_and_paint(e)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsies.py", line 136, in process_event_and_paint
    self.process_event(e)
    ~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsiesfrontend/repl.py", line 645, in process_event
    self.process_key_event(e)
    ~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsiesfrontend/repl.py", line 785, in process_key_event
    self.on_enter()
    ~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsiesfrontend/repl.py", line 953, in on_enter
    self.push(self.current_line, insert_into_history=new_code)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsiesfrontend/repl.py", line 1293, in push
    self.run_code_and_maybe_finish()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.14/site-packages/bpython/curtsiesfrontend/repl.py", line 1297, in run_code_and_maybe_finish
    r = self.coderunner.run_code(for_code=for_code)
  File "/usr/lib/python3.14/site-packages/bpython/curtsiesfrontend/coderunner.py", line 138, in run_code
    request = self.code_context.switch()
  File "/usr/lib/python3.14/site-packages/bpython/curtsiesfrontend/coderunner.py", line 185, in _blocking_run_code
    unfinished = self.interp.runsource(self.source)
  File "/usr/lib/python3.14/site-packages/bpython/repl.py", line 152, in runsource
    return super().runsource(source, filename, symbol)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/code.py", line 67, in runsource
    self.showsyntaxerror(filename, source=source)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.14/site-packages/bpython/repl.py", line 166, in showsyntaxerror
    args = list(value.args[1])
                ~~~~~~~~~~^^^
IndexError: tuple index out of range

Activity

  1. vattenbit commented on May 5, 2026

    @vattenbit
    vattenbit
    on May 5, 2026
    More actions

    The error "SyntaxError: nonlocal declaration not allowed at module level" is correct, because the command nonlocal must be used within a function. But maybe would be interesting to handle the error in the same way as the original Python console does.

    python
    Python 3.12.1 (v3.12.1:2305ca5144, Dec  7 2023, 17:23:38) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> nonlocal a
      File "<stdin>", line 1
    SyntaxError: nonlocal declaration not allowed at module level
    
  2. sebastinas
    closed this as completedin #1058on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.