Skip to content

Python compatibility clarifications #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 11, 2019
Merged

Conversation

pavel-kirienko
Copy link
Member

Python 3.5.2 turned out to be unsupported because there was an issue in the static typing library: python/typing#308. The issue has been fixed in Python 3.5.3, so all newer versions function correctly. This is how you can reproduce the problem:

>>> import typing
>>> T = typing.TypeVar('T')
>>> G = typing.Callable[[], T]
>>> G[int]
typing.Callable[[], int]

The above is the expected behavior observable in Python 3.5.3+. In 3.5.2 you get this instead:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.5/typing.py", line 815, in __getitem__
    raise TypeError("This Callable type is already parameterized.")
TypeError: This Callable type is already parameterized.

An alternative solution would be to remove the offending type annotations, which you can look at here:

https://github.com/UAVCAN/pydsdl/blob/9a0bd72b4fd298e96c57f77e3c9a48b6fe1ee70a/pydsdl/_expression.py#L563-L565

However, I would rather not do that because that would require us to plaster the code with linter suppression comments and doing so for the sake of an ancient version of the interpreter (which will be EOLed next year) doesn't seem particularly sensible.

Should we accept this change, or should we add workarounds instead and retain compatibility with all v3.5.x?

@pavel-kirienko pavel-kirienko added class-defect question Further information is requested labels May 8, 2019
@pavel-kirienko pavel-kirienko self-assigned this May 8, 2019
@coveralls
Copy link

coveralls commented May 8, 2019

Pull Request Test Coverage Report for Build 232

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 225: 0.0%
Covered Lines: 2658
Relevant Lines: 2658

💛 - Coveralls

pavel-kirienko added a commit to OpenCyphal/specification that referenced this pull request May 8, 2019
@pavel-kirienko pavel-kirienko merged commit 82e6ff9 into master May 11, 2019
@pavel-kirienko pavel-kirienko deleted the py3.5-compat-fix branch May 11, 2019 15:27
@thirtytwobits
Copy link
Member

Sorry I didn't comment on this sooner. I'm okay with this stipulation. Nunavut uses python 3.5.7 as it's minimal support target (i.e. our python tox container uses 3.5.7).

Have you considered enabling tox for this project?

We should also discuss standardizing the UAVCAN python tools since nunavut uses a different set of them than pydsdl. This is fine for now but at some point we'll tire of supporting so many external dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
class-defect question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants