Commit Graph

87 Commits

Author SHA1 Message Date
Gregory P. Smith 296e4efebb
gh-89336: Remove configparser APIs that were deprecated for 3.12 (#92503)
https://github.com/python/cpython/issue/89336: Remove configparser 3.12 deprecations.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2022-06-21 14:31:25 -07:00
Hugo van Kemenade 75280944e5
bpo-46607: Add DeprecationWarning for LegacyInterpolation, deprecated in docs since 3.2 (GH-30927) 2022-04-05 08:15:11 -07:00
Brian Faherty fc115c9bde
bpo-41086: Add exception for uninstantiated interpolation (configparser) (GH-21062)
* Add exception for uninstantiated interpolation (configparser)

The current feedback when users try to pass an uninstantiated
interpolation into a ConfigParser is an error message that does not help
users solve the problem. This current error of `TypeError: before_set()
missing 1 required positional argument: 'value'` does not display until
the parser is used, which usually results in the assumption that
instantiation of the parser was done correctly. The new exception of
InterpolationTypeError, will be raised on the line where the
ConfigParser is instantiated. This will result in users see the line
that has the error in their backtrace for faster debugging.

There have been a number of bugs created in the issue tracker, which
could have been addressed by:
https://bugs.python.org/issue26831 and https://bugs.python.org/issue26469

* 📜🤖 Added by blurb_it.

* Replace custom Error with TypeError

Per feedback from @iritkatriel, the custom InterpolationTypeError has
been dropped in favour of a TypeError with a custom message, and the
unittests have been expanded.

* More verbose message

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2022-02-17 13:17:43 +01:00
Hugo van Kemenade e8659b47de
bpo-45173: Keep configparser deprecations until Python 3.12 (GH-30952)
* Revert "bpo-45173 Remove configparser deprecations"

This reverts commit df2284bc41.

* bpo-45173: Note these configparser deprecations will be removed in 3.12
2022-02-02 08:59:39 -08:00
Hugo van Kemenade 1fc41ae870
bpo-45173 Remove configparser deprecations (GH-28292)
In the configparser module, these have been deprecated since Python 3.2:

* the SafeConfigParser class,
* the filename property of the ParsingError class,
* the readfp method of the ConfigParser class,
2021-09-13 19:12:36 +02:00
jsnklln 2924bb1a56
bpo-38741: Definition of multiple ']' in header configparser (GH-17129)
Co-authored-by: Jason Killen <jason.killen@windsorcircle.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2021-07-13 15:54:06 +02:00
Jürgen Gmach 02ee819126
bpo-41963: document that ConfigParser strips off comments (GH-26197)
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Laura Gutierrez Funderburk <58710704+lgfunderburk@users.noreply.github.com>
2021-05-18 18:11:23 +02:00
Inada Naoki 4827483f47
bpo-43510: Implement PEP 597 opt-in EncodingWarning. (GH-19481)
See [PEP 597](https://www.python.org/dev/peps/pep-0597/).

* Add `-X warn_default_encoding` and `PYTHONWARNDEFAULTENCODING`.
* Add EncodingWarning
* Add io.text_encoding()
* open(), TextIOWrapper() emits EncodingWarning when encoding is omitted and warn_default_encoding is enabled.
* _pyio.TextIOWrapper() uses UTF-8 as fallback default encoding used when failed to import locale module. (used during building Python)
* bz2, configparser, gzip, lzma, pathlib, tempfile modules use io.text_encoding().
* What's new entry
2021-03-29 12:28:14 +09:00
Woko 45d75faa72 fix typo in configparser doc (GH-12154) 2019-03-03 18:23:19 -08:00
Zackery Spytz e45473e3ca bpo-27351: Fix ConfigParser.read() documentation and docstring (GH-8123)
Switch "list" with "iterable" to match with the implementation.
2018-09-29 10:15:55 -06:00
Cheryl Sabella 33cd058f21 bpo-32108: Don't clear configparser values if key is assigned to itself (GH-7588) 2018-06-12 13:37:51 -07:00
Łukasz Langa 214f18e49f
bpo-33802: Do not interpolate in ConfigParser while reading defaults (GH-7524)
This solves a regression in logging config due to changes in BPO-23835.
2018-06-08 04:02:48 -07:00
John Reese 3a5b0d8988 bpo-33504: Migrate configparser from OrderedDict to dict. (#6819)
With 3.7+, dictionary are ordered by design.  Configparser still uses
collections.OrderedDict, which is unnecessary.  This updates the module
to use the standard dict implementation by default, and changes the
docs and tests to match.
2018-06-05 16:31:33 -07:00
Chris Bradbury 1d4a733cce bpo-33251: Prevent ConfigParser.items returning items present in vars. (#6446)
* bpo-33251: ConfigParser.items no longer returns items present in vars.

Documentation for `ConfigParser.items()` states:
'Items present in vars no longer appear in the result.'

This fix aligns behaviour to that specified in the documentation.
2018-04-23 12:16:17 -07:00
Vincent Michel e314853d57 bpo-31307: Make ConfigParser.read() accept bytes objects (GH-3420) 2017-11-02 15:47:04 +03:00
Łukasz Langa a5fab17fc1 bpo-23835: Restore legacy defaults= behavior for RawConfigParser (#3191)
The fix for bpo-23835 fixed ConfigParser behavior in defaults= handling.
Unfortunately, it caused a backwards compatibility regression with
RawConfigParser objects which allow for non-string values.

This commit restores the legacy behavior for RawConfigParser only.
2017-08-24 09:43:53 -07:00
James Tocknell 44e6ad8734 bpo-23835: Enforce that configparser defaults are strings (#2558)
* Enforce that configparser defaults are strings
* Update test_configparser.py
2017-08-21 15:46:30 -07:00
Serhiy Storchaka 5affd23e6f bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
2017-04-05 09:37:24 +03:00
David Ellis 85b8d01c91 bpo-29623: Make PathLike objects work with ConfigParser.read() (#242) 2017-03-03 20:14:27 +03:00
Łukasz Langa 47a9a4beda Fixes #24142: [configparser] always join multiline values to not leave the parser in an invalid state 2016-11-26 14:00:39 -08:00
Robert Collins f7a92673ab Issue #21159: Improve message in configparser.InterpolationMissingOptionError.
Patch from Łukasz Langa.
2015-08-14 11:47:41 +12:00
Robert Collins ac37ba0742 Issue #21159: Improve message in configparser.InterpolationMissingOptionError.
Patch from Łukasz Langa.
2015-08-14 11:11:35 +12:00
Łukasz Langa dfdd2f7ef8 Closes #18159: ConfigParser getters not available on SectionProxy 2014-09-15 02:08:41 -07:00
Łukasz Langa 949053bff2 Fix #19546: onfigparser exceptions expose implementation details. Patch by Claudiu Popa. 2014-09-04 01:36:33 -07:00
Serhiy Storchaka a26b3f183d Issue #20363. Fixed BytesWarning triggerred by test suite.
Patch by Berker Peksag.
2014-02-06 22:52:23 +02:00
Serhiy Storchaka bc27a050a7 Issue #20363. Fixed BytesWarning triggerred by test suite.
Patch by Berker Peksag.
2014-02-06 22:49:45 +02:00
Serhiy Storchaka ab0ac27d24 Issue #20315: Removed support for backward compatibility with early 2.x versions.
Removed backward compatibility alias curses.window.nooutrefresh which should
be removed in 2.3.
2014-01-20 21:35:06 +02:00
Serhiy Storchaka 7e52705ee3 Issue #20315: Removed support for backward compatibility with early 2.x versions. 2014-01-20 21:29:31 +02:00
Łukasz Langa 82276964c8 Merged fix for issue #18260 from 3.3 2013-06-23 19:12:12 +02:00
Łukasz Langa f9b4eb4d04 Fixed issue #18260: configparser TypeError on source name specified as bytes 2013-06-23 19:10:25 +02:00
Łukasz Langa f3d8fb142d fix character index in ExtendedInterpolation's exception message 2013-04-24 01:25:55 +02:00
Łukasz Langa fa608186b4 fix character index in ExtendedInterpolation's exception message 2013-04-24 01:25:18 +02:00
Łukasz Langa 6e410a2cdb Merged section order preservation fix when using `__setitem__` (issue #16820) 2013-01-01 22:36:33 +01:00
Łukasz Langa a821f82f66 configparser: preserve section order when using `__setitem__` (issue #16820) 2013-01-01 22:33:19 +01:00
Łukasz Langa 8d518970ce Merged `parser['DEFAULT'].__setitem__` fix (issue #16820) from 3.3. 2012-12-31 13:57:21 +01:00
Łukasz Langa 0210194d48 Fixes `__setitem__` on parser['DEFAULT'] reported in issue #16820. 2012-12-31 13:55:11 +01:00
Łukasz Langa 1dce0003a6 Merged `parser.clean()` fix (issue #16820) from 3.2 through 3.3. 2012-12-31 03:43:37 +01:00
Łukasz Langa 0dc5ab41f0 Merged `parser.clean()` fix (issue #16820) from 3.2. 2012-12-31 03:41:54 +01:00
Łukasz Langa 3a8479a583 Fixes `parser.clean()` reported in issue #16820. 2012-12-31 03:38:39 +01:00
Łukasz Langa 641bb66070 Merged fix for #15803 from 3.2 through 3.3 2012-12-31 02:26:11 +01:00
Łukasz Langa 97eefc105e Merged fix for #15803 from 3.2 2012-12-31 02:25:28 +01:00
Łukasz Langa 3057469506 Fixes issue #15803: incorrect `ConfigParser.items()` docstring 2012-12-31 02:18:20 +01:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Łukasz Langa cba243215e Fixes #14590: ConfigParser doesn't strip inline comment when delimiter occurs
earlier without preceding space.
2012-07-07 18:54:08 +02:00
Ezio Melotti f10644983e Merge with 3.2. 2011-10-19 11:06:26 +03:00
Ezio Melotti e130a52d8a Remove duplication. 2011-10-19 10:58:56 +03:00
Łukasz Langa 82710c594b Merged minor cleanups from 3.2. 2011-04-29 16:17:51 +02:00
Łukasz Langa 5c7419d433 Removed debugging leftovers. 2011-04-29 16:16:36 +02:00
Łukasz Langa 70eb79c669 Merged solution for #11324 from 3.2. 2011-04-28 17:04:25 +02:00
Łukasz Langa 1aa422fe8f Closes #11324: ConfigParser(interpolation=None) doesn't work.
Initial patches by Tobias Brink. Thanks!
2011-04-28 17:03:45 +02:00