SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S






1
2
3
(1)
4
(3)
5
6
7
8
9
(1)
10
(5)
11
(2)
12
(7)
13
(1)
14
15
16
17
(1)
18
(2)
19
(6)
20
(5)
21
(1)
22
23
(2)
24
(2)
25
26
(2)
27
(2)
28
(3)
29
30
(6)
31
(6)





Showing 3 results of 3

Revision: 8342
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8342&view=rev
Author: jswhit
Date: 2010年05月28日 18:53:48 +0000 (2010年5月28日)
Log Message:
-----------
fix typo
Modified Paths:
--------------
 trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py	2010年05月28日 17:42:05 UTC (rev 8341)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py	2010年05月28日 18:53:48 UTC (rev 8342)
@@ -2759,7 +2759,7 @@
 import matplotlib.tri as tri
 except:
 msg='need basemap > 0.99.1 to plot on unstructured grids'
- Raise ImportError(msg)
+ raise ImportError(msg)
 # for unstructured grids, toss out points outside
 # projection limb (don't use those points in triangulation).
 if hasattr(data,'mask'):
@@ -2849,7 +2849,7 @@
 import matplotlib.tri as tri
 except:
 msg='need basemap > 0.99.1 to plot on unstructured grids'
- Raise ImportError(msg)
+ raise ImportError(msg)
 # for unstructured grids, toss out points outside
 # projection limb (don't use those points in triangulation).
 if hasattr(data,'mask'):
@@ -2934,7 +2934,7 @@
 import matplotlib.tri as tri
 except:
 msg='need basemap > 0.99.1 to plot on unstructured grids'
- Raise ImportError(msg)
+ raise ImportError(msg)
 # for unstructured grids, toss out points outside
 # projection limb (don't use those points in triangulation).
 if hasattr(data,'mask'):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年05月28日 17:42:12
Revision: 8341
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8341&view=rev
Author: mdboom
Date: 2010年05月28日 17:42:05 +0000 (2010年5月28日)
Log Message:
-----------
Fix memory leak caused by never disconnecting callbacks.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2010年05月28日 16:56:45 UTC (rev 8340)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2010年05月28日 17:42:05 UTC (rev 8341)
@@ -13,6 +13,7 @@
 import os.path
 import random
 import urllib2
+import new
 
 import matplotlib
 
@@ -124,12 +125,87 @@
 callbacks.disconnect(ideat) # disconnect oneat
 callbacks.process('eat', 456) # nothing will be called
 
+ In practice, one should always disconnect all callbacks when they
+ are no longer needed to avoid dangling references (and thus memory
+ leaks). However, real code in matplotlib rarely does so, and due
+ to its design, it is rather difficult to place this kind of code.
+ To get around this, and prevent this class of memory leaks, we
+ instead store weak references to bound methods only, so when the
+ destination object needs to die, the CallbackRegistry won't keep
+ it alive. The Python stdlib weakref module can not create weak
+ references to bound methods directly, so we need to create a proxy
+ object to handle weak references to bound methods (or regular free
+ functions). This technique was shared by Peter Parente on his
+ `"Mindtrove" blog
+ <http://mindtrove.info/articles/python-weak-references/>`_.
 """
+ class BoundMethodProxy(object):
+ '''
+ Our own proxy object which enables weak references to bound and unbound
+ methods and arbitrary callables. Pulls information about the function,
+ class, and instance out of a bound method. Stores a weak reference to the
+ instance to support garbage collection.
+
+ @organization: IBM Corporation
+ @copyright: Copyright (c) 2005, 2006 IBM Corporation
+ @license: The BSD License
+
+ Minor bugfixes by Michael Droettboom
+ '''
+ def __init__(self, cb):
+ try:
+ try:
+ self.inst = ref(cb.im_self)
+ except TypeError:
+ self.inst = None
+ self.func = cb.im_func
+ self.klass = cb.im_class
+ except AttributeError:
+ self.inst = None
+ self.func = cb
+ self.klass = None
+
+ def __call__(self, *args, **kwargs):
+ '''
+ Proxy for a call to the weak referenced object. Take
+ arbitrary params to pass to the callable.
+
+ Raises `ReferenceError`: When the weak reference refers to
+ a dead object
+ '''
+ if self.inst is not None and self.inst() is None:
+ raise ReferenceError
+ elif self.inst is not None:
+ # build a new instance method with a strong reference to the instance
+ mtd = new.instancemethod(self.func, self.inst(), self.klass)
+ else:
+ # not a bound method, just return the func
+ mtd = self.func
+ # invoke the callable and return the result
+ return mtd(*args, **kwargs)
+
+ def __eq__(self, other):
+ '''
+ Compare the held function and instance with that held by
+ another proxy.
+ '''
+ try:
+ if self.inst is None:
+ return self.func == other.func and other.inst is None
+ else:
+ return self.func == other.func and self.inst() == other.inst()
+ except Exception:
+ return False
+
+ def __ne__(self, other):
+ '''
+ Inverse of __eq__.
+ '''
+ return not self.__eq__(other)
+
 def __init__(self, signals):
 '*signals* is a sequence of valid signals'
 self.signals = set(signals)
- # callbacks is a dict mapping the signal to a dictionary
- # mapping callback id to the callback function
 self.callbacks = dict([(s, dict()) for s in signals])
 self._cid = 0
 
@@ -146,8 +222,15 @@
 func will be called
 """
 self._check_signal(s)
- self._cid +=1
- self.callbacks[s][self._cid] = func
+ proxy = self.BoundMethodProxy(func)
+ for cid, callback in self.callbacks[s].items():
+ # Clean out dead references
+ if callback.inst is not None and callback.inst() is None:
+ del self.callbacks[s][cid]
+ elif callback == proxy:
+ return cid
+ self._cid += 1
+ self.callbacks[s][self._cid] = proxy
 return self._cid
 
 def disconnect(self, cid):
@@ -155,9 +238,12 @@
 disconnect the callback registered with callback id *cid*
 """
 for eventname, callbackd in self.callbacks.items():
- try: del callbackd[cid]
- except KeyError: continue
- else: return
+ try:
+ del callbackd[cid]
+ except KeyError:
+ continue
+ else:
+ return
 
 def process(self, s, *args, **kwargs):
 """
@@ -165,8 +251,12 @@
 callbacks on *s* will be called with *\*args* and *\*\*kwargs*
 """
 self._check_signal(s)
- for func in self.callbacks[s].values():
- func(*args, **kwargs)
+ for cid, proxy in self.callbacks[s].items():
+ # Clean out dead references
+ if proxy.inst is not None and proxy.inst() is None:
+ del self.callbacks[s][cid]
+ else:
+ proxy(*args, **kwargs)
 
 
 class Scheduler(threading.Thread):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ry...@us...> - 2010年05月28日 16:56:51
Revision: 8340
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8340&view=rev
Author: ryanmay
Date: 2010年05月28日 16:56:45 +0000 (2010年5月28日)
Log Message:
-----------
Fix typos in set_xlim docstring.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2010年05月27日 18:56:19 UTC (rev 8339)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2010年05月28日 16:56:45 UTC (rev 8340)
@@ -2184,9 +2184,9 @@
 
 Keyword arguments:
 
- *ymin*: scalar
+ *xmin*: scalar
 the min of the ylim
- *ymax*: scalar
+ *xmax*: scalar
 the max of the ylim
 *emit*: [ True | False ]
 notify observers of lim change
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing 3 results of 3

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /