Skip to content
Snippets Groups Projects

Remove dependency on 'decorator'

I don't understand what this library does or why we needed it. This commit replaces it with the good old functools.wraps(), which fixes this crash that started occuring with decorator 5.0.5:

ERROR    testapp:app.py:1892 Exception on /foo [POST]
Traceback (most recent call last):
  File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/dev/.local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/dev/.local/lib/python3.7/site-packages/decorator.py", line 231, in fun
    args, kw = fix(args, kw, sig)
  File "/home/dev/.local/lib/python3.7/site-packages/decorator.py", line 203, in fix
    ba = sig.bind(*args, **kwargs)
  File "/usr/lib/python3.7/inspect.py", line 3015, in bind
    return args[0]._bind(args[1:], kwargs)
  File "/usr/lib/python3.7/inspect.py", line 2930, in _bind
    raise TypeError(msg) from None
TypeError: missing a required argument: 'self'

https://github.com/micheles/decorator/issues/109

Resolves #3207 (closed)


Migrated from D5421 (view on Phabricator)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Build is green

    Patch application report for D5421 (id=19377)

    Rebasing onto a6d8ccbd...

    Current branch diff-target is up to date.
    Changes applied before test
    commit 246abfb9b375a7ab4870fe4f97167da2e77a61fc
    Author: Valentin Lorentz <vlorentz@softwareheritage.org>
    Date:   Tue Apr 6 12:00:23 2021 +0200
    
        Remove dependency on 'decorator'
        
        I don't understand what this library does or why we needed it.
        This commit replaces it with the good old functools.wraps(),
        which fixes this crash that started occuring with
        decorator 5.0.5:
        
        ```
        ERROR    testapp:app.py:1892 Exception on /foo [POST]
        Traceback (most recent call last):
          File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
            response = self.full_dispatch_request()
          File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
            rv = self.handle_user_exception(e)
          File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
            reraise(exc_type, exc_value, tb)
          File "/home/dev/.local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
            raise value
          File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
            rv = self.dispatch_request()
          File "/home/dev/.local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
            return self.view_functions[rule.endpoint](**req.view_args)
          File "/home/dev/.local/lib/python3.7/site-packages/decorator.py", line 231, in fun
            args, kw = fix(args, kw, sig)
          File "/home/dev/.local/lib/python3.7/site-packages/decorator.py", line 203, in fix
            ba = sig.bind(*args, **kwargs)
          File "/usr/lib/python3.7/inspect.py", line 3015, in bind
            return args[0]._bind(args[1:], kwargs)
          File "/usr/lib/python3.7/inspect.py", line 2930, in _bind
            raise TypeError(msg) from None
        TypeError: missing a required argument: 'self'
        ```
        
        https://github.com/micheles/decorator/issues/109

    See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/206/ for more details.

  • Merge request was accepted

  • Antoine R. Dumont approved this merge request

    approved this merge request

  • Author Maintainer

    Merge request was merged

  • closed

Please register or sign in to reply
Loading