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

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

                Author: ASF GitHub Bot
            Created on: 02/Apr/18 21:54
            Start Date: 02/Apr/18 21:54
    Worklog Time Spent: 10m 
      Work Description: RobbeSneyders commented on a change in pull request 
#4990: [BEAM-3981] [WIP] Futurize and fix python 2 compatibility for coders 
subpackage
URL: https://github.com/apache/beam/pull/4990#discussion_r178661554
 
 

 ##########
 File path: sdks/python/apache_beam/coders/typecoders_test.py
 ##########
 @@ -33,14 +39,18 @@ def __init__(self, n):
   def __eq__(self, other):
     return self.number == other.number
 
+  def __hash__(self):
+    return self.number
+
 
 class CustomCoder(coders.Coder):
 
   def encode(self, value):
-    return str(value.number)
+    x = value.number
+    return int(x).to_bytes((x.bit_length() + 7) // 8, 'big', signed=True)
 
 Review comment:
   That would be simpler indeed. It clashed with the cython bytes, since 
`str().encode('latin-1')` will return `newbytes` with the future package. 
   However, seems like we need to fix this cython bytes issue anyway, so I have 
changed it back. This is the drawback of working on a per module basis I guess 
:)

----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 86797)
    Time Spent: 4h 20m  (was: 4h 10m)

> Futurize and fix python 2 compatibility for coders package
> ----------------------------------------------------------
>
>                 Key: BEAM-3981
>                 URL: https://issues.apache.org/jira/browse/BEAM-3981
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: Ahmet Altay
>            Priority: Major
>          Time Spent: 4h 20m
>  Remaining Estimate: 0h
>
> Run automatic conversion with futurize tool on coders subpackage and fix 
> python 2 compatibility. This prepares the subpackage for python 3 support.



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

Reply via email to