Skip to content

bpo-36409: Remove old plistlib API deprecated in 3.4 #15615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 6 additions & 76 deletions Doc/library/plistlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To work with plist data in bytes objects, use :func:`dumps`
and :func:`loads`.

Values can be strings, integers, floats, booleans, tuples, lists, dictionaries
(but only with string keys), :class:`Data`, :class:`bytes`, :class:`bytesarray`
(but only with string keys), :class:`bytes`, :class:`bytearray`
or :class:`datetime.datetime` objects.

.. versionchanged:: 3.4
Expand All @@ -40,6 +40,9 @@ or :class:`datetime.datetime` objects.
Support added for reading and writing :class:`UID` tokens in binary plists as used
by NSKeyedArchiver and NSKeyedUnarchiver.

.. versionchanged:: 3.9
Old API removed.

.. seealso::

`PList manual page <https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/PropertyLists/>`_
Expand All @@ -48,7 +51,7 @@ or :class:`datetime.datetime` objects.

This module defines the following functions:

.. function:: load(fp, \*, fmt=None, use_builtin_types=True, dict_type=dict)
.. function:: load(fp, \*, fmt=None, dict_type=dict)

Read a plist file. *fp* should be a readable and binary file object.
Return the unpacked root object (which usually is a
Expand All @@ -62,10 +65,6 @@ This module defines the following functions:

* :data:`FMT_BINARY`: Binary plist format

If *use_builtin_types* is true (the default) binary data will be returned
as instances of :class:`bytes`, otherwise it is returned as instances of
:class:`Data`.

The *dict_type* is the type used for dictionaries that are read from the
plist file.

Expand All @@ -80,7 +79,7 @@ This module defines the following functions:
.. versionadded:: 3.4


.. function:: loads(data, \*, fmt=None, use_builtin_types=True, dict_type=dict)
.. function:: loads(data, \*, fmt=None, dict_type=dict)

Load a plist from a bytes object. See :func:`load` for an explanation of
the keyword arguments.
Expand Down Expand Up @@ -124,75 +123,6 @@ This module defines the following functions:

.. versionadded:: 3.4

The following functions are deprecated:

.. function:: readPlist(pathOrFile)

Read a plist file. *pathOrFile* may be either a file name or a (readable
and binary) file object. Returns the unpacked root object (which usually
is a dictionary).

This function calls :func:`load` to do the actual work, see the documentation
of :func:`that function <load>` for an explanation of the keyword arguments.

.. deprecated:: 3.4 Use :func:`load` instead.

.. versionchanged:: 3.7
Dict values in the result are now normal dicts. You no longer can use
attribute access to access items of these dictionaries.


.. function:: writePlist(rootObject, pathOrFile)

Write *rootObject* to an XML plist file. *pathOrFile* may be either a file name
or a (writable and binary) file object

.. deprecated:: 3.4 Use :func:`dump` instead.


.. function:: readPlistFromBytes(data)

Read a plist data from a bytes object. Return the root object.

See :func:`load` for a description of the keyword arguments.

.. deprecated:: 3.4 Use :func:`loads` instead.

.. versionchanged:: 3.7
Dict values in the result are now normal dicts. You no longer can use
attribute access to access items of these dictionaries.


.. function:: writePlistToBytes(rootObject)

Return *rootObject* as an XML plist-formatted bytes object.

.. deprecated:: 3.4 Use :func:`dumps` instead.


The following classes are available:

.. class:: Data(data)

Return a "data" wrapper object around the bytes object *data*. This is used
in functions converting from/to plists to represent the ``<data>`` type
available in plists.

It has one attribute, :attr:`data`, that can be used to retrieve the Python
bytes object stored in it.

.. deprecated:: 3.4 Use a :class:`bytes` object instead.

.. class:: UID(data)

Wraps an :class:`int`. This is used when reading or writing NSKeyedArchiver
encoded data, which contains UID (see PList manual).

It has one attribute, :attr:`data` which can be used to retrieve the int value
of the UID. :attr:`data` must be in the range `0 <= data <= 2**64`.

.. versionadded:: 3.8


The following constants are available:

Expand Down
6 changes: 6 additions & 0 deletions Doc/whatsnew/3.9.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ Removed
instead. The ``xml.etree.cElementTree`` module has been removed.
(Contributed by Serhiy Storchaka in :issue:`36543`.)

* The old :mod:`plistlib` API has been removed, it was deprecated since Python
3.4. Use the :func:`load`, :func:`loads`, :func:`dump`, and :func:`dumps`
functions. Additionally, the ``use_builtin_types`` parameter was removed,
standard :class:`bytes` objects are always used.
(Contributed by Jon Janzen in :issue:`36409`.)


Porting to Python 3.9
=====================
Expand Down
Loading