aboutsummaryrefslogtreecommitdiff
path: root/paramiko/resource.py
diff options
context:
space:
mode:
Diffstat (limited to 'paramiko/resource.py')
-rw-r--r--paramiko/resource.py17
1 files changed, 8 insertions, 9 deletions
diff --git a/paramiko/resource.py b/paramiko/resource.py
index 6ef86d8..9809afb 100644
--- a/paramiko/resource.py
+++ b/paramiko/resource.py
@@ -28,13 +28,13 @@ class ResourceManager (object):
A registry of objects and resources that should be closed when those
objects are deleted.
- This is meant to be a safer alternative to python's C{__del__} method,
+ This is meant to be a safer alternative to Python's ``__del__`` method,
which can cause reference cycles to never be collected. Objects registered
with the ResourceManager can be collected but still free resources when
they die.
- Resources are registered using L{register}, and when an object is garbage
- collected, each registered resource is closed by having its C{close()}
+ Resources are registered using `register`, and when an object is garbage
+ collected, each registered resource is closed by having its ``close()``
method called. Multiple resources may be registered per object, but a
resource will only be closed once, even if multiple objects register it.
(The last object to register it wins.)
@@ -47,14 +47,13 @@ class ResourceManager (object):
"""
Register a resource to be closed with an object is collected.
- When the given C{obj} is garbage-collected by the python interpreter,
- the C{resource} will be closed by having its C{close()} method called.
+ When the given ``obj`` is garbage-collected by the Python interpreter,
+ the ``resource`` will be closed by having its ``close()`` method called.
Any exceptions are ignored.
- @param obj: the object to track
- @type obj: object
- @param resource: the resource to close when the object is collected
- @type resource: object
+ :param object obj: the object to track
+ :param object resource:
+ the resource to close when the object is collected
"""
def callback(ref):
try: