On 11/21/18 4:11 PM, Matěj Cepl wrote:
On 2018-11-21, 14:54 GMT, Benjamin Peterson wrote:
In Python 3, there is no underlying FILE* because the io
module is implemented using fds directly rather than C stdio.
OK, so the proper solution is to kill all functions which expect
FILE
Indeed.
This has another side to it: there are file-like objects that aren't
backed by FILE*. In most case, being a "real" file is an unnecessary
distinction, like that between the old `int` vs. `long`. "Fits in the
machine register" is a detail from a level below Python, and so is "the
kernel treats this as a file".
Of course, this is not how C libraries work -- so, sadly, it makes
wrappers harder to write. And a perfect solution might require adding
more generic I/O to the C library.
and if you are anal retentive about stability of API, then
you have to fake it by creating FILE structure around the
underlying fd handler as I did in M2Crypto, right?
Yes, AFAIK that is the least bad solution.
I did something very similar here:
https://github.com/encukou/py3c/blob/master/include/py3c/fileshim.h
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com