Skip to content

Commit b666476

Browse files
Update README
1 parent 27a5d40 commit b666476

1 file changed

Lines changed: 21 additions & 15 deletions

File tree

README.rst

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,24 @@ Documentation
4040
The libexiv2_ library is well documented for C++ users, in Doxygen_ format.
4141
Recent versions of SWIG_ can convert this documentation to pydoc_ format in the Python interface::
4242

43-
$ pydoc3 exiv2.Image.exifData
44-
43+
$ pydoc3 exiv2.Image.readMetadata
4544
Help on method_descriptor in exiv2.Image:
4645

47-
exiv2.Image.exifData = exifData(...)
48-
Returns an ExifData instance containing currently buffered
49-
Exif data.
46+
exiv2.Image.readMetadata = readMetadata(...)
47+
Read all metadata supported by a specific image format from the
48+
image. Before this method is called, the image metadata will be
49+
cleared.
50+
51+
This method returns success even if no metadata is found in the
52+
image. Callers must therefore check the size of individual metadata
53+
types before accessing the data.
5054

51-
The contained Exif data may have been read from the image by
52-
a previous call to readMetadata() or added directly. The Exif
53-
data in the returned instance will be written to the image when
54-
writeMetadata() is called.
55+
:raises: Error if opening or reading of the file fails or the image
56+
data is not valid (does not look like data of the specific image
57+
type).
5558

56-
:rtype: :py:class:`ExifData`
57-
:return: modifiable ExifData instance containing Exif values
59+
Unfortunately some documentation gets lost in the manipulations needed to make a useful interface.
60+
The C++ documentation is still needed in these cases.
5861

5962
Assignment
6063
----------
@@ -149,10 +152,13 @@ This allows them to be used in a very Pythonic style::
149152
Warning: segmentation faults
150153
----------------------------
151154

152-
It is easy to crash python-exiv2 if you delete objects which contain data that another object is pointing to.
153-
For example, deleting an ``Image`` after extracting its metadata can cause a segfault when the metadata is accessed.
154-
Ideally the Python interface to libexiv2 would use Python objects' reference counts to ensure this doesn't happen, preventing the deletion of the ``Image`` object until all references to it have been deleted.
155-
Unfortunately I haven't found a sensible way to do this in the Python interface, so some care is needed when using it.
155+
Many of the libexiv2 objects point to data in other objects.
156+
For example, ``image.exifData()`` returns an object that points to data in ``image``.
157+
The Python interface uses Python objects' reference counting to prevent ``image`` being deleted while its data is being pointed at by another object.
158+
This avoids one possible cause of segfaults.
159+
160+
There may be other cases where the Python interface doesn't prevent segfaults.
161+
Please let me know if you find any.
156162

157163
Error handling
158164
--------------

0 commit comments

Comments
 (0)