Skip to content

Remove long from builtin #862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Src/IronPython/Lib/iptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
from .ipunittest import IronPythonTestCase, stdout_trapper, stderr_trapper, path_modifier, retryOnFailure, run_test, skipUnlessIronPython, source_root
from .test_env import *
from .type_util import *
from .misc_util import ip_supported_encodings
from .misc_util import ip_supported_encodings

long = type(1 << 63) # https://github.com/IronLanguages/ironpython3/issues/52
2 changes: 0 additions & 2 deletions Src/IronPython/Modules/Builtin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,6 @@ public static object locals(CodeContext/*!*/ context) {
return context.Dict;
}

public static PythonType @long => TypeCache.BigInteger;

public static PythonType memoryview => DynamicHelpers.GetPythonTypeFromType(typeof(MemoryView));

public static PythonType map => DynamicHelpers.GetPythonTypeFromType(typeof(Map));
Expand Down
2 changes: 2 additions & 0 deletions Src/Scripts/generate_alltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import clr
from System import *

long = type(1 << 63) # https://github.com/IronLanguages/ironpython3/issues/52

def get_min_max(type):
if hasattr(type, 'MinValue'):
return type.MinValue, type.MaxValue
Expand Down
2 changes: 1 addition & 1 deletion Src/StdLib/Lib/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,4 +387,4 @@ def denominator(self):
return 1

Integral.register(int)
Integral.register(long) # TODO: remove me
Integral.register(type(1 << 63)) # https://github.com/IronLanguages/ironpython3/issues/52
2 changes: 1 addition & 1 deletion Src/StdLib/Lib/pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ def save_long(self, obj):
return
self.write(LONG + repr(obj).encode("ascii") + b'L\n')
dispatch[int] = save_long
dispatch[long] = save_long
dispatch[type(1 << 63)] = save_long # https://github.com/IronLanguages/ironpython3/issues/52

def save_float(self, obj):
if self.bin:
Expand Down
2 changes: 1 addition & 1 deletion Src/StdLib/Lib/test/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def test_buffer_info(self):
bi = a.buffer_info()
self.assertIsInstance(bi, tuple)
self.assertEqual(len(bi), 2)
self.assertIsInstance(bi[0], (int, long) if sys.implementation.name == "ironpython" else int)
self.assertIsInstance(bi[0], int)
self.assertIsInstance(bi[1], int)
self.assertEqual(bi[1], len(a))

Expand Down
2 changes: 1 addition & 1 deletion Tests/interop/net/field/test_initonly_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from iptest import IronPythonTestCase, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, long, run_test, skipUnlessIronPython

@skipUnlessIronPython()
class InitOnlyFieldsTest(IronPythonTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/interop/net/field/test_literal_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from iptest import IronPythonTestCase, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, long, run_test, skipUnlessIronPython

@skipUnlessIronPython()
class LiteralFieldsTest(IronPythonTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/modules/io_related/test__bytesio.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from _io import BytesIO

from iptest import run_test
from iptest import long, run_test

def bytesio_helper():
return (BytesIO(bytearray(b'')),
Expand Down
4 changes: 1 addition & 3 deletions Tests/modules/misc/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
import math
import unittest

from iptest import IronPythonTestCase, is_cli, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, is_cli, long, run_test, skipUnlessIronPython

if is_cli:
from System import Int64, Byte, Int16
else:
long = type(sys.maxsize + 1)

class MathTest(IronPythonTestCase):

Expand Down
2 changes: 1 addition & 1 deletion Tests/modules/misc/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import operator
import unittest

from iptest import IronPythonTestCase, is_cli, is_netcoreapp, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, is_cli, is_netcoreapp, long, run_test, skipUnlessIronPython

class OperaterTest(IronPythonTestCase):
def setUp(self):
Expand Down
5 changes: 1 addition & 4 deletions Tests/modules/system_related/test_nt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@
import sys
import unittest

from iptest import IronPythonTestCase, is_cli, is_netcoreapp, run_test, skipUnlessIronPython, stderr_trapper
from iptest import IronPythonTestCase, is_cli, is_netcoreapp, long, run_test, skipUnlessIronPython, stderr_trapper

if sys.platform == "win32":
import nt

if not is_cli:
long = type(sys.maxsize + 1)

@unittest.skipUnless(sys.platform == "win32", 'Windows specific test')
class NtTest(IronPythonTestCase):
def assertRaisesNumber(self, expected_exception, expected_number, callable_obj, *args, **kwargs):
Expand Down
5 changes: 1 addition & 4 deletions Tests/modules/type_related/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
import array
import unittest

from iptest import is_cli, is_mono, run_test

if not is_cli:
long = int
from iptest import is_cli, is_mono, long, run_test

class ArrayTest(unittest.TestCase):
def test_ArrayType(self):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_bigint.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from iptest import run_test
from iptest import long, run_test

class BigIntTest(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from iptest import is_cli, run_test
from iptest import is_cli, long, run_test

class BoolTest(unittest.TestCase):
def test_types(self):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_builtinfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_01_with_clr_import(self):
from operator import neg
import random

from iptest import IronPythonTestCase, is_cli, is_netcoreapp, run_test
from iptest import IronPythonTestCase, is_cli, is_netcoreapp, long, run_test

if not is_cli:
long = int
Expand Down
5 changes: 1 addition & 4 deletions Tests/test_bytes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import sys
import unittest

from iptest import IronPythonTestCase, is_cli, is_cpython, run_test, skipUnlessIronPython

if not is_cli:
long = int
from iptest import IronPythonTestCase, is_cli, is_cpython, long, run_test, skipUnlessIronPython

types = [bytearray, bytes]

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_clrnuminterop.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
'''

import unittest
from iptest import is_cli, run_test
from iptest import is_cli, long, run_test

#Test Python/CLR number interop.
clr_integer_types = [ "System.Byte",
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import datetime
import time

from iptest import run_test, skipUnlessIronPython
from iptest import long, run_test, skipUnlessIronPython

class TestDatetime(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import unittest
import sys

from iptest import IronPythonTestCase, is_cli, path_modifier, run_test, skipUnlessIronPython, source_root
from iptest import IronPythonTestCase, is_cli, long, path_modifier, run_test, skipUnlessIronPython, source_root

class DictTest(IronPythonTestCase):
def test_sanity(self):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from iptest import IronPythonTestCase, is_cli, is_mono, is_netcoreapp, is_posix, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, is_cli, is_mono, is_netcoreapp, is_posix, long, run_test, skipUnlessIronPython
from types import FunctionType, MethodType

global init
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_ironmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import unittest

from iptest import IronPythonTestCase, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, long, run_test, skipUnlessIronPython

@skipUnlessIronPython()
class IronMathTest(IronPythonTestCase):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_kwarg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from iptest import IronPythonTestCase, is_netcoreapp, is_posix, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, is_netcoreapp, is_posix, long, run_test, skipUnlessIronPython

#############################################################
# Helper functions for verifying the calls. On each call
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import unittest

from iptest import IronPythonTestCase, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, long, run_test, skipUnlessIronPython

hitCount = 0

Expand Down
5 changes: 1 addition & 4 deletions Tests/test_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import sys
import unittest

from iptest import IronPythonTestCase, is_cli, run_test, skipUnlessIronPython

if not is_cli:
long = int
from iptest import IronPythonTestCase, is_cli, long, run_test, skipUnlessIronPython

def get_builtins_dict():
if type(__builtins__) is type(sys):
Expand Down
7 changes: 3 additions & 4 deletions Tests/test_strformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys
import unittest

from iptest import IronPythonTestCase, is_cli, is_cpython, is_netcoreapp21, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, is_cli, is_cpython, is_netcoreapp21, long, run_test, skipUnlessIronPython

allChars = ''
for y in [chr(x) for x in range(256) if chr(x) != '[' and chr(x) != '.']:
Expand Down Expand Up @@ -1192,11 +1192,10 @@ def test_builtin_types_that_implement_format(self):

formatTypes.sort()
if is_cli:
# no unicode
# why does bool have __format__ in ipy?
self.assertEqual(formatTypes, ['bool', 'complex', 'float', 'int', 'long', 'object', 'str'])
self.assertEqual(formatTypes, ['bool', 'complex', 'float', 'int', 'object', 'str'])
else:
self.assertEqual(formatTypes, ['complex', 'float', 'int', 'long', 'object', 'str', 'unicode'])
self.assertEqual(formatTypes, ['complex', 'float', 'int', 'object', 'str'])


def test_computed_format(self):
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import unittest

from iptest import IronPythonTestCase, run_test, skipUnlessIronPython
from iptest import IronPythonTestCase, long, run_test, skipUnlessIronPython

class TupleTest(IronPythonTestCase):

Expand Down