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

Fix BUG: Exception when PYTHONOPTIMIZE=2 #7434

Merged
merged 5 commits into from
Feb 26, 2021
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
9 changes: 5 additions & 4 deletions python/cudf/cudf/core/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -7517,10 +7517,11 @@ def merge(left, right, *args, **kwargs):

# a bit of fanciness to inject docstring with left parameter
merge_doc = DataFrame.merge.__doc__
idx = merge_doc.find("right")
merge.__doc__ = "".join(
[merge_doc[:idx], "\n\tleft : DataFrame\n\t", merge_doc[idx:]]
)
if merge_doc is not None:
idx = merge_doc.find("right")
merge.__doc__ = "".join(
[merge_doc[:idx], "\n\tleft : DataFrame\n\t", merge_doc[idx:]]
)


def _align_indices(lhs, rhs):
Expand Down
3 changes: 2 additions & 1 deletion python/cudf/cudf/utils/docutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def docfmt(**kwargs):

def outer(fn):
buf = []
if fn.__doc__ is None:
return fn
formatsiter = string.Formatter().parse(fn.__doc__)
for literal, field, fmtspec, conv in formatsiter:
assert conv is None
Expand All @@ -44,7 +46,6 @@ def outer(fn):
buf.extend([indent + ln for ln in valuelines[1:]])
else:
buf.append(kwargs[field])

fn.__doc__ = "".join(buf)
return fn

Expand Down