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 garbage collection for Shotgun instances #95

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bchapman
Copy link

Found that Shotgun instances weren't getting garbage collected.
Did some research and found that it's due to the this line in int

if ensure_ascii:
    self._json_loads = self._json_loads_ascii

This causes python not to garbage collect any Shotgun instances

Example:

>>> import gc
>>> sg = shotgun_api3.Shotgun(**params)
>>> gc.get_referrers(sg)
[<bound method Shotgun._json_loads_ascii of <trak.shotgun.Shotgun object at 0x10542dd10>>, ...]

Changed it to store the ensure_ascii as variable on the class and check in _json_loads which method to use.

@kporangehat
Copy link

Hey Brennan,

Thanks for the insight and the PR! We were mostly offline last week at our yearly summit so apologies for not chiming in sooner. This change does look pretty innocuous. We'll assign someone to run the tests against it and try and bring it in. Will follow up shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants