Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/using/cmdline.rst

    r2 r391  
    11.. highlightlang:: none
     2
     3.. ATTENTION: You probably should update Misc/python.man, too, if you modify
     4.. this file.
    25
    36.. _using-on-general:
     
    2225When invoking Python, you may specify any of these options::
    2326
    24     python [-BdEiOQsStuUvVWxX3?] [-c command | -m module-name | script | - ] [args]
     27    python [-BdEiOQsRStuUvVWxX3?] [-c command | -m module-name | script | - ] [args]
    2528
    2629The most common use case is, of course, a simple invocation of a script::
     
    5962.. cmdoption:: -c <command>
    6063
    61    Execute the Python code in *command*.  *command* can be one ore more
     64   Execute the Python code in *command*.  *command* can be one or more
    6265   statements separated by newlines, with significant leading whitespace as in
    6366   normal module code.
     
    7982   use a name that includes a hyphen).
    8083
     84   Package names are also permitted. When a package name is supplied instead
     85   of a normal module, the interpreter will execute ``<pkg>.__main__`` as
     86   the main module. This behaviour is deliberately similar to the handling
     87   of directories and zipfiles that are passed to the interpreter as the
     88   script argument.
     89
    8190   .. note::
    8291
     
    98107   .. seealso::
    99108      :func:`runpy.run_module`
    100          The actual implementation of this feature.
     109         Equivalent functionality directly available to Python code
    101110
    102111      :pep:`338` -- Executing modules as scripts
     
    106115   .. versionchanged:: 2.5
    107116      The named module can now be located inside a package.
     117
     118   .. versionchanged:: 2.7
     119      Supply the package name to run a ``__main__`` submodule.
     120      sys.argv[0] is now set to ``"-m"`` while searching for the module
     121      (it was previously incorrectly set to ``"-c"``)
    108122
    109123
     
    240254
    241255
     256.. cmdoption:: -R
     257
     258   Turn on hash randomization, so that the :meth:`__hash__` values of str,
     259   bytes and datetime objects are "salted" with an unpredictable random value.
     260   Although they remain constant within an individual Python process, they are
     261   not predictable between repeated invocations of Python.
     262
     263   This is intended to provide protection against a denial-of-service caused by
     264   carefully-chosen inputs that exploit the worst case performance of a dict
     265   construction, O(n^2) complexity.  See
     266   http://www.ocert.org/advisories/ocert-2011-003.html for details.
     267
     268   Changing hash values affects the order in which keys are retrieved from a
     269   dict.  Although Python has never made guarantees about this ordering (and it
     270   typically varies between 32-bit and 64-bit builds), enough real-world code
     271   implicitly relies on this non-guaranteed behavior that the randomization is
     272   disabled by default.
     273
     274   See also :envvar:`PYTHONHASHSEED`.
     275
     276   .. versionadded:: 2.6.8
     277
     278
    242279.. cmdoption:: -s
    243280
    244    Don't add user site directory to sys.path
     281   Don't add the :data:`user site-packages directory <site.USER_SITE>` to
     282   :data:`sys.path`.
    245283
    246284   .. versionadded:: 2.6
     
    301339   :option:`-W` options are ignored (though, a warning message is printed about
    302340   invalid options when the first warning is issued).
     341
     342   Starting from Python 2.7, :exc:`DeprecationWarning` and its descendants
     343   are ignored by default.  The :option:`-Wd` option can be used to re-enable
     344   them.
    303345
    304346   Warnings can also be controlled from within a Python program using the
     
    332374   may be omitted.  The *message* field matches the start of the warning message
    333375   printed; this match is case-insensitive.  The *category* field matches the
    334    warning category.  This must be a class name; the match test whether the
     376   warning category.  This must be a class name; the match tests whether the
    335377   actual warning category of the message is a subclass of the specified warning
    336378   category.  The full class name must be given.  The *module* field matches the
     
    343385
    344386      :pep:`230` -- Warning framework
     387
     388      :envvar:`PYTHONWARNINGS`
    345389
    346390
     
    399443---------------------
    400444
    401 These environment variables influence Python's behavior.
     445These environment variables influence Python's behavior, they are processed
     446before the command-line switches other than -E.  It is customary that
     447command-line switches override environmental variables where there is a
     448conflict.
    402449
    403450.. envvar:: PYTHONHOME
     
    492539
    493540   If this is set, Python ignores case in :keyword:`import` statements.  This
    494    only works on Windows.
     541   only works on Windows, OS X, OS/2, and RiscOS.
    495542
    496543
     
    498545
    499546   If this is set, Python won't try to write ``.pyc`` or ``.pyo`` files on the
    500    import of source modules.
     547   import of source modules.  This is equivalent to specifying the :option:`-B`
     548   option.
    501549
    502550   .. versionadded:: 2.6
     551
     552.. envvar:: PYTHONHASHSEED
     553
     554   If this variable is set to ``random``, the effect is the same as specifying
     555   the :option:`-R` option: a random value is used to seed the hashes of str,
     556   bytes and datetime objects.
     557
     558   If :envvar:`PYTHONHASHSEED` is set to an integer value, it is used as a
     559   fixed seed for generating the hash() of the types covered by the hash
     560   randomization.
     561
     562   Its purpose is to allow repeatable hashing, such as for selftests for the
     563   interpreter itself, or to allow a cluster of python processes to share hash
     564   values.
     565
     566   The integer must be a decimal number in the range [0,4294967295].
     567   Specifying the value 0 will lead to the same hash values as when hash
     568   randomization is disabled.
     569
     570   .. versionadded:: 2.6.8
     571
    503572
    504573.. envvar:: PYTHONIOENCODING
     
    513582.. envvar:: PYTHONNOUSERSITE
    514583
    515    If this is set, Python won't add the user site directory to sys.path
     584   If this is set, Python won't add the :data:`user site-packages directory
     585   <site.USER_SITE>` to :data:`sys.path`.
    516586
    517587   .. versionadded:: 2.6
     
    524594.. envvar:: PYTHONUSERBASE
    525595
    526    Sets the base directory for the user site directory
     596   Defines the :data:`user base directory <site.USER_BASE>`, which is used to
     597   compute the path of the :data:`user site-packages directory <site.USER_SITE>`
     598   and :ref:`Distutils installation paths <inst-alt-install-user>` for ``python
     599   setup.py install --user``.
    527600
    528601   .. versionadded:: 2.6
     
    539612   Mac OS X.
    540613
     614.. envvar:: PYTHONWARNINGS
     615
     616   This is equivalent to the :option:`-W` option. If set to a comma
     617   separated string, it is equivalent to specifying :option:`-W` multiple
     618   times.
     619
    541620
    542621Debug-mode variables
     
    544623
    545624Setting these variables only has an effect in a debug build of Python, that is,
    546 if Python was configured with the :option:`--with-pydebug` build option.
     625if Python was configured with the ``--with-pydebug`` build option.
    547626
    548627.. envvar:: PYTHONTHREADDEBUG
     
    563642   If set, Python will print memory allocation statistics every time a new
    564643   object arena is created, and on shutdown.
    565 
Note: See TracChangeset for help on using the changeset viewer.