pathrs 0.2.6__tar.gz → 0.2.7__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: pathrs
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: Python bindings for libpathrs, a safe path resolution library for Linux.
5
5
  Author-email: Aleksa Sarai <cyphar@cyphar.com>
6
6
  Maintainer-email: Aleksa Sarai <cyphar@cyphar.com>
@@ -40,6 +40,12 @@ else:
40
40
 
41
41
 
42
42
  def _cstr(pystr: str) -> CString:
43
+ # C cannot express embedded nul bytes which means that paths and other
44
+ # string arguments get silently truncated (as ffi.new("char[]") happily
45
+ # copies them over), which results in unexpected behaviour for Python
46
+ # users. Python raises a ValueError in this case so just emulate that.
47
+ if "\0" in pystr:
48
+ raise ValueError(f"embedded null character in string {pystr!r}")
43
49
  return ffi.new("char[]", pystr.encode("utf8"))
44
50
 
45
51
 
@@ -158,7 +164,7 @@ class WrappedFd:
158
164
  pathrs will return WrappedFds for most operations that return an fd.
159
165
  """
160
166
 
161
- _fd: int | None
167
+ _fd: int | None = None
162
168
 
163
169
  def __init__(self, file: FileLike, /):
164
170
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pathrs
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: Python bindings for libpathrs, a safe path resolution library for Linux.
5
5
  Author-email: Aleksa Sarai <cyphar@cyphar.com>
6
6
  Maintainer-email: Aleksa Sarai <cyphar@cyphar.com>
@@ -21,7 +21,7 @@ build-backend = "setuptools.build_meta"
21
21
  [project]
22
22
  name = "pathrs"
23
23
  # TODO: Figure out a way to keep this version up-to-date with Cargo.toml.
24
- version = "0.2.6"
24
+ version = "0.2.7"
25
25
  description = "Python bindings for libpathrs, a safe path resolution library for Linux."
26
26
  readme = "README.md"
27
27
  keywords = ["libpathrs", "pathrs"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes