[ANN] pyasm 0.1 - x86 assembler for Python

2005-03-01 Thread Grant Olson
pyasm 0.1 - x86 assembler for Python

This release is for early adopters only.  It is not properly packaged and
doesn't have very good documentation.  It is however a functional assembler
that should be of interest to some people.

Current output targets include Windows-style COFF files that can be
subsequently linked to produce executables, and more interestingly output
can target memory in an existing Python process and binding within a Python
namespace.  That's right, you can now generate dynamic inline assembly
straight from Python!  A simple hello world function implementation is
listed at the end of this message.


The files test\test_object_creation.py and test\test_winmem.py in the
distribution probably give the best examples of usage.

Future plans include targeting ELF file formats and Linux memory at runtime,
and of course real documentation.

The package is available at:
http://mysite.verizon.net/olsongt/pyasm-0.1.zip

Enjoy,

-Grant

#
# PYTHON HELLO WORLD IN ASSEMBLY
#

import pyasm.winmem
from pyasm.x86asm import assembler, CDECL
from pyasm.x86cpToMemory import CpToMemory

nonePointer = id(None)


a = assembler()
a.ADStr(hello_world, Hello world!\n\0)
a.AP(test_print, CDECL)
a.AddLocal(self)
a.AddLocal(args)
#a.AI(INT 3)
a.AI(PUSH hello_world)
a.AI(CALL PySys_WriteStdout)
#a.AI(INT 3)
a.AI(MOV EAX,%s % id(None))
a.AI(ADD [EAX],0x1) #refcount manipulation
a.EP()


mem = CpToMemory(a.Compile(),pyasm.winmem)
mem.MakeMemory()
mem.BindPythonFunctions(globals())

test_print() # calls the assembly function

-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


python-dev Summary for 2005-01-16 through 2005-01-31

2005-03-01 Thread Brett C
=
Summary Announcements
=
-
School sure likes to destroy my free time
-
A month late, that much closer to having this hectic quarter being over.  Sorry 
for being so delinquent with this summary but school has kept me busy and 
obviously the Real World has to take precedence over volunteer work.  Now if I 
could only get paid for doing this... =)

And if you hate the summaries being late, you could do it yourself.  This is 
not meant to be a flippant comment!  I am always willing to hand over 
development of the summaries to anyone who is willing to do a comparable job. 
If you are interested feel free to email me.  I have now made this a permanent 
offer in the header in case someone comes along later and decides they want to 
do this.

--
RSS feed now available
--
Thanks entirely to one of my predecessors, A.M. Kuchling, the python-dev 
Summaries are available as an `RSS feed`_.  The feed contains the titles of 
every summary and so will be updated with the newest summaries as soon as they 
are posted online.  A full text feed will eventually be available.

--
New format
--
I have done a thorough restructuring of the boilerplate and the Summary 
Announcements section for the Summaries.  The purpose of this is to make 
finding information in the boilerplate much easier.  It also keeps consistency 
by sectioning off everything as in the Summary section.

The other reason is for the ``contents`` directive in reST_.  This will provide 
a more thorough table of contents for the web version of the summary at the 
very top of the summaries.  This will allow people to jump directly to the 
section of the Summary they care about the most.  Obviously this perk only 
exists in the HTML version.

Lastly, the typical boilerplate for each Summary has now been moved to the 
bottom.  This was at the request of a regular reader who I would like to keep 
happy.  =)  It also seems reasonable since once you have read through it once 
chances are you are not going to read it again so might as well move it out of 
the way.

Then again I could be totally wrong about all of this and manage to alienate 
every person who reads the summaries regularly.  =)


===
Summary
===
-
Python 2.3.5 released
-
Consider how late this summary is I bet you already knew Python 2.3.5 was 
already out the door.  =)

With Python 2.4 out in the world this means there is a very high probability 
2.3.6 will never exist and this marks the end of the 2.3 branch.

Contributing threads:
  - `2.3.5 delayed til next week 
http://mail.python.org/pipermail/python-dev/2005-January/051140.html`__
  - `2.3 BRANCH FREEZE imminent! 
http://mail.python.org/pipermail/python-dev/2005-January/051277.html`__
  - `RELEASED Python 2.3.5, release candidate 1 
http://mail.python.org/pipermail/python-dev/2005-January/051304.html`__

--
Making magic type conversion methods act like __str__
--
Walter Drwald discovered that when you subclass 'unicode' and call unicode() 
on an instance of the subclass it will not call the implementation of 
__unicode__ of the subclass but instead will call unicode.__unicode__ .  When 
in the same scenario with strings, though, str() calls the subclass' __str__ 
method.  Turns out 'int' and 'float' act like 'unicode' while 'complex' acts 
like 'str'.

So who is right?  Docs say 'str' is wrong, but this is mainly an artifact of 
pre-2.2 inability to subclass types.  Turns out 'str' is acting properly. 
`Patch #1109424`_ implements the proper semantics and will eventually go in for 
2.5 (won't touch 2.4 since it is a semantic change).

.. _Patch #1109424: http://www.python.org/sf/1109424
Contributing threads:
  - `__str__ vs. __unicode__ 
http://mail.python.org/pipermail/python-dev/2005-January/051175.html`__

-
Speeding up function calls to C API functions
-
Neal Norwitz posted the patch found at http://www.python.org/sf/1107887 to help 
with function calls to C code.  The idea is to expand the family of values used 
in PyMethodDef.ml_flags for argument types to include specifying the number of 
minimum and maximum number of arguments.  This can provide a speedup by 
allowing the eval loop to unpack everything in the C stack and skip packing 
arguments in a tuple.

But not everyone was sure it was worth the extra need to specify all of this 
for functions.  Regardless of that and any other objections this would be more 
of a Python 3000 thing.

Which also led to a quick shift in topic to how Python 3.0 will be developed. 
Guido said it would be piece-meal.  Read 
http://joelonsoftware.com/articles/fog69.html for why.