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

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

                Author: ASF GitHub Bot
            Created on: 07/May/19 05:36
            Start Date: 07/May/19 05:36
    Worklog Time Spent: 10m 
      Work Description: NikeNano commented on pull request #8453: [BEAM-6985] 
TypeHints Py3 Error: Native type compatibility tests fail on Python 3.7+ Updates
URL: https://github.com/apache/beam/pull/8453#discussion_r281466436
 
 

 ##########
 File path: sdks/python/apache_beam/typehints/native_type_compatibility.py
 ##########
 @@ -84,19 +84,38 @@ def _safe_issubclass(derived, parent):
     issubclass(derived, parent), or False if a TypeError was raised.
   """
   try:
-    return issubclass(derived, parent)
+    if type(derived) == typing._GenericAlias:
+      out = issubclass(derived.__origin__, parent.__origin__)
+    else:
+      out = issubclass(derived, parent)
+    return out
   except TypeError:
     return False
+  except AttributeError:
+    try:
+      out = issubclass(derived, parent)
+      return out
+    except TypeError:
+      return False
 
 
 def _match_issubclass(match_against):
   return lambda user_type: _safe_issubclass(user_type, match_against)
 
 
+def _matcher_(derived, parent):
+  """ Follow structure of _safe_issubclass
+  but uses __orign__ due to updates in typing package of python3"""
+  try:
+    return derived.__origin__ is parent
 
 Review comment:
   Same as above, but would be great if you could elaborate on why you think it 
might be needed? Maybe I am missing something. 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

    Worklog Id:     (was: 238260)
    Time Spent: 1.5h  (was: 1h 20m)

> TypeHints Py3 Error: Native type compatibility tests fail on Python 3.7+
> ------------------------------------------------------------------------
>
>                 Key: BEAM-6985
>                 URL: https://issues.apache.org/jira/browse/BEAM-6985
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: niklas Hansson
>            Priority: Major
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> The following tests are failing:
> * test_convert_nested_to_beam_type 
> (apache_beam.typehints.native_type_compatibility_test.NativeTypeCompatibilityTest)
>  
> * test_convert_to_beam_type 
> (apache_beam.typehints.native_type_compatibility_test.NativeTypeCompatibilityTest)
>  
> * test_convert_to_beam_types 
> (apache_beam.typehints.native_type_compatibility_test.NativeTypeCompatibilityTest)
> With similar errors, where `typing.<Type> != <Type>`. eg:
> {noformat}
>  FAIL: test_convert_to_beam_type 
> (apache_beam.typehints.native_type_compatibility_test.NativeTypeCompatibilityTest)
>  ----------------------------------------------------------------------
>  Traceback (most recent call last):
>  File 
> "/home/jenkins/jenkins-slave/workspace/beam_PreCommit_Python_Commit/src/sdks/python/test-suites/tox/py37/build/srcs/sdks/python/apache_beam/typehints/native_type_compatibility_test.py",
>  line 79, in test_convert_to_beam_type
>  beam_type, description)
>  AssertionError: typing.Dict[bytes, int] != Dict[bytes, int] : simple dict
> {noformat}
>  



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

Reply via email to