python -U problem for 2.4.3c1 on Windows 2000 (was Does -U optionreally exist?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Petr Prikryl

    #1

    python -U problem for 2.4.3c1 on Windows 2000 (was Does -U optionreally exist?)

    I did observe the problem when using the -U
    option on Windows 2000. Seems like some infinite
    recursion in cp1250.py -- see below.

    I did not try it with earlier versions of Python.

    Can this be reproduced on your computer?

    Thanks for your time and experience,
    pepr

    P.S. Thanks, Martin, for the hint.

    Martin v. Löwis wrote[color=blue]
    > Petr Prikryl wrote:[color=green]
    > > Martin v. Löwis wrote[color=darkred]
    > > > As for dropping the u prefix on string literals:
    > > > Just try the -U option of the interpreter some time,
    > > > which makes all string literals Unicode. If you manage
    > > > to get the standard library working this way, you
    > > > won't need a per-file decision anymore: just start
    > > > your program with 'python -U'.[/color][/color]
    > [color=green]
    > > I have failed to find the -U option in Python 2.4.2.[/color]
    > [/color]
    [...][color=blue]
    > $ python2.4 -U
    > Python 2.4.2 (#2, Sep 30 2005, 21:19:01)
    > [GCC 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)] on linux2
    > Type "help", "copyright" , "credits" or "license" for more information.
    > [color=green][color=darkred]
    > >>> type("")[/color][/color]
    > <type 'unicode'>[color=green][color=darkred]
    > >>> ^D[/color][/color][/color]
    [...]

    On Windows machine

    C:\>python -U
    'import site' failed; use -v for traceback
    Python 2.4.3c1 (#68, Mar 23 2006, 10:19:27) [MSC v.1310 32 bit (Intel)] on win32

    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> type('')[/color][/color][/color]
    <type 'unicode'>[color=blue][color=green][color=darkred]
    >>> ^Z[/color][/color][/color]

    See the 'import site' failure. I do use the sitecustomize.p y
    (C:\Python24\Li b\site-packages\sitecu stomize.py). It contains
    -------------------------------------
    import sys
    sys.setdefaulte ncoding('cp1250 ')
    -------------------------------------

    I did remove the sitecustomize.p yc before the command.
    When trying the python -U -v 2>xxx.log, I get the
    following (shortened):

    # installing zipimport hook
    import zipimport # builtin
    # installed zipimport hook
    # C:\Python24\lib \site.pyc matches C:\Python24\lib \site.py
    import site # precompiled from C:\Python24\lib \site.pyc
    # C:\Python24\lib \os.pyc matches C:\Python24\lib \os.py
    import os # precompiled from C:\Python24\lib \os.pyc
    import nt # builtin
    # C:\Python24\lib \ntpath.pyc matches C:\Python24\lib \ntpath.py
    import ntpath # precompiled from C:\Python24\lib \ntpath.pyc
    # C:\Python24\lib \stat.pyc matches C:\Python24\lib \stat.py
    import stat # precompiled from C:\Python24\lib \stat.pyc
    # C:\Python24\lib \UserDict.pyc matches C:\Python24\lib \UserDict.py
    import UserDict # precompiled from C:\Python24\lib \UserDict.pyc
    # C:\Python24\lib \copy_reg.pyc matches C:\Python24\lib \copy_reg.py
    import copy_reg # precompiled from C:\Python24\lib \copy_reg.pyc
    # C:\Python24\lib \types.pyc matches C:\Python24\lib \types.py
    import types # precompiled from C:\Python24\lib \types.pyc
    # C:\Python24\lib \locale.pyc matches C:\Python24\lib \locale.py
    import locale # precompiled from C:\Python24\lib \locale.pyc
    import _locale # builtin
    # C:\Python24\lib \codecs.pyc matches C:\Python24\lib \codecs.py
    import codecs # precompiled from C:\Python24\lib \codecs.pyc
    import _codecs # builtin
    import encodings # directory C:\Python24\lib \encodings
    # C:\Python24\lib \encodings\__in it__.pyc matches C:\Python24\lib \encodings\__in it__.py
    import encodings # precompiled from C:\Python24\lib \encodings\__in it__.pyc
    # C:\Python24\lib \encodings\alia ses.pyc matches C:\Python24\lib \encodings\alia ses.py
    import encodings.alias es # precompiled from C:\Python24\lib \encodings\alia ses.pyc
    # C:\Python24\lib \encodings\cp12 50.pyc matches C:\Python24\lib \encodings\cp12 50.py
    import encodings.cp125 0 # precompiled from C:\Python24\lib \encodings\cp12 50.pyc
    import sitecustomize # from C:\Python24\lib \site-packages\sitecu stomize.py
    # wrote C:\Python24\lib \site-packages\sitecu stomize.pyc
    'import site' failed; traceback:
    Traceback (most recent call last):
    File "C:\Python24\li b\site.py", line 397, in ?
    main()
    File "C:\Python24\li b\site.py", line 394, in main
    if hasattr(sys, "setdefaultenco ding"):
    File "C:\Python24\li b\encodings\cp1 250.py", line 18, in encode
    return codecs.charmap_ encode(input,er rors,encoding_m ap)
    File "C:\Python24\li b\encodings\cp1 250.py", line 18, in encode
    return codecs.charmap_ encode(input,er rors,encoding_m ap)
    File "C:\Python24\li b\encodings\cp1 250.py", line 18, in encode
    return codecs.charmap_ encode(input,er rors,encoding_m ap)
    [...snip...]
    File "C:\Python24\li b\encodings\cp1 250.py", line 18, in encode
    return codecs.charmap_ encode(input,er rors,encoding_m ap)
    File "C:\Python24\li b\encodings\cp1 250.py", line 18, in encode
    return codecs.charmap_ encode(input,er rors,encoding_m ap)
    RuntimeError: maximum recursion depth exceeded
    # C:\Python24\lib \warnings.pyc matches C:\Python24\lib \warnings.py
    import warnings # precompiled from C:\Python24\lib \warnings.pyc
    # C:\Python24\lib \linecache.pyc matches C:\Python24\lib \linecache.py
    import linecache # precompiled from C:\Python24\lib \linecache.pyc
    Python 2.4.3c1 (#68, Mar 23 2006, 10:19:27) [MSC v.1310 32 bit (Intel)] on win32
    Type "help", "copyright" , "credits" or "license" for more information.[color=blue][color=green][color=darkred]
    >>> [/color][/color][/color]
    # clear __builtin__._
    # clear sys.path
    # clear sys.argv
    # clear sys.ps1
    # clear sys.ps2
    # clear sys.exitfunc
    # clear sys.exc_type
    # clear sys.exc_value
    # clear sys.exc_traceba ck
    # clear sys.last_type
    # clear sys.last_value
    # clear sys.last_traceb ack
    # clear sys.path_hooks
    # clear sys.path_import er_cache
    # clear sys.meta_path
    # restore sys.stdin
    # restore sys.stdout
    # restore sys.stderr
    # cleanup __main__
    # cleanup[1] locale
    # cleanup[1] encodings
    # cleanup[1] nt
    # cleanup[1] zipimport
    # cleanup[1] warnings
    # cleanup[1] _codecs
    # cleanup[1] types
    # cleanup[1] _locale
    # cleanup[1] sitecustomize
    # cleanup[1] signal
    # cleanup[1] linecache
    # cleanup[1] encodings.alias es
    # cleanup[1] exceptions
    # cleanup[1] encodings.cp125 0
    # cleanup[1] codecs
    # cleanup[2] copy_reg
    # cleanup[2] ntpath
    # cleanup[2] UserDict
    # cleanup[2] stat
    # cleanup[2] os
    # cleanup sys
    # cleanup __builtin__
    # cleanup ints: 7 unfreed ints in 1 out of 8 blocks
    # cleanup floats

    (the end)


    --
    Petr Prikryl (prikrylp at skil dot cz)
  • Martin v. Löwis

    #2
    Re: python -U problem for 2.4.3c1 on Windows 2000 (was Does -U optionreally exist?)

    Petr Prikryl wrote:[color=blue]
    > I did observe the problem when using the -U
    > option on Windows 2000. Seems like some infinite
    > recursion in cp1250.py -- see below.
    >
    > I did not try it with earlier versions of Python.
    >
    > Can this be reproduced on your computer?[/color]

    I can't try right now. However, I can readily
    believe that Python easily crashes when invoked
    with -U, and I can also believe that it only happens
    on some systems.

    If you care, please research the cause, and submit a
    bug fix. Just submitting the bug report likely won't
    react in action (atleast not from me).

    Regards,
    Martin

    Comment

    Working...