[Python-Dev] Can Python implementations reject semantically invalid expressions? (original) (raw)
Mark Dickinson dickinsm at gmail.com
Fri Jul 2 13:39:18 CEST 2010
- Previous message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Next message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jul 2, 2010 at 12:25 PM, Steven D'Aprano <steve at pearwood.info> wrote:
Craig, what are you using to get that? When I try it in Python 3.1, I get:
TypeError: don't know how to disassemble str objects How do you get that result?
As I just discovered (see above), dis.dis is happy to interpret byte strings (i.e., strings in 2.x, bytes in 3.x) as direct representations of Python bytecode.
There's also an open feature request[1] to allow text strings as input in py3k, doing an automatic compile before passing the result to dis.dis.
Mark
[1] http://bugs.python.org/issue6507
- Previous message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Next message: [Python-Dev] Can Python implementations reject semantically invalid expressions?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]