Skip to content
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

Fix PseudoFixtureDef reference cycle. #3249

Merged
merged 5 commits into from Feb 22, 2018
Merged

Fix PseudoFixtureDef reference cycle. #3249

merged 5 commits into from Feb 22, 2018

Commits on Feb 22, 2018

  1. Fix reference cycle caused by PseudoFixtureDef.

    Python types have reference cycles to themselves when they are created. This is
    partially caused by descriptors which get / set values from the __dict__
    attribute for getattr / setattr on classes.
    
    This is not normally an issue since types tend to remain referenced for the
    lifetime of the Python process (and thus never become garbage).
    
    However, in the case of PseudoFixtureDef, the class is generated in
    _get_active_fixturedef and later discarded when pytest_fixture_setup returns.
    As a result, the generated PseudoFixtureDef type becomes garbage.
    
    This is not really a performance issue but it can lead to some problems when
    making tests and assertions about garbage when using pytest.
    
    This garbage creation problem can be rectified by returning a namedtuple
    instance which is functionally the same. In the modified code, the namedtuple
    is allocated / deallocated using reference counting rather than having to use
    the garbage collector.
    a-feld committed Feb 22, 2018
    Copy the full SHA
    75f11f0 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    aa53e37 View commit details
    Browse the repository at this point in the history
  3. Add myself to AUTHORS.

    a-feld committed Feb 22, 2018
    Copy the full SHA
    287c003 View commit details
    Browse the repository at this point in the history
  4. Add changelog entry.

    a-feld committed Feb 22, 2018
    Copy the full SHA
    7536e94 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    4854876 View commit details
    Browse the repository at this point in the history