----------------
- Adding functions isString(), isInt(), isBytes() to make type testing simpler and more consistent. Works for Python 2 and 3.
- Note: "string_type", "bytes_type" and "int_types" are functionally unchanged: Made sure all references to these types were compatible with how things worked pre-fork.
I was experimenting with `PdfFileMerger` and when I tried to
write the data to a file the following exception was raised:
Traceback (most recent call last):
File "pypdf2/PyPDF2/merger.py", line 194, in write
self._write_bookmarks()
File "pypdf2/PyPDF2/merger.py", line 280, in _write_bookmarks
self._write_bookmarks(b, last_added)
File "pypdf2/PyPDF2/merger.py", line 292, in _write_bookmarks
last_added = self.output.addBookmarkDestination(b, parent)
File "pypdf2/PyPDF2/pdf.py", line 442, in addBookmarkDestination
parent.addChild(destRef, self)
AttributeError: 'Destination' object has no attribute 'addChild'
After debugging this for a while I noticed that there are two
different `Destination` classes in PyPDF2 defined in the following
modules: `PyPDF2.generic` and `PyPDF2.pdf`. The difference between
them is that the one defined in `generic` module inherits from
`TreeObject` and has a few extra methods (`getDestArray` and
`writeToStream`) whereas the one defined in `pdf` modules inherits
from `DictionaryObject`.
The `addBookmarkDestination` method expects that `parent` has
`addChild` method, which in turn is defined in `TreeObject` class.
Thus, in order to fix this issue, I removed `Destination` class
defined in `PyPDF2.pdf` module.