[issue32884] Adding the ability for getpass to print asterisks when passowrd is typed

2018-02-21 Thread Matanya Stroh

Matanya Stroh  added the comment:

for getpass.win_getpass() it can simply be done by adding this line
msvcrt.putch("*").
So the code will look like:

def win_getpass(prompt='Password: ', stream=None):
"""Prompt for password with echo off, using Windows getch()."""
if sys.stdin is not sys.__stdin__:
return fallback_getpass(prompt, stream)

for c in prompt:
msvcrt.putwch(c)
pw = ""
while 1:
c = msvcrt.getwch()
if c == '\r' or c == '\n':
break
if c == '\003':
raise KeyboardInterrupt
if c == '\b':
pw = pw[:-1]
else:
pw = pw + c
msvcrt.putch("*") #Line that was added
msvcrt.putwch('\r')
msvcrt.putwch('\n')
return pw

--

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



[issue32884] Adding the ability for getpass to print asterisks when passowrd is typed

2018-02-20 Thread Matanya Stroh

New submission from Matanya Stroh :

I saw some questions about it in stackoverflow (links below), and also find it 
very useful to have the ability to print asterisks.
Some users, find it disturbing when they don't have any indication that 
password is typed, and it will be helpful to have it.

I know that it's have some risks exposing the number of chars to the password, 
but I think it's worth it.

When using Jupyter (notebook server is 4.3.1) the password does echoed as "*", 
but not in Python IDE in linux and Windows

1) 
https://stackoverflow.com/questions/10990998/how-to-have-password-echoed-as-asterisks
2) 
https://stackoverflow.com/questions/7838564/how-to-read-password-with-echo-in-python-console-program

--
components: Library (Lib)
messages: 312410
nosy: matanya.stroh
priority: normal
severity: normal
status: open
title: Adding the ability for getpass to print asterisks when passowrd is typed
type: enhancement
versions: Python 3.8

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



[issue32783] ln(2) isn't accurate in _math.c in cpython

2018-02-06 Thread Matanya Stroh

New submission from Matanya Stroh :

In cpython/Modules/_math.c there is definition of as const ln2
the value that in that const isn't correct (at least not accurate)

This is value that in the file:

ln2 = 0.693147180559945286227 (cpython)

but when calculating the value in wolframalpha, this is the value we get.
ln2 = 0.6931471805599453094172321214581 (wolframalpha)

and this is the value from Wikipedia
ln2 = 0.693147180559945309417232121458 (wikipedia)

also this is the thread in stackoverflow regarding this issue
https://stackoverflow.com/questions/48644767/ln2-const-value-in-math-c-in-cpython

--
components: Library (Lib)
messages: 311749
nosy: matanya.stroh
priority: normal
severity: normal
status: open
title: ln(2) isn't accurate in _math.c in cpython
type: behavior
versions: Python 3.8

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