Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1838327 - pcs fails to build with Python 3.9: AttributeError: __args__ and AttributeError: type object 'Mapping' has no attribute '_special'
Summary: pcs fails to build with Python 3.9: AttributeError: __args__ and AttributeErr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcs
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ondrej Mular
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1841655 (view as bug list)
Depends On:
Blocks: F33FTBFS F33FailsToInstall PYTHON39
TreeView+ depends on / blocked
 
Reported: 2020-05-20 22:19 UTC by Miro Hrončok
Modified: 2020-07-21 10:03 UTC (History)
11 users (show)

Fixed In Version: pcs-0.10.5-6.fc33 pcs-0.10.5-8.fc33
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-03 13:16:19 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Miro Hrončok 2020-05-20 22:19:45 UTC
pcs fails to build with Python 3.9.0b1.

ERROR: test_success (pcs_test.tier0.cli.resource.test_relations.ShowResourceRelationsCmd)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/types.py", line 99, in _has_specified_inner_types
    return not type_._special
  File "/usr/lib64/python3.9/typing.py", line 639, in __getattr__
    return getattr(self.__origin__, attr)
AttributeError: type object 'Mapping' has no attribute '_special'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/mock.py", line 1337, in patched
    return func(*newargs, **newkeywargs)
  File "/builddir/build/BUILD/pcs-67591ed1487cb0aefa181fdfc166c8a66b55d25a/pcs_test/tier0/cli/resource/test_relations.py", line 100, in test_success
    relations.show_resource_relations_cmd(
  File "/builddir/build/BUILD/pcs-67591ed1487cb0aefa181fdfc166c8a66b55d25a/pcs/cli/resource/relations.py", line 37, in show_resource_relations_cmd
    dto.from_dict(
  File "/builddir/build/BUILD/pcs-67591ed1487cb0aefa181fdfc166c8a66b55d25a/pcs/common/interface/dto.py", line 40, in from_dict
    return dacite.from_dict(
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/core.py", line 59, in from_dict
    value = _build_value(type_=field.type, data=transformed_value, config=config)
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/core.py", line 86, in _build_value
    return from_dict(data_class=type_, data=data, config=config)
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/core.py", line 59, in from_dict
    value = _build_value(type_=field.type, data=transformed_value, config=config)
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/core.py", line 84, in _build_value
    return _build_value_for_collection(collection=type_, data=data, config=config)
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/core.py", line 107, in _build_value_for_collection
    if is_instance(data, Mapping):
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/types.py", line 79, in is_instance
    if not _has_specified_inner_types(type_):
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/types.py", line 101, in _has_specified_inner_types
    return bool(extract_generic(type_))
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/types.py", line 115, in extract_generic
    return type_.__args__  # type: ignore
  File "/usr/lib64/python3.9/typing.py", line 640, in __getattr__
    raise AttributeError(attr)
AttributeError: __args__


See https://docs.python.org/3.9/whatsnew/changelog.html?highlight=__args__#id2 (search for __args__) "Removed attributes __args__ and __parameters__ from special generic aliases like typing.List (not subscripted)" https://bugs.python.org/issue40397

See similar related fixes in sphinx:

https://github.com/sphinx-doc/sphinx/commit/46372726

And in hypothesis:

https://github.com/HypothesisWorks/hypothesis/pull/2441


For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/fedora-rawhide-x86_64/01396301-pcs/

For all our attempts to build pcs with Python 3.9, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/package/pcs/

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.9:
https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Let us know here if you have any questions.

Python 3.9 will be included in Fedora 33. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.9.
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.

Comment 1 Miro Hrončok 2020-05-20 22:20:32 UTC
  File "/builddir/build/BUILDROOT/pcs-0.10.5-4.fc33.x86_64/usr/lib/pcs/bundled/packages/dacite/types.py", line 99, in _has_specified_inner_types
    return not type_._special

Try replacing it with: return not getattr(type_, '_special', False)

Comment 2 Ondrej Mular 2020-05-22 06:51:15 UTC
Thank you for reporting this issue and even suggesting a possible solution. The problem is in bundled library dacite so, I'll report this issue in their upstream and I'll update pcs package as soon as we have a patch.

Comment 3 Miro Hrončok 2020-05-25 13:02:12 UTC
This comment is mass posted to all bugs blocking the Python 3.9 tracker, sorry if it is not 100 % relevant. When in doubt, please ask.


The Python 3.9 rebuild is in progress in a Koji side tag.

If you fix this bug, please don't rebuild the package in regular rawhide, but do it in the side tag with:

    $ fedpkg build --target=f33-python

The rebuild is progressing slowly and it is possible this package won't have all the required build dependencies yet. If that's the case, please just leave the fix committed and pushed and we will eventually rebuild it for you.

You are not asked to go and try rebuild all the missing dependencies yourself. If you know there is a bootstrap loop in the dependencies, let me know and we can untangle it together.

If you want to test your fix or reproduce the failure, you can still use the Copr repo mentioned in the initial comment of this bug: https://copr.fedorainfracloud.org/coprs/g/python/python3.9/

Comment 4 Ondrej Mular 2020-05-27 13:32:59 UTC
I filed an issue in dacite upstream: https://github.com/konradhalas/dacite/issues/98

Comment 5 Miro Hrončok 2020-05-29 07:12:02 UTC
Python 3.9 update: The f33-python side tag is currently being merged.

New builds in f33-python are no longer possible, but python3 is not yet updated to Python 3.9 in rawhide. You can check when Python is Python 3.9 with:

    $ koji wait-repo f33-build --build python3.9-3.9.0~b1-3.fc3

And build the packages normally after that.

Comment 6 Tomáš Hrnčiar 2020-06-09 08:54:53 UTC
*** Bug 1841655 has been marked as a duplicate of this bug. ***

Comment 7 Ondrej Mular 2020-07-03 13:16:19 UTC
Temporarily we'll use a patched version of dacite (which works fine in our use case) until there is an upstream version with Python 3.9 support.

Comment 8 Fedora Update System 2020-07-21 10:03:18 UTC
FEDORA-2020-0a4ce6ab7e has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.