IronLanguages / IronLanguages/ironpython3

Incorrect error message with global assignment

Open
#501 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CPython compatibility
Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

After https://github.com/IronLanguages/ironpython3/pull/500, the following raises the incorrect error message

def test():
   global a
   a = 1
   global a

SyntaxError: name 'a' is used prior to global declaration

instead of the expected

SyntaxError: name 'a' is assigned to before global declaration

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the example from the issue and review the changes in pull request #500, which introduced the incorrect message. Trace the global-declaration error handling until the assigned-before-declaration case is distinguished from the used-before-declaration case, then verify that the example reports the expected SyntaxError message.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.