[issue6507] Enhance dis.dis to autocompile codestrings

2010-07-09 Thread Éric Araujo
Changes by Éric Araujo : -- resolution: accepted -> fixed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue6507] Enhance dis.dis to autocompile codestrings

2010-07-03 Thread Nick Coghlan
Nick Coghlan added the comment: Committed (with some minor modifications) in r82471. Inspired by Yanov Aknin's ssc() tool, I've opened a new RFE (issue 9147) for a similarly enhanced show_code() implementation. -- stage: patch review -> committed/rejected status: open -> closed _

[issue6507] Enhance dis.dis to autocompile codestrings

2010-07-02 Thread Éric Araujo
Changes by Éric Araujo : -- resolution: -> accepted stage: commit review -> patch review ___ Python tracker ___ ___ Python-bugs-list m

[issue6507] Enhance dis.dis to autocompile codestrings

2010-07-02 Thread Terry J. Reedy
Terry J. Reedy added the comment: Just today, someone posted the result of dis.dis('somebytes') and did not notice the error because dis blithely disassembles bytes as bytecodes, even in 3.x. (The person actually dissed a 2.x string). >>> from dis import dis >>> dis(b'cat') 0 DUP_TO

[issue6507] Enhance dis.dis to autocompile codestrings

2010-07-02 Thread Mark Dickinson
Changes by Mark Dickinson : -- nosy: +mark.dickinson ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue6507] Enhance dis.dis to autocompile codestrings

2010-07-02 Thread Daniel Urban
Daniel Urban added the comment: > disassemble_string should've been private as well, while we are editing this > module. Attached the updated patch. -- Added file: http://bugs.python.org/file17839/issue6507_3.diff ___ Python tracker

[issue6507] Enhance dis.dis to autocompile codestrings

2010-07-02 Thread Scott Dial
Scott Dial added the comment: > disassemble_str should be private with an underscore. disassemble_string should've been private as well, while we are editing this module. -- nosy: +scott.dial ___ Python tracker _

[issue6507] Enhance dis.dis to autocompile codestrings

2010-05-25 Thread Nick Coghlan
Nick Coghlan added the comment: Missed the window for 2.7, but should be right for 3.2. There's a minor error in the documentation (strings need to be mentioned in the list of acceptable types), but I can fix that on commit. -- assignee: benjamin.peterson -> ncoghlan priority: low ->

[issue6507] Enhance dis.dis to autocompile codestrings

2010-05-08 Thread Daniel Urban
Daniel Urban added the comment: Done. Attached new patch as issue6507_2_priv.diff. -- Added file: http://bugs.python.org/file17265/issue6507_2_priv.diff ___ Python tracker ___ __

[issue6507] Enhance dis.dis to autocompile codestrings

2010-05-08 Thread Benjamin Peterson
Benjamin Peterson added the comment: disassemble_str should be private with an underscore. -- ___ Python tracker ___ ___ Python-bugs-l

[issue6507] Enhance dis.dis to autocompile codestrings

2010-04-18 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> benjamin.peterson nosy: +benjamin.peterson stage: needs patch -> commit review versions: +Python 2.7 ___ Python tracker ___ ___

[issue6507] Enhance dis.dis to autocompile codestrings

2010-04-18 Thread Daniel Urban
Daniel Urban added the comment: Any chance, that my patch will be accepted? Is there a problem with it? Thanks. -- ___ Python tracker ___ ___

[issue6507] Enhance dis.dis to autocompile codestrings

2010-04-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue6507] Enhance dis.dis to autocompile codestrings

2010-04-11 Thread Daniel Urban
Daniel Urban added the comment: I've made a patch, which adds a disassemble_str function to the dis module. The dis.dis function calls this function if x is a string. Added the following sentence to the documentation: "Strings are first compiled to code objects with the :func:`compile` built-

[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: Trying both 'eval' and 'exec' looks fine to me. Marking 'easy' because I expect it should be ;-) -- keywords: +easy ___ Python tracker ___ _

[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-18 Thread Nick Coghlan
Nick Coghlan added the comment: As per Georg's suggestion, a better approach would look like: from dis import dis def dis_str(source): try: c = compile(source, '', 'eval') except SyntaxError: c = compile(source, '', 'exec') return dis(c) -- __

[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-18 Thread Georg Brandl
Georg Brandl added the comment: As I explained on python-ideas, 'single' should not be tried. -- nosy: +georg.brandl ___ Python tracker ___ __

[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-17 Thread Nick Coghlan
Nick Coghlan added the comment: Copying my suggestion (minus examples) over from the python-ideas thread: We could define it as trying the three modes in order (first 'eval', then 'single', then 'exec') moving on to the next option if it raises syntax error: from dis import dis def dis_str(sou

[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-17 Thread Benjamin Peterson
Changes by Benjamin Peterson : -- priority: -> low stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue6507] Enhance dis.dis to autocompile codestrings

2009-07-17 Thread Terry J. Reedy
New submission from Terry J. Reedy : dis.dis(ob) currently accepts "a module, a class, a method, a function, or a code object." But for most uses I have seen on python-list, people start with a code snippet. They must then wrap that in a function or remember (or lookup) a call such as compile(cod