Skip to content

Commit

Permalink
Merge branch '3.9' into patchback/backports/3.9/a0a9b3db486df1ea2aed2…
Browse files Browse the repository at this point in the history
…1dc6c9c1d72452d31fc/pr-6163
  • Loading branch information
asvetlov committed Dec 4, 2021
2 parents 4f9755d + a089aa4 commit c9950d9
Show file tree
Hide file tree
Showing 17 changed files with 150 additions and 62 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
needs: gen_llhttp
strategy:
matrix:
pyver: [3.6, 3.7, 3.8, 3.9, '3.10']
pyver: [3.7, 3.8, 3.9, '3.10']
no-extensions: ['', 'Y']
os: [ubuntu, macos, windows]
exclude:
Expand All @@ -126,7 +126,7 @@ jobs:
- os: windows
no-extensions: 'Y'
include:
- pyver: pypy3
- pyver: pypy-3.8
no-extensions: 'Y'
os: ubuntu
fail-fast: true
Expand Down Expand Up @@ -167,9 +167,12 @@ jobs:
with:
name: llhttp
path: vendor/llhttp/build/
- name: Install dependencies
run: |
make .develop
- name: Run unittests
env:
COLOR: 'yes'
COLOR: yes
AIOHTTP_NO_EXTENSIONS: ${{ matrix.no-extensions }}
run: |
make vvtest
Expand All @@ -182,16 +185,18 @@ jobs:
# fail_ci_if_error: false

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- test

runs-on: ubuntu-latest

steps:
- name: Report success of the test matrix
run: >-
print("All's good")
shell: python
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

pre-deploy:
name: Pre-Deploy
Expand Down Expand Up @@ -290,7 +295,7 @@ jobs:
run: |
make cythonize
- name: Build wheels
uses: pypa/cibuildwheel@v2.2.2
uses: pypa/cibuildwheel@v2.3.0
env:
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
- uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -323,7 +328,7 @@ jobs:
run: |
tree dist
- name: Make Release
uses: aio-libs/create-release@v1.2.3
uses: aio-libs/create-release@v1.3.1
with:
changes_file: CHANGES.rst
name: aiohttp
Expand Down
3 changes: 3 additions & 0 deletions CHANGES/6369.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixed the CI check used in the branch protection to gate merging PR, now
broken pull requests from ``Dependabot`` and others are not auto-merged
silently anymore -- :user:`webknjaz`.
8 changes: 5 additions & 3 deletions aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
)
from .cookiejar import CookieJar
from .helpers import (
_SENTINEL,
DEBUG,
PY_36,
BasicAuth,
Expand Down Expand Up @@ -191,7 +192,8 @@ class ClientSession:
]
)

_source_traceback = None
_source_traceback: Optional[traceback.StackSummary] = None
_connector: Optional[BaseConnector] = None

def __init__(
self,
Expand Down Expand Up @@ -252,7 +254,7 @@ def __init__(
if cookies is not None:
self._cookie_jar.update_cookies(cookies)

self._connector = connector # type: Optional[BaseConnector]
self._connector = connector
self._connector_owner = connector_owner
self._default_auth = auth
self._version = version
Expand Down Expand Up @@ -381,7 +383,7 @@ async def _request(
read_until_eof: bool = True,
proxy: Optional[StrOrURL] = None,
proxy_auth: Optional[BasicAuth] = None,
timeout: Union[ClientTimeout, object] = sentinel,
timeout: Union[ClientTimeout, _SENTINEL] = sentinel,
verify_ssl: Optional[bool] = None,
fingerprint: Optional[bytes] = None,
ssl_context: Optional[SSLContext] = None,
Expand Down
2 changes: 1 addition & 1 deletion aiohttp/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def __enter__(self) -> "BaseConnector":
return self

def __exit__(self, *exc: Any) -> None:
self.close()
self._close()

async def __aenter__(self) -> "BaseConnector":
return self
Expand Down
16 changes: 8 additions & 8 deletions aiohttp/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

import async_timeout
import attr
from multidict import MultiDict, MultiDictProxy
from multidict import MultiDict, MultiDictProxy, MultiMapping
from yarl import URL

from . import hdrs
Expand Down Expand Up @@ -747,11 +747,13 @@ class HeadersMixin:

ATTRS = frozenset(["_content_type", "_content_dict", "_stored_content_type"])

_headers: MultiMapping[str]

_content_type = None # type: Optional[str]
_content_dict = None # type: Optional[Dict[str, str]]
_stored_content_type = sentinel
_stored_content_type: Union[str, None, _SENTINEL] = sentinel

def _parse_content_type(self, raw: str) -> None:
def _parse_content_type(self, raw: Optional[str]) -> None:
self._stored_content_type = raw
if raw is None:
# default value according to RFC 2616
Expand All @@ -763,25 +765,23 @@ def _parse_content_type(self, raw: str) -> None:
@property
def content_type(self) -> str:
"""The value of content part for Content-Type HTTP header."""
raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore[attr-defined]
raw = self._headers.get(hdrs.CONTENT_TYPE)
if self._stored_content_type != raw:
self._parse_content_type(raw)
return self._content_type # type: ignore[return-value]

@property
def charset(self) -> Optional[str]:
"""The value of charset part for Content-Type HTTP header."""
raw = self._headers.get(hdrs.CONTENT_TYPE) # type: ignore[attr-defined]
raw = self._headers.get(hdrs.CONTENT_TYPE)
if self._stored_content_type != raw:
self._parse_content_type(raw)
return self._content_dict.get("charset") # type: ignore[union-attr]

@property
def content_length(self) -> Optional[int]:
"""The value of Content-Length HTTP header."""
content_length = self._headers.get( # type: ignore[attr-defined]
hdrs.CONTENT_LENGTH
)
content_length = self._headers.get(hdrs.CONTENT_LENGTH)

if content_length is not None:
return int(content_length)
Expand Down
3 changes: 2 additions & 1 deletion aiohttp/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from . import hdrs
from .abc import AbstractStreamWriter
from .helpers import (
_SENTINEL,
PY_36,
content_disposition_header,
guess_filename,
Expand Down Expand Up @@ -141,7 +142,7 @@ def __init__(
headers: Optional[
Union[_CIMultiDict, Dict[str, str], Iterable[Tuple[str, str]]]
] = None,
content_type: Optional[str] = sentinel,
content_type: Union[str, None, _SENTINEL] = sentinel,
filename: Optional[str] = None,
encoding: Optional[str] = None,
**kwargs: Any,
Expand Down
37 changes: 22 additions & 15 deletions aiohttp/web_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@
from urllib.parse import parse_qsl

import attr
from multidict import CIMultiDict, CIMultiDictProxy, MultiDict, MultiDictProxy
from multidict import (
CIMultiDict,
CIMultiDictProxy,
MultiDict,
MultiDictProxy,
MultiMapping,
)
from yarl import URL

from . import hdrs
from .abc import AbstractStreamWriter
from .helpers import (
_SENTINEL,
DEBUG,
ETAG_ANY,
LIST_QUOTED_ETAG_RE,
Expand Down Expand Up @@ -191,12 +198,12 @@ def __init__(
def clone(
self,
*,
method: str = sentinel,
rel_url: StrOrURL = sentinel,
headers: LooseHeaders = sentinel,
scheme: str = sentinel,
host: str = sentinel,
remote: str = sentinel,
method: Union[str, _SENTINEL] = sentinel,
rel_url: Union[StrOrURL, _SENTINEL] = sentinel,
headers: Union[LooseHeaders, _SENTINEL] = sentinel,
scheme: Union[str, _SENTINEL] = sentinel,
host: Union[str, _SENTINEL] = sentinel,
remote: Union[str, _SENTINEL] = sentinel,
) -> "BaseRequest":
"""Clone itself with replacement some attributes.
Expand Down Expand Up @@ -456,7 +463,7 @@ def raw_path(self) -> str:
return self._message.path

@reify
def query(self) -> "MultiDictProxy[str]":
def query(self) -> "MultiMapping[str]":
"""A multidict with all the variables in the query string."""
return MultiDictProxy(self._rel_url.query)

Expand All @@ -469,7 +476,7 @@ def query_string(self) -> str:
return self._rel_url.query_string

@reify
def headers(self) -> "CIMultiDictProxy[str]":
def headers(self) -> "MultiMapping[str]":
"""A case-insensitive multidict proxy with all headers."""
return self._headers

Expand Down Expand Up @@ -823,12 +830,12 @@ def __setattr__(self, name: str, val: Any) -> None:
def clone(
self,
*,
method: str = sentinel,
rel_url: StrOrURL = sentinel,
headers: LooseHeaders = sentinel,
scheme: str = sentinel,
host: str = sentinel,
remote: str = sentinel,
method: Union[str, _SENTINEL] = sentinel,
rel_url: Union[StrOrURL, _SENTINEL] = sentinel,
headers: Union[LooseHeaders, _SENTINEL] = sentinel,
scheme: Union[str, _SENTINEL] = sentinel,
host: Union[str, _SENTINEL] = sentinel,
remote: Union[str, _SENTINEL] = sentinel,
) -> "Request":
ret = super().clone(
method=method,
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ asynctest==0.13.0; python_version<"3.8"
attrs==21.2.0
Brotli==1.0.9
cchardet==2.1.7
charset-normalizer==2.0.7
charset-normalizer==2.0.8
frozenlist==1.2.0
gunicorn==20.1.0
idna-ssl==1.1.0; python_version<"3.7"
Expand Down
8 changes: 4 additions & 4 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ cffi==1.15.0
# pycares
cfgv==3.3.1
# via pre-commit
charset-normalizer==2.0.7
charset-normalizer==2.0.8
# via
# -r requirements/base.txt
# requests
Expand All @@ -50,7 +50,7 @@ click==8.0.3
# wait-for-it
click-default-group==1.2.2
# via towncrier
coverage==6.1.2
coverage==6.2
# via
# -r requirements/test.txt
# pytest-cov
Expand Down Expand Up @@ -128,7 +128,7 @@ platformdirs==2.4.0
# via virtualenv
pluggy==1.0.0
# via pytest
pre-commit==2.15.0
pre-commit==2.16.0
# via -r requirements/lint.txt
proxy.py==2.3.1
# via -r requirements/test.txt
Expand Down Expand Up @@ -185,7 +185,7 @@ six==1.16.0
# virtualenv
snowballstemmer==2.1.0
# via sphinx
sphinx==4.3.0
sphinx==4.3.1
# via
# -r requirements/doc.txt
# sphinxcontrib-asyncio
Expand Down
2 changes: 1 addition & 1 deletion requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ aiohttp-theme==0.1.6
# Temp fix till updated: https://github.com/blockdiag/blockdiag/pull/148
funcparserlib==1.0.0a0
pygments==2.10.0
sphinx==4.3.0
sphinx==4.3.1
sphinxcontrib-asyncio==0.3.0
sphinxcontrib-blockdiag==2.0.0
sphinxcontrib-towncrier==0.2.0a0
Expand Down
2 changes: 1 addition & 1 deletion requirements/lint.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r typing-extensions.txt
mypy==0.910; implementation_name=="cpython"
pre-commit==2.15.0
pre-commit==2.16.0
pytest==6.2.5
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r base.txt
Brotli==1.0.9
coverage==6.1.2
coverage==6.2
cryptography==36.0.0; platform_machine!="i686" # no 32-bit wheels; no python 3.9 wheels yet
freezegun==1.1.0
mypy==0.910; implementation_name=="cpython"
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ classifiers =
Topic :: Internet :: WWW/HTTP

[options]
python_requires = >=3.6
python_requires = >=3.7
packages = find:
# https://setuptools.readthedocs.io/en/latest/setuptools.html#setting-the-zip-safe-flag
zip_safe = False
Expand Down Expand Up @@ -136,6 +136,7 @@ filterwarnings =
# Temporarily ignore warnings internal to Python 3.9.7, can be removed again in 3.9.8.
ignore:The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.:DeprecationWarning:asyncio
ignore:Creating a LegacyVersion has been deprecated and will be removed in the next major release:DeprecationWarning::
ignore::ResourceWarning
junit_suite_name = aiohttp_test_suite
norecursedirs = dist docs build .tox .eggs
minversion = 3.8.2
Expand Down

0 comments on commit c9950d9

Please sign in to comment.