Repository navigation
Feature: Add internal logging for behavioral debug - #708
Conversation
* Use standard python logging * Use nested loggers for possibility to set atomic logging * Add `__repr__` to the part of critical types * In screen event loop with `selectors` usage: use IO objects instead of descriptors if possible: get human-friendly output in logs * `MainLoop` methods`watch_pipe` / `remove_watch_pipe` are not available under Windows
Pull Request Test Coverage Report for Build 7220483902
💛 - Coveralls |
* These are only for type checking.
| y, x = super().get_cols_rows() | ||
| with contextlib.suppress(OSError): # Term size could not be determined | ||
| if hasattr(self._term_output_file, "fileno"): | ||
| buf = fcntl.ioctl(self._term_output_file.fileno(), termios.TIOCGWINSZ, " " * 4) |
There was a problem hiding this comment.
This is buggy code: ioctl expect Buffer protocol, which includes bytes, but not str
|
|
||
| class Screen(BaseScreen, RealTerminal): | ||
| def __init__(self, input: FileLikeObj, output: FileLikeObj): # noqa: A002 | ||
| def __init__(self, input: io.IOBase, output: io.IOBase): # noqa: A002 |
|
|
||
| fds = self.get_input_descriptors() | ||
| handles = [event_loop.watch_file(fd, wrapper) for fd in fds] | ||
| handles = [event_loop.watch_file(fd if isinstance(fd, int) else fd.fileno(), wrapper) for fd in fds] |
There was a problem hiding this comment.
Do not break EventLoop API
| try: | ||
| watch_handle, pipe_rd = self._watch_pipes.pop(write_fd) | ||
| except KeyError: | ||
| return False |
There was a problem hiding this comment.
This is mainly used to trigger a screen update from a signal (like the terminal resize) or from another process/thread. On windows we need something like this, maybe a socket pair connected over loopback?
There was a problem hiding this comment.
https://github.com/urwid/urwid/blob/master/urwid/_win32_raw_display.py#L247 ->
https://github.com/urwid/urwid/blob/master/urwid/_win32_raw_display.py#L165C77-L165C94 ->
https://github.com/urwid/urwid/blob/master/urwid/_raw_display_base.py#L99
And socket instance is used for sending b"R" to trigger update.
Unfortunately it's not enough, so issue #700 created and in process of debugging, when I have physical access to the Windows machine.
Use standard python logging
Use nested loggers for possibility to set atomic logging
Add
__repr__to the part of critical typesIn screen event loop with
selectorsusage: use IO objects instead of descriptors if possible: get human-friendly output in logsMainLoopmethodswatch_pipe/remove_watch_pipeare not available under WindowsChecklist
masterorpython-dual-supportbranchtoxsuccessfully in local environment