sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

Discussion in 'Python' started by Lin, Dec 16, 2008.

  1. Lin

    Lin Guest

    Hi,

    I installed the amd64 version of Python 2.6.1 on my Windows XP x64
    system. I was expecting sys.maxint to be 9223372036854775807 (or 2 ^63
    -1), but instead I got 2147483647 (i.e., 2^31-1) just like what I got
    from a 32-bit version of Python. Is this by design or does it indicate
    a bug or an installation problem? Thank you very much!


    --lin
     
    Lin, Dec 16, 2008
    #1
    1. Advertising

  2. Lin

    Lin Guest

    >
    > > I installed the amd64 version of Python 2.6.1 on my Windows XP x64
    > > system. I was expecting sys.maxint to be 9223372036854775807 (or 2 ^63
    > > -1), but instead I got 2147483647 (i.e., 2^31-1) just like what I got
    > > from a 32-bit version of Python. Is this by design or does it indicate
    > > a bug or an installation problem? Thank you very much!

    >
    > This is by design. In their infinitive wisdom Microsoft has decided to
    > make the 'long' C type always a 32 bit signed integer - even on 64bit
    > systems. On most Unix systems a long is at least 32 bit but usually
    > sizeof(ptr).
    >


    Ah, this makes sense. Thanks...... The main reason I'm trying 64-bit
    Python is that I want to write files bigger than 4GB. This should work
    on Windows x64, right? (i.e., are the pointers bona fide 64 bit?)

    -lin
     
    Lin, Dec 16, 2008
    #2
    1. Advertising

  3. Lin

    Tim Roberts Guest

    Lin <> wrote:
    >
    >Ah, this makes sense. Thanks...... The main reason I'm trying 64-bit
    >Python is that I want to write files bigger than 4GB. This should work
    >on Windows x64, right? (i.e., are the pointers bona fide 64 bit?)


    Those two questions are not related. Win32 (NTFS) has always been able to
    create files larger than 4GB, and the file APIs that deal with file
    positions and file sizes can all handle 64-bit values.

    Pointers on Win32 are 32 bits, but that doesn't affect files. If you want
    to map that large file into memory, you have to do it a gigabyte at a time,
    but if you're using ReadFile and WriteFile, it's not a problem.
    --
    Tim Roberts,
    Providenza & Boekelheide, Inc.
     
    Tim Roberts, Dec 18, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Grant Edwards
    Replies:
    3
    Views:
    586
    Grant Edwards
    Aug 11, 2004
  2. Bengt Richter

    int(float(sys.maxint)) buglet ?

    Bengt Richter, Nov 24, 2004, in forum: Python
    Replies:
    0
    Views:
    362
    Bengt Richter
    Nov 24, 2004
  3. Bengt Richter
    Replies:
    6
    Views:
    355
    Bengt Richter
    Dec 9, 2004
  4. Nick Coghlan
    Replies:
    0
    Views:
    485
    Nick Coghlan
    Dec 6, 2004
  5. sys.maxint in Python 3

    , Apr 21, 2008, in forum: Python
    Replies:
    4
    Views:
    973
Loading...

Share This Page