2 new commits in pytest:

https://bitbucket.org/hpk42/pytest/commits/9545ee037ecb/
Changeset:   9545ee037ecb
User:        jurko
Date:        2014-01-15 19:30:03
Summary:     document explicitly clearing local references to pytest.raises() 
results

pytest.raises() returns an ExceptionInfo object which, if a local reference is
made to it, forms a reference cycle:
  ExceptionInfo
  --> exception
  --> stack frame raising the exception
  --> current stack frame
  --> current local variables
  --> Exception Info

Such a reference cycle would then prevent any local variables in the current
stack frame, or any of its child stack frames involved in the same reference
cycle, from being garbage collected until the next reference cycle garbage
collection phase. This unnecessarily increases the program's memory footprint
and potentially slows it down.

This situation is based on a similar one described in the official 'try'
statement Python documentation for locally stored exception references.
Affected #:  1 file

diff -r 0bf4880a178da71d44ba91d844e68165c83f2562 -r 
9545ee037ecb9de2177a1ee0ba4e50bfa181adac _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -938,6 +938,12 @@
 
     This helper produces a ``py.code.ExceptionInfo()`` object.
 
+    Note that any local references made to such returned
+    ``py.code.ExceptionInfo()`` objects should be explicitly cleared, as they
+    are part of a reference cycle similar to local references to caught Python
+    exception objects. See the official Python ``try`` statement documentation
+    for more detailed information.
+
     If using Python 2.5 or above, you may use this function as a
     context manager::
 


https://bitbucket.org/hpk42/pytest/commits/bdc540368ddf/
Changeset:   bdc540368ddf
User:        bubenkoff
Date:        2014-01-23 01:09:30
Summary:     Merged in jurko/pytest (pull request #98)

document explicitly clearing local references to pytest.raises() results
Affected #:  3 files

diff -r 60052491d38bf3fd68909c35aa04e063415fe2b6 -r 
bdc540368ddfd4dcfb0558625b4caba02355b812 /contribute.txt
--- /dev/null
+++ b//contribute.txt
@@ -0,0 +1,3 @@
+.. _contributing:
+
+.. include:: ../../CONTRIBUTING.rst

diff -r 60052491d38bf3fd68909c35aa04e063415fe2b6 -r 
bdc540368ddfd4dcfb0558625b4caba02355b812 _pytest/python.py
--- a/_pytest/python.py
+++ b/_pytest/python.py
@@ -938,6 +938,12 @@
 
     This helper produces a ``py.code.ExceptionInfo()`` object.
 
+    Note that any local references made to such returned
+    ``py.code.ExceptionInfo()`` objects should be explicitly cleared, as they
+    are part of a reference cycle similar to local references to caught Python
+    exception objects. See the official Python ``try`` statement documentation
+    for more detailed information.
+
     If using Python 2.5 or above, you may use this function as a
     context manager::
 

diff -r 60052491d38bf3fd68909c35aa04e063415fe2b6 -r 
bdc540368ddfd4dcfb0558625b4caba02355b812 doc/en/contribute.txt
--- a/doc/en/contribute.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-.. _contributing:
-
-.. include:: ../../CONTRIBUTING.rst

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

Reply via email to