Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1916

Show
Ignore:
Timestamp:
03/14/08 10:10:37
Author:
fumanchu
Message:

Fix suggested by Andrew Stromnov to let psyco play nice with CherryPy 3.1.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/restsrv/wspbus.py

    r1869 r1916  
    247247    def wait(self, state, interval=0.1): 
    248248        """Wait for the given state.""" 
    249         while self.state != state: 
    250             time.sleep(interval) 
     249        def _wait(): 
     250            while self.state != state: 
     251                time.sleep(interval) 
     252         
     253        # From http://psyco.sourceforge.net/psycoguide/bugs.html: 
     254        # "The compiled machine code does not include the regular polling 
     255        # done by Python, meaning that a KeyboardInterrupt will not be 
     256        # detected before execution comes back to the regular Python 
     257        # interpreter. Your program cannot be interrupted if caught 
     258        # into an infinite Psyco-compiled loop." 
     259        try: 
     260            sys.modules['psyco'].cannotcompile(_wait) 
     261        except (KeyError, AttributeError): 
     262            pass 
     263         
     264        _wait() 
    251265     
    252266    def _do_execv(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets