Martin Panter added the comment:

FYI Martin Panter and vadmium are both me :)

I’m not a big fan or expert on configure.ac and Autoconf, but I guess in this 
case it is the simplest solution. Maybe look at some of the existing 
AC_CHECK_DECL and AC_COMPILE_IFELSE invocations. I guess you need to see if 
__NR_copy_file_range is available.

In the earlier patches, there were four space characters at the start of the 
file. In the 2016-04-27 09:16 patch, there is a completely empty line (after 
+#endif /* HAVE_COPY_FILE_RANGE */), which may also be interfering.

FWIW, I don’t think you have to have the posix_ prefix on your function if you 
don’t want it. It is a static function, so the naming is fairly unrestricted.

About changing copyfileobj(), here are some test cases which may help explain 
the compatibility problems:

# Transcoding a file to a different character encoding
with open("input.txt", "rt", encoding="latin-1") as input, \
        open("utf8.txt", "wt", encoding="utf-8") as output:
    shutil.copyfileobj(input, output)

# Input is a BufferedReader and may hold extra buffered data
with open("data", "rb") as input, open("output", "wb") as output:
    header = input.read(100)  # Actually reads more bytes from OS
    process_header(header)
    copyfileobj(input, output)  # Copy starting from offset 100

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26826>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to