I'm working with pythran, a Python to c++ compiler http://pythran.readthedocs.io/
In its manual page, pythran says it supports the method write
from TextIOWrapper
However, trying to compile this simple file
file: mylib.py
#pythran export write_test(str,bool)
#pythran export fake_write(str)
def write_test(fname,r):
if r:
print('writing %s'%fname)
f = open(fname,'w')
#write_line = f.writelines
write_line = f.write
else:
print('NO FILE WILL BE WRITTEN')
write_line = fake_write
for i in range(10):
write_line(str(i) + '\n')
if r:
f.close()
def fake_write(s):
return 0
with the command line
pythran mylib.py -o mylib.so -O3 -march=native -v
fails with the message:
mylib.py:9:21 error: Unsupported attribute 'write' for this object
Pythran version: 0.9.8.post2
Python version: 3.8.5
Using Ubuntu 20.04.1 LTS