[Bug 1961455] [NEW] twisted.python.log.PythonLoggingObserver is broken on Ubuntu 20.04

Colin Watson 1961455 at bugs.launchpad.net
Sat Feb 19 00:44:48 UTC 2022


Public bug reported:

On up-to-date focal with python3-twisted 18.9.0-11ubuntu0.20.04.1,
following
https://twistedmatrix.com/documents/current/core/howto/logging.html#using-
the-standard-library-logging-module:

  $ python3
  Python 3.8.10 (default, Nov 26 2021, 20:14:08)
  [GCC 9.3.0] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import logging
  >>> from twisted.python import log
  >>> logging.basicConfig(level=logging.INFO)
  >>> observer = log.PythonLoggingObserver()
  >>> observer.start()
  >>> log.msg('test')
  Temporarily disabling observer LegacyLogObserverWrapper(<bound method PythonLoggingObserver.emit of <twisted.python.log.PythonLoggingObserver object at 0x7f962dbc1130>>) due to exception: [Failure instance: Traceback: <class 'TypeError'>: _findCaller() takes from 1 to 2 positional arguments but 3 were given
  <stdin>:1:<module>
  /usr/lib/python3/dist-packages/twisted/python/threadable.py:53:sync
  /usr/lib/python3/dist-packages/twisted/python/log.py:286:msg
  /usr/lib/python3/dist-packages/twisted/logger/_legacy.py:154:publishToNewObserver
  --- <exception caught here> ---
  /usr/lib/python3/dist-packages/twisted/logger/_observer.py:131:__call__
  /usr/lib/python3/dist-packages/twisted/logger/_legacy.py:93:__call__
  /usr/lib/python3/dist-packages/twisted/python/log.py:595:emit
  /usr/lib/python3/dist-packages/twisted/logger/_legacy.py:154:publishToNewObserver
  /usr/lib/python3/dist-packages/twisted/logger/_stdlib.py:115:__call__
  /usr/lib/python3.8/logging/__init__.py:1512:log
  /usr/lib/python3.8/logging/__init__.py:1577:_log
  ]
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  
    File "/usr/lib/python3/dist-packages/twisted/python/threadable.py", line 53, in sync
      return function(self, *args, **kwargs)
    File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 286, in msg
      _publishNew(self._publishPublisher, actualEventDict, textFromEventDict)
    File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
      observer(eventDict)
  --- <exception caught here> ---
    File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
      observer(event)
    File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
      self.legacyObserver(event)
    File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 595, in emit
      _publishNew(self._newObserver, eventDict, textFromEventDict)
    File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
      observer(eventDict)
    File "/usr/lib/python3/dist-packages/twisted/logger/_stdlib.py", line 115, in __call__
      self.logger.log(
    File "/usr/lib/python3.8/logging/__init__.py", line 1512, in log
      self._log(level, msg, args, **kwargs)
    File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log
      fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
  builtins.TypeError: _findCaller() takes from 1 to 2 positional arguments but 3 were given

This is https://twistedmatrix.com/trac/ticket/9668; the fix should be a
trivial backport.

This caused test failures in launchpad-buildd on focal (though I may
look for a workaround).

** Affects: twisted (Ubuntu)
     Importance: Undecided
         Status: Fix Released

** Affects: twisted (Ubuntu Focal)
     Importance: Undecided
         Status: New

** Also affects: twisted (Ubuntu Focal)
   Importance: Undecided
       Status: New

** Changed in: twisted (Ubuntu)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to twisted in Ubuntu.
https://bugs.launchpad.net/bugs/1961455

Title:
  twisted.python.log.PythonLoggingObserver is broken on Ubuntu 20.04

Status in twisted package in Ubuntu:
  Fix Released
Status in twisted source package in Focal:
  New

Bug description:
  On up-to-date focal with python3-twisted 18.9.0-11ubuntu0.20.04.1,
  following
  https://twistedmatrix.com/documents/current/core/howto/logging.html#using-
  the-standard-library-logging-module:

    $ python3
    Python 3.8.10 (default, Nov 26 2021, 20:14:08)
    [GCC 9.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import logging
    >>> from twisted.python import log
    >>> logging.basicConfig(level=logging.INFO)
    >>> observer = log.PythonLoggingObserver()
    >>> observer.start()
    >>> log.msg('test')
    Temporarily disabling observer LegacyLogObserverWrapper(<bound method PythonLoggingObserver.emit of <twisted.python.log.PythonLoggingObserver object at 0x7f962dbc1130>>) due to exception: [Failure instance: Traceback: <class 'TypeError'>: _findCaller() takes from 1 to 2 positional arguments but 3 were given
    <stdin>:1:<module>
    /usr/lib/python3/dist-packages/twisted/python/threadable.py:53:sync
    /usr/lib/python3/dist-packages/twisted/python/log.py:286:msg
    /usr/lib/python3/dist-packages/twisted/logger/_legacy.py:154:publishToNewObserver
    --- <exception caught here> ---
    /usr/lib/python3/dist-packages/twisted/logger/_observer.py:131:__call__
    /usr/lib/python3/dist-packages/twisted/logger/_legacy.py:93:__call__
    /usr/lib/python3/dist-packages/twisted/python/log.py:595:emit
    /usr/lib/python3/dist-packages/twisted/logger/_legacy.py:154:publishToNewObserver
    /usr/lib/python3/dist-packages/twisted/logger/_stdlib.py:115:__call__
    /usr/lib/python3.8/logging/__init__.py:1512:log
    /usr/lib/python3.8/logging/__init__.py:1577:_log
    ]
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    
      File "/usr/lib/python3/dist-packages/twisted/python/threadable.py", line 53, in sync
        return function(self, *args, **kwargs)
      File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 286, in msg
        _publishNew(self._publishPublisher, actualEventDict, textFromEventDict)
      File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
        observer(eventDict)
    --- <exception caught here> ---
      File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
        observer(event)
      File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
        self.legacyObserver(event)
      File "/usr/lib/python3/dist-packages/twisted/python/log.py", line 595, in emit
        _publishNew(self._newObserver, eventDict, textFromEventDict)
      File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 154, in publishToNewObserver
        observer(eventDict)
      File "/usr/lib/python3/dist-packages/twisted/logger/_stdlib.py", line 115, in __call__
        self.logger.log(
      File "/usr/lib/python3.8/logging/__init__.py", line 1512, in log
        self._log(level, msg, args, **kwargs)
      File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log
        fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
    builtins.TypeError: _findCaller() takes from 1 to 2 positional arguments but 3 were given

  This is https://twistedmatrix.com/trac/ticket/9668; the fix should be
  a trivial backport.

  This caused test failures in launchpad-buildd on focal (though I may
  look for a workaround).

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/twisted/+bug/1961455/+subscriptions




More information about the foundations-bugs mailing list