[issue44979] pathlib: support relative path construction
Change by Kirill Pinchuk : -- keywords: +patch pull_requests: +26344 stage: -> patch review pull_request: https://github.com/python/cpython/pull/27890 ___ Python tracker <https://bugs.python.org/issue44979> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44979] pathlib: support relative path construction
New submission from Kirill Pinchuk : Hi. I've been using this snippet for years and believe that it would be a nice addition to pathlib's functionality. Basically, it allows constructing path relative to the current file (instead of cwd). Comes quite handy when you're working with deeply nested resources like file fixtures in tests and many other cases. ``` @classmethod def relative(cls, path, depth=1): """ Return path that is constructed relatively to caller file. """ base = Path(sys._getframe(depth).f_code.co_filename).parent return (base / path).resolve() ``` -- components: Library (Lib) messages: 400075 nosy: cybergrind priority: normal severity: normal status: open title: pathlib: support relative path construction type: enhancement versions: Python 3.11 ___ Python tracker <https://bugs.python.org/issue44979> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44291] Unify logging.handlers.SysLogHandler behavior with SocketHandlers
Kirill Pinchuk added the comment: Oh, sorry bad wording. The current implementation has reconnection logic only for UNIX sockets The patch adds reconnection logic for UDP/TCP sockets as well. I've done it with minimal changes to the existing code to accomplish that. And probably it can be merged. But in general, it looks like we can refactor SysLogHandler to inherit from SocketHandler. Not sure if it should be done in this PR or better to create separate? -- ___ Python tracker <https://bugs.python.org/issue44291> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44291] Unify logging.handlers.SysLogHandler behavior with SocketHandlers
Kirill Pinchuk added the comment: UPD: right now it has reconnection logic for unixsocket but not for tcp/udp -- ___ Python tracker <https://bugs.python.org/issue44291> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue44291] Unify logging.handlers.SysLogHandler behavior with SocketHandlers
New submission from Kirill Pinchuk : Probably we should make the behavior of SysLogHandler consistent with other Socket handlers. Right now SocketHandler and DatagramHandler implement such behavior: 1) on `close` set `self.socket = None` 2) when trying to send - make socket when it is None SysLogHandler doesn't implement this behavior and when you close the socket for some reason (eg. restart of uWSGI server on code change) it leaves it in the closed state, then raises an error when you try to send any message because it is closed ``` --- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.9/logging/handlers.py", line 959, in emit self.socket.sendto(msg, self.address) OSError: [Errno 9] Bad file descriptor ``` -- components: Library (Lib) messages: 394932 nosy: Kirill Pinchuk priority: normal severity: normal status: open title: Unify logging.handlers.SysLogHandler behavior with SocketHandlers type: enhancement versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue44291> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com