[pycrypto] Pycrypto working with python 3.0 or 3.1

Christoph Tapler christoph.tapler at gmx.net
Wed Mar 17 13:36:01 CST 2010


Hi Grail,

Following replacement - I have used AES as an example - seems to work
fine:

From:
     from common import make_block_tests
     return make_block_tests(AES, "AES", test_data)

To:
     from . import common
     return common.make_block_tests(AES, "AES", test_data)

In some files, you also need to remove the "import common import dict" 
at the beginning of the files. According to the comment, this was only
needed for Python 2.1 / 2.2. Hence that removal should not negatively 
affect functionality.

Unfortunately I don't have enough time to do all the replacements in
the next days. I could send you a patch on weekend earliest.

Cheers,
Christoph

On 15.03.2010 21:41, Christoph Tapler wrote:
> Hi,
>
> I could find the relevant change documented in
> http://docs.python.org/py3k/whatsnew/3.0.html , "Removed Syntax" section.
> Using "from . import X" instead of "import X" should fix the issue.
> I will try to adapt the Test Suite asap.
>
> Cheers,
> Christoph
>
>
> On 15.03.2010 02:10, Dwayne C. Litzenberger wrote:
>> Are absolute imports standard in Python 3?
>>
>> http://www.python.org/dev/peps/pep-0328/
>>
>> On Sun, Mar 14, 2010 at 04:11:58PM +0100, Christoph Tapler wrote:
>>> Hi Grail,
>>>
>>> I have tried to fix the test suite, but I came across a problem,
>>> which seems to be specific to Python 3. It seems to me that Python 3
>>> behaves differently in terms of hierarchical imports.
>>>
>>> To demonstrate this difference, I have attached a small example (just
>>> start level_test.py in Python 2 / 3). If you execute this example in
>>> Python 2, everything works fine. However, in Python 3, the second
>>> (nested) import fails. I don't understand why.
>>>
>>> Do you (or anybody else of course ;-) ) have an idea how this issue
>>> could be resolved? Btw, this pattern appears several times in the test
>>> suite.
>>>
>>> Kind Regards,
>>> Christoph
>>>
>>> On 04.03.2010 03:37, Grail Dane wrote:
>>>> Hi Christoph
>>>>
>>>> Good to see this is coming together for you, and as one of the users
>>>> mentions,
>>>> using the unified option is a general rule of thumb for patches /
>>>> diffs.
>>>>
>>>> You are correct about the test suite as I have not had a chance to
>>>> alter
>>>> the tests to Python 3 context.
>>>>
>>>> Cheers
>>>> Grail
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> Date: Wed, 3 Mar 2010 21:58:09 +0100
>>>> From: christoph.tapler at gmx.net
>>>> To: pycrypto at lists.dlitz.net
>>>> Subject: Re: [pycrypto] Pycrypto working with python 3.0 or 3.1
>>>>
>>>> Hi Grail,
>>>>
>>>> I have applied your patch on my Windows machine. Your AES encryption /
>>>> decryption seems to work well - In case
>>>> AZCkZ1wU5d0psrwlaoS5R4tz1dRL6rBBNzjIvK9NHSo= is the result ;-)
>>>> Moreover, I have tried the diff tool. Not sure if the output is usable
>>>> for you. Just
>>>> let me know if this format is okay or not. The patch contains a few
>>>> rather trivial
>>>> fixes for the Windows environment. With those fixes the build is
>>>> successful.
>>>> However, the test suite doesn't build, needs adaptions as well (but I
>>>> think only
>>>> in Python).
>>>>
>>>> Cheers,
>>>> Christoph
>>>>
>>>> On 03.03.2010 03:48, Grail Dane wrote:
>>>>
>>>> OK ... OK ... OK - stop the presses
>>>>
>>>> Well, maybe not just yet, anyhoo, the attached patch allows the
>>>> source to compile
>>>> and run the attached script<woohoo>
>>>>
>>>> Cheers
>>>> Grail
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> Meet local singles online. Browse profiles for FREE!
>>>> <http://clk.atdmt.com/NMN/go/150855801/direct/01/>
>>>>
>>>>
>>>> _______________________________________________
>>>> pycrypto mailing list
>>>> pycrypto at lists.dlitz.net<mailto:pycrypto at lists.dlitz.net>
>>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> Find out now. Link all your email accounts and social updates with
>>>> Hotmail.<http://windowslive.ninemsn.com.au/oneinbox?ocid=T162MSN05A0710G>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> pycrypto mailing list
>>>> pycrypto at lists.dlitz.net
>>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>>
>>
>>
>>> _______________________________________________
>>> pycrypto mailing list
>>> pycrypto at lists.dlitz.net
>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>
>>
>



More information about the pycrypto mailing list