Find the answer to your Linux question:
Results 1 to 1 of 1
Hello all, I am trying to disassemble some Python Bytecode with dis.dis and this is really though. So here is a little look into my Journey! % python -V Python ...
  1. #1
    Linux Engineer RobinVossen's Avatar
    Join Date
    Aug 2007
    Location
    The Netherlands
    Posts
    1,422

    Python Version: 2.6a1 where to get this?

    Hello all,

    I am trying to disassemble some Python Bytecode with dis.dis and this is really though.
    So here is a little look into my Journey!
    % python -V
    Python 2.6.5
    % python
    Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import dis
    >>> import base64
    >>> dir(base64)
    ['EMPTYSTRING', 'MAXBINSIZE', 'MAXLINESIZE', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_b32alphabet', '_b32rev', '_b32tab', '_translate', '_translation', '_x', 'b16decode', 'b16encode', 'b32decode', 'b32encode', 'b64decode', 'b64encode', 'binascii', 'decode', 'decodestring', 'encode', 'encodestring', 'k', 're', 'standard_b64decode', 'standard_b64encode', 'struct', 'test', 'test1', 'urlsafe_b64decode', 'urlsafe_b64encode', 'v']
    >>> dis.dis(base64.decode)
    302 0 SETUP_LOOP 64 (to 67)
    >> 3 LOAD_GLOBAL 0 (True)
    6 JUMP_IF_FALSE 56 (to 65)
    9 POP_TOP
    <More Byte Code this works fine>
    % ls
    download.pyc
    % python
    Python 2.6.5 (r265:79063, Mar 23 2010, 04:49:54)
    [GCC 4.4.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import download.pyc
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    ImportError: Bad magic number in download.pyc
    So I went out googling
    And I read this sourcefile:
    [projects] View of /python/trunk/Python/import.c

    And I figured how it worked thus I used radare to figure-out the Magic by hand.
    I used this sourcefile to figure out what version of Python the Bytecode was coded :
    Code:
    #include <stdio.h>
    
    /* Version 2.6a1 */
    #define MAGIC (62161 | ((long)'\r'<<16) | ((long)'\n'<<24))
    
    static long pyc_magic = MAGIC;
    
    int main(int argc, char **argv)
    {
       printf ("%8x\n",pyc_magic);
       return 0;
    }
    And that was Right (took me a while till I got the right Magic..
    Anyway, To make a long story short.
    I want to manage to get Python 2.6a1 on my Linux box. Where can I get this?
    As on the Python webpage it does just say:
    Python 3.1.2 (March 21st, 2010)
    Python 3.0.1 (February 13, 2009)
    Python 2.6.5 (March 19, 2010)
    Python 2.5.5 (January 31, 2010)
    Python 2.4.6 (December 19, 200
    Python 2.3.7 (March 11, 200
    Python 2.2.3 (May 30, 2003)
    Python 2.1.3 (April 8, 2002)
    Python 2.0.1 (June 2001)
    Python 1.6.1 (September 2000)
    Python 1.5.2 (April 1999)
    So no 2.6.1..
    So who has this can tell me where to get this?


    Thanks

    Cheers,
    Robin
    Last edited by RobinVossen; 04-09-2010 at 08:38 PM. Reason: Turned on Instant Email Notification.
    New Users, please read this..
    Google first, then ask..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...