GH-81881: Raise SpecialFileError for sockets and devices in shutil.copyfile#142693
Conversation
|
This PR is stale because it has been open for 30 days with no activity. |
|
@savannahostrowski , are you interested in pursuing this. Overall this looks good to me. |
Documentation build overview
14 files changed ·
|
|
@orsenthil Yes, but was waiting for someone else to review it! |
|
Test failures in test_logging seems unrelated. It should be re-run.
For Character Device. This is a legitimate program at the moment and it will stop functioning after this change. However, this is not pythonic and correct way piping to character device Empty file is created using open and close call. Or pathlib.Path.touch It only "works" because '/dev/null' happens to return EOF immediately It's incidental, not designed. Similarly, using So, it okay to raise against the Character Device too. I did a github search of using shutil with /dev/null and I couldn't find any. |
Reviewed and approved. Thank you. |
* main: (266 commits) pythongh-151626: Fix tests that fail when PYTHONPYCACHEPREFIX is set (pythonGH-151952) pythongh-152728: IDLE - move 3 toplevel fix_xyz functions to idlelb.util (python#152729) pythongh-152711: Add pythoninfo-build command to Platforms/Android (python#152713) pythongh-152715: Add pythoninfo-build command to Platforms/Apple (python#152716) pythongh-152433: Windows: enable mmapmodule for UWP (python#152473) pythongh-152433: Windows: use GetFileSizeEx instead of GetFileSize for memory mapped files (python#152383) pythonGH-81881: Raise `SpecialFileError` for sockets and devices in `shutil.copyfile` (python#142693) pythongh-152502: Detect the curses mouse interface and is_* methods portably (pythonGH-152705) pythongh-145857: Replace `DELETE_GLOBAL` with `PUSH_NULL; STORE_GLOBAL` (pythonGH-146314) pythongh-145854: Replace `DELETE_NAME` with `PUSH_NULL; STORE_NAME` (pythonGH-146006) pythongh-152680: Detect container/VM in test.pythoninfo (python#152668) pythongh-152682: Fix NULL dereference on OOM in `symtable_visit_type_param_bound_or_default` (python#152684) pythongh-151881: Skip tk_inactive negativity check on Windows (pythonGH-152683) pythongh-152546: Refactor `mappingproxy.__new__` to use `PyDictProxy_New` (python#152547) pythongh-151126: Fix a possible crash during the startup with no memory under `Py_STACKREF_DEBUG` (python#152478) pythongh-152635: Raise MemoryError when the lock allocation fails in `_interpchannels.create()` (python#152642) pythongh-151029: Fix `test_remote_exec_deleted_static_executable` on static installed builds (pythonGH-152653) pythongh-121249: Deprecate using F/D type codes in the struct module (python#152309) pythongh-152192: Fix JUMP_BACKWARD passing a truncated oparg to the jit tracer (pythonGH-152382) Don't require the `_test{internal}capi` modules in `test_monitoring.py` (python#152311) ...
The original issue just mentions sockets, but while documenting this I found it very confusing and inconsistent that device files didn't get the same treatment, so I figured I'd fix them all in one go.
📚 Documentation preview 📚: https://cpython-previews--142693.org.readthedocs.build/