[Python-Dev] Challenge: Please break this! (a.k.a restricted mode revisited) (original) (raw)

Robert Collins robertc at robertcollins.net
Mon Apr 11 03:08:54 EDT 2016


On 11 April 2016 at 13:49, Tres Seaver <tseaver at palladion.com> wrote:

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

On 04/10/2016 06:31 PM, Jon Ribbens wrote: Unless someone knows a way to get to an object's dict or its type without using vars() or type() or underscore attributes... Hmm, 'classmethod'-wrapped functions get passed the type.

yeah, but to access that you need to assign the descriptor to the type

thetype = [] class gettype: def get(self, obj, type=None): thetype.append((obj, type)) return None

classIwant.query = gettype() classIwant().query thetype[0][1]...

but you've already gotten to classIwant there.

-Rob

-- Robert Collins <rbtcollins at hpe.com> Distinguished Technologist HP Converged Cloud



More information about the Python-Dev mailing list