Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The test suite crashes pytest on Python 3.11.0b1 #654

Closed
mgorny opened this issue May 13, 2022 · 7 comments
Closed

The test suite crashes pytest on Python 3.11.0b1 #654

mgorny opened this issue May 13, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@mgorny
Copy link

mgorny commented May 13, 2022

$ tox -e py311
GLOB sdist-make: /tmp/loguru/setup.py
py311 create: /tmp/loguru/.tox/py311
py311 inst: /tmp/loguru/.tox/.tmp/package/1/loguru-0.6.0.zip
py311 installed: alabaster==0.7.12,attrs==21.4.0,Babel==2.10.1,black==22.3.0,certifi==2021.10.8,charset-normalizer==2.0.12,click==8.1.3,colorama==0.4.4,coverage==6.3.2,distlib==0.3.4,docutils==0.16,filelock==3.6.0,flake8==4.0.1,freezegun==1.1.0,idna==3.3,imagesize==1.3.0,iniconfig==1.1.1,isort==5.10.1,Jinja2==3.1.2,livereload==2.6.3,loguru==0.6.0,MarkupSafe==2.1.1,mccabe==0.6.1,mypy-extensions==0.4.3,packaging==21.3,pathspec==0.9.0,platformdirs==2.5.2,pluggy==1.0.0,py==1.11.0,pycodestyle==2.8.0,pyflakes==2.4.0,Pygments==2.12.0,pyparsing==3.0.9,pytest==7.1.2,pytest-cov==3.0.0,python-dateutil==2.8.2,pytz==2022.1,requests==2.27.1,six==1.16.0,snowballstemmer==2.2.0,Sphinx==4.5.0,sphinx-autobuild==2021.3.14,sphinx-rtd-theme==1.0.0,sphinxcontrib-applehelp==1.0.2,sphinxcontrib-devhelp==1.0.2,sphinxcontrib-htmlhelp==2.0.0,sphinxcontrib-jsmath==1.0.1,sphinxcontrib-qthelp==1.0.3,sphinxcontrib-serializinghtml==1.1.5,toml==0.10.2,tomli==2.0.1,tornado==6.1,tox==3.25.0,urllib3==1.26.9,virtualenv==20.14.1
py311 run-test-pre: PYTHONHASHSEED='300318784'
py311 run-test: commands[0] | flake8 --exit-zero loguru tests docs setup.py
py311 run-test: commands[1] | pytest --cov loguru/ --cov-report=xml
========================================================= test session starts =========================================================
platform linux -- Python 3.11.0b1, pytest-7.1.2, pluggy-1.0.0
cachedir: .tox/py311/.pytest_cache
rootdir: /tmp/loguru, configfile: tox.ini
plugins: cov-3.0.0
collected 1392 items                                                                                                                  

tests/test_activation.py ..............................                                                                         [  2%]
tests/test_add_option_backtrace.py .                                                                                            [  2%]
tests/test_add_option_catch.py ...........                                                                                      [  3%]
tests/test_add_option_colorize.py ...........................................................                                   [  7%]
tests/test_add_option_diagnose.py .                                                                                             [  7%]
tests/test_add_option_enqueue.py ............s                                                                                  [  8%]
tests/test_add_option_filter.py .......................................................                                         [ 12%]
tests/test_add_option_format.py ....................                                                                            [ 13%]
tests/test_add_option_kwargs.py .......                                                                                         [ 14%]
tests/test_add_option_level.py ..........                                                                                       [ 14%]
tests/test_add_option_serialize.py .........                                                                                    [ 15%]
tests/test_add_sinks.py .......................................................                                                 [ 19%]
tests/test_ansimarkup_basic.py ........................................................................................         [ 25%]
tests/test_ansimarkup_extended.py ............................................................................................  [ 32%]
tests/test_bind.py .........                                                                                                    [ 33%]
tests/test_configure.py ................                                                                                        [ 34%]
tests/test_contextualize.py ..............                                                                                      [ 35%]
tests/test_coroutine_sink.py ...............................                                                                    [ 37%]
tests/test_datetime.py ................................                                                                         [ 39%]
tests/test_deepcopy.py ....                                                                                                     [ 40%]
tests/test_defaults.py .............                                                                                            [ 40%]
tests/test_exceptions_catch.py ..................................................                                               [ 44%]
tests/test_exceptions_formatting.py ............................................................................                [ 50%]
tests/test_filesink_compression.py ......................................................                                       [ 53%]
tests/test_filesink_delay.py ..........                                                                                         [ 54%]
tests/test_filesink_permissions.py ..........                                                                                   [ 55%]
tests/test_filesink_retention.py .................................................                                              [ 58%]
tests/test_filesink_rotation.py .........
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/main.py", line 268, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/main.py", line 322, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/main.py", line 347, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/runner.py", line 111, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/runner.py", line 124, in runtestprotocol
INTERNALERROR>     rep = call_and_report(item, "setup", log)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/runner.py", line 221, in call_and_report
INTERNALERROR>     report: TestReport = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 55, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>     ^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/skipping.py", line 265, in pytest_runtest_makereport
INTERNALERROR>     rep = outcome.get_result()
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/runner.py", line 365, in pytest_runtest_makereport
INTERNALERROR>     return TestReport.from_item_and_call(item, call)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/reports.py", line 347, in from_item_and_call
INTERNALERROR>     longrepr = item._repr_failure_py(
INTERNALERROR>                ^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/nodes.py", line 447, in _repr_failure_py
INTERNALERROR>     self._prunetraceback(excinfo)
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/python.py", line 1769, in _prunetraceback
INTERNALERROR>     path, firstlineno = code.path, code.firstlineno
INTERNALERROR>                         ^^^^^^^^^
INTERNALERROR>   File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/_code/code.py", line 95, in path
INTERNALERROR>     if not p.exists():
INTERNALERROR>            ^^^^^^^^^^
INTERNALERROR>   File "/usr/lib/python3.11/pathlib.py", line 1233, in exists
INTERNALERROR>     self.stat()
INTERNALERROR>     ^^^^^^^^^^^
INTERNALERROR>   File "/usr/lib/python3.11/pathlib.py", line 1011, in stat
INTERNALERROR>     return os.stat(self, follow_symlinks=follow_symlinks)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> TypeError: monkeypatch_filesystem.<locals>.monkeypatch_filesystem.<locals>.patched_stat() got an unexpected keyword argument 'follow_symlinks'
Traceback (most recent call last):
  File "/tmp/loguru/.tox/py311/bin/pytest", line 8, in <module>
    sys.exit(console_main())
             ^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
           ^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/config/__init__.py", line 164, in main
    ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
           ^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/main.py", line 315, in pytest_cmdline_main
    return wrap_session(config, _main)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/main.py", line 303, in wrap_session
    config.hook.pytest_sessionfinish(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
    ^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/terminal.py", line 798, in pytest_sessionfinish
    outcome.get_result()
    ^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/cacheprovider.py", line 433, in pytest_sessionfinish
    config.cache.set("cache/nodeids", sorted(self.cached_nodeids))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/cacheprovider.py", line 177, in set
    if path.parent.is_dir():
       ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 1248, in is_dir
    return S_ISDIR(self.stat().st_mode)
                   ^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 1011, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: monkeypatch_filesystem.<locals>.monkeypatch_filesystem.<locals>.patched_stat() got an unexpected keyword argument 'follow_symlinks'
Exception ignored in atexit callback: <function cleanup_numbered_dir at 0x7fb8aab2c220>
Traceback (most recent call last):
  File "/tmp/loguru/.tox/py311/lib/python3.11/site-packages/_pytest/pathlib.py", line 344, in cleanup_numbered_dir
    for path in root.glob("garbage-*"):
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 951, in glob
    for p in selector.select_from(self):
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 320, in select_from
    if not is_dir(parent_path):
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 1248, in is_dir
    return S_ISDIR(self.stat().st_mode)
                   ^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 1011, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: monkeypatch_filesystem.<locals>.monkeypatch_filesystem.<locals>.patched_stat() got an unexpected keyword argument 'follow_symlinks'
ERROR: InvocationError for command /tmp/loguru/.tox/py311/bin/pytest --cov loguru/ --cov-report=xml (exited with code 1)
_______________________________________________________________ summary _______________________________________________________________
ERROR:   py311: commands failed
@Delgan
Copy link
Owner

Delgan commented May 20, 2022

Thanks for pointing this out. 👍

I'll investigate it and fix it before official 3.11 release.

@Delgan Delgan added the bug Something isn't working label May 20, 2022
@Delgan
Copy link
Owner

Delgan commented May 28, 2022

Fixed on master. The 3.11 version was also added to CI tests.

The reported error due to patched_stat() was an easy fix (missing arguments).

However, the 3.11 version also "breaks" the InterceptHandler implementation due to python/cpython@5ca6d74.
Users must update their existing InterceptHandler while upgrading to 3.11 (replace logging.currentframe() with sys._getframe()).

@Delgan Delgan closed this as completed May 28, 2022
@dvzrv
Copy link

dvzrv commented Apr 8, 2023

@Delgan can you please create a release that has this fix? We're currently rebuilding all Python packages against 3.11 on Arch Linux and I am now running into this problem.

archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue Apr 8, 2023
Disable further tests that are not compatible with Python 3.11: Delgan/loguru#654

git-svn-id: file:///srv/repos/svn-community/svn@1443022 9fca08f4-af9d-4005-b8df-a31f2cc04f65
archlinux-github pushed a commit to archlinux/svntogit-community that referenced this issue Apr 8, 2023
Disable further tests that are not compatible with Python 3.11: Delgan/loguru#654

git-svn-id: file:///srv/repos/svn-community/svn@1443022 9fca08f4-af9d-4005-b8df-a31f2cc04f65
@Delgan
Copy link
Owner

Delgan commented Apr 10, 2023

@dvzrv I just published 0.7.0.

@Jedore
Copy link

Jedore commented Apr 21, 2023

The same problem afflicted me a whole aftertoon ...

@quantumpacket
Copy link
Contributor

quantumpacket commented Sep 3, 2023

Users must update their existing InterceptHandler while upgrading to 3.11 (replace logging.currentframe() with sys._getframe()).

@Delgan All my QA tools including my IDE warns against using _getframe() as it's an implementation detail, which I tend to agree on.

So I looked for an alternative and came up with this, where we immediatly start on the 6th frame. Based on my testing using this method and the current method, I get the same results (please confirm).

depth = 6
frame: FrameType | None = inspect.getouterframes(inspect.currentframe())[depth].frame

Would this be a better choice to use for the InterceptHandler() example as it's more robust?

@Delgan
Copy link
Owner

Delgan commented Sep 3, 2023

@quantumpacket The point of using _getframe(6) was to access the 6th frame directly and avoid iterating through intermediate frames. Using inspect.getouterframes() will cause them to be iterated and indexed anyway, so we could as well just refactor InterceptHandler to start iteration at the 1st frame.

# Find caller from where originated the logged message.
frame, depth = inspect.currentframe(), 0
while frame and (depth == 0 or frame.f_code.co_filename == logging.__file__):
    frame = frame.f_back
    depth += 1

This looks a bit more straightforward. This shouldn't impact performance too much. Eventually, I plan to replace InterceptHandler with a built-in logger.bridge() method anyway.

github-actions bot pushed a commit to afonasev/deta_todo_service that referenced this issue Jan 1, 2025
[//]: # (dependabot-start)
⚠️  **Dependabot is rebasing this PR** ⚠️ 

Rebasing might not happen immediately, so don't worry if this takes some
time.

Note: if you make any changes to this PR yourself, they will take
precedence over the rebase.

---

[//]: # (dependabot-end)

Bumps [loguru](https://github.com/Delgan/loguru) from 0.6.0 to 0.7.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Delgan/loguru/releases">loguru's
releases</a>.</em></p>
<blockquote>
<h2>0.7.3</h2>
<ul>
<li>Fix Cython incompatibility caused by the absence of underlying stack
frames, which resulted in a <code>ValueError</code> during logging (<a
href="https://redirect.github.com/Delgan/loguru/issues/88">#88</a>).</li>
<li>Fix possible <code>RuntimeError</code> when removing all handlers
with <code>logger.remove()</code> due to thread-safety issue (<a
href="https://redirect.github.com/Delgan/loguru/issues/1183">#1183</a>,
thanks <a
href="https://github.com/jeremyk"><code>@​jeremyk</code></a>).</li>
<li>Fix <code>diagnose=True</code> option of exception formatting not
working as expected with Python 3.13 (<a
href="https://redirect.github.com/Delgan/loguru/issues/1235">#1235</a>,
thanks <a
href="https://github.com/etianen"><code>@​etianen</code></a>).</li>
<li>Fix non-standard level names not fully compatible with
<code>logging.Formatter()</code> (<a
href="https://redirect.github.com/Delgan/loguru/issues/1231">#1231</a>,
thanks <a
href="https://github.com/yechielb2000"><code>@​yechielb2000</code></a>).</li>
<li>Fix inability to display a literal <code>&quot;\&quot;</code>
immediately before color markups (<a
href="https://redirect.github.com/Delgan/loguru/issues/988">#988</a>).</li>
<li>Fix possible infinite recursion when an exception is raised from a
<code>__repr__</code> method decorated with <code>logger.catch()</code>
(<a
href="https://redirect.github.com/Delgan/loguru/issues/1044">#1044</a>).</li>
<li>Improve performance of <code>datetime</code> formatting while
logging messages (<a
href="https://redirect.github.com/Delgan/loguru/issues/1201">#1201</a>,
thanks <a
href="https://github.com/trim21"><code>@​trim21</code></a>).</li>
<li>Reduce startup time in the presence of installed but unused
<code>IPython</code> third-party library (<a
href="https://redirect.github.com/Delgan/loguru/issues/1001">#1001</a>,
thanks <a
href="https://github.com/zakstucke"><code>@​zakstucke</code></a>).</li>
</ul>
<h2>0.7.2</h2>
<ul>
<li>Add support for formatting of <code>ExceptionGroup</code> errors (<a
href="https://redirect.github.com/Delgan/loguru/issues/805">#805</a>).</li>
<li>Fix possible <code>RuntimeError</code> when using
<code>multiprocessing.set_start_method()</code> after importing the
<code>logger</code> (<a
href="https://redirect.github.com/Delgan/loguru/issues/974">#974</a>).</li>
<li>Fix formatting of possible <code>__notes__</code> attached to an
<code>Exception</code> (<a
href="https://redirect.github.com/Delgan/loguru/issues/980">#980</a>).</li>
</ul>
<h2>0.7.1</h2>
<ul>
<li>Add a new <code>context</code> optional argument to
<code>logger.add()</code> specifying <code>multiprocessing</code>
context (like <code>&quot;spawn&quot;</code> or
<code>&quot;fork&quot;</code>) to be used internally instead of the
default one (<a
href="https://redirect.github.com/Delgan/loguru/issues/851">#851</a>).</li>
<li>Add support for true colors on Windows using ANSI/VT console when
available (<a
href="https://redirect.github.com/Delgan/loguru/issues/934">#934</a>,
thanks <a
href="https://github.com/tunaflsh"><code>@​tunaflsh</code></a>).</li>
<li>Fix possible deadlock when calling <code>logger.complete()</code>
with concurrent logging of an asynchronous sink (<a
href="https://redirect.github.com/Delgan/loguru/issues/906">#906</a>).</li>
<li>Fix file possibly rotating too early or too late when re-starting an
application around midnight (<a
href="https://redirect.github.com/Delgan/loguru/issues/894">#894</a>).</li>
<li>Fix inverted <code>&quot;&lt;hide&gt;&quot;</code> and
<code>&quot;&lt;strike&gt;&quot;</code> color tags (<a
href="https://redirect.github.com/Delgan/loguru/issues/943">#943</a>,
thanks <a
href="https://github.com/tunaflsh"><code>@​tunaflsh</code></a>).</li>
<li>Fix possible untraceable errors raised when logging non-unpicklable
<code>Exception</code> instances while using <code>enqueue=True</code>
(<a
href="https://redirect.github.com/Delgan/loguru/issues/329">#329</a>).</li>
<li>Fix possible errors raised when logging non-picklable
<code>Exception</code> instances while using <code>enqueue=True</code>
(<a
href="https://redirect.github.com/Delgan/loguru/issues/342">#342</a>,
thanks <a
href="https://github.com/ncoudene"><code>@​ncoudene</code></a>).</li>
<li>Fix missing seconds and microseconds when formatting timezone offset
that requires such accuracy (<a
href="https://redirect.github.com/Delgan/loguru/issues/961">#961</a>).</li>
<li>Raise <code>ValueError</code> if an attempt to use nanosecond
precision for time formatting is detected (<a
href="https://redirect.github.com/Delgan/loguru/issues/855">#855</a>).</li>
</ul>
<h2>0.7.0</h2>
<ul>
<li>Update <code>InterceptHandler</code> recipe to make it compatible
with Python 3.11 (<a
href="https://redirect.github.com/Delgan/loguru/issues/654">#654</a>).</li>
<li>Add a new <code>watch</code> optional argument to file sinks in
order to automatically re-create possibly deleted or changed file (<a
href="https://redirect.github.com/Delgan/loguru/issues/471">#471</a>).</li>
<li>Make <code>patch()</code> calls cumulative instead of overriding the
possibly existing patching function (<a
href="https://redirect.github.com/Delgan/loguru/issues/462">#462</a>).</li>
<li>Make sinks added with <code>enqueue=True</code> and
<code>catch=False</code> still process logged messages in case of
internal exception (<a
href="https://redirect.github.com/Delgan/loguru/issues/833">#833</a>).</li>
<li>Avoid possible deadlocks caused by re-using the logger inside a
sink, a signal handler or a <code>__del__</code> method. Since the
logger is not re-entrant, such misuse will be detected and will now
generate a <code>RuntimeError</code> (<a
href="https://redirect.github.com/Delgan/loguru/issues/712">#712</a>,
thanks <a
href="https://github.com/jacksmith15"><code>@​jacksmith15</code></a>).</li>
<li>Fix file sink rotation using an aware <code>datetime.time</code> for
which the timezone was ignored (<a
href="https://redirect.github.com/Delgan/loguru/issues/697">#697</a>).</li>
<li>Fix logs colorization not automatically enabled for Jupyter Notebook
and Google Colab (<a
href="https://redirect.github.com/Delgan/loguru/issues/494">#494</a>).</li>
<li>Fix logs colorization not automatically enabled for Github Actions
and others CI platforms (<a
href="https://redirect.github.com/Delgan/loguru/issues/604">#604</a>).</li>
<li>Fix <code>logger.complete()</code> possibly hanging forever when
<code>enqueue=True</code> and <code>catch=False</code> if internal
thread killed due to <code>Exception</code> raised by sink (<a
href="https://redirect.github.com/Delgan/loguru/issues/647">#647</a>).</li>
<li>Fix incompatibility with <code>freezegun</code> library used to
simulate time (<a
href="https://redirect.github.com/Delgan/loguru/issues/600">#600</a>).</li>
<li>Raise exception if <code>logger.catch()</code> is used to wrap a
class instead of a function to avoid unexpected behavior (<a
href="https://redirect.github.com/Delgan/loguru/issues/623">#623</a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/Delgan/loguru/blob/master/CHANGELOG.rst">loguru's
changelog</a>.</em></p>
<blockquote>
<h1><code>0.7.3</code>_ (2024-12-06)</h1>
<ul>
<li>Fix Cython incompatibility caused by the absence of underlying stack
frames, which resulted in a <code>ValueError</code> during logging
(<code>[#88](Delgan/loguru#88)
&lt;https://github.com/Delgan/loguru/issues/88&gt;</code>_).</li>
<li>Fix possible <code>RuntimeError</code> when removing all handlers
with <code>logger.remove()</code> due to thread-safety issue
(<code>[#1183](Delgan/loguru#1183)
&lt;https://github.com/Delgan/loguru/issues/1183&gt;</code><em>, thanks
<code>@jeremyk &lt;https://github.com/jeremyk&gt;</code></em>).</li>
<li>Fix <code>diagnose=True</code> option of exception formatting not
working as expected with Python 3.13
(<code>[#1235](Delgan/loguru#1235)
&lt;https://github.com/Delgan/loguru/issues/1235&gt;</code><em>, thanks
<code>@etianen &lt;https://github.com/etianen&gt;</code></em>).</li>
<li>Fix non-standard level names not fully compatible with
<code>logging.Formatter()</code>
(<code>[#1231](Delgan/loguru#1231)
&lt;https://github.com/Delgan/loguru/issues/1231&gt;</code><em>, thanks
<code>@yechielb2000
&lt;https://github.com/yechielb2000&gt;</code></em>).</li>
<li>Fix inability to display a literal <code>&quot;\&quot;</code>
immediately before color markups
(<code>[#988](Delgan/loguru#988)
&lt;https://github.com/Delgan/loguru/issues/988&gt;</code>_).</li>
<li>Fix possible infinite recursion when an exception is raised from a
<code>__repr__</code> method decorated with <code>logger.catch()</code>
(<code>[#1044](Delgan/loguru#1044)
&lt;https://github.com/Delgan/loguru/issues/1044&gt;</code>_).</li>
<li>Improve performance of <code>datetime</code> formatting while
logging messages
(<code>[#1201](Delgan/loguru#1201)
&lt;https://github.com/Delgan/loguru/issues/1201&gt;</code><em>, thanks
<code>@trim21 &lt;https://github.com/trim21&gt;</code></em>).</li>
<li>Reduce startup time in the presence of installed but unused
<code>IPython</code> third-party library
(<code>[#1001](Delgan/loguru#1001)
&lt;https://github.com/Delgan/loguru/issues/1001&gt;</code><em>, thanks
<code>@zakstucke &lt;https://github.com/zakstucke&gt;</code></em>).</li>
</ul>
<h1><code>0.7.2</code>_ (2023-09-11)</h1>
<ul>
<li>Add support for formatting of <code>ExceptionGroup</code> errors
(<code>[#805](Delgan/loguru#805)
&lt;https://github.com/Delgan/loguru/issues/805&gt;</code>_).</li>
<li>Fix possible <code>RuntimeError</code> when using
<code>multiprocessing.set_start_method()</code> after importing the
<code>logger</code>
(<code>[#974](Delgan/loguru#974)
&lt;https://github.com/Delgan/loguru/issues/974&gt;</code>_).</li>
<li>Fix formatting of possible <code>__notes__</code> attached to an
<code>Exception</code>
(<code>[#980](Delgan/loguru#980)
&lt;https://github.com/Delgan/loguru/issues/980&gt;</code>_).</li>
</ul>
<h1><code>0.7.1</code>_ (2023-09-04)</h1>
<ul>
<li>Add a new <code>context</code> optional argument to
<code>logger.add()</code> specifying <code>multiprocessing</code>
context (like <code>&quot;spawn&quot;</code> or
<code>&quot;fork&quot;</code>) to be used internally instead of the
default one (<code>[#851](Delgan/loguru#851)
&lt;https://github.com/Delgan/loguru/issues/851&gt;</code>_).</li>
<li>Add support for true colors on Windows using ANSI/VT console when
available (<code>[#934](Delgan/loguru#934)
&lt;https://github.com/Delgan/loguru/issues/934&gt;</code><em>, thanks
<code>@tunaflsh &lt;https://github.com/tunaflsh&gt;</code></em>).</li>
<li>Fix possible deadlock when calling <code>logger.complete()</code>
with concurrent logging of an asynchronous sink
(<code>[#906](Delgan/loguru#906)
&lt;https://github.com/Delgan/loguru/issues/906&gt;</code>_).</li>
<li>Fix file possibly rotating too early or too late when re-starting an
application around midnight
(<code>[#894](Delgan/loguru#894)
&lt;https://github.com/Delgan/loguru/issues/894&gt;</code>_).</li>
<li>Fix inverted <code>&quot;&lt;hide&gt;&quot;</code> and
<code>&quot;&lt;strike&gt;&quot;</code> color tags
(<code>[#943](Delgan/loguru#943)
&lt;https://github.com/Delgan/loguru/pull/943&gt;</code><em>, thanks
<code>@tunaflsh &lt;https://github.com/tunaflsh&gt;</code></em>).</li>
<li>Fix possible untraceable errors raised when logging non-unpicklable
<code>Exception</code> instances while using <code>enqueue=True</code>
(<code>[#329](Delgan/loguru#329)
&lt;https://github.com/Delgan/loguru/issues/329&gt;</code>_).</li>
<li>Fix possible errors raised when logging non-picklable
<code>Exception</code> instances while using <code>enqueue=True</code>
(<code>[#342](Delgan/loguru#342)
&lt;https://github.com/Delgan/loguru/issues/342&gt;</code><em>, thanks
<code>@ncoudene &lt;https://github.com/ncoudene&gt;</code></em>).</li>
<li>Fix missing seconds and microseconds when formatting timezone offset
that requires such accuracy
(<code>[#961](Delgan/loguru#961)
&lt;https://github.com/Delgan/loguru/issues/961&gt;</code>_).</li>
<li>Raise <code>ValueError</code> if an attempt to use nanosecond
precision for time formatting is detected
(<code>[#855](Delgan/loguru#855)
&lt;https://github.com/Delgan/loguru/issues/855&gt;</code>_).</li>
</ul>
<h1><code>0.7.0</code>_ (2023-04-10)</h1>
<ul>
<li>Update <code>InterceptHandler</code> recipe to make it compatible
with Python 3.11
(<code>[#654](Delgan/loguru#654)
&lt;https://github.com/Delgan/loguru/issues/654&gt;</code>_).</li>
<li>Add a new <code>watch</code> optional argument to file sinks in
order to automatically re-create possibly deleted or changed file
(<code>[#471](Delgan/loguru#471)
&lt;https://github.com/Delgan/loguru/issues/471&gt;</code>_).</li>
<li>Make <code>patch()</code> calls cumulative instead of overriding the
possibly existing patching function
(<code>[#462](Delgan/loguru#462)
&lt;https://github.com/Delgan/loguru/issues/462&gt;</code>_).</li>
<li>Make sinks added with <code>enqueue=True</code> and
<code>catch=False</code> still process logged messages in case of
internal exception
(<code>[#833](Delgan/loguru#833)
&lt;https://github.com/Delgan/loguru/issues/833&gt;</code>_).</li>
<li>Avoid possible deadlocks caused by re-using the logger inside a
sink, a signal handler or a <code>__del__</code> method. Since the
logger is not re-entrant, such misuse will be detected and will now
generate a <code>RuntimeError</code>
(<code>[#712](Delgan/loguru#712)
&lt;https://github.com/Delgan/loguru/issues/712&gt;</code><em>, thanks
<code>@jacksmith15
&lt;https://github.com/jacksmith15&gt;</code></em>).</li>
<li>Fix file sink rotation using an aware <code>datetime.time</code> for
which the timezone was ignored
(<code>[#697](Delgan/loguru#697)
&lt;https://github.com/Delgan/loguru/issues/697&gt;</code>_).</li>
<li>Fix logs colorization not automatically enabled for Jupyter Notebook
and Google Colab
(<code>[#494](Delgan/loguru#494)
&lt;https://github.com/Delgan/loguru/issues/494&gt;</code>_).</li>
<li>Fix logs colorization not automatically enabled for Github Actions
and others CI platforms
(<code>[#604](Delgan/loguru#604)
&lt;https://github.com/Delgan/loguru/issues/604&gt;</code>_).</li>
<li>Fix <code>logger.complete()</code> possibly hanging forever when
<code>enqueue=True</code> and <code>catch=False</code> if internal
thread killed due to <code>Exception</code> raised by sink
(<code>[#647](Delgan/loguru#647)
&lt;https://github.com/Delgan/loguru/issues/647&gt;</code>_).</li>
<li>Fix incompatibility with <code>freezegun</code> library used to
simulate time (<code>[#600](Delgan/loguru#600)
&lt;https://github.com/Delgan/loguru/issues/600&gt;</code>_).</li>
<li>Raise exception if <code>logger.catch()</code> is used to wrap a
class instead of a function to avoid unexpected behavior
(<code>[#623](Delgan/loguru#623)
&lt;https://github.com/Delgan/loguru/issues/623&gt;</code>_).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/Delgan/loguru/commit/ae3bfd1b85b6b4a3db535f69b975687c79498be4"><code>ae3bfd1</code></a>
Bump version to 0.7.3</li>
<li><a
href="https://github.com/Delgan/loguru/commit/ccca3566cc00c22eed8659705e45386fa2101b5d"><code>ccca356</code></a>
Replace &quot;notifiers&quot; (seems unmaintained) with
&quot;apprise&quot; in docs (<a
href="https://redirect.github.com/Delgan/loguru/issues/1251">#1251</a>)</li>
<li><a
href="https://github.com/Delgan/loguru/commit/a372814bf79d47628e66ca9a91072f53fba032f8"><code>a372814</code></a>
Configure &quot;trusted publishing&quot; in Github workflow</li>
<li><a
href="https://github.com/Delgan/loguru/commit/633016db07e5dff63bc05dd3c4d5aa81b6190700"><code>633016d</code></a>
Use tox to define the &quot;release&quot; command</li>
<li><a
href="https://github.com/Delgan/loguru/commit/ef12cbbaf54fb2e64ca66b0a90675cdf9e8a522f"><code>ef12cbb</code></a>
Convert README from RST to MD (fix PyPI packaging)</li>
<li><a
href="https://github.com/Delgan/loguru/commit/cb3314a5af107ad175a9bafa11b1b79670e3067a"><code>cb3314a</code></a>
Add Github action to verify packaging</li>
<li><a
href="https://github.com/Delgan/loguru/commit/6161a13b79e1a3a29e922926b44f26edbcc3c06a"><code>6161a13</code></a>
Complete the &quot;Troubleshooting&quot; docs with more examples</li>
<li><a
href="https://github.com/Delgan/loguru/commit/7f5001fe46393627ced287bba2c4064442c3fd25"><code>7f5001f</code></a>
Simplify the example of dynamic handler level</li>
<li><a
href="https://github.com/Delgan/loguru/commit/2e0cd7bb5105461057c56aefb225da569882ad29"><code>2e0cd7b</code></a>
Move &quot;Introduction to logging&quot; docs to a new section</li>
<li><a
href="https://github.com/Delgan/loguru/commit/72b93d1a24d1491ce7ba752fe36c14f9570a5d63"><code>72b93d1</code></a>
Correct outdated instructions for reporting a vulnerability</li>
<li>Additional commits viewable in <a
href="https://github.com/Delgan/loguru/compare/0.6.0...0.7.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=loguru&package-manager=pip&previous-version=0.6.0&new-version=0.7.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants