Use msvcrt 110 and 120 when 110 is not avaliable
This commit is contained in:
parent
aec1ab4ed2
commit
b6d0bf8f6b
1 changed files with 15 additions and 3 deletions
|
@ -6,10 +6,22 @@ def setMaxfilesopened(limit):
|
||||||
try:
|
try:
|
||||||
if sys.platform == "win32":
|
if sys.platform == "win32":
|
||||||
import ctypes
|
import ctypes
|
||||||
maxstdio = ctypes.cdll.msvcr100._getmaxstdio()
|
dll = None
|
||||||
|
last_err = None
|
||||||
|
for dll_name in ["msvcr100", "msvcr110", "msvcr120"]:
|
||||||
|
try:
|
||||||
|
dll = getattr(ctypes.cdll, dll_name)
|
||||||
|
break
|
||||||
|
except OSError as err:
|
||||||
|
last_err = err
|
||||||
|
|
||||||
|
if not dll:
|
||||||
|
raise last_err
|
||||||
|
|
||||||
|
maxstdio = dll._getmaxstdio()
|
||||||
if maxstdio < limit:
|
if maxstdio < limit:
|
||||||
logging.debug("Current maxstdio: %s, changing to %s..." % (maxstdio, limit))
|
logging.debug("%s: Current maxstdio: %s, changing to %s..." % (dll, maxstdio, limit))
|
||||||
ctypes.cdll.msvcr100._setmaxstdio(limit)
|
dll._setmaxstdio(limit)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
import resource
|
import resource
|
||||||
|
|
Loading…
Reference in a new issue