[Django] #22364: changepassword fails on Windows

8 views
Skip to first unread message

Django

unread,
Mar 31, 2014, 4:39:25 PM3/31/14
to django-...@googlegroups.com
#22364: changepassword fails on Windows
------------------------------+----------------------
Reporter: jpaulett | Owner: jpaulett
Type: Bug | Status: new
Component: contrib.auth | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+----------------------
"manage.py changepassword" fails on Windows 2008 R2 and Windows 7 due to
getpass receiving an unicode string.

{{{
C:\project>manage.py changepassword bob
Changing password for user 'bob'
Traceback (most recent call last):
djangorecipe.manage.main('test_project.settings')
File "C:\project\vendor\djangorecipe\src\djangorecipe\manage.py", line
9, in main
management.execute_from_command_line(sys.argv)
File
"C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\__init__.py",
line 399, in execute_from_command_line
utility.execute()
File
"C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\__init__.py",
line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File
"C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\base.py",
line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File
"C:\project\eggs\django-1.6.2-py2.7.egg\django\core\management\base.py",
line 285, in execute
output = self.handle(*args, **options)
File
"C:\project\eggs\django-1.6.2-py2.7.egg\django\contrib\auth\management\commands\changepassword.py",
line 50, in handle
p1 = self._get_pass()
File
"C:\project\eggs\django-1.6.2-py2.7.egg\django\contrib\auth\management\commands\changepassword.py",
line 21, in _get_pass
p = getpass.getpass(prompt=prompt)
File "C:\Python27\lib\getpass.py", line 95, in win_getpass
msvcrt.putch(c)
TypeError: must be char, not unicode
}}}

Related to #19807, which had the same error in createsuperuser on Windows.
I have tested the same solution to force_str and it resolves the issue
(Pull Request is incoming). On other OSes, everything works fine.

This appears to be a regression was introduced in 1.5 and is still present
today. changepassword on Windows worked under 1.4. It definitely seems
relevant to include in the 1.7 release and potentially as a bug fix
release for 1.5 & 1.6. I found no other reports of this error, so there
does not seem to be a large affected population, but would be helpful to
me to have as part of any upcoming 1.6.x bug fix release (I do have a
workaround under 1.6 until then).

--
Ticket URL: <https://code.djangoproject.com/ticket/22364>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Mar 31, 2014, 4:47:07 PM3/31/14
to django-...@googlegroups.com
#22364: changepassword fails on Windows
------------------------------+--------------------------------------

Reporter: jpaulett | Owner: jpaulett
Type: Bug | Status: new
Component: contrib.auth | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------------------------
Changes (by jpaulett):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

Issued [https://github.com/django/django/pull/2503 Pull Request 2503].
Verified fix in application on Windows 7. All tests passing using default
runtests.py.

--
Ticket URL: <https://code.djangoproject.com/ticket/22364#comment:1>

Django

unread,
Apr 1, 2014, 10:59:20 PM4/1/14
to django-...@googlegroups.com
#22364: changepassword fails on Windows
------------------------------+------------------------------------

Reporter: jpaulett | Owner: jpaulett
Type: Bug | Status: new
Component: contrib.auth | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Alex):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/22364#comment:2>

Django

unread,
Apr 10, 2014, 1:16:05 PM4/10/14
to django-...@googlegroups.com
#22364: changepassword fails on Windows
------------------------------+------------------------------------
Reporter: jpaulett | Owner: jpaulett
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"b5a9166f7e0e21ae0f2cc8f218b422bc2c116fb0"]:
{{{
#!CommitTicketReference repository=""
revision="b5a9166f7e0e21ae0f2cc8f218b422bc2c116fb0"
Fixed #22364 -- Sanitized getpass input in changepassword.

Python 2 getpass on Windows does not accept unicode, even
when containing on ASCII characters. Related #190807.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22364#comment:3>

Django

unread,
Apr 10, 2014, 1:16:29 PM4/10/14
to django-...@googlegroups.com
#22364: changepassword fails on Windows
------------------------------+------------------------------------
Reporter: jpaulett | Owner: jpaulett
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"b4681be154dd7194041e94f3eb6d7f24217b9a1b"]:
{{{
#!CommitTicketReference repository=""
revision="b4681be154dd7194041e94f3eb6d7f24217b9a1b"
[1.7.x] Fixed #22364 -- Sanitized getpass input in changepassword.

Python 2 getpass on Windows does not accept unicode, even
when containing on ASCII characters. Related #190807.

Backport of b5a9166f7e from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22364#comment:4>

Django

unread,
Apr 10, 2014, 1:16:30 PM4/10/14
to django-...@googlegroups.com
#22364: changepassword fails on Windows
------------------------------+------------------------------------
Reporter: jpaulett | Owner: jpaulett
Type: Bug | Status: closed
Component: contrib.auth | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"129cb7e2228cf076104eb5de69e6063f1bf34dd9"]:
{{{
#!CommitTicketReference repository=""
revision="129cb7e2228cf076104eb5de69e6063f1bf34dd9"
[1.6.x] Fixed #22364 -- Sanitized getpass input in changepassword.

Python 2 getpass on Windows does not accept unicode, even
when containing on ASCII characters. Related #190807.

Backport of b5a9166f7e from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/22364#comment:5>

Reply all
Reply to author
Forward
0 new messages