Path: csiph.com!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!feedme.news.telefonica.de!telefonica.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: monkey patching __code__ Date: Fri, 18 Mar 2016 08:23:00 -0600 Lines: 6 Message-ID: References: <56EBEB5A.7050207@mail.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 76+hj1hBOGw2gLpZvQEO2wHfI9c8DoiPTky6QKyb63AA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.039 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'received:209.85.223': 0.03; 'defaults': 0.05; '2016': 0.16; 'attribute?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'add': 0.34; 'received:google.com': 0.35; 'replace': 0.35; 'received:209.85': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'version': 0.38; 'received:209': 0.38; 'takes': 0.39; 'well.': 0.40; 'to:addr:python.org': 0.40; 'your': 0.60; "you'll": 0.61; 'mar': 0.65; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=7KDs++Vy5/9ZRtKm1f/QPQrUAo5/meG33rqXlcwvWKo=; b=chBd5zrlYYm4HhgDlP7t7G9Qj9R5fH6QPdWWva9BioHV1dcenqIJZg99g1MN8rqmtX dK6Kd/qCZRb8MOEUhGaUeWtxsbDnhAu+Glp2tqtFVY10AC2f8+3z1mfdAHsP5bHo4i5v 5rV92bSs4SUpDUlJaE3mKsnz0yPGyQyi3aHszs3UGapzyVFNZ2ZHvtUDyhUc3JAbJbvc J8q71a875pO3ztX630EnYyVBlaGvT/DtUJ7TB06DbKRf+L7PjHb7p+yNHWB11K9Z4IV1 7P22XmZJoYSaaO7BJmbKnvDTVlcPbU6YggW8Csco3fdjHxg0qnEMhzSWNnTAI1b2r9sD gKoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=7KDs++Vy5/9ZRtKm1f/QPQrUAo5/meG33rqXlcwvWKo=; b=BfeUtYcP8LaWJq3rXWsaA8gLe9+Ce7ezDi0Wertwwf4UtRi+WZs+TrlvRFIb+1jUx9 aOqEv3z+bxmaxqDDA4igRtR2MWwOO+80gjMVLZBqw9MBfBxXRmRLbvLUKVWgOCGdAMA0 KOrlt0HBdGGLF3IZmZRqWKtNLXGrdJKEwB8ufN+3Yb2wqxfz/DPMkXhbOpn+iVtdnae7 t02+CU4FZ5siMTSpJ7KiR9heRXL2AqfXUFUKcpGQ10ovnso+duludy1r0v3A+p3Pgr4H Gg7KVoNY0T7XXGaM1VZbxqgjxN/i4O9B8BJnuwFDy/CaF3FIvfX+F6hYD+MM9VVhLt+m wdPg== X-Gm-Message-State: AD7BkJKbJ2rpQaSblv/fIRjmGFvuBsj1SYBfbG/Rx5KgIYtmbYr9Y8xMua5dqTaJnh7H+YRd2j0ME6AEvdotKA== X-Received: by 10.107.19.140 with SMTP id 12mr17997085iot.11.1458311020276; Fri, 18 Mar 2016 07:23:40 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105217 On Fri, Mar 18, 2016 at 7:47 AM, Ian Kelly wrote: > Your patched version takes two extra arguments. Did you add the > defaults for those to the function's __defaults__ attribute? And as an afterthought, you'll likely need to replace the function's __globals__ with your own as well.