Gabriel Genellina wrote: > At Thursday 18/1/2007 04:41, John Nagle wrote:
> On a previous version of M2Crypto that line said: map()[self.ctx] = > self, and that failed too ("unhashable object", I think). > I changed the class _ctxmap (the map() above returns an instance of it) > to use str(key) in the 3 places it was used. (That would be equivalent > to use str(self.ctx) everywhere, instead of long(self.ctx) as your > traceback is showing). All I can say is that no error happened > afterwards, but I don't know if that broke something. > > > So using str() appears, at least on the surface, to be reasonable. But > someone with more intimate knowledge of the library should confirm that. > I don't even understand what's the point for the _ctxmap singleton - > it's the same thing as a global dictionary, isn't it? I played around with using "str" too, but I was worried about Python and SWIG version issues. I'm not sure you can use "str" on those objects on all versions and platforms. I think that SWIG is generating the implementations of __str__ and __long__. Incidentally, note in that area that if you never explicitly call "close" on a Context, it will never be released. Or so it looks from the code. Actually, at the moment I'm having an M2Crypto problem related to a SWIG/OpenSSL conflict. Older versions of OpenSSL have an include file that needs __i386__ defined, which is something GCC does based on what platform you're on. SWIG uses CPP, but doesn't set the platform defines, so the SWIG phase of the M2Crypto build fails. I'm currently trying to get the shared host where that build took place upgraded to a later version of OpenSSL, but that requires a server restart, so it may take a few days. I'm doing something that requires M2Crypto to run on a range of machines, which turns out to be rather harder than expected. All this stuff is in the area that Guido was unhappy about in his "M2Crypto Woes" article. http://www.artima.com/weblogs/viewpost.jsp?thread=95863 The worst problems there have been fixed, but we're not out of the woods yet. As Guido wrote, using SWIG does complicate things. I'm currently getting good results on Windows 2000 with Python 2.4 using M2Crypto 0.17; right now, the problems are on the Linux side. John Nagle -- http://mail.python.org/mailman/listinfo/python-list