mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-22 01:54:09 +01:00
Fix compatibility with Python 3.3.1.
This commit is contained in:
parent
6ffcf122a7
commit
04b7d9eeda
@ -6,8 +6,7 @@ Master branch: [![Build Status (master branch)](https://travis-ci.org/ProgVal/Li
|
||||
|
||||
Testing branch: [![Build Status (testing branch)](https://travis-ci.org/ProgVal/Limnoria.png?branch=testing)](https://travis-ci.org/ProgVal/Limnoria)
|
||||
|
||||
Limnoria is tested with Python 2.6, 2.7, 3.2, and Pypy. Python 2.5 is not supported.
|
||||
Python 3.3 is not fully supported because of a [bug in Python](http://bugs.python.org/issue17856)
|
||||
Limnoria is tested with Python 2.6, 2.7, 3.2, 3.3, and Pypy. Python 2.5 and older versions are not supported.
|
||||
|
||||
# EVERYONE:
|
||||
|
||||
|
25
src/world.py
25
src/world.py
@ -36,8 +36,9 @@ import os
|
||||
import sys
|
||||
import time
|
||||
import atexit
|
||||
import select
|
||||
import threading
|
||||
import multiprocessing # python 2.6 and later!
|
||||
import multiprocessing
|
||||
|
||||
import re
|
||||
|
||||
@ -73,6 +74,28 @@ class SupyProcess(multiprocessing.Process):
|
||||
super(SupyProcess, self).__init__(*args, **kwargs)
|
||||
log.debug('Spawning process %q.', self.name)
|
||||
|
||||
if sys.version_info[0:3] == (3, 3, 1) and hasattr(select, 'poll'):
|
||||
# http://bugs.python.org/issue17707
|
||||
import multiprocessing.connection
|
||||
def _poll(fds, timeout):
|
||||
if timeout is not None:
|
||||
timeout = int(timeout * 1000) # timeout is in milliseconds
|
||||
fd_map = {}
|
||||
pollster = select.poll()
|
||||
for fd in fds:
|
||||
pollster.register(fd, select.POLLIN)
|
||||
if hasattr(fd, 'fileno'):
|
||||
fd_map[fd.fileno()] = fd
|
||||
else:
|
||||
fd_map[fd] = fd
|
||||
ls = []
|
||||
for fd, event in pollster.poll(timeout):
|
||||
if event & select.POLLNVAL:
|
||||
raise ValueError('invalid file descriptor %i' % fd)
|
||||
ls.append(fd_map[fd])
|
||||
return ls
|
||||
multiprocessing.connection._poll = _poll
|
||||
|
||||
|
||||
commandsProcessed = 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user