A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-July/067176.html below:

[Python-Dev] Unary minus bug

[Python-Dev] Unary minus bug [Python-Dev] Unary minus bugNeil Schemenauer nas at arctrix.com
Sun Jul 9 22:54:56 CEST 2006
The bug was reported by Armin in SF #1333982:

    the literal -2147483648 (i.e. the value of -sys.maxint-1) gives
    a long in 2.5, but an int in <= 2.4.

I have a fix but I wonder if it's the right thing to do.  I suppose
returning a long has the chance of breaking someone code.  Here's
the test we currently have for a related case:

    [...]
    # 32-bit machine
    all_one_bits = '0xffffffff'
    self.assertEqual(eval(all_one_bits), 4294967295L)
    self.assertEqual(eval("-" + all_one_bits), -4294967295L)

I guess I would add self.assertTrue(isinstance(eval("-2147483648"), int))
to that set of tests.

  Neil

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4