Please update shutil.py copyfileobj to include code mentioned in below issues

I opened two issues regarding copyfileobj that were not bugs, but a fix that was involved helped me figure out I needed a new external drive, since it displayed the error number from the copyfileobj function. I'd like a modified version of this code implemented permanently in shutil.py so others could see if they have the same issue as me. Here are the two issues I opened: This is the original issue that has the code I was using that Eryksun posted. https://github.com/python/cpython/issues/96721 Here's the second issue where it happened again. I put the error message in this post, so you can see how it helped me. Also, the code might need to be modified slightly, since it generated an error. https://github.com/python/cpython/issues/102357

On 6/8/23, jschwar@sbcglobal.net <jschwar@sbcglobal.net> wrote:
I don't know how many people still subscribe to and read this mailing list. More people would see this suggestion if you posted this on discuss.python.org/c/ideas.
The ctypes code that I provided was only for debugging purposes. Python needs to support the C runtime's _doserrno value (actually it's a Windows error code) internally for I/O calls such as _wopen(), close(), read(), and write(). Also, the error that you encountered, ERROR_NO_SUCH_DEVICE (433), should be mapped to the C errno value ENOENT (i.e. FileNotFoundError) in PC/errmap.h.

Ok, Thanks. I didn't know this wasn't the place to go for help. I'll post there. I don't care if this is not done. I just thought it might help others down the road like it helped me. Also, the reason I posted this to this email list was as follows. This is the text that shows up when I click in GitHub under new issue, then feature. Maybe the mailing list should be removed from that template. ------------------------------------------------------------------------------------------------------------------------------------- # Feature or enhancement (A clear and concise description of your proposal.) # Pitch (Explain why this feature or enhancement should be implemented and how it would be used. Add examples, if applicable.) # Previous discussion <!-- New features to Python should first be discussed elsewhere before creating issues on GitHub, for example in the "ideas" category (https://discuss.python.org/c/ideas/6) of discuss.python.org, or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/). Use this space to post links to the places where you have already discussed this feature proposal: --> <!-- You can freely edit this text. Remove any lines you believe are unnecessary. --> -----Original Message----- From: Eryk Sun <eryksun@gmail.com> Sent: Thursday, June 8, 2023 12:02 PM To: jschwar@sbcglobal.net Cc: python-ideas@python.org Subject: Re: [Python-ideas] Please update shutil.py copyfileobj to include code mentioned in below issues On 6/8/23, jschwar@sbcglobal.net <jschwar@sbcglobal.net> wrote:
I don't know how many people still subscribe to and read this mailing list. More people would see this suggestion if you posted this on discuss.python.org/c/ideas.
The ctypes code that I provided was only for debugging purposes. Python needs to support the C runtime's _doserrno value (actually it's a Windows error code) internally for I/O calls such as _wopen(), close(), read(), and write(). Also, the error that you encountered, ERROR_NO_SUCH_DEVICE (433), should be mapped to the C errno value ENOENT (i.e. FileNotFoundError) in PC/errmap.h.

On 6/8/23, jschwar@sbcglobal.net <jschwar@sbcglobal.net> wrote:
I don't know how many people still subscribe to and read this mailing list. More people would see this suggestion if you posted this on discuss.python.org/c/ideas.
The ctypes code that I provided was only for debugging purposes. Python needs to support the C runtime's _doserrno value (actually it's a Windows error code) internally for I/O calls such as _wopen(), close(), read(), and write(). Also, the error that you encountered, ERROR_NO_SUCH_DEVICE (433), should be mapped to the C errno value ENOENT (i.e. FileNotFoundError) in PC/errmap.h.

Ok, Thanks. I didn't know this wasn't the place to go for help. I'll post there. I don't care if this is not done. I just thought it might help others down the road like it helped me. Also, the reason I posted this to this email list was as follows. This is the text that shows up when I click in GitHub under new issue, then feature. Maybe the mailing list should be removed from that template. ------------------------------------------------------------------------------------------------------------------------------------- # Feature or enhancement (A clear and concise description of your proposal.) # Pitch (Explain why this feature or enhancement should be implemented and how it would be used. Add examples, if applicable.) # Previous discussion <!-- New features to Python should first be discussed elsewhere before creating issues on GitHub, for example in the "ideas" category (https://discuss.python.org/c/ideas/6) of discuss.python.org, or the python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/). Use this space to post links to the places where you have already discussed this feature proposal: --> <!-- You can freely edit this text. Remove any lines you believe are unnecessary. --> -----Original Message----- From: Eryk Sun <eryksun@gmail.com> Sent: Thursday, June 8, 2023 12:02 PM To: jschwar@sbcglobal.net Cc: python-ideas@python.org Subject: Re: [Python-ideas] Please update shutil.py copyfileobj to include code mentioned in below issues On 6/8/23, jschwar@sbcglobal.net <jschwar@sbcglobal.net> wrote:
I don't know how many people still subscribe to and read this mailing list. More people would see this suggestion if you posted this on discuss.python.org/c/ideas.
The ctypes code that I provided was only for debugging purposes. Python needs to support the C runtime's _doserrno value (actually it's a Windows error code) internally for I/O calls such as _wopen(), close(), read(), and write(). Also, the error that you encountered, ERROR_NO_SUCH_DEVICE (433), should be mapped to the C errno value ENOENT (i.e. FileNotFoundError) in PC/errmap.h.
participants (3)
-
Eryk Sun
-
Jim Schwartz
-
jschwar@sbcglobal.net