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

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

                Author: ASF GitHub Bot
            Created on: 18/Sep/18 22:43
            Start Date: 18/Sep/18 22:43
    Worklog Time Spent: 10m 
      Work Description: RobbeSneyders commented on a change in pull request 
#6424: [BEAM-5324] Partially port unpackaged modules to Python 3
URL: https://github.com/apache/beam/pull/6424#discussion_r218618418
 
 

 ##########
 File path: sdks/python/apache_beam/runners/worker/operations.py
 ##########
 @@ -496,7 +496,8 @@ def __init__(self, name_context, spec, counter_factory, 
state_sampler):
     fn, args, kwargs = pickler.loads(self.spec.combine_fn)[:3]
     self.combine_fn = curry_combine_fn(fn, args, kwargs)
     if (getattr(fn.add_input, 'im_func', None)
-        is core.CombineFn.add_input.__func__):
+        is getattr(core.CombineFn.add_input, '__func__',
 
 Review comment:
   On Python 2, getting a method from a class returns an unbound method, with a 
reference to the wrapped function stored in `__func__`.
   On Pyhon 3, getting a method from a class returns the function itself.
   
   On Python 2.6+, `im_func` is also available as `__func__`, so we can change 
it to
   ```Python
   if (getattr(fn.add_input, '__func__', None)
       is is getattr(core.CombineFn.add_input, '__func__',
                     core.CombineFn.add_input)):
   ```
   if this is more clear.

----------------------------------------------------------------
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: 145513)
    Time Spent: 40m  (was: 0.5h)

> Finish Python 3 porting for unpackaged files
> --------------------------------------------
>
>                 Key: BEAM-5324
>                 URL: https://issues.apache.org/jira/browse/BEAM-5324
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-py-core
>            Reporter: Robbe
>            Assignee: Robbe
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>




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

Reply via email to