IronLanguages / IronLanguages/ironpython3

If call Python and there is an infinite loop in Python, where can set the timeout?

Open
#1,800 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When running the following code, it will get stuck all the time.
Is there any solution?

c# code:

ScriptEngine engine = Python.CreateEngine();
ScriptScope scope = engine.CreateScope();

return engine.Execute(@"import math 
def myadd(a, b):
    while True:
        a += 1
        b += 1
    return a + b 
myadd(2, 3)", scope);



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

Start with the hosting entry points shown in the report: Python.CreateEngine(), CreateScope(), and engine.Execute(...). Check the IronPython hosting and execution documentation for supported timeout or cancellation behavior; done means identifying a supported timeout mechanism or documenting that the request requires a separate design.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.