Staging
v0.5.1
https://github.com/python/cpython
Revision b7cfda132406bd0a4f626610657fd9b1e0e63f65 authored by Matthias Klose on 12 November 2008, 07:21:52 UTC, committed by Matthias Klose on 12 November 2008, 07:21:52 UTC
  parameter but was not verifying that it was greater than zero.  Values
  less than zero will now raise a SystemError and return NULL to indicate a
  bug in the calling C code. CVE-2008-1887.

  backport r62261, r62271
1 parent 8af5d57
Raw File
Tip revision: b7cfda132406bd0a4f626610657fd9b1e0e63f65 authored by Matthias Klose on 12 November 2008, 07:21:52 UTC
- Issue #2587: In the C API, PyString_FromStringAndSize() takes a signed size
Tip revision: b7cfda1
test_future3.py
from __future__ import nested_scopes
from __future__ import division

import unittest
from test import test_support

x = 2
def nester():
    x = 3
    def inner():
        return x
    return inner()


class TestFuture(unittest.TestCase):

    def test_floor_div_operator(self):
        self.assertEqual(7 // 2, 3)

    def test_true_div_as_default(self):
        self.assertAlmostEqual(7 / 2, 3.5)

    def test_nested_scopes(self):
        self.assertEqual(nester(), 3)

def test_main():
    test_support.run_unittest(TestFuture)

if __name__ == "__main__":
    test_main()
back to top