Commit Graph

39 Commits

Author SHA1 Message Date
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
Inada Naoki 35715d1e72
bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25145)
* test_asyncio
* test_bz2
* test_math
* test_cmath
* test_cmd_line
* test_cmd_line_script
* test_compile
* test_contextlib
* test_profile
* ctypes/test/test_find
* test_multiprocessing
* test_configparser
* test_csv
* test_dbm_dumb
* test_decimal
* test_difflib
* os.fdopen() calls io.text_encoding() to emit EncodingWarning for right place.
2021-04-04 09:01:23 +09:00
Victor Stinner fbf43f051e
bpo-41521: Rename blacklist parameter to not_exported (GH-21824)
Rename "blacklist" parameter of test.support.check__all__() to
"not_exported".
2020-08-17 07:20:40 +02:00
Hai Shi a7f5d93bb6
bpo-40275: Use new test.support helper submodules in tests (GH-21449) 2020-08-03 18:41:24 +02: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
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
David Ellis 85b8d01c91 bpo-29623: Make PathLike objects work with ConfigParser.read() (#242) 2017-03-03 20:14:27 +03:00
Serhiy Storchaka 70d28a184c Remove unused imports. 2016-12-16 20:00:15 +02:00
Łukasz Langa 8fb4e421f4 Merge 3.5, fix for #24142 2016-11-26 14:02:48 -08: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
Martin Panter 2b9b70b43b Issue #27106: Add test for configparser.__all__
Patch by Jacek Kołodziej. The Error class is deliberately omitted because it
is a generic name and of limited use.
2016-09-09 06:46:48 +00: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
Serhiy Storchaka 65ee4674e2 Issue #22777: Test pickling with all protocols. 2014-12-15 14:06:02 +02:00
Serhiy Storchaka bad1257c96 Issue #22777: Test pickling with all protocols. 2014-12-15 14:03:42 +02: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 521e5860a5 Issue #22032: __qualname__ instead of __name__ is now always used to format
fully qualified class names of Python implemented classes.
2014-07-22 15:00:37 +03:00
Zachary Ware 9fe6d86709 Issue 19572: More silently skipped tests explicitly skipped. 2013-12-08 00:20:35 -06:00
Łukasz Langa f9b4eb4d04 Fixed issue #18260: configparser TypeError on source name specified as bytes 2013-06-23 19:10:25 +02:00
Ezio Melotti dc1fa80b6c #16925: test_configparser now works with unittest test discovery. Patch by Zachary Ware. 2013-01-11 06:30:57 +02:00
Łukasz Langa a821f82f66 configparser: preserve section order when using `__setitem__` (issue #16820) 2013-01-01 22:33:19 +01:00
Łukasz Langa 0210194d48 Fixes `__setitem__` on parser['DEFAULT'] reported in issue #16820. 2012-12-31 13:55:11 +01:00
Łukasz Langa 0dc5ab41f0 Merged `parser.clean()` fix (issue #16820) from 3.2. 2012-12-31 03:41:54 +01: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
Łukasz Langa e7851956de #13760: picklability tests for configparser exceptions 2012-01-20 14:57:55 +01:00
Łukasz Langa 82710c594b Merged minor cleanups from 3.2. 2011-04-29 16:17:51 +02:00
Łukasz Langa 70eb79c669 Merged solution for #11324 from 3.2. 2011-04-28 17:04:25 +02:00
Łukasz Langa e812bf7bf6 Merged styling updates for #11670 from 3.2. 2011-04-28 12:02:58 +02:00
Łukasz Langa 50c7562da9 Merged solution for #11858 from 3.2. 2011-04-28 11:01:18 +02:00
Łukasz Langa 29050d7317 Merged #11670 from 3.2 2011-04-27 18:11:50 +02:00
Raymond Hettinger 16fe75e4e0 Have the test filename match the module filename. 2011-02-22 01:48:33 +00:00