[Patches] [ python-Patches-637906 ] Allow any file-like object on dis module

noreply@sourceforge.net noreply@sourceforge.net
Thu, 14 Nov 2002 10:07:47 -0800


Patches item #637906, was opened at 2002-11-14 03:24
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=637906&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Hye-Shik Chang (perky)
Assigned to: Nobody/Anonymous (nobody)
Summary: Allow any file-like object on dis module

Initial Comment:
This was useful for me to make a restricted environment
by disallowing specific opcodes.


----------------------------------------------------------------------

>Comment By: Hye-Shik Chang (perky)
Date: 2002-11-15 03:07

Message:
Logged In: YES 
user_id=55188

Yes. To disallow BINARY_POWER and INPLACE_POWER, I'm hooking
sys.stdout now. But, because it isn't thread-safe way, I
needed to lock threads whenever I print something to stdout.
To make a cheaper solution, I like this patch.

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2002-11-15 01:56

Message:
Logged In: YES 
user_id=31435

I'm also missing the connection to restricted environments.

If you want to capture dis output (or output from anything else 
that uses print), the usual way to do it is to assign a StringIO 
instance (or other file-like object) to sys.stdout before 
invoking dis.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-11-14 08:46

Message:
Logged In: YES 
user_id=21627

Can you please elaborate? In what way does is that useful
for a restricted environment?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=637906&group_id=5470