Skip to content

Commit

Permalink
Merge pull request ceph#6711 from jdurgin/wip-13880
Browse files Browse the repository at this point in the history
pybind: decode empty string in conf_parse_argv() correctly

Reviewed-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Nov 27, 2015
2 parents 4b80b30 + f76d5d6 commit 9ab820f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/pybind/rados.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,7 @@ def conf_parse_argv(self, args):

# cretargs was allocated with fixed length; collapse return
# list to eliminate any missing args

retargs = [decode_cstr(a) for a in cretargs if a is not None]
retargs = [a.decode('utf-8') for a in cretargs if a is not None]
self.parsed_args = args
return retargs

Expand Down
5 changes: 5 additions & 0 deletions src/test/pybind/test_rados.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def test_ioctx_context_manager():
with conn.open_ioctx('rbd') as ioctx:
pass

def test_parse_argv_empty_str():
args = ['']
r = Rados()
eq(args, r.conf_parse_argv(args))

class TestRequires(object):
@requires(('foo', str), ('bar', int), ('baz', int))
def _method_plain(self, foo, bar, baz):
Expand Down

0 comments on commit 9ab820f

Please sign in to comment.