Message264371
| Author |
martin.panter |
| Recipients |
StyXman, christian.heimes, martin.panter, neologix, vstinner |
| Date |
2016年04月27日.10:39:39 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1461753580.1.0.915085069042.issue26826@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|