Re: Creating instances of untrusted new-style classes

2006-05-26 Thread greg
Michael Spencer wrote: > >>> class A(object): > ... > >>> b = object.__new__(A) Note that you'll need to be a bit cleverer if the class might be derived from some other built-in type: >>> class A(list): ... pass ... >>> b = object.__new__(A) Traceback (most recent call last): File "", li

Re: Creating instances of untrusted new-style classes

2006-05-25 Thread Devan L
Michael Spencer wrote: > Devan L wrote: > > Is there any safe way to create an instance of an untrusted class > > without consulting the class in any way? With old-style classes, I can > > recreate an instance from another one without worrying about malicious > > code (ignoring, for now, malicious

Re: Creating instances of untrusted new-style classes

2006-05-25 Thread Michael Spencer
Devan L wrote: > Is there any safe way to create an instance of an untrusted class > without consulting the class in any way? With old-style classes, I can > recreate an instance from another one without worrying about malicious > code (ignoring, for now, malicious code involving attribute access)

Re: Creating instances of untrusted new-style classes

2006-05-25 Thread Devan L
Ben Finney wrote: > "Devan L" <[EMAIL PROTECTED]> writes: > > > Is there any safe way to create an instance of an untrusted class > > Why are you instantiating classes you don't trust? > > > without consulting the class in any way? > If you don't "consult the class", how can the instance be created

Re: Creating instances of untrusted new-style classes

2006-05-25 Thread Ben Finney
"Devan L" <[EMAIL PROTECTED]> writes: > Is there any safe way to create an instance of an untrusted class Why are you instantiating classes you don't trust? > without consulting the class in any way? If you don't "consult the class", how can the instance be created properly? -- \ "It's