[pypy-dev] binascii.py in pure python

Christian Tismer tismer at stackless.com
Thu Nov 25 19:40:32 CET 2004


holger krekel wrote:
> Hi Florian, 
> 
> [Florian Bauer Thu, Nov 25, 2004 at 04:53:33PM +0100]
> 
>>Hi there,
>>
>>I checked the list of missing C modules on the wiki pages.
>>I could contribute some code for binascii.py. 
> 
> 
> nice. 
> 
> 
>>Some time ago i started porting the C module to python.
>>It's halfway done, but some functions are pretty usable and have some test coverage.
>>Right now, I don't have time to download pypy and play with it, so I don't know if there are any issues with integrating my code. It would be best if I could develop and test the module on CPython.
> 
> 
> that's just fine.  Actually it's faster <wink> to develop against CPython  and
> not let the current PyPy interpret your application level code.  

As an addition:
I'm just busy figuring out how to make C modules which are implemented
in Python easier to compile back to C.
It turned out that there is only little to change if your
implementation does not use fancy features like generators.
If you can assume that
- all your globals are constant after initialization
- you don't use ints or longs larger than machine words
- methods are constants and not shadowed by instance vars
- exceptions are raised only if you provide a try statement
- no generators
- no imports of modules which don't obey these rules
- use __all__ to report the exports

then this module is almost ready to become a builtin module.
I just have to convert the exported objects in __all__
an give them an application-python interface, again.

ciao - chris
-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9A     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/



More information about the Pypy-dev mailing list