Skip to content

"TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'TypeVar'" #1

@luukasahola

Description

@luukasahola

While running the test script on the repository page, Python gives out the following error output:

Traceback (most recent call last):
  File "/home/luukas/stv/stv-test.py", line 1, in <module>
    from stvpoll.scottish_stv import ScottishSTV
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/scottish_stv.py", line 3, in <module>
    from stvpoll.abcs import STVPollBase
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/abcs.py", line 15, in <module>
    from .tiebreak_strategies import (
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/tiebreak_strategies.py", line 8, in <module>
    class TiebreakStrategy(Protocol):
  File "/home/luukas/.local/lib/python3.9/site-packages/stvpoll/tiebreak_strategies.py", line 14, in TiebreakStrategy
    ) -> Candidates | Candidate:  # pragma: no coverage
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'TypeVar'

The following output was produced with the following workflow:

> pip3 install STVpoll
> # Inserted the Scottish STV example to stv-test.py
> doas chmod +x stv-test.py
> python3 stv-test.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions