Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Lib/warnings.py

    r2 r388  
    3030    except IOError:
    3131        pass # the file (probably stderr) is invalid - this warning gets lost.
    32 # Keep a worrking version around in case the deprecation of the old API is
     32# Keep a working version around in case the deprecation of the old API is
    3333# triggered.
    3434showwarning = _show_warning
     
    4747    """Insert an entry into the list of warnings filters (at the front).
    4848
    49     Use assertions to check that all arguments have the right type."""
     49    'action' -- one of "error", "ignore", "always", "default", "module",
     50                or "once"
     51    'message' -- a regex that the warning message must match
     52    'category' -- a class that the warning must be a subclass of
     53    'module' -- a regex that the module name must match
     54    'lineno' -- an integer line number, 0 matches all warnings
     55    'append' -- if true, append to the list of filters
     56    """
    5057    import re
    5158    assert action in ("error", "ignore", "always", "default", "module",
     
    6976
    7077    A simple filter matches all modules and messages.
     78    'action' -- one of "error", "ignore", "always", "default", "module",
     79                or "once"
     80    'category' -- a class that the warning must be a subclass of
     81    'lineno' -- an integer line number, 0 matches all warnings
     82    'append' -- if true, append to the list of filters
    7183    """
    7284    assert action in ("error", "ignore", "always", "default", "module",
     
    263275              "Unrecognized action (%r) in warnings.filters:\n %s" %
    264276              (action, item))
    265     # Warn if showwarning() does not support the 'line' argument.
    266     # Don't use 'inspect' as it relies on an extension module, which break the
    267     # build thanks to 'warnings' being imported by setup.py.
    268     fxn_code = None
    269     if hasattr(showwarning, 'func_code'):
    270         fxn_code = showwarning.func_code
    271     elif hasattr(showwarning, '__func__'):
    272         fxn_code = showwarning.__func__.func_code
    273     if fxn_code:
    274         args = fxn_code.co_varnames[:fxn_code.co_argcount]
    275         CO_VARARGS = 0x4
    276         if 'line' not in args and not fxn_code.co_flags & CO_VARARGS:
    277             showwarning_msg = ("functions overriding warnings.showwarning() "
    278                                 "must support the 'line' argument")
    279             if message == showwarning_msg:
    280                 _show_warning(message, category, filename, lineno)
    281             else:
    282                 warn(showwarning_msg, DeprecationWarning)
    283277    # Print message and context
    284278    showwarning(message, category, filename, lineno)
     
    390384_processoptions(sys.warnoptions)
    391385if not _warnings_defaults:
    392     simplefilter("ignore", category=PendingDeprecationWarning, append=1)
    393     simplefilter("ignore", category=ImportWarning, append=1)
     386    silence = [ImportWarning, PendingDeprecationWarning]
     387    # Don't silence DeprecationWarning if -3 or -Q was used.
     388    if not sys.py3kwarning and not sys.flags.division_warning:
     389        silence.append(DeprecationWarning)
     390    for cls in silence:
     391        simplefilter("ignore", category=cls)
    394392    bytes_warning = sys.flags.bytes_warning
    395393    if bytes_warning > 1:
Note: See TracChangeset for help on using the changeset viewer.