IronLanguages / IronLanguages/ironpython3

On Mono, not all CLR members defined on int are available on all int instances

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

Nobody has claimed this yet.

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

Description

Python type int is backed by BigInteger, but both BigInteger and Int32 instances are used as int instances for performance reasons (#52). For the Python type system consistency, any attributes available on int (thus BigInteger) should be available on instances of int (thus also on Int32 instances). PR #1399 implemented a set of properties and methods that are available on BigInteger but not on Int32 as additional extension methods for Int32. However, this does not work well on Mono (v6.12.0.162 on darwin, but possibly on linux too). The following methods appear on int that do not appear on Int32 instances:

  • GetByteCount
  • TryWriteBytes

These two methods do not exist in .NET Framework 4.6 so they should not exist in Mono as well. And indeed, they do not, at least not as members of System.Numerics.BigInteger (so they are not accessible in C# code). However, somehow they do appear in IronPython, perhaps they are implemented as extensions?

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 by reproducing the member differences between BigInteger and Int32 on Mono 6.12.0.162, then inspect PR #1399 and the extension methods it added. Done means GetByteCount and TryWriteBytes have consistent availability on int instances without exposing members absent from the target .NET Framework.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.