IronLanguages / IronLanguages/ironpython3

Rich compasions of Int32-based ints and subclasses of int return NotImplemented

Open
#1,554 8 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

Calling a rich comparison directly on an instance of an Int32-based int returns NotImplemented for subclasses of int. In CPython, the comparison succeeds. However, it works properly for BigInteger. for For example:

import System

class test(int): pass

assert (0).__lt__(test(1)) is True

assert (0).ToBigInteger().__lt__(test(1)) is True

Seems to have broken somewhere between the alpha and the beta releases. @BCSharp could this be related to your work on https://github.com/IronLanguages/ironpython3/issues/52?

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 running the supplied Python reproducer in IronPython and compare its Int32-based int behavior with the BigInteger control case and CPython. Trace the implementation path for direct rich comparisons on int subclasses; done means both assertions pass without returning NotImplemented.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.