[issue41963] ConfigParser: stripping of comments should be documented

2021-05-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 4d17c93dfe760478509bcf709345b0522fd3a7e8 by Łukasz Langa in 
branch '3.10':
[3.10] bpo-41963: document that ConfigParser strips off comments (GH-26197) 
(GH-26214)
https://github.com/python/cpython/commit/4d17c93dfe760478509bcf709345b0522fd3a7e8


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2021-05-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c17ba233b3bdf6af4e9dad24374ab0a917b593e7 by Miss Islington (bot) 
in branch '3.9':
bpo-41963: document that ConfigParser strips off comments (GH-26197) (GH-26213)
https://github.com/python/cpython/commit/c17ba233b3bdf6af4e9dad24374ab0a917b593e7


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2021-05-18 Thread Łukasz Langa

Change by Łukasz Langa :


--
nosy: +lukasz.langa
nosy_count: 2.0 -> 3.0
pull_requests: +24831
pull_request: https://github.com/python/cpython/pull/26214

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2021-05-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +24830
pull_request: https://github.com/python/cpython/pull/26213

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2021-05-17 Thread Jürgen Gmach

Change by Jürgen Gmach :


--
keywords: +patch
pull_requests: +24814
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/26197

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2020-10-09 Thread Jürgen Gmach

Jürgen Gmach  added the comment:

pymotw.com shows a big red warning about comments not being preserved:

https://pymotw.com/3/configparser/

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2020-10-09 Thread Jürgen Gmach

Jürgen Gmach  added the comment:

The Python wiki mentions that "writing to an INI file will wipe out all 
comments".

https://wiki.python.org/moin/ConfigParserExamples

So, when updating the docstrings, it may be a good idea to both add a note at 
the read methods, that comments get ignored and to the write method(s) that on 
writing, the possible previous existing comments get removed.

Are there any thoughts on this or should I go forward and create a pull request?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2020-10-07 Thread Jürgen Gmach

Jürgen Gmach  added the comment:

This "while comments have a default value, inline comments do not" should read 
"while comment prefixes have a default value, inline comment prefixes do not"

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41963] ConfigParser: stripping of comments should be documented

2020-10-07 Thread Jürgen Gmach

New submission from Jürgen Gmach :

While working on `tox-ini-fmt`, a formatter for - you guessed it - `tox.ini` 
files, I noticed ConfigParser strips comments when reading a config file.

( https://github.com/tox-dev/tox-ini-fmt/issues/34 )

While reasonable, this behaviour is surprising, as it is neither documented at 
https://docs.python.org/3/library/configparser.html nor in the docstrings (read 
and _read) which I read at first.

The stripping of comments is only documented with inline comments

https://github.com/jugmac00/cpython/blob/610a60c601fb4380eee30e15be1cd4dcbdaeec4c/Lib/configparser.py#L1019

and

https://github.com/jugmac00/cpython/blob/610a60c601fb4380eee30e15be1cd4dcbdaeec4c/Lib/configparser.py#L1031

Once I found these comments, I was surprised once again, as in my code the 
inline comments were not stripped. After some more pdb-ing and reading the 
source of ConfigParser, I noticed that - while comments have a default value, 
inline comments do not - and that is why when you read a config file, some 
comments get removed and others not.

I'd like to work on a pull request to document this behaviour, both in the 
official documentation and in the docstrings of the read and the _read methods.

--
messages: 378146
nosy: jugmac00
priority: normal
severity: normal
status: open
title: ConfigParser: stripping of comments should be documented

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com