c2pa-python 0.32.11__tar.gz → 0.32.12__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.
Files changed (22) hide show
  1. {c2pa_python-0.32.11/src/c2pa_python.egg-info → c2pa_python-0.32.12}/PKG-INFO +1 -1
  2. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/pyproject.toml +1 -1
  3. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa/c2pa.py +41 -14
  4. {c2pa_python-0.32.11 → c2pa_python-0.32.12/src/c2pa_python.egg-info}/PKG-INFO +1 -1
  5. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/LICENSE-APACHE +0 -0
  6. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/LICENSE-MIT +0 -0
  7. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/MANIFEST.in +0 -0
  8. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/README.md +0 -0
  9. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/requirements.txt +0 -0
  10. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/scripts/download_artifacts.py +0 -0
  11. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/setup.cfg +0 -0
  12. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/setup.py +0 -0
  13. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa/__init__.py +0 -0
  14. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa/build.py +0 -0
  15. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa/lib.py +0 -0
  16. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa_python.egg-info/SOURCES.txt +0 -0
  17. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa_python.egg-info/dependency_links.txt +0 -0
  18. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa_python.egg-info/entry_points.txt +0 -0
  19. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa_python.egg-info/requires.txt +0 -0
  20. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/src/c2pa_python.egg-info/top_level.txt +0 -0
  21. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/tests/test_unit_tests.py +0 -0
  22. {c2pa_python-0.32.11 → c2pa_python-0.32.12}/tests/test_unit_tests_threaded.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: c2pa-python
3
- Version: 0.32.11
3
+ Version: 0.32.12
4
4
  Summary: Python bindings for the C2PA Content Authenticity Initiative (CAI) library
5
5
  Author-email: Gavin Peacock <gvnpeacock@adobe.com>, Tania Mathern <mathern@adobe.com>
6
6
  Maintainer-email: Gavin Peacock <gpeacock@adobe.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "c2pa-python"
7
- version = "0.32.11"
7
+ version = "0.32.12"
8
8
  requires-python = ">=3.10"
9
9
  description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
10
10
  readme = { file = "README.md", content-type = "text/markdown" }
@@ -1425,7 +1425,12 @@ class Settings(ManagedResource):
1425
1425
  super().__init__()
1426
1426
 
1427
1427
  ptr = _lib.c2pa_settings_new()
1428
- _check_ffi_operation_result(ptr, "Failed to create Settings")
1428
+ try:
1429
+ _check_ffi_operation_result(ptr, "Failed to create Settings")
1430
+ except Exception:
1431
+ if ptr:
1432
+ ManagedResource._free_native_ptr(ptr)
1433
+ raise
1429
1434
 
1430
1435
  self._handle = ptr
1431
1436
  self._lifecycle_state = LifecycleState.ACTIVE
@@ -1807,7 +1812,17 @@ class Stream:
1807
1812
  if not data or length <= 0:
1808
1813
  return -1
1809
1814
 
1810
- buffer = self._file_like_stream.read(length)
1815
+ stream = self._file_like_stream
1816
+ readinto = getattr(stream, "readinto", None)
1817
+ if readinto is not None:
1818
+ # Most streams have readinto
1819
+ buf = (ctypes.c_char * length).from_address(
1820
+ ctypes.addressof(data.contents))
1821
+ n = readinto(buf)
1822
+ return n if n else 0
1823
+
1824
+ # Fallback for streams without readinto.
1825
+ buffer = stream.read(length)
1811
1826
  if not buffer: # EOF
1812
1827
  return 0
1813
1828
 
@@ -1841,8 +1856,10 @@ class Stream:
1841
1856
  if not self._initialized or self._closed:
1842
1857
  return -1
1843
1858
  try:
1844
- file_stream.seek(offset, whence)
1845
- return file_stream.tell()
1859
+ # Fall back to tell() only for stream objects that do not
1860
+ # return the new absolute position and return None.
1861
+ pos = file_stream.seek(offset, whence)
1862
+ return pos if pos is not None else file_stream.tell()
1846
1863
  except Exception:
1847
1864
  return -1
1848
1865
 
@@ -2403,11 +2420,16 @@ class Reader(ManagedResource):
2403
2420
  reader_ptr = _lib.c2pa_reader_from_context(
2404
2421
  context.execution_context,
2405
2422
  )
2406
- _check_ffi_operation_result(reader_ptr,
2407
- Reader._ERROR_MESSAGES[
2408
- 'reader_error'
2409
- ].format("Unknown error")
2410
- )
2423
+ try:
2424
+ _check_ffi_operation_result(reader_ptr,
2425
+ Reader._ERROR_MESSAGES[
2426
+ 'reader_error'
2427
+ ].format("Unknown error")
2428
+ )
2429
+ except Exception:
2430
+ if reader_ptr:
2431
+ ManagedResource._free_native_ptr(reader_ptr)
2432
+ raise
2411
2433
 
2412
2434
  if manifest_data is not None:
2413
2435
  if not isinstance(manifest_data, bytes):
@@ -3176,11 +3198,16 @@ class Builder(ManagedResource):
3176
3198
  builder_ptr = _lib.c2pa_builder_from_context(
3177
3199
  context.execution_context,
3178
3200
  )
3179
- _check_ffi_operation_result(builder_ptr,
3180
- Builder._ERROR_MESSAGES[
3181
- 'builder_error'
3182
- ].format("Unknown error")
3183
- )
3201
+ try:
3202
+ _check_ffi_operation_result(builder_ptr,
3203
+ Builder._ERROR_MESSAGES[
3204
+ 'builder_error'
3205
+ ].format("Unknown error")
3206
+ )
3207
+ except Exception:
3208
+ if builder_ptr:
3209
+ ManagedResource._free_native_ptr(builder_ptr)
3210
+ raise
3184
3211
 
3185
3212
  # Consume-and-return: builder_ptr is consumed,
3186
3213
  # new_ptr is the valid pointer going forward
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: c2pa-python
3
- Version: 0.32.11
3
+ Version: 0.32.12
4
4
  Summary: Python bindings for the C2PA Content Authenticity Initiative (CAI) library
5
5
  Author-email: Gavin Peacock <gvnpeacock@adobe.com>, Tania Mathern <mathern@adobe.com>
6
6
  Maintainer-email: Gavin Peacock <gpeacock@adobe.com>
File without changes
File without changes
File without changes
File without changes
File without changes