[pycrypto] python crypto with python 3.0 or 3.1

don at amberfisharts.com don at amberfisharts.com
Wed Mar 10 06:58:39 CST 2010


Hi,

I just realized, that it seems that I just received your mail from January
for some odd reason.
And back then I already replied with almost the same points so feel free
to ignore my last message.
Though I'm not sure I noticed the thing with the exception back then.

So again. sorry for the noise.

yours
//Lorenz
 

On Wed, 10 Mar 2010 13:40:12 +0100, <don at amberfisharts.com> wrote:
> Hi Grail,
> 
> I just looked at your patch and have some comments.
> I haven't tested the patch. I only read it.
> 
> 1) In AllOrNothing.py you replace:
> -    except getopt.error, msg:
> +    except getopt.error:
> At first glance that looks wrong. If msg is used in the exception block
> with your patch it would be undefined.
> What you probably want to do is:
> -    except getopt.error, msg:
> +    except getopt.error as msg:
> 
> 2) Is there a reason why you don't use the Py_SIZE and Py_TYPE macros in
> the C extension modules?
> In various places you do something like this:
> -       ALGtype.ob_type = &PyType_Type;
> +       ALGtype.ob_base.ob_base.ob_type = &PyType_Type;
> I would try:
> -       ALGtype.ob_type = &PyType_Type;
> +       Py_TYPE(ALGtype) = &PyType_Type;
> and similarly instead of 
> -               size = -p->ob_size;
> +               size = -p->ob_base.ob_size;
> I would try
> -               size = -p->ob_size;
> +               size = -Py_SIZE(p);
> These Macros are defined in pythons source Include/object.h
> 
> Note that I didn't try any of this. So you should try this out before
you
> change anything.
> 
> sincerely yours
> //Lorenz
> 
> 
> 
> On Fri, 15 Jan 2010 09:19:14 +0000, Grail Dane <grail69 at hotmail.com>
> wrote:
>> Hi All
>> So I am going to go on a limb a little and say I have successfully
>> compiled pycrypto with python 3.1.1
>> The attached patch makes the necessary changes to remove any errors
> during
>> install.If someone would like to give me a small test script, I am
happy
> to
>> see if my tinkering actually worksor is just allowing it to install??
>> I am also aware that some of the changes are probably not the best way
> to
>> do it, but I am happy to investigatefurther once I have it working :)
>> CheersGrail
>> 
>> From: grail69 at hotmail.com
>> To: pycrypto at lists.dlitz.net
>> Date: Fri, 15 Jan 2010 00:32:04 +0000
>> Subject: Re: [pycrypto] python crypto with python 3.0 or 3.1
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> Hi
>> Thanks for the speedy reply :)
>> I am a little confused though as the doco for 3.1 says:
>> PyVarObjectThis is an extension of PyObject that adds the ob_size
field.
>> This is only used for objects that have some notion of length. This
type
>> does not often appear in the Python/C API. It corresponds to the fields
>> defined by the expansion of the PyObject_VAR_HEAD macro.This appears to
> be
>> the same as what is written in the doco for 2.6.4 as well, which
> pycrypto
>> seems to work with.
>> Well i will keep looking to see what i can find out.
>> CheersGrail
>>> Date: Thu, 14 Jan 2010 10:07:36 +0100
>>> From: don at amberfisharts.com
>>> To: pycrypto at lists.dlitz.net
>>> Subject: Re: [pycrypto] python crypto with python 3.0 or 3.1
>>> 
>>> Hi,
>>> 
>>> as far as I know there hasn't been a move to port pyCrypto to python
> 3.x
>>> so simply compiling against python 3.x is bound to fail!
>>> If you try to port yourself and during that effort ran into this
>>> compiler
>>> error then if you look at the documentation [1] or this blog post [2]
>>> (it's
>>> a bit outdated since the docs have been fixed in the meantime) you
will
>>> see
>>> that the first few lines (besides other things) of a python extension
>>> type
>>> have
>>> changed from 
>>>  
>>>   PyObject_HEAD_INIT(NULL)
>>>   0,                   /* ob_size */
>>>   "myTypeName",        /* tp_name */
>>> 
>>> to
>>> 
>>>   PyVarObject_HEAD_INIT(NULL, 0)
>>>   "myTypeName",        /* tp_name */
>>> 
>>> If I recall correctly, the ob_size has be moved to a different
> structure
>>> and no longer
>>> is a member of PyTypeObject.
>>> So to sum it up:
>>>  * no porting effort exist so far, AFAIK
>>>  * no, the error is not bogus
>>> 
>>> sincerely yours
>>> //Lorenz
>>> 
>>> [1] http://docs.python.org/dev/py3k/extending/newtypes.html
>>> [2]
>>>
>
http://rhodesmill.org/brandon/2008/porting-a-c-extension-module-to-python-30/
>>> 
>>> 
>>> 
>>> On Thu, 14 Jan 2010 07:52:59 +0000, Grail Dane <grail69 at hotmail.com>
>>> wrote:
>>> > Hi GuysI am new to the list but have recently run into this
issue.Has
>>> > there been any movement?Personally I am stuck when gcc tries to
> compile
>>> > src/_fastmath.cwhich seems to die with an error about 'ob_size'
> member
>>> not
>>> > existing :(This seems to be bogus as I traced back the struct's to
>>> include
>>> > PyObject_VAR_HEADwhich does have this as member.Any further help on
>>> > this
>>> > would be appreciated ;)Cheers Grail>On Fri, Dec 04, 2009 at
> 11:44:00AM
>>> > +0100, Tobias Koeck wrote:>>Is it possible to run python crypto with
>>> python
>>> > 3.0 or 3.1. If not is 
>>> >>>it planed to adjust?
>>> > 
>>> >>Sure, and it'll happen sooner if somebody volunteers to do it. :-)
>>> > 
>>> >>There will need to be be some strategy for Python 2.x compatibility,
>>> >>and
>>> 
>>> >>the contributor(s) need to to meet the PyCrypto Code Submission 
>>> >>Requirements:
>>> > 
>>> >>http://www.dlitz.net/software/pycrypto/submission-requirements/
>>> > 
>>> >>-- 
>>> >>Dwayne C. Litzenberger <dlitz at dlitz.net>
>>> >>  Key-signing key   - 19E1 1FE8 B3CF F273 ED17  4A24 928C EC13 39C2
>>> >>  5CF7
>>> >>  Annual key (2009) - C805 1746 397B 0202 2758  2821 58E0 894B 81D2
>>> >>  582E
>>> >>
>>> > _________________________________________________________________
>>> > View photos of singles in your area! Browse profiles for FREE
>>> > http://clk.atdmt.com/NMN/go/150855801/direct/01/
>>> _______________________________________________
>>> pycrypto mailing list
>>> pycrypto at lists.dlitz.net
>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>  		 	   		  
>> If It Exists, You'll Find it on SEEK Shopping Trolley Mechanic 		 	   
> 
>> _________________________________________________________________
>> Time for a new car? Sell your old one fast!
>> http://clk.atdmt.com/NMN/go/157637060/direct/01/
> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto


More information about the pycrypto mailing list