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/Queue.py

    r2 r388  
    22
    33from time import time as _time
     4try:
     5    import threading as _threading
     6except ImportError:
     7    import dummy_threading as _threading
    48from collections import deque
    59import heapq
     
    2125    """
    2226    def __init__(self, maxsize=0):
    23         try:
    24             import threading
    25         except ImportError:
    26             import dummy_threading as threading
    2727        self.maxsize = maxsize
    2828        self._init(maxsize)
     
    3131        # is shared between the three conditions, so acquiring and
    3232        # releasing the conditions also acquires and releases mutex.
    33         self.mutex = threading.Lock()
     33        self.mutex = _threading.Lock()
    3434        # Notify not_empty whenever an item is added to the queue; a
    3535        # thread waiting to get is notified then.
    36         self.not_empty = threading.Condition(self.mutex)
     36        self.not_empty = _threading.Condition(self.mutex)
    3737        # Notify not_full whenever an item is removed from the queue;
    3838        # a thread waiting to put is notified then.
    39         self.not_full = threading.Condition(self.mutex)
     39        self.not_full = _threading.Condition(self.mutex)
    4040        # Notify all_tasks_done whenever the number of unfinished tasks
    4141        # drops to zero; thread waiting to join() is notified to resume
    42         self.all_tasks_done = threading.Condition(self.mutex)
     42        self.all_tasks_done = _threading.Condition(self.mutex)
    4343        self.unfinished_tasks = 0
    4444
     
    110110        If optional args 'block' is true and 'timeout' is None (the default),
    111111        block if necessary until a free slot is available. If 'timeout' is
    112         a positive number, it blocks at most 'timeout' seconds and raises
     112        a non-negative number, it blocks at most 'timeout' seconds and raises
    113113        the Full exception if no free slot was available within that time.
    114114        Otherwise ('block' is false), put an item on the queue if a free slot
     
    126126                        self.not_full.wait()
    127127                elif timeout < 0:
    128                     raise ValueError("'timeout' must be a positive number")
     128                    raise ValueError("'timeout' must be a non-negative number")
    129129                else:
    130130                    endtime = _time() + timeout
     
    153153        If optional args 'block' is true and 'timeout' is None (the default),
    154154        block if necessary until an item is available. If 'timeout' is
    155         a positive number, it blocks at most 'timeout' seconds and raises
     155        a non-negative number, it blocks at most 'timeout' seconds and raises
    156156        the Empty exception if no item was available within that time.
    157157        Otherwise ('block' is false), return an item if one is immediately
     
    168168                    self.not_empty.wait()
    169169            elif timeout < 0:
    170                 raise ValueError("'timeout' must be a positive number")
     170                raise ValueError("'timeout' must be a non-negative number")
    171171            else:
    172172                endtime = _time() + timeout
Note: See TracChangeset for help on using the changeset viewer.