Mailing List Archive

[issue20120] Percent-signs (%) in .pypirc should not be interpolated
New submission from Thomas Levine:

This works fine in Python 2.7, but it fails in Python 3.3.

[tlevine@wildebeest mailfest-scoreboard]$ python3 --version
Python 3.3.3
[tlevine@wildebeest mailfest-scoreboard]$ python3 setup.py register sdist
running register
Traceback (most recent call last):
File "setup.py", line 11, in <module>
scripts=['scoreboard']
File "/usr/lib/python3.3/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.3/distutils/dist.py", line 929, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.3/distutils/dist.py", line 948, in run_command
cmd_obj.run()
File "/usr/lib/python3.3/distutils/command/register.py", line 45, in run
self._set_config()
File "/usr/lib/python3.3/distutils/command/register.py", line 71, in _set_config
config = self._read_pypirc()
File "/usr/lib/python3.3/distutils/config.py", line 83, in _read_pypirc
current[key] = config.get(server, key)
File "/usr/lib/python3.3/configparser.py", line 790, in get
d)
File "/usr/lib/python3.3/configparser.py", line 391, in before_get
self._interpolate_some(parser, option, L, value, section, defaults, 1)
File "/usr/lib/python3.3/configparser.py", line 440, in _interpolate_some
"found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%rest-of-my-password'



Here are the relevant files.



[tlevine@wildebeest mailfest-scoreboard]$ cat ~/.pypirc
[distutils]
index-servers =
pypi

[pypi]
username:tlevine
password:yh^%#rest-of-my-password
[tlevine@wildebeest mailfest-scoreboard]$ cat setup.py
#!/usr/bin/env python3

from distutils.core import setup

setup(name='mailfest-scoreboard',
version='0.0.1',
description='Score mailfest participants',
author='Thomas Levine',
author_email='_@thomaslevine.com',
url='https://github.com/tlevine/mailfest-scoreboard',
scripts=['scoreboard']
)

----------
components: Distutils
messages: 207275
nosy: tlevine
priority: normal
severity: normal
status: open
title: Percent-signs (%) in .pypirc should not be interpolated
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue20120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue20120] Percent-signs (%) in .pypirc should not be interpolated [ In reply to ]
Thomas Levine added the comment:

The relevant section distutils/config.py seems no different in Python 2.7, so now I see this as a bug in configparser.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue20120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue20120] Percent-signs (%) in .pypirc should not be interpolated [ In reply to ]
Thomas Levine added the comment:

Hmm now it looks to me like this is the intended behavior.
http://hg.python.org/cpython/file/ea0aa3e32ab5/Lib/test/test_configparser.py#l1541

Switching the single percent sign (%) to two (%%) in .pypirc makes it work. Maybe we can make a nicer error message though.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue20120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue20120] Percent-signs (%) in .pypirc should not be interpolated [ In reply to ]
R. David Murray added the comment:

It could be an issue of which configparser is/was used.

----------
nosy: +lukasz.langa, r.david.murray
versions: +Python 3.4

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue20120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue20120] Percent-signs (%) in .pypirc should not be interpolated [ In reply to ]
Antoine Pitrou added the comment:

In 3.x, the ConfigParser class is 2.x's SafeConfigParser, and the parsing rules are different (stricter, it seems).

It's probably a won't fix, I'd say.

----------
nosy: +pitrou

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue20120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue20120] Percent-signs (%) in .pypirc should not be interpolated [ In reply to ]
R. David Murray added the comment:

"More rational" is probably closer to the truth :).

Yeah, it's probably a won't fix, but it would be nice to have Łukasz's input.

----------

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue20120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue20120] Percent-signs (%) in .pypirc should not be interpolated [ In reply to ]
Łukasz Langa added the comment:

Yes, that's wontfix but we can make the error message more friendly so I'll leave this open.

The .pypirc parser should have been RawConfigParser from the start, the interpolation mechanism is obscure enough it's probably not used. Unfortunately this "probably" means we cannot easily switch it to RawConfigParser now.

----------
assignee: -> lukasz.langa
versions: +Python 3.5 -Python 3.3, Python 3.4

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue20120>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com