Skip to content

Allow any buffer type to written to BufferedFile (1.17) - #969

Closed
bz2 wants to merge 3 commits into
paramiko:1.17from
bz2:1.17_BufferedFile_write_buffers
Closed

bz2 wants to merge 3 commits into
paramiko:1.17from
bz2:1.17_BufferedFile_write_buffers

Conversation

@bz2

@bz2 bz2 commented May 25, 2017

Copy link
Copy Markdown
Contributor

Fixes #967

Also adds test coverage for writing various types to BufferedFile which required some small changes to the test LoopbackFile subclass, and a new skipUnlessBuiltin helper.

@bz2

bz2 commented May 25, 2017

Copy link
Copy Markdown
Contributor Author

One test failed on Python 2.6, not enough of the buffer api had been backported.

ERROR: test_write_bytearray (tests.test_file.BufferedFileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../paramiko/tests/test_file.py", line 203, in test_write_bytearray
    f.write(bytearray(12))
  File ".../paramiko/paramiko/file.py", line 384, in write
    self._write_all(data)
  File ".../paramiko/paramiko/file.py", line 501, in _write_all
    count = self._write(data)
  File ".../paramiko/tests/test_file.py", line 49, in _write
    self.buffer.write(data)
TypeError: write() argument 1 must be string or pinned buffer, not bytearray

Simple enough to skip the bytearray test on 2.6.

Fixes paramiko#967

Also adds test coverage for writing various types to
BufferedFile which required some small changes to the test
LoopbackFile subclass.

Change against the 1.17 branch.
@bz2
bz2 force-pushed the 1.17_BufferedFile_write_buffers branch from 0dd2fa7 to 2f74a9f Compare May 25, 2017 19:57
bz2 added a commit to bz2/paramiko that referenced this pull request May 26, 2017
Fixes paramiko#967 paramiko#968

Rollup of earlier branches proposed as paramiko#969 and paramiko#970 with
additional fix inside sftp_client.

Includes new tests for SFTPFile usage.

Change against the 1.17 branch.
@bitprophet

Copy link
Copy Markdown
Member

Rolling into the final PR. Thanks!

@bitprophet bitprophet closed this May 31, 2017
bitprophet pushed a commit that referenced this pull request Jun 9, 2017
Fixes #967 #968

Rollup of earlier branches proposed as #969 and #970 with
additional fix inside sftp_client.

Includes new tests for SFTPFile usage.

Change against the 1.17 branch.
dkhapun pushed a commit to cyberx-labs/paramiko that referenced this pull request Jun 7, 2018
Fixes paramiko#967 paramiko#968

Rollup of earlier branches proposed as paramiko#969 and paramiko#970 with
additional fix inside sftp_client.

Includes new tests for SFTPFile usage.

Change against the 1.17 branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants