Skip to content

Commit 14da182

Browse files
committed
Merge branch 'develop' into master
* develop: Update CHANGELOG.md [hdfs] Make CliRawOutputBase.write return number of bytes written (#920) Bump the github-actions group with 2 updates (#919)
2 parents 7d0b128 + ac4ca96 commit 14da182

4 files changed

Lines changed: 25 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ jobs:
3232
python -m build
3333
3434
- name: Upload package distributions as release assets
35-
uses: softprops/action-gh-release@v2.6.1
35+
uses: softprops/action-gh-release@v3.0.0
3636
with:
3737
files: dist/*
3838

3939
# https://github.com/pypa/gh-action-pypi-publish#trusted-publishing
4040
- name: Publish package distributions to PyPI
41-
uses: pypa/gh-action-pypi-publish@v1.13.0
41+
uses: pypa/gh-action-pypi-publish@v1.14.0
4242

4343
- uses: apexskier/github-release-commenter@v1.4.1
4444
with:

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 7.6.1, 2026-05-09
2+
3+
- Bump the github-actions group with 2 updates (PR [#919](https://github.com/piskvorky/smart_open/pull/919), [@dependabot[bot]](https://github.com/apps/dependabot))
4+
- [hdfs] Make CliRawOutputBase.write return number of bytes written (PR [#920](https://github.com/piskvorky/smart_open/pull/920), [@LiuGuH](https://github.com/LiuGuH))
5+
16
# 7.6.0, 2026-04-13
27

38
- Bump softprops/action-gh-release from 2.5.0 to 2.6.1 in the github-actions group (PR [#918](https://github.com/piskvorky/smart_open/pull/918), [@dependabot[bot]](https://github.com/apps/dependabot))

smart_open/hdfs.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,17 @@ def seekable(self):
151151
return False
152152

153153
def write(self, b):
154-
self._sub.stdin.write(b)
154+
"""Write the given buffer to the underlying raw stream.
155+
156+
Returns the number of bytes written, as required by
157+
:class:`io.RawIOBase`. Without this return value, callers that wrap
158+
this stream and rely on the documented ``write`` contract (for
159+
example, ``ray._private.external_storage._write_multiple_objects``,
160+
which asserts ``written_bytes == payload_len``) fail with an
161+
``AssertionError`` because ``write`` would otherwise implicitly
162+
return ``None``.
163+
"""
164+
return self._sub.stdin.write(b)
155165

156166
#
157167
# io.IOBase methods.

tests/test_hdfs.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,15 @@ def test_write(schema):
110110
expected = 'мы в ответе за тех, кого приручили'
111111
mocked_cat = cat()
112112

113+
payload = expected.encode('utf-8')
113114
with mock.patch('subprocess.Popen', return_value=mocked_cat):
114115
with smart_open.hdfs.CliRawOutputBase(f'{schema}://dummy/url') as fout:
115-
fout.write(expected.encode('utf-8'))
116+
written = fout.write(payload)
117+
118+
# CliRawOutputBase implements io.RawIOBase, whose write() contract is to
119+
# return the number of bytes written. Returning None breaks callers like
120+
# ray._private.external_storage that assert on the return value.
121+
assert written == len(payload)
116122

117123
actual = mocked_cat.stdout.read().decode('utf-8')
118124
assert actual == expected

0 commit comments

Comments
 (0)