Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9ba956

Browse files
authored
new_buffer_error (#6243)
1 parent9792001 commitc9ba956

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

‎Lib/test/test_binascii.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ def test_base64_roundtrip(self, binary, newline):
490490
restored=binascii.a2b_base64(self.type2test(converted))
491491
self.assertConversion(binary,converted,restored,newline=newline)
492492

493-
@unittest.expectedFailure# TODO: RUSTPYTHON
494493
deftest_c_contiguity(self):
495494
m=memoryview(bytearray(b'noncontig'))
496495
noncontig_writable=m[::-2]

‎Lib/test/test_ssl.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,6 @@ def test_pending(self):
18111811
bio.read()
18121812
self.assertEqual(bio.pending,0)
18131813

1814-
@unittest.expectedFailure# TODO: RUSTPYTHON
18151814
deftest_buffer_types(self):
18161815
bio=ssl.MemoryBIO()
18171816
bio.write(b'foo')

‎vm/src/function/buffer.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl PyObject {
2222
buffer
2323
.as_contiguous()
2424
.map(|x|f(&x))
25-
.ok_or_else(|| vm.new_type_error("non-contiguous buffer is not a bytes-like object"))
25+
.ok_or_else(|| vm.new_buffer_error("non-contiguous buffer is not a bytes-like object"))
2626
}
2727

2828
pubfntry_rw_bytes_like<R>(
@@ -81,7 +81,7 @@ impl<'a> TryFromBorrowedObject<'a> for ArgBytesLike {
8181
if buffer.desc.is_contiguous(){
8282
Ok(Self(buffer))
8383
}else{
84-
Err(vm.new_type_error("non-contiguous buffer is not a bytes-like object"))
84+
Err(vm.new_buffer_error("non-contiguous buffer is not a bytes-like object"))
8585
}
8686
}
8787
}
@@ -121,7 +121,7 @@ impl<'a> TryFromBorrowedObject<'a> for ArgMemoryBuffer {
121121
fntry_from_borrowed_object(vm:&VirtualMachine,obj:&'aPyObject) ->PyResult<Self>{
122122
let buffer =PyBuffer::try_from_borrowed_object(vm, obj)?;
123123
if !buffer.desc.is_contiguous(){
124-
Err(vm.new_type_error("non-contiguous buffer is not a bytes-like object"))
124+
Err(vm.new_buffer_error("non-contiguous buffer is not a bytes-like object"))
125125
}elseif buffer.desc.readonly{
126126
Err(vm.new_type_error("buffer is not a read-write bytes-like object"))
127127
}else{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp