Commit Graph

53 Commits

Author SHA1 Message Date
Serhiy Storchaka 77b45fa6d0
gh-111803: Support loading more deeply nested lists in binary plist format (GH-114024)
It no longer uses the C stack. The depth of nesting is only limited by
Python recursion limit setting.
2024-01-13 15:26:55 +02:00
AN Long bbf214df23
gh-113537: support loads str in plistlib.loads (#113582)
Add support for loading XML plists from a string value instead of a only bytes value.
2024-01-06 10:26:59 +01:00
Serhiy Storchaka 50b093f5c7
gh-53502: Fix plistlib.dump() for naive datetime with aware_datetime option (GH-113645) 2024-01-02 21:45:36 +02:00
Ronald Oussoren 8e4ff5c788
gh-53502: Fixes for tests in gh-113363 (#113627)
* gh-53502: Fixes for tests in gh-113363

* Use 32-bit compatible date in test_dump_naive_datetime_with_aware_datetime_option

* Saving non-aware datetimes will use the old behaviour regardless of the aware_datimetime setting
2024-01-01 21:31:43 +01:00
AN Long b4b2cc1012
gh-53502: add a new option aware_datetime in plistlib to loads or dumps aware datetime. (#113363)
* add options to loads and dumps aware datetime in plistlib
2024-01-01 19:51:24 +01:00
Dustin Rodrigues e4609cbe4c
gh-101992: update pstlib module documentation (#102133) 2023-03-04 13:35:25 -08:00
Jakob Weigert 81b9d9ddc2
Fix typo in error message in plistlib (GH-97540) 2022-09-28 20:46:09 +03:00
Serhiy Storchaka 3680ebed7f
bpo-44712: Replace "type(literal)" with corresponding builtin types (GH-27294)
I suppose it is a remnants of very old code written when str, int, list, dict, etc
were functions and not classes.
2022-05-08 17:10:11 +03:00
Kumar Aditya 83d544b929
bpo-40066: [Enum] skip failing doc test (GH-30637) 2022-01-17 07:18:13 -08:00
Victor Stinner 42a64c03ec
Revert "bpo-40066: [Enum] update str() and format() output (GH-30582)" (GH-30632)
This reverts commit acf7403f9b.
2022-01-17 13:58:40 +01:00
Ethan Furman acf7403f9b
bpo-40066: [Enum] update str() and format() output (GH-30582)
Undo rejected PEP-663 changes:

- restore `repr()` to its 3.10 status
- restore `str()` to its 3.10 status

New changes:

- `IntEnum` and `IntFlag` now leave `__str__` as the original `int.__str__` so that str() and format() return the same result
- zero-valued flags without a name have a slightly changed repr(), e.g. `repr(Color(0)) == '<Color: 0>'`
- update `dir()` for mixed-in types to return all the methods and attributes of the mixed-in type
- added `_numeric_repr_` to `Flag` to control display of unnamed values
- enums without doc strings have a more comprehensive doc string added
- `ReprEnum` added -- inheriting from this makes it so only `__repr__` is replaced, not `__str__` nor `__format__`; `IntEnum`, `IntFlag`, and `StrEnum` all inherit from `ReprEnum`
2022-01-15 22:41:43 -08:00
Binbin 17b16e13bb
Fix typos in multiple files (GH-26689)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2021-06-12 22:47:44 -04:00
Ethan Furman b775106d94
bpo-40066: Enum: modify `repr()` and `str()` (GH-22392)
* Enum: streamline repr() and str(); improve docs

- repr() is now ``enum_class.member_name``
- stdlib global enums are ``module_name.member_name``
- str() is now ``member_name``
- add HOW-TO section for ``Enum``
- change main documentation to be an API reference
2021-03-30 21:17:26 -07:00
Serhiy Storchaka 212d32f45c
bpo-42249: Fix writing binary Plist files larger than 4 GiB. (GH-23121) 2020-11-03 16:15:56 +02:00
Serhiy Storchaka 34637a0ce2
bpo-42103: Improve validation of Plist files. (GH-22882)
* Prevent some possible DoS attacks via providing invalid Plist files
  with extremely large number of objects or collection sizes.
* Raise InvalidFileException for too large bytes and string size instead of returning garbage.
* Raise InvalidFileException instead of ValueError for specific invalid datetime (NaN).
* Raise InvalidFileException instead of TypeError for non-hashable dict keys.
* Add more tests for invalid Plist files.
2020-11-02 23:01:40 +02:00
Ronald Oussoren 3185267400
bpo-41491: plistlib: accept hexadecimal integer values in xml plist files (GH-22764) 2020-10-20 09:26:33 +02:00
Ronald Oussoren 05ee790f4d
bpo-42051: Reject XML entity declarations in plist files (#22760) 2020-10-19 20:13:49 +02:00
Victor Stinner 90549676e0
bpo-40443: Remove unused imports in the stdlib (GH-19803) 2020-04-30 11:26:33 +02:00
Jon Janzen ce81a925ef bpo-36409: Remove old plistlib API deprecated in 3.4 (GH-15615)
* Remove implementation for old plistlib API deprecated in 3.4
2019-09-05 10:11:35 +02:00
Collin Styles 0d4f4352ef Clarify that plistlib's load and dump functions take a binary file object (GH-9825)
The documentation says that the fp parameter to plistlib.load "should be a
readable and binary file object" but the docstring only mentions that it
should be readable. Similarly, plistlib.dump's docstring only mentions
"writable". This commit clarifies that fp should also be binary.

https://docs.python.org/3/library/plistlib.html#plistlib.load
https://docs.python.org/3/library/plistlib.html#plistlib.dump
2019-07-14 11:01:48 +02:00
Jon Janzen c981ad16b0 bpo-26707: Enable plistlib to read UID keys. (GH-12153)
Plistlib currently throws an exception when asked to decode a valid
.plist file that was generated by Apple's NSKeyedArchiver. Specifically,
this is caused by a byte 0x80 (signifying a UID) not being understood.

This fixes the problem by enabling the binary plist reader and writer
to read and write plistlib.UID objects.
2019-05-15 23:14:38 +03:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) acdc660efc bpo-33908: Remove two superfluous assignments (GH-7116)
Signed-off-by: Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
2018-06-20 13:07:31 +08:00
Serhiy Storchaka a897aeeef6
bpo-32072: Fix issues with binary plists. (#4455)
* Fixed saving bytearrays.
* Identical objects will be saved only once.
* Equal references will be load as identical objects.
* Added support for saving and loading recursive data structures.
2017-11-30 23:26:11 +02:00
Serhiy Storchaka db91e0fe24
bpo-31897: Convert unexpected errors when read bogus binary plists into InvalidFileException. (#4171) 2017-10-31 14:05:53 +02:00
Serhiy Storchaka edef358ed6 bpo-29196: Removed old-deprecated classes Plist, Dict and _InternalDict (#488)
in the plistlib module.  Dict values in the result of functions
readPlist() and readPlistFromBytes() are now exact dicts.
2017-05-15 13:21:31 +03:00
Serhiy Storchaka db8d6265fa Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. 2016-10-04 20:08:29 +03:00
Serhiy Storchaka 7338ebc4ba Issue #28321: Fixed writing non-BMP characters with binary format in plistlib. 2016-10-04 20:04:30 +03:00
Martin Panter d04d21373f Issue #27109: Add InvalidFileException to __all__, by Jacek Kołodziej 2016-06-06 02:00:50 +00:00
Serhiy Storchaka dd1bcdf618 Issue #26711: Fixed the comparison of plistlib.Data with other types. 2016-05-01 13:36:16 +03:00
Serhiy Storchaka 94ad49fabc Issue #26709: Fixed Y2038 problem in loading binary PLists. 2016-04-08 15:00:02 +03:00
Serhiy Storchaka 8966759b03 Issue #21888: plistlib's load() and loads() now work if the fmt parameter is
specified.
2014-07-23 18:49:31 +03:00
Serhiy Storchaka 065266450e Issue #21538: The plistlib module now supports loading of binary plist files
when reference or offset size is not a power of two.
2014-05-23 16:13:33 +03:00
Ronald Oussoren 94e44a935b Issue #14455: fix handling of unsigned long long values for binary plist files
Values in the range of an unsigned long long, but outside of the range
of a signed long long were serialized as a negative value.

Due to a bug in PyObjC my test scripts indicated that the previous behavior
matched Apple's plist code, instead the handle large unsigned values correctly.

The change to plistlib.py is from a patch by Serhiy.
2014-02-06 11:19:18 +01:00
Ronald Oussoren 6db6653bbc Issue #14455: Fix some issues with plistlib
* Negative integer support in binary plists was broken

* Better exception for invalid data

* Fix the versionadded/versionchanged markup in the documentation

* Add the interface cleanup to what's new for 3.4
2014-01-15 11:32:35 +01:00
Ned Deily c06d6fdc37 Issue #14455: Fix maybe_open typo in Plist.fromFile(). 2013-11-21 20:56:23 -08:00
Ronald Oussoren c5cf797342 Issue #14455: plistlib now supports binary plists and has an updated API.
This patch adds support for binary plists on OSX to plistlib (based
on a patch by 'dpounces').

The patch also cleans up the API for the plistlib module.
2013-11-21 15:46:49 +01:00
Ronald Oussoren 326edfde56 Ensure that plistlib doesn't corrupt deeply nested datastructures
Without this changeset plistlib would write empty tags for plistlib.Data
objects in deeply nested datastructures.

Fixes #17353
2013-04-23 13:47:22 +02:00
Hynek Schlawack 52209d3a1e #14835: Make plistlib output empty arrays & dicts like OS X
Patch by Sidney San Martín.
2012-05-29 12:04:54 +02:00
Victor Stinner b575289292 Issue #12452: Plist and Dict are now deprecated
Replace PendingDeprecationWarning warnings by DeprecationWarning.
2011-07-04 14:28:45 +02:00
Ned Deily 32b5cb0a66 Issue #985064: Make plistlib more resilient to faulty input plists.
Patch by Mher Movsisyan.
2011-05-28 03:02:30 -07:00
Ned Deily b8e59f77e6 Issue #985064: Make plistlib more resilient to faulty input plists.
Patch by Mher Movsisyan.
2011-05-28 02:19:19 -07:00
Ronald Oussoren 33798fde76 Merged revisions 80279 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80279 | ronald.oussoren | 2010-04-20 22:59:37 +0200 (Tue, 20 Apr 2010) | 3 lines

  Fix for issue 7852: the DTD for OSX Plists has changed due
  to a change in the company name for Apple.
........
2010-04-20 21:00:34 +00:00
Ezio Melotti 1e112baf6a Merged revisions 74813 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r74813 | ezio.melotti | 2009-09-16 03:49:03 +0300 (Wed, 16 Sep 2009) | 1 line

  updated the doc to match the module docstring, fixed a couple of errors in the doc markup and in the module
........
2009-09-16 00:57:27 +00:00
Ezio Melotti 6e9b1df499 updated the doc to match the module docstring, fixed a couple of errors in the doc markup and in the module 2009-09-16 00:49:03 +00:00
Georg Brandl 706824f19f More codestring -> codebytes. 2009-06-04 09:42:55 +00:00
Philip Jenvey a394f2dca3 #4351: more appropriate DeprecationWarning stacklevels 2009-05-08 03:57:12 +00:00
Benjamin Peterson ef3e4c2b4d Merged revisions 70980,71059,71225,71234,71241,71243,71249,71251,71255,71266,71299,71329,71397-71398,71486 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r70980 | jack.diederich | 2009-04-01 15:26:13 -0500 (Wed, 01 Apr 2009) | 3 lines

  bounds check arguments to mmap.move().  All of them.  Really.
  fixes crasher on OS X 10.5
........
  r71059 | mark.dickinson | 2009-04-02 13:39:37 -0500 (Thu, 02 Apr 2009) | 2 lines

  sys.long_info attributes should be ints, not longs
........
  r71225 | georg.brandl | 2009-04-05 06:54:07 -0500 (Sun, 05 Apr 2009) | 1 line

  #5580: no need to use parentheses when converterr() argument is actually a type description.
........
  r71234 | georg.brandl | 2009-04-05 08:16:35 -0500 (Sun, 05 Apr 2009) | 1 line

  Whitespace normalization.
........
  r71241 | georg.brandl | 2009-04-05 09:48:49 -0500 (Sun, 05 Apr 2009) | 1 line

  #5471: fix expanduser() for $HOME set to "/".
........
  r71243 | georg.brandl | 2009-04-05 10:14:29 -0500 (Sun, 05 Apr 2009) | 1 line

  #5432: make plistlib docstring a raw string, since it contains examples with backslash escapes.
........
  r71249 | georg.brandl | 2009-04-05 11:30:43 -0500 (Sun, 05 Apr 2009) | 1 line

  #5444: adapt make.bat to new htmlhelp output file name.
........
  r71251 | georg.brandl | 2009-04-05 12:17:42 -0500 (Sun, 05 Apr 2009) | 1 line

  #5298: clarify docs about GIL by using more consistent wording.
........
  r71255 | georg.brandl | 2009-04-05 13:34:58 -0500 (Sun, 05 Apr 2009) | 1 line

  #602893: add indicator for current line in cgitb that doesnt rely on styling alone.
........
  r71266 | georg.brandl | 2009-04-05 15:23:13 -0500 (Sun, 05 Apr 2009) | 1 line

  Normalize issue referencing style.
........
  r71299 | gregory.p.smith | 2009-04-05 18:43:58 -0500 (Sun, 05 Apr 2009) | 3 lines

  Fixes issue5705: os.setuid() and friends did not accept the same range of
  values that pwd.getpwnam() returns.
........
  r71329 | benjamin.peterson | 2009-04-06 16:53:33 -0500 (Mon, 06 Apr 2009) | 1 line

  add create_connection to __all__ #5711
........
  r71397 | georg.brandl | 2009-04-08 11:36:39 -0500 (Wed, 08 Apr 2009) | 1 line

  Remove redundant backtick.
........
  r71398 | georg.brandl | 2009-04-08 11:39:04 -0500 (Wed, 08 Apr 2009) | 1 line

  Update ignore file for suspicious builder.
........
  r71486 | andrew.kuchling | 2009-04-11 11:18:14 -0500 (Sat, 11 Apr 2009) | 1 line

  Re-word
........
2009-04-11 19:48:14 +00:00
Antoine Pitrou fd036451bf #2834: Change re module semantics, so that str and bytes mixing is forbidden,
and str (unicode) patterns get full unicode matching by default. The re.ASCII
flag is also introduced to ask for ASCII matching instead.
2008-08-19 17:56:33 +00:00
Benjamin Peterson 69a07fbd9b Remove the Mac modules 2008-05-12 22:25:16 +00:00
Christian Heimes 7e182548fa svn cp -r60150 svn+ssh://pythondev@svn.python.org/python/branches/py3k/Lib/plat-mac/plistlib.py Lib/ 2008-01-27 15:20:13 +00:00