Modifying the Python interpreter to create a custom secure version

G

Gouda Man

Hey everyone,

I'm embedding the Python interpreter within my program to use as a
scripting language. However, one of the unique features of our program is
the ability of the internal language to possess per-object security
permissions and restricted execution.

Therefore, we need to add extra "magic members" (a la __class__, __doc__,
and friends) to *all* objects in Python. By editing PyClass_New, we
managed to add a test member to all old-style classes. Furthermore, by
editing type_new, we managed to achieve the same results for all user-
made new-style classes.

However! This didn't do anything for built-in types, such as int, object,
etc.

What are we doing wrong, and does anyone have any
recommendations/experience in modifying the built-in interpreter. The
source code is clear but a bit daunting when it comes to finding -
exactly- where to place code like this. If we're implementing things too
far down the type hierarchy, it would be nice to know this beforehand so
we don't duplicate any code.

Thanks in advance for all your help.

Alex, Lucas
Comp. Engineering
University of Waterloo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,222
Messages
2,571,138
Members
47,755
Latest member
Grazynkaa

Latest Threads

Top