2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/c46eb47ecff4/ Changeset: c46eb47ecff4 Branch: break_ExceptionInfo_reference_cycles User: jurko Date: 2014-04-02 15:34:36 Summary: break reference cycles caused by storing local reference to exception info
Such reference cycles unnecessarily cause Python interpreter not to garbage collect the objects referenced in those cycles as soon they could be collected, and in turn cause the tests to use more memory than is strictly necessary. Affected #: 3 files diff -r e3309a39fb919391d0e9d9cb0e7fc7e75b7162e7 -r c46eb47ecff4289ac318426f871a20f1aa7d2467 _pytest/assertion/util.py --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -149,11 +149,10 @@ if istext(left) and istext(right): explanation = _notin_text(left, right, verbose) except Exception: - excinfo = py.code.ExceptionInfo() explanation = [ u('(pytest_assertion plugin: representation of details failed. ' 'Probably an object has a faulty __repr__.)'), - u(excinfo)] + u(py.code.ExceptionInfo())] if not explanation: return None diff -r e3309a39fb919391d0e9d9cb0e7fc7e75b7162e7 -r c46eb47ecff4289ac318426f871a20f1aa7d2467 _pytest/main.py --- a/_pytest/main.py +++ b/_pytest/main.py @@ -98,6 +98,7 @@ if session._testsfailed: session.exitstatus = EXIT_TESTSFAILED finally: + excinfo = None # Explicitly break reference cycle. session.startdir.chdir() if initstate >= 2: config.hook.pytest_sessionfinish( diff -r e3309a39fb919391d0e9d9cb0e7fc7e75b7162e7 -r c46eb47ecff4289ac318426f871a20f1aa7d2467 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -456,8 +456,8 @@ try: mod = self.fspath.pyimport(ensuresyspath=True) except SyntaxError: - excinfo = py.code.ExceptionInfo() - raise self.CollectError(excinfo.getrepr(style="short")) + raise self.CollectError( + py.code.ExceptionInfo().getrepr(style="short")) except self.fspath.ImportMismatchError: e = sys.exc_info()[1] raise self.CollectError( https://bitbucket.org/hpk42/pytest/commits/e3398dc8d7cc/ Changeset: e3398dc8d7cc User: hpk42 Date: 2014-04-03 09:47:41 Summary: Merged in jurko/pytest/break_ExceptionInfo_reference_cycles (pull request #144) break reference cycles caused by storing local reference to exception info Affected #: 3 files diff -r dd7b468026d15a577d2d1f272257e86b2855eb83 -r e3398dc8d7cc36221657d3d4b417231f60a019a6 _pytest/assertion/util.py --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -149,11 +149,10 @@ if istext(left) and istext(right): explanation = _notin_text(left, right, verbose) except Exception: - excinfo = py.code.ExceptionInfo() explanation = [ u('(pytest_assertion plugin: representation of details failed. ' 'Probably an object has a faulty __repr__.)'), - u(excinfo)] + u(py.code.ExceptionInfo())] if not explanation: return None diff -r dd7b468026d15a577d2d1f272257e86b2855eb83 -r e3398dc8d7cc36221657d3d4b417231f60a019a6 _pytest/main.py --- a/_pytest/main.py +++ b/_pytest/main.py @@ -98,6 +98,7 @@ if session._testsfailed: session.exitstatus = EXIT_TESTSFAILED finally: + excinfo = None # Explicitly break reference cycle. session.startdir.chdir() if initstate >= 2: config.hook.pytest_sessionfinish( diff -r dd7b468026d15a577d2d1f272257e86b2855eb83 -r e3398dc8d7cc36221657d3d4b417231f60a019a6 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -456,8 +456,8 @@ try: mod = self.fspath.pyimport(ensuresyspath=True) except SyntaxError: - excinfo = py.code.ExceptionInfo() - raise self.CollectError(excinfo.getrepr(style="short")) + raise self.CollectError( + py.code.ExceptionInfo().getrepr(style="short")) except self.fspath.ImportMismatchError: e = sys.exc_info()[1] raise self.CollectError( Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit