Skip to content
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

Revert "[BEAM-5878] support DoFns with Keyword-only arguments" #9517

Merged
merged 1 commit into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions sdks/python/apache_beam/internal/pickler.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,31 +136,6 @@ def _reject_generators(unused_pickler, unused_obj):

dill.dill.Pickler.dispatch[types.GeneratorType] = _reject_generators

# TODO: Remove this once uqfoundation/dill#313 is fixed
if sys.version_info[0] > 2:
# Monkey patch for dill._dill.Pickler to pickle functions
# with keyword-only args
_create_function = dill.dill._create_function

def _create_function_has_kwdefaults(fcode, fglobals, fname=None,
fdefaults=None, fclosure=None, fdict=None,
fkwdefaults=None):
func = _create_function(fcode, fglobals, fname, fdefaults, fclosure, fdict)
func.__kwdefaults__ = fkwdefaults
return func

def new_save_reduce(self, func, args, *other_args, **kwargs):
pickler = super(dill.dill.Pickler, self)
obj = kwargs['obj'] if 'obj' in kwargs else None
if (func is _create_function and obj is not None
and getattr(obj, '__kwdefaults__', None) is not None):
pickler.save_reduce(_create_function_has_kwdefaults,
args + (getattr(obj, '__kwdefaults__', None),),
*other_args, **kwargs)
else:
pickler.save_reduce(func, args, *other_args, **kwargs)

dill._dill.Pickler.save_reduce = new_save_reduce

# This if guards against dill not being full initialized when generating docs.
if 'save_module' in dir(dill.dill):
Expand Down

This file was deleted.