[ 
https://issues.apache.org/jira/browse/BEAM-6709?focusedWorklogId=201138&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-201138
 ]

ASF GitHub Bot logged work on BEAM-6709:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 20/Feb/19 08:12
            Start Date: 20/Feb/19 08:12
    Worklog Time Spent: 10m 
      Work Description: charlesccychen commented on pull request #7873: 
[BEAM-6709] Check tuple typing failure.
URL: https://github.com/apache/beam/pull/7873#discussion_r258371039
 
 

 ##########
 File path: sdks/python/apache_beam/typehints/native_type_compatibility.py
 ##########
 @@ -37,14 +38,33 @@
 
 def _get_arg(typ, index):
   """Returns the index-th argument to the given type."""
-  return typ.__args__[index]
+  try:
+    return typ.__args__[index]
+  except AttributeError:
+    if (3, 0, 0) <= sys.version_info[0:3] < (3, 5, 3):
+      # On Python versions < 3.5.3, the Tuple and Union type from typing do
+      # not have an __args__ attribute, but a __tuple_params__, and a
+      # __union_params__ and __union_set_params__ argument respectively.
+      args = next(value for key, value in typ.__dict__.items()
 
 Review comment:
   I sent out https://github.com/apache/beam/pull/7902 to implement 
@tvalentyn's suggestion
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 201138)
    Time Spent: 1h 20m  (was: 1h 10m)

> Typehinting depends on typing changes in Python 3.5.3
> -----------------------------------------------------
>
>                 Key: BEAM-6709
>                 URL: https://issues.apache.org/jira/browse/BEAM-6709
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: Robbe
>            Priority: Major
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> On Python versions < 3.5.3, the Tuple and Union type from typing do not have 
> an `__args__` attribute, but a `__tuple_params__`, and a `__union_params__` 
> and `__union_set_params__` argument respectively.
> The current implementation fails <3.5.3 since it depends on the `__args__` 
> attribute



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to