python-filewrap 0.3.0__tar.gz → 0.3.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-filewrap
3
- Version: 0.3.0
3
+ Version: 0.3.0.1
4
4
  Summary: Python file wrappers.
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -839,7 +839,12 @@ def to_string_buffer(s: str, /) -> array:
839
839
  def to_bytes_buffer(b: Buffer, /) -> bytes | bytearray | memoryview:
840
840
  if isinstance(b, (bytes, bytearray)):
841
841
  return b
842
- return memoryview(b).cast("B")
842
+ view = memoryview(b)
843
+ if view.format == "B":
844
+ return view
845
+ if view.c_contiguous:
846
+ return view.cast("B")
847
+ return view.tobytes()
843
848
 
844
849
 
845
850
  def bio_chunk_iter(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-filewrap"
3
- version = "0.3.0"
3
+ version = "0.3.0.1"
4
4
  description = "Python file wrappers."
5
5
  authors = ["ChenyangGao <wosiwujm@gmail.com>"]
6
6
  license = "MIT"