Py2.7/FreeBSD: maximum number of open files

Christian Heimes lists at cheimes.de
Mon Nov 14 13:03:31 EST 2011


Am 14.11.2011 18:46, schrieb Tobias Oberstein:
> I just confirmed that the bug is even there for FreeBSD 9 RC1 !
> 
> This is most unfortunate. Seriously.

W00t, that sucks! You could migrate to another BSD (NetBSD) or Linux ... :)

> I am running out of options, since I am willing to make my stuff Python 3 compatible,
> but Twisted is not yet there.
> 
> Using the backported new IO on Python 2.7 will not make open() automatically use the new IO, will it?

No, the open() function of Python 2.7 will still use the file class
which in return uses fopen(). You could try to monkey patch the built-in
open() function. It's mostly API compatible with the current open()
function:

  >>> import io, __builtin__
  >>> __builtin__.open = io.open

It works as long as no codes checks for isinstance(obj, file). If your
app only has to worry about log files, you might want to overwrite the
_open() method of logging.FileHandler and its subclasses.

Christian




More information about the Python-list mailing list