<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
Hello Christoph<div><br></div><div>I have made more head way since that one (and made a lot more changes).</div><div>I found that the module creation required a few more steps and I have come up </div><div>with two solutions (in attached patches):</div><div><br></div><div>1. First patch follows most of the online info I could find related to PyModuleDef and the related PyTypeObject.</div><div> This required that all tp_getattr functions be removed and set to 0 (zero) in the PyTypeObject definition.</div><div><br></div><div>2. The second patch retained the already created tp_getattr functions.</div><div><br></div><div>With either applied I am able to compile but when running a test program with the following lines only:</div><div><br></div><div>#!/usr/bin/env python</div><div><br></div><div>from Crypto.Cipher import AES</div><div>import base64</div><div>import os</div><div><br></div><div><br></div><div>When run I receive the following error:</div><div><br></div><div>Traceback (most recent call last):</div><div> File "./cypher.py", line 3, in <module></div><div> from Crypto.Cipher import AES</div><div>SystemError: NULL result without error in PyObject_Call</div><div><br></div><div>So apply patches (and make necessary changes for Windows) and we will see if I can help further :)</div><div><br></div><div>Cheers Grail<br><br>> Date: Sun, 28 Feb 2010 22:04:12 +0100<br>> From: christoph.tapler@gmx.net<br>> To: pycrypto@lists.dlitz.net<br>> Subject: Re: [pycrypto] FW: python crypto with python 3.0 or 3.1<br>> <br>> Hi Grail,<br>> <br>> Thanks for your patch! I assume you generated the patch based on a Unix<br>> environment. Tried to compile pycrypto together with your patch on my<br>> Windows machine. However, it did not work out.<br>> After fixing two straightforward errors in setup.py (relevant to Windows <br>> only,<br>> see [1], [2]), I got stuck when linking the module MD4 and other hashing <br>> methods<br>> (MD2, etc).<br>> <br>> Now, when I compare the build process against Python 2, I see the following<br>> difference:<br>> <br>> ###############################################################################<br>> [Python 2:]<br>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL <br>> /nologo /INCRE<br>> MENTAL:NO "/LIBPATH:C:\Program Files\Python26\libs" "/LIBPATH:C:\Program <br>> Files\P<br>> ython26\PCbuild" /EXPORT:initMD4 <br>> build\temp.win32-2.6\Release\src/MD4.obj /OUT:b<br>> uild\lib.win32-2.6\Crypto\Hash\MD4.pyd <br>> /IMPLIB:build\temp.win32-2.6\Release\src\<br>> MD4.lib /MANIFESTFILE:build\temp.win32-2.6\Release\src\MD4.pyd.manifest<br>> Creating library build\temp.win32-2.6\Release\src\MD4.lib and object <br>> build\te<br>> mp.win32-2.6\Release\src\MD4.exp<br>> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo <br>> -manifest build<br>> \temp.win32-2.6\Release\src\MD4.pyd.manifest <br>> -outputresource:build\lib.win32-2.6<br>> \Crypto\Hash\MD4.pyd;2<br>> <br>> [Python 3:]<br>> C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL <br>> /nologo /INCRE<br>> MENTAL:NO "/LIBPATH:C:\Program Files\Python31\libs" "/LIBPATH:C:\Program <br>> Files\P<br>> ython31\PCbuild" /EXPORT:PyInit_MD4 <br>> build\temp.win32-3.1\Release\src/MD4.obj /OU<br>> T:build\lib.win32-3.1\Crypto\Hash\MD4.pyd <br>> /IMPLIB:build\temp.win32-3.1\Release\s<br>> rc\MD4.lib /MANIFESTFILE:build\temp.win32-3.1\Release\src\MD4.pyd.manifest<br>> LINK : error LNK2001: unresolved external symbol PyInit_MD4<br>> build\temp.win32-3.1\Release\src\MD4.lib : fatal error LNK1120: 1 <br>> unresolved ext<br>> ernals<br>> error: command '"C:\Program Files\Microsoft Visual Studio <br>> 9.0\VC\BIN\link.exe"'<br>> failed with exit status 1120<br>> ###############################################################################<br>> <br>> It seems that the /EXPORT argument for the Windows Linker is assembled in a<br>> different way. This leads to an export name, which does not exist as <br>> function.<br>> Hence the linker terminates with an error.<br>> <br>> Any idea what I need to change to get the /EXPORT name fixed? Is this <br>> problem<br>> located in pycrypto or in the Python distutils?<br>> <br>> <br>> ##### Regarding the changes in setup.py:<br>> [1] Changed the following stmt:<br>> From<br>> print << sys.stderr "warning: GMP library not found; Not building <br>> Crypto.PublicKey._fastmath."<br>> to<br>> print("warning: GMP library not found; Not building <br>> Crypto.PublicKey._fastmath.", sys.stderr)<br>> <br>> [2] (Temporarily) disabled winrand.c which is included when using the <br>> Windows platform.<br>> <br>> Cheers, Christoph<br>> <br>> _______________________________________________<br>> pycrypto mailing list<br>> pycrypto@lists.dlitz.net<br>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto<br><div style="z-index: -1; position:absolute; top:0px; left: 0px; width: 100%; height: 1414px;"></div></div>                                            <br /><hr />Get straight to the Point <a href='http://clk.atdmt.com/NMN/go/157637060/direct/01/' target='_new'>Find a great deal on your next car.</a></body>
</html>