Bug 2584211

Summary: awscli2 fails to build with Python 3.16: ValueError: Port could not be cast to integer value as 'a' / AssertionError
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: awscli2Assignee: Nikola Forró <nforro>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: davdunc, knivnia, ksurma, mhroncok, nforro
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2567340    

Description Karolina Surma 2026-11-25 15:25:18 UTC
awscli2 fails to build with Python 3.16.0a2.

There are two types of errors: 
- E           ValueError: Port could not be cast to integer value as 'a'
- AssertionError: '    Polls :py:meth:`MyService.Client.foo` every 1 seconds until a successful state is reached. An error is returned after 1 failed checks.' not found in "Help on method wait in module botocore.waiter:\n\nwait(**kwargs) method of botocore.waiter.MyService.Waiter.WaiterName instance\n    Polls :py:meth:`MyService.Client.foo` every 1 seconds until a\n    successful state is reached. An error is returned after 1 failed\n    checks.\n\n    **Request Syntax**\n    ::\n\n      waiter.wait(\n          bar='string',\n          WaiterConfig={\n              'Delay': 123,\n              'MaxAttempts': 123\n          }\n      )\n    :type bar: string\n    :param bar: Documents bar\n\n\n    :type WaiterConfig: dict\n    :param WaiterConfig:\n\n      A dictionary that provides parameters to control waiting behavior.\n\n\n\n\n      - **Delay** *(integer) --*\n\n        The amount of time in seconds to wait between attempts. Default: 1\n\n\n\n\n      - **MaxAttempts** *(integer) --*\n\n        The maximum number of attempts to be made. Default: 1\n\n\n\n\n\n\n    :returns: None\n\n"

_ test_endpoint_resolution_raises[ruleset29-input_params29-endpoint was invalid] _
[gw3] linux -- Python 3.16.0 /usr/bin/python3

partitions = OrderedDict({'partitions': [OrderedDict({'id': 'aws', 'outputs': OrderedDict({'dnsSuffix': 'amazonaws.com', 'dualStack...GovCloud (US-East)'}), 'us-gov-west-1': OrderedDict({'description': 'AWS GovCloud (US-West)'})})})], 'version': '1.1'})
ruleset = {'version': '1.3', 'parameters': {'Region': {'type': 'string', 'builtIn': 'AWS::Region'}, 'Endpoint': {'type': 'string...#path}'}, 'type': 'endpoint'}], 'type': 'tree'}, {'error': 'endpoint was invalid', 'conditions': [], 'type': 'error'}]}
input_params = {'Endpoint': 'http://abc.com:a/foo'}
expected_error = 'endpoint was invalid'

    @pytest.mark.parametrize(
        "ruleset,input_params,expected_error",
        ERROR_TEST_CASES,
    )
    def test_endpoint_resolution_raises(
        partitions, ruleset, input_params, expected_error
    ):
        endpoint_provider = EndpointProvider(ruleset, partitions)
        with pytest.raises(EndpointResolutionError) as exc_info:
>           endpoint_provider.resolve_endpoint(**input_params)

tests/unit/botocore/test_endpoint_provider.py:211: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/endpoint_provider.py:726: in resolve_endpoint
    return self._resolve_endpoint(**input_parameters)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/utils.py:1353: in inner
    return func_with_weakref(weakref.ref(self), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/utils.py:1346: in func_with_weakref
    return func(weakref_to_self(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/endpoint_provider.py:731: in _resolve_endpoint
    endpoint = self.ruleset.evaluate(input_parameters)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/endpoint_provider.py:705: in evaluate
    evaluation = rule.evaluate(input_parameters.copy(), self.rule_lib)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/endpoint_provider.py:546: in evaluate
    if self.evaluate_conditions(scope_vars, rule_lib):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/endpoint_provider.py:432: in evaluate_conditions
    result = rule_lib.call_function(func_signature, scope_vars)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/endpoint_provider.py:151: in call_function
    result = func(*func_args)
             ^^^^^^^^^^^^^^^^
../BUILDROOT/usr/lib/python3.16/site-packages/awscli/botocore/endpoint_provider.py:299: in parse_url
    url_components = urlparse(value)
                     ^^^^^^^^^^^^^^^
/usr/lib64/python3.16/urllib/parse.py:486: in urlparse
    scheme, netloc, url, params, query, fragment = _urlparse(url, scheme, allow_fragments)
                                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.16/urllib/parse.py:499: in _urlparse
    scheme, netloc, url, query, fragment = _urlsplit(url, scheme, allow_fragments)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib64/python3.16/urllib/parse.py:646: in _urlsplit
    _checknetloc(netloc)
/usr/lib64/python3.16/urllib/parse.py:547: in _checknetloc
    _validate_port(port)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

port = 'a'

    def _validate_port(port):
        if port.isdigit() and port.isascii():
            port = int(port)
        else:
>           raise ValueError(f"Port could not be cast to integer value as {port!r}")
E           ValueError: Port could not be cast to integer value as 'a'

/usr/lib64/python3.16/urllib/parse.py:166: ValueError
_______________ TestCreateWaiter.test_waiter_help_documentation ________________
[gw1] linux -- Python 3.16.0 /usr/bin/python3

self = <tests.unit.botocore.test_waiters.TestCreateWaiter testMethod=test_waiter_help_documentation>

    def test_waiter_help_documentation(self):
        waiter_name = 'WaiterName'
        waiter = create_waiter_with_client(
            waiter_name, self.waiter_model, self.client
        )
        with mock.patch('sys.stdout', io.StringIO()) as mock_stdout:
            help(waiter.wait)
        content = mock_stdout.getvalue()
        lines = [
            (
                '    Polls :py:meth:`MyService.Client.foo` every 1 '
                'seconds until a successful state is reached. An error '
                'is returned after 1 failed checks.'
            ),
            '    **Request Syntax**',
            '    ::',
            '      waiter.wait(',
            "          bar='string'",
            '      )',
            '    :type bar: string',
            '    :param bar: Documents bar',
            '    :returns: None',
        ]
        for line in lines:
>           self.assertIn(line, content)
E           AssertionError: '    Polls :py:meth:`MyService.Client.foo` every 1 seconds until a successful state is reached. An error is returned after 1 failed checks.' not found in "Help on method wait in module botocore.waiter:\n\nwait(**kwargs) method of botocore.waiter.MyService.Waiter.WaiterName instance\n    Polls :py:meth:`MyService.Client.foo` every 1 seconds until a\n    successful state is reached. An error is returned after 1 failed\n    checks.\n\n    **Request Syntax**\n    ::\n\n      waiter.wait(\n          bar='string',\n          WaiterConfig={\n              'Delay': 123,\n              'MaxAttempts': 123\n          }\n      )\n    :type bar: string\n    :param bar: Documents bar\n\n\n    :type WaiterConfig: dict\n    :param WaiterConfig:\n\n      A dictionary that provides parameters to control waiting behavior.\n\n\n\n\n      - **Delay** *(integer) --*\n\n        The amount of time in seconds to wait between attempts. Default: 1\n\n\n\n\n      - **MaxAttempts** *(integer) --*\n\n        The maximum number of attempts to be made. Default: 1\n\n\n\n\n\n\n    :returns: None\n\n"

tests/unit/botocore/test_waiters.py:820: AssertionError

https://docs.python.org/3.16/whatsnew/3.16.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.16/fedora-rawhide-x86_64/11359577-awscli2/

For all our attempts to build awscli2 with Python 3.16, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.16/package/awscli2/

Testing and mass rebuild of packages is happening in copr.
You can follow these instructions to test locally in mock if your package builds with Python 3.16:
https://copr.fedorainfracloud.org/coprs/g/python/python3.16/

Let us know here if you have any questions.

Python 3.16 is planned to be included in Fedora 47.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.16.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires),
so if this package is required a lot, it's important for us to get it fixed soon.

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.