Skip to content

Test causes segfault #528

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

Closed
pytestbot opened this issue Jun 13, 2014 · 3 comments
Closed

Test causes segfault #528

pytestbot opened this issue Jun 13, 2014 · 3 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: BitBucket: timothy, GitHub: timothy


#!python

import unittest

import functools

def dec(f):
    @functools.wraps(f)
    def wrap(*a, **kw):
        assert f.__annotations__.get('a') == 'equal'
    return wrap

class TestClass(object):
    @dec
    def __init__(self, a:'not'):
        self.a = a

class TestSegfault(unittest.TestCase):

    def test_segfault(self):
        with self.assertRaises(IOError):
            TestClass()

if __name__ == '__main__':
    unittest.main()

py.test -v

#!

============================= test session starts ==============================

platform linux -- Python 3.4.1 -- py-1.4.20 -- pytest-2.5.2 -- /home/vagrant/py_
env/bin/python
collected 1 items / 1 skipped

test_segfault.py:18: TestSegfault.test_segfault Segmentation fault

python:

#!

F
======================================================================
FAIL: test_segfault (__main__.TestSegfault)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_segfault.py", line 20, in test_segfault
    TestClass()
  File "test_segfault.py", line 8, in wrap
    assert f.__annotations__.get('a') == 'equal'
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (failures=1)

@pytestbot
Copy link
Contributor Author

Original comment by Masami HIRATA (BitBucket: msmhrt, GitHub: msmhrt):


This may the same issue as http://bugs.python.org/issue21897 .

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


yes, seems the issue was fixed in python3.4 trunk. so let's not worry here.

@pytestbot
Copy link
Contributor Author

Original comment by Mikko Ohtamaa (BitBucket: miohtama, GitHub: miohtama):


Are there any workarounds for Python 3.4.1? Looks like the Python patch is in unreleased 3.4.2. As this issue may make running tests little bit challenging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant