Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-sniffio for openSUSE:Factory 
checked in at 2022-09-17 20:08:34
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-sniffio (Old)
 and      /work/SRC/openSUSE:Factory/.python-sniffio.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-sniffio"

Sat Sep 17 20:08:34 2022 rev:7 rq:1003953 version:1.3.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-sniffio/python-sniffio.changes    
2021-02-04 20:24:04.714826663 +0100
+++ /work/SRC/openSUSE:Factory/.python-sniffio.new.2083/python-sniffio.changes  
2022-09-17 20:08:40.220867882 +0200
@@ -1,0 +2,6 @@
+Thu Sep 15 18:24:34 UTC 2022 - Dirk M??ller <dmuel...@suse.com>
+
+- update to 1.3.0:
+  * requires python 3.7
+
+-------------------------------------------------------------------

Old:
----
  sniffio-1.2.0.tar.gz

New:
----
  sniffio-1.3.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-sniffio.spec ++++++
--- /var/tmp/diff_new_pack.zbWovE/_old  2022-09-17 20:08:40.812869590 +0200
+++ /var/tmp/diff_new_pack.zbWovE/_new  2022-09-17 20:08:40.816869601 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-sniffio
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,23 +16,20 @@
 #
 
 
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
+%{?!python_module:%define python_module() python3-%{**}}
 %define skip_python2 1
 Name:           python-sniffio
-Version:        1.2.0
+Version:        1.3.0
 Release:        0
 Summary:        Module to sniff which async library code runs under
-License:        MIT OR Apache-2.0
+License:        Apache-2.0 OR MIT
 Group:          Development/Languages/Python
 URL:            https://github.com/python-trio/sniffio
 Source:         
https://github.com/python-trio/sniffio/archive/v%{version}.tar.gz#/sniffio-%{version}.tar.gz
-BuildRequires:  %{python_module contextvars >= 2.1 if %python-base < 3.7}
+BuildRequires:  %{python_module base >= 3.7}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros >= 20210127.3a18043
-%if 0%{?python_version_nodots} < 37
-Requires:       python-contextvars >= 2.1
-%endif
 BuildArch:      noarch
 # SECTION test requirements
 BuildRequires:  %{python_module curio}

++++++ sniffio-1.2.0.tar.gz -> sniffio-1.3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/.github/workflows/ci.yml 
new/sniffio-1.3.0/.github/workflows/ci.yml
--- old/sniffio-1.2.0/.github/workflows/ci.yml  1970-01-01 01:00:00.000000000 
+0100
+++ new/sniffio-1.3.0/.github/workflows/ci.yml  2022-09-01 12:54:31.000000000 
+0200
@@ -0,0 +1,87 @@
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+  Windows:
+    name: 'Windows (${{ matrix.python }})'
+    runs-on: 'windows-latest'
+    strategy:
+      fail-fast: false
+      matrix:
+        python: ['3.7', '3.8', '3.9', '3.10']
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Setup python
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python }}
+          cache: pip
+          cache-dependency-path: test-requirements.txt
+      - name: Run tests
+        run: ./ci.sh
+        shell: bash
+        env:
+          # Should match 'name:' up above
+          JOB_NAME: 'Windows (${{ matrix.python }})'
+
+  Ubuntu:
+    name: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
+    timeout-minutes: 10
+    runs-on: 'ubuntu-latest'
+    strategy:
+      fail-fast: false
+      matrix:
+        python: ['3.7', '3.8', '3.9', '3.10', '3.11-dev']
+        check_formatting: ['0']
+        extra_name: ['']
+        include:
+          - python: '3.10'
+            check_formatting: '1'
+            extra_name: ', check formatting'
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Setup python
+        uses: actions/setup-python@v2
+        if: "!endsWith(matrix.python, '-dev')"
+        with:
+          python-version: ${{ matrix.python }}
+          cache: pip
+          cache-dependency-path: test-requirements.txt
+      - name: Setup python (dev)
+        uses: deadsnakes/action@v2.0.2
+        if: endsWith(matrix.python, '-dev')
+        with:
+          python-version: '${{ matrix.python }}'
+      - name: Run tests
+        run: ./ci.sh
+        env:
+          CHECK_FORMATTING: '${{ matrix.check_formatting }}'
+          # Should match 'name:' up above
+          JOB_NAME: 'Ubuntu (${{ matrix.python }}${{ matrix.extra_name }})'
+
+  macOS:
+    name: 'macOS (${{ matrix.python }})'
+    timeout-minutes: 10
+    runs-on: 'macos-latest'
+    strategy:
+      fail-fast: false
+      matrix:
+        python: ['3.7', '3.8', '3.9', '3.10']
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+      - name: Setup python
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python }}
+          cache: pip
+          cache-dependency-path: test-requirements.txt
+      - name: Run tests
+        run: ./ci.sh
+        env:
+          # Should match 'name:' up above
+          JOB_NAME: 'macOS (${{ matrix.python }})'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/.readthedocs.yml 
new/sniffio-1.3.0/.readthedocs.yml
--- old/sniffio-1.2.0/.readthedocs.yml  2020-10-11 20:21:00.000000000 +0200
+++ new/sniffio-1.3.0/.readthedocs.yml  2022-09-01 12:54:31.000000000 +0200
@@ -5,12 +5,6 @@
 
 requirements_file: ci/rtd-requirements.txt
 
-# Currently RTD's default image only has 3.5
-# This gets us 3.6 (and hopefully 3.7 in the future)
-# https://docs.readthedocs.io/en/latest/yaml-config.html#build-image
-build:
-  image: latest
-
 python:
   version: 3
   pip_install: True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/.travis.yml 
new/sniffio-1.3.0/.travis.yml
--- old/sniffio-1.2.0/.travis.yml       2020-10-11 20:21:00.000000000 +0200
+++ new/sniffio-1.3.0/.travis.yml       1970-01-01 01:00:00.000000000 +0100
@@ -1,22 +0,0 @@
-language: python
-dist: xenial
-
-matrix:
-  include:
-    # These are quick and often catch errors, so list them first
-    - python: 3.7
-      env: CHECK_DOCS=1
-    - python: 3.7
-      env: CHECK_FORMATTING=1
-    # The pypy tests are slow, so list them early
-    - python: pypy3.5
-    # Uncomment if you want to test on pypy nightly:
-    # - language: generic
-    #   env: USE_PYPY_NIGHTLY=1
-    - python: 3.5
-    - python: 3.6
-    - python: 3.7
-    - python: 3.8-dev
-
-script:
-  - ci/travis.sh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/ci/travis.sh 
new/sniffio-1.3.0/ci/travis.sh
--- old/sniffio-1.2.0/ci/travis.sh      2020-10-11 20:21:00.000000000 +0200
+++ new/sniffio-1.3.0/ci/travis.sh      1970-01-01 01:00:00.000000000 +0100
@@ -1,114 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-MYPY_VERSION=0.782
-YAPF_VERSION=0.22.0
-
-if [ "$TRAVIS_OS_NAME" = "osx" ]; then
-    curl -Lo macpython.pkg 
https://www.python.org/ftp/python/${MACPYTHON}/python-${MACPYTHON}-macosx10.6.pkg
-    sudo installer -pkg macpython.pkg -target /
-    ls /Library/Frameworks/Python.framework/Versions/*/bin/
-    PYTHON_EXE=/Library/Frameworks/Python.framework/Versions/*/bin/python3
-    # The pip in older MacPython releases doesn't support a new enough TLS
-    curl https://bootstrap.pypa.io/get-pip.py | sudo $PYTHON_EXE
-    sudo $PYTHON_EXE -m pip install virtualenv
-    $PYTHON_EXE -m virtualenv testenv
-    source testenv/bin/activate
-    https://github.com/dabeaz/curio
-fi
-
-if [ "$USE_PYPY_NIGHTLY" = "1" ]; then
-    curl -fLo pypy.tar.bz2 
http://buildbot.pypy.org/nightly/py3.5/pypy-c-jit-latest-linux64.tar.bz2
-    if [ ! -s pypy.tar.bz2 ]; then
-        # We know:
-        # - curl succeeded (200 response code; -f means "exit with error if
-        # server returns 4xx or 5xx")
-        # - nonetheless, pypy.tar.bz2 does not exist, or contains no data
-        # This isn't going to work, and the failure is not informative of
-        # anything involving this package.
-        ls -l
-        echo "PyPy3 nightly build failed to download ??? something is wrong on 
their end."
-        echo "Skipping testing against the nightly build for right now."
-        exit 0
-    fi
-    tar xaf pypy.tar.bz2
-    # something like "pypy-c-jit-89963-748aa3022295-linux64"
-    PYPY_DIR=$(echo pypy-c-jit-*)
-    PYTHON_EXE=$PYPY_DIR/bin/pypy3
-    ($PYTHON_EXE -m ensurepip \
-     && $PYTHON_EXE -m pip install virtualenv \
-     && $PYTHON_EXE -m virtualenv testenv) \
-        || (echo "pypy nightly is broken; skipping tests"; exit 0)
-    source testenv/bin/activate
-fi
-
-if [ "$USE_PYPY_RELEASE_VERSION" != "" ]; then
-    curl -fLo pypy.tar.bz2 
https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3.5-${USE_PYPY_RELEASE_VERSION}-linux_x86_64-portable.tar.bz2
-    tar xaf pypy.tar.bz2
-    # something like "pypy3.5-5.7.1-beta-linux_x86_64-portable"
-    PYPY_DIR=$(echo pypy3.5-*)
-    PYTHON_EXE=$PYPY_DIR/bin/pypy3
-    $PYTHON_EXE -m ensurepip
-    $PYTHON_EXE -m pip install virtualenv
-    $PYTHON_EXE -m virtualenv testenv
-    source testenv/bin/activate
-fi
-
-pip install -U pip setuptools wheel
-
-if [ "$CHECK_FORMATTING" = "1" ]; then
-    pip install yapf==${YAPF_VERSION}
-    if ! yapf -rpd setup.py sniffio; then
-        cat <<EOF
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-Formatting problems were found (listed above). To fix them, run
-
-   pip install yapf==${YAPF_VERSION}
-   yapf -rpi setup.py sniffio
-
-in your local checkout.
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-EOF
-        exit 1
-    fi
-    pip install mypy==${MYPY_VERSION}
-    if ! mypy --pretty sniffio; then
-      cat <<EOF
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
-Type checking problems were found (listed above).
-
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-EOF
-      exit 1
-    fi
-    exit 0
-fi
-
-python setup.py sdist --formats=zip
-pip install dist/*.zip
-
-if [ "$CHECK_DOCS" = "1" ]; then
-    pip install -Ur ci/rtd-requirements.txt
-    cd docs
-    # -n (nit-picky): warn on missing references
-    # -W: turn warnings into errors
-    sphinx-build -nW  -b html source build
-else
-    # Actual tests
-    pip install -Ur test-requirements.txt
-
-    mkdir empty
-    cd empty
-
-    pytest -W error -ra -v --pyargs sniffio --cov=sniffio 
--cov-config=../.coveragerc --verbose
-
-    bash <(curl -s https://codecov.io/bash)
-fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/ci.sh new/sniffio-1.3.0/ci.sh
--- old/sniffio-1.2.0/ci.sh     1970-01-01 01:00:00.000000000 +0100
+++ new/sniffio-1.3.0/ci.sh     2022-09-01 12:54:31.000000000 +0200
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+set -ex
+
+MYPY_VERSION=0.782
+YAPF_VERSION=0.22.0
+
+
+pip install -U pip setuptools wheel
+
+if [ "$CHECK_FORMATTING" = "1" ]; then
+    pip install yapf==${YAPF_VERSION}
+    if ! yapf -rpd setup.py sniffio; then
+        cat <<EOF
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+Formatting problems were found (listed above). To fix them, run
+
+   pip install yapf==${YAPF_VERSION}
+   yapf -rpi setup.py sniffio
+
+in your local checkout.
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+EOF
+        exit 1
+    fi
+    pip install mypy==${MYPY_VERSION}
+    if ! mypy --pretty sniffio; then
+      cat <<EOF
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+Type checking problems were found (listed above).
+
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+EOF
+      exit 1
+    fi
+    exit 0
+fi
+
+python setup.py sdist --formats=zip
+pip install dist/*.zip
+
+# Actual tests
+pip install -Ur test-requirements.txt
+
+mkdir empty
+cd empty
+
+pytest -W error -ra -v --pyargs sniffio --cov=sniffio 
--cov-config=../.coveragerc --verbose
+
+bash <(curl -s https://codecov.io/bash)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/docs/source/history.rst 
new/sniffio-1.3.0/docs/source/history.rst
--- old/sniffio-1.2.0/docs/source/history.rst   2020-10-11 20:21:00.000000000 
+0200
+++ new/sniffio-1.3.0/docs/source/history.rst   2022-09-01 12:54:31.000000000 
+0200
@@ -5,6 +5,22 @@
 
 .. towncrier release notes start
 
+sniffio 1.3.0 (2022-09-01)
+--------------------------
+
+Features
+~~~~~~~~
+
+- Add support for Python 3.9 and 3.10. (`#29 
<https://github.com/python-trio/outcome/pull/29>`__)
+- Provide ``sniffio.thread_local.name`` for coroutine libraries to set (`#23 
<https://github.com/python-trio/outcome/pull/23>`__)
+
+
+Deprecations and Removals
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+- Drop support for Python 3.5 and 3.6. (`#29 
<https://github.com/python-trio/outcome/pull/29>`__)
+
+
 sniffio 1.2.0 (2020-10-11)
 --------------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/docs/source/index.rst 
new/sniffio-1.3.0/docs/source/index.rst
--- old/sniffio-1.2.0/docs/source/index.rst     2020-10-11 20:21:00.000000000 
+0200
+++ new/sniffio-1.3.0/docs/source/index.rst     2022-09-01 12:54:31.000000000 
+0200
@@ -52,53 +52,53 @@
 easy.
 
 **Step 1:** Pick the magic string that will identify your library. To
-avoid collisions, this should match your library's name on PyPI.
+avoid collisions, this should match your library's PEP 503 normalized name on 
PyPI.
 
-**Step 2:** There's a special :class:`contextvars.ContextVar` object:
+**Step 2:** There's a special :class:`threading.local` object:
 
-.. data:: current_async_library_cvar
+.. data:: thread_local.name
 
-Make sure that whenever your library is running, this is set to your
-identifier string. In most cases, this will be as simple as:
+Make sure that whenever your library is calling a coroutine ``throw()``, 
``send()``, or ``close()``
+that this is set to your identifier string. In most cases, this will be as 
simple as:
 
 .. code-block:: python3
 
-   from sniffio import current_async_library_cvar
+   from sniffio import thread_local
 
-   # Your library's run function
-   def run(...):
-        token = current_async_library_cvar.set("my-library's-PyPI-name")
+   # Your library's step function
+   def step(...):
+        old_name, thread_local.name = thread_local.name, 
"my-library's-PyPI-name"
         try:
-            # The actual body of your run() function:
-            ...
+            result = coro.send(None)
         finally:
-            current_async_library_cvar.reset(token)
+            thread_local.name = old_name
 
 **Step 3:** Send us a PR to add your library to the list of supported
 libraries above.
 
 That's it!
 
-Notes:
+There are libraries that directly drive a sniffio-naive coroutine from another,
+outer sniffio-aware coroutine such as `trio_asyncio`.
+These libraries should make sure to set the correct value
+while calling a synchronous function that will go on to drive the
+sniffio-naive coroutine.
+
+
+.. code-block:: python3
+
+   from sniffio import thread_local
+
+   # Your library's compatibility loop
+   async def main_loop(self, ...) -> None:
+        ...
+        handle: asyncio.Handle = await self.get_next_handle()
+        old_name, thread_local.name = thread_local.name, "asyncio"
+        try:
+            result = handle._callback(obj._args)
+        finally:
+            thread_local.name = old_name
 
-On older Pythons without native contextvars support, sniffio
-transparently uses `the official contextvars backport
-<https://pypi.org/project/contextvars/>`__, so you don't need to worry
-about that.
-
-There are libraries that can switch back and forth between different
-async modes within a single call-task ??? like ``trio_asyncio`` or
-Twisted's asyncio operability. These libraries should make sure to set
-the value back and forth at appropriate points.
-
-The general rule of thumb: :data:`current_async_library_cvar` should
-be set to X exactly at those moments when ``await X.sleep(...)`` will
-work.
-
-.. warning:: You shouldn't attempt to read the value of
-   ``current_async_library_cvar`` directly ???
-   :func:`current_async_library` has a little bit more cleverness than
-   that.
 
 .. toctree::
    :maxdepth: 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/setup.py new/sniffio-1.3.0/setup.py
--- old/sniffio-1.2.0/setup.py  2020-10-11 20:21:00.000000000 +0200
+++ new/sniffio-1.3.0/setup.py  2022-09-01 12:54:31.000000000 +0200
@@ -12,17 +12,15 @@
     long_description=LONG_DESC,
     author="Nathaniel J. Smith",
     author_email="n...@pobox.com",
-    license="MIT -or- Apache License 2.0",
+    license="MIT OR Apache-2.0",
     packages=find_packages(),
     package_data={"sniffio": ["py.typed"]},
-    install_requires=[],
     keywords=[
         "async",
         "trio",
         "asyncio",
     ],
-    extras_require={":python_version < '3.7'": ["contextvars>=2.1"]},
-    python_requires=">=3.5",
+    python_requires=">=3.7",
     tests_require=['curio'],
     classifiers=[
         "License :: OSI Approved :: MIT License",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/sniffio/__init__.py 
new/sniffio-1.3.0/sniffio/__init__.py
--- old/sniffio-1.2.0/sniffio/__init__.py       2020-10-11 20:21:00.000000000 
+0200
+++ new/sniffio-1.3.0/sniffio/__init__.py       2022-09-01 12:54:31.000000000 
+0200
@@ -11,4 +11,5 @@
     current_async_library,
     AsyncLibraryNotFoundError,
     current_async_library_cvar,
+    thread_local,
 )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/sniffio/_impl.py 
new/sniffio-1.3.0/sniffio/_impl.py
--- old/sniffio-1.2.0/sniffio/_impl.py  2020-10-11 20:21:00.000000000 +0200
+++ new/sniffio-1.3.0/sniffio/_impl.py  2022-09-01 12:54:31.000000000 +0200
@@ -1,12 +1,23 @@
 from contextvars import ContextVar
 from typing import Optional
 import sys
+import threading
 
 current_async_library_cvar = ContextVar(
     "current_async_library_cvar", default=None
 )  # type: ContextVar[Optional[str]]
 
 
+class _ThreadLocal(threading.local):
+    # Since threading.local provides no explicit mechanism is for setting
+    # a default for a value, a custom class with a class attribute is used
+    # instead.
+    name = None  # type: Optional[str]
+
+
+thread_local = _ThreadLocal()
+
+
 class AsyncLibraryNotFoundError(RuntimeError):
     pass
 
@@ -52,15 +63,13 @@
                    raise RuntimeError(f"Unsupported library {library!r}")
 
     """
-    value = current_async_library_cvar.get()
+    value = thread_local.name
     if value is not None:
         return value
 
-    # Sniff for curio (for now)
-    if 'curio' in sys.modules:
-        from curio.meta import curio_running
-        if curio_running():
-            return 'curio'
+    value = current_async_library_cvar.get()
+    if value is not None:
+        return value
 
     # Need to sniff for asyncio
     if "asyncio" in sys.modules:
@@ -71,13 +80,16 @@
             current_task = asyncio.Task.current_task  # type: 
ignore[attr-defined]
         try:
             if current_task() is not None:
-                if (3, 7) <= sys.version_info:
-                    # asyncio has contextvars support, and we're in a task, so
-                    # we can safely cache the sniffed value
-                    current_async_library_cvar.set("asyncio")
                 return "asyncio"
         except RuntimeError:
             pass
+
+    # Sniff for curio (for now)
+    if 'curio' in sys.modules:
+        from curio.meta import curio_running
+        if curio_running():
+            return 'curio'
+
     raise AsyncLibraryNotFoundError(
         "unknown async library, or not in async context"
     )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/sniffio/_tests/test_sniffio.py 
new/sniffio-1.3.0/sniffio/_tests/test_sniffio.py
--- old/sniffio-1.2.0/sniffio/_tests/test_sniffio.py    2020-10-11 
20:21:00.000000000 +0200
+++ new/sniffio-1.3.0/sniffio/_tests/test_sniffio.py    2022-09-01 
12:54:31.000000000 +0200
@@ -1,14 +1,15 @@
+import os
 import sys
 
 import pytest
 
 from .. import (
     current_async_library, AsyncLibraryNotFoundError,
-    current_async_library_cvar
+    current_async_library_cvar, thread_local
 )
 
 
-def test_basics():
+def test_basics_cvar():
     with pytest.raises(AsyncLibraryNotFoundError):
         current_async_library()
 
@@ -22,6 +23,20 @@
         current_async_library()
 
 
+def test_basics_tlocal():
+    with pytest.raises(AsyncLibraryNotFoundError):
+        current_async_library()
+
+    old_name, thread_local.name = thread_local.name, "generic-lib"
+    try:
+        assert current_async_library() == "generic-lib"
+    finally:
+        thread_local.name = old_name
+
+    with pytest.raises(AsyncLibraryNotFoundError):
+        current_async_library()
+
+
 def test_asyncio():
     import asyncio
 
@@ -36,16 +51,18 @@
         assert current_async_library() == "asyncio"
         ran.append(True)
 
-    loop = asyncio.get_event_loop()
-    loop.run_until_complete(this_is_asyncio())
+    asyncio.run(this_is_asyncio())
     assert ran == [True]
-    loop.close()
 
     with pytest.raises(AsyncLibraryNotFoundError):
         current_async_library()
 
 
-@pytest.mark.skipif(sys.version_info < (3, 6), reason='Curio requires 3.6+')
+# https://github.com/dabeaz/curio/pull/354
+@pytest.mark.skipif(
+    os.name == "nt" and sys.version_info >= (3, 9),
+    reason="Curio breaks on Python 3.9+ on Windows. Fix was not released yet",
+)
 def test_curio():
     import curio
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/sniffio-1.2.0/sniffio/_version.py 
new/sniffio-1.3.0/sniffio/_version.py
--- old/sniffio-1.2.0/sniffio/_version.py       2020-10-11 20:21:00.000000000 
+0200
+++ new/sniffio-1.3.0/sniffio/_version.py       2022-09-01 12:54:31.000000000 
+0200
@@ -1,3 +1,3 @@
 # This file is imported from __init__.py and exec'd from setup.py
 
-__version__ = "1.2.0"
+__version__ = "1.3.0"

Reply via email to