IronLanguages / IronLanguages/ironpython3

Different behaviour of simple script when compiled

Open
#1,745 2 comments 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

Prerequisites

The issue tracker is used to report bugs and request new features, NOT to ask questions.

Questions should be posted in Discussions or to the users mailing list which can be accessed at
https://ironpython.groups.io/g/users.

  • [ Y ] Are you running the latest version?
  • [ Y ] Are you reporting to the correct repository?
  • [ Y ] Did you perform a cursory search?
Description

In loading a .NET dll, I get a SystemError that does not come out when compiling with ipyc. See code below.

Steps to Reproduce

Code used in file testIPY.py

import clr
# import my api
clr.AddReferenceToFileAndPath("myClass.dll")
import myClass
tt=myClass.API() # instance of my object
print(tt.version()) # return version
input("Press key to close...")
  1. if I run ipy testIPY.py I get:
Traceback (most recent call last):
  File "testIPY.py", line 6, in <module>
SystemError: L'inizializzatore di tipo di 'myInnerClass.innerClass' ha generato un'eccezione.
  1. if I compile with ipyc /main:testIPY.py /target:exe, I can run testIPY.exe flawlessly. Output is:
1.00000000000001
Press key to close...Error occurred: unknown encoding: cp850
Version Information

If you are using the ipy console program, provide output of executing ipy -VV. If it is a local build, provide also the git hash of the commit used to build IronPython. Additionally, provide the type of the operating system used.

ipy -VV
IronPython 3.4.1 (3.4.1.1000)
[.NETFramework,Version=v4.6.2 on .NET Framework 4.8.9181.0 (64-bit)]

Ufortunately I cannot share the DLL, which is obfuscated. Debug DLL does not exhibit the same problem.

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 testIPY.py reproduction and compare running it through ipy with compiling it through ipyc using the reported commands. Investigate the differing behavior around loading myClass.dll and the myInnerClass.innerClass initializer; the missing obfuscated DLL limits direct reproduction. Done means the script behaves consistently in both modes, with the reported SystemError and encoding error addressed or clearly explained.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.