[issue31456] SimpleCookie fails to parse any cookie if an entry has whitespace in the name

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

The main cause of this behaviour is that whitespace (matching the ASCII RE 
“\s”) is treated as separation between cookie “morsels”. It looks like this has 
always been the behaviour, but I’m not sure it was intended.

>>> print(BaseCookie('first=morsel second=morsel'))
Set-Cookie: first=morsel
Set-Cookie: second=morsel

This could be a security problem, if an attacker managed to inject a CSRF token 
as the second “morsel”. This was mentioned in 
.

IMO it would be better to not split off a second morsel. Either keep it as one 
long morsel value with spaces in, or skip over it to the next semicolon (;).

The reason why the whole cookie string is lost is due to the behaviour of 
cookie morsels without equals signs:

>>> BaseCookie('cookie=lost; ignore').items()
dict_items([])

IMO it would be better to skip over these to the next semicolon as well. It 
looks like this is a regression in Python 3.5+ caused by Issue 22796.

--
nosy: +martin.panter

___
Python tracker 

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



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2019-01-26 Thread Windson Yang


Windson Yang  added the comment:

Why requests library didn't raise an error because urllib3 (the library 
requests using) ignore the auth part right now

> Currently we expect our users to handle authentication headers themselves. 
> It's unfortunate that we silently strip this information though...

The discuss also in https://github.com/urllib3/urllib3/issues/1530

Should we ignore the userinfo part of raising an error here?

--

___
Python tracker 

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



[issue32129] Icon on macOS

2019-01-26 Thread Kevin Walzer


Kevin Walzer  added the comment:

Making the icon 512x512 pixels will make it look correct on Retina displays on 
the Mac.

--

___
Python tracker 

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



[issue2212] Cookie.BaseCookie has ambiguous unicode handling

2019-01-26 Thread Martin Panter


Change by Martin Panter :


--
stage: test needed -> resolved
status: open -> closed

___
Python tracker 

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



[issue2212] Cookie.BaseCookie has ambiguous unicode handling

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

Same as Issue 11315, where Éric suggested documenting the behaviour.

--
nosy: +martin.panter
resolution:  -> duplicate
superseder:  -> unicode support in Cookie module

___
Python tracker 

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



[issue11315] unicode support in Cookie module

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

Sorry, but changing to bytes after ten years of using str in this module in 
Python 3 is not going to happen. Let’s just document the state of Python 2 (see 
Éric: https://bugs.python.org/issue11315#msg129448).

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, ezio.melotti, martin.panter, vstinner
title: Fix type regression in http.cookies.load (want bytes, not str) -> 
unicode support in Cookie module
versions: +Python 2.7 -Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 
3.6

___
Python tracker 

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



[issue19670] SimpleCookie Generates Non-RFC6265-Compliant Cookies

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I think the solution here is to document what “SimpleCookie.value_encode” 
really does: RFC 2109 quoted-string escaping. If you want to a generate 
RFC-6265-compliant Set-Cookie string, do not include non-compliant characters 
in the cookie value, and consider using BaseCookie rather than SimpleCookie, 
especially if your “morsel” values are enclosed in double quotes.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, martin.panter

___
Python tracker 

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



[issue32129] Icon on macOS

2019-01-26 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

A Branch Seidenman posted 'Retina Icons' on idle-dev.  He posted a screenshot 
similar to Kevin's.  He says Apple recommends having all these sizes:
1024px × 1024px
512px × 512px
256px × 256px
128px × 128px
64px × 64px
32px × 32px
16px × 16px

Creating new icons larger that 48px is beyond me.  Besides which, I believe 
these are copies of files elsewhere in the repository.  (The icons directory 
should have a README explaining the files and their origin.  How many of these 
sizes would actually be useful?  Would larger icons be useful on hi-rex Linux 
(or even Windows) systems?

--
nosy: +taleinat

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-26 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

> * Decide whether "setxid problem"[5] is important enough to worry about.
> [5] https://ewontfix.com/7

This is a scary issue.  But I think a reasonable approach could be to never use 
vfork when running as whatever we choose to define a "privileged user" to be.

getuid() or geteuid() return 0?  don't use vfork.

the concept of "privileged user" can obviously mean a lot more than that and 
likely goes beyond what we should attempt to ascertain ourselves.

How about also providing a disable-only global setting so that someone writing 
code they consider to have elevated privileges can prevent its use entirely.  
subprocess.disable_use_of_vfork() and subprocess.is_vfork_enabled() calls 
perhaps (just setting/reading a static int vfork_disallowed = 0 flag within 
_posixsubprocess.c).

If we did that, on systems where posix_spawn() _might_ be implemented using 
vfork() we'd want to avoid using it based on is_vfork_enabled().

True setuid vs vfork attack security would suggest code needs to opt-in to 
vfork() or posix_spawn() rather than opt-out.  Which would destroy the benefit 
for most users (who won't bother) for the sake of an issue that just is not 
what most code ever does (setuid/setgid/etc. calls are very uncommon for most 
software).

I think documenting "HEY, if you are running as with elevated privileges, 
here's a reason why you might want to disable vfork, and how to do it." should 
be enough.  Hopefully not famous last words.

--

___
Python tracker 

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



[issue35835] There is no mention of breakpoint() in the pdb documentation

2019-01-26 Thread jcrmatos


New submission from jcrmatos :

In the Pdb documentation, found at
https://docs.python.org/3.7/library/pdb.html?highlight=pdb#module-pdb
there is no mention of breakpoint().

In my opinion, this text

import pdb; pdb.set_trace()

should be replaced with

import pdb; pdb.set_trace()
New in version 3.7: breakpoint() replaces the previous line.

Thanks,

JM

--
messages: 334406
nosy: jcrmatos
priority: normal
severity: normal
status: open
title: There is no mention of breakpoint() in the pdb documentation
type: enhancement
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-26 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +11523, 11524, 11525

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-26 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +11523, 11524

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-26 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +11523

___
Python tracker 

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



[issue35833] IDLE: revise doc for control chars sent to Shell

2019-01-26 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Martin, your suspicion is correct, as verified by selecting and copying the 
string and pasting into code between quotes.  I strongly suspect that tk just 
sends the string as is to the OS graphics system insert text function, that the 
latter decides what to display.  I ran
  for i in range(1,33): print(f'<{chr(i)}>')
on Windows console, Windows IDLE, and Mac IDLE (omitting '1' crashes on Mac) 
and there are multiple inconsistencies.  I believe tcl/tk only documents \t and 
\n because those are the only two control chars whose behavior is consistent 
across graphics systems.  Thanks for digging up the previous issue.  I would 
close as a duplicate if I did not see a need for doc revision.

--
nosy: +martin.panter

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-26 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Thanks for your _extremely detailed_ analysii of the (often sad) state of 
posix_spawn() on platforms in the world today.

My first reaction to this was "but then we'll be owning our own custom 
posix_spawn-like implementation as if we'll do better at it than every 
individual libc variant."

After reading this through and looking at your PR... I now consider that a good 
thing. =)  We clearly can do better.  vfork() is pretty simple and allows us to 
keep our semantics; providing benefits to existing users at no cost.

The plethora of libc bugs surrounding posix_spawn() seem likely to persist 
within various environments in the world for years to come.  No sense in us 
waiting for that to settle.

As for your PR... a configure check for vfork, a news entry, and whatever other 
documentation updates seem appropriate.

With this in place we may want to make the _use_posix_spawn() logic in 
subprocess.py stricter?  That could be its own followup PR.

--

___
Python tracker 

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



[issue35833] IDLE: revise doc for control chars sent to Shell

2019-01-26 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Example code for the tracker should not use 3rd-party modules unless essential. 
 It should be reduced to the minimum testcase needed to show the behavior.  In 
this case, "print('a\b')", resulting, on Windows 10, in "a", is enough. (On 
macOS Mohave, the result is just 'a'.) These results are not a bug. The IDLE 
chapter of the doc, viewable with Help => IDLE Doc, has a section 'User output 
in Shell', added for 3.6.8 and 3.7.2, that explains.  The full relevant text 
with the key line Martin posted is

"When a program outputs text, the result is determined by the corresponding 
output device.  When IDLE executes user code, sys.stdout and sys.stderr are 
connected to the display area of IDLE’s Shell.  Some of its features are 
inherited from the underlying Tk Text widget.  Others are programmed additions. 
 Where it matters, Shell is designed for development rather than production 
runs. 
...
Text widgets display a subset of Unicode, the Basic Multilingual Plane (BMP). 
Which characters get a proper glyph instead of a replacement box depends on the 
operating system and installed fonts.  Newline characters cause following text 
to appear on a new line, but other control characters are either replaced with 
a box or deleted.  However, repr(), which is used for interactive echo of 
expression values, replaces control characters, some BMP codepoints, and all 
non-BMP characters with escape codes before they are output."

In reviewing this and doing more experiments, I realized that this needs 
revision. A. tabs jump to the next 8-char tabstop.  B. Display replacements for 
control chars can include spaces and other things.  C. Display replacements 
depend on the operating system (as noted above) and possibly the font. D. 
Display replacements only occur when the string is displayed, not when stored 
in the text widget.  Selecting and copying a string on the screen copies what 
is stored in the widget, not what is displayed on the screen.  E. Trying to 
insert non-BMP characters ('\U000n') in a text widget is an error.  
(Preventing this even when a user implicitly requests is a separate issue.)  F. 
Printing null and return characters may cause problems.  Null (\0, \x00) hands 
IDLE on Mac.  Return (\r, \x0D) is ignored by tk but interpreted and converted 
to \n when pasted into code.

I want to add a code block example that illustrate some of these points.

>>> s = 'abc\t\a<\x02><\r>\b'
>>> len(s)
12
>>> s
'abc\t\x07<\x02><\r>\x08'  # This is repr(s).
>>> print(s)  # In IDLE, inserts s into text widget.
# Visible result varies; try it.

PS: On hard-copy terminals, where control characters originated, \b only means 
'Move the print position back a character.'  On 'soft-copy' terminals and 
consoles, it may or may not also mean 'erase the previous character'.

--
nosy:  -martin.panter
stage:  -> needs patch
title: Backspace not working -> IDLE: revise doc for control chars sent to Shell
versions: +Python 3.8

___
Python tracker 

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



[issue35823] Use vfork() in subprocess on Linux

2019-01-26 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

I've checked subprocess.Popen() error reporting in QEMU user-mode and WSL and 
confirm that it works both with my patch (vfork/exec) and the traditional 
fork/exec, but doesn't work with glibc's posix_spawn.

The first command below uses posix_spawn() internally because close_fds=False. 
Under QEMU posix_spawn() from glibc doesn't report errors because it relies on 
address-space sharing of clone(CLONE_VM|CLONE_VFORK), which is not emulated by 
QEMU. The second command uses vfork()/exec() in _posixsubprocess, but lack of 
address-space sharing doesn't matter because the error data is transferred via 
a pipe.

$ qemu-x86_64 --version
qemu-x86_64 version 2.11.1
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
$ ldd --version
ldd (GNU libc) 2.27
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
$ qemu-x86_64 ./python3 -c 'import subprocess; subprocess.call("/xxx", 
close_fds=False)'
$ qemu-x86_64 ./python3 -c 'import subprocess; subprocess.call("/xxx")'
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/izbyshev/install/python-3.8a/lib/python3.8/subprocess.py", line 
324, in call
with Popen(*popenargs, **kwargs) as p:
  File "/home/izbyshev/install/python-3.8a/lib/python3.8/subprocess.py", line 
830, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/izbyshev/install/python-3.8a/lib/python3.8/subprocess.py", line 
1648, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'xxx'

For WSL, I've tested Ubuntu 18.04 (glibc 2.27) on Windows 10 1709 (Fall 
Creators Update) and 1803.

In 1709, the result is the same as for QEMU (i.e. the first command silently 
succeeds). In 1803, both commands raise the exception because address-space 
sharing was fixed for clone(CLONE_VM|CLONE_VFORK) and vfork() in WSL: 
https://github.com/Microsoft/WSL/issues/1878

I've also run all subprocess tests under QEMU user-mode (by making 
sys.executable to point to a wrapper that runs python under QEMU) for the 
following code bases:
* current master (fork/exec or posix_spawn can be used)
* classic (fork/exec always)
* my patch + master (vfork/exec or posix_spawn)
* vfork/exec always
 All tests pass in all four flavors, which indicates that we don't have a test 
for error reporting with close_fds=False :)

Out of curiosity I also did the same on WSL in 1803. Only 3 groups of tests 
fail, all because of WSL bugs:

* It's not possible to send signals to zombies, e.g.:
==
ERROR: test_terminate_dead (test.test_subprocess.POSIXProcessTestCase)
--
Traceback (most recent call last):
  File "/home/test/cpython/Lib/test/test_subprocess.py", line 1972, in 
test_terminate_dead
self._kill_dead_process('terminate')
  File "/home/test/cpython/Lib/test/test_subprocess.py", line 1941, in 
_kill_dead_process
getattr(p, method)(*args)
  File "/home/test/cpython/Lib/subprocess.py", line 1877, in terminate
self.send_signal(signal.SIGTERM)
  File "/home/test/cpython/Lib/subprocess.py", line 1872, in send_signal
os.kill(self.pid, sig)
ProcessLookupError: [Errno 3] No such process
--

* getdents64 syscall doesn't work properly (doesn't return the rest of entries 
on the second call, so close_fds=True doesn't fully work with large number of 
open descriptors).

==
FAIL: test_close_fds_when_max_fd_is_lowered 
(test.test_subprocess.POSIXProcessTestCase)
Confirm that issue21618 is fixed (may fail under valgrind).
--
Traceback (most recent call last):
  File "/home/test/cpython/Lib/test/test_subprocess.py", line 2467, in 
test_close_fds_when_max_fd_is_lowered
self.assertFalse(remaining_fds & opened_fds,
AssertionError: {34, 35, 36, 37, 38, 39, 40, 41, 42} is not false : Some fds 
were left open.
--

* Signal masks in /proc/self/status are not correct (always zero)

==
FAIL: test_restore_signals (test.test_subprocess.POSIXProcessTestCase)
--
Traceback (most recent call last):
  File "/home/test/cpython/Lib/test/test_subprocess.py", line 1643, in 
test_restore_signals
self.assertNotEqual(default_sig_ign_mask, restored_sig_ign_mask,
AssertionError: b'SigIgn:\t' == 

[issue35833] Backspace not working

2019-01-26 Thread Martin Panter


Martin Panter  added the comment:

Ment to point to previous bug report: Issue 23220

--

___
Python tracker 

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



[issue35833] Backspace not working

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I suspect Idle just passes control characters directly to an underlying Text or 
similar TK widget. As far as I know, TK only documents behaviour for tabs and 
newlines, not other control characters.

Last time this was brought up, Terry added a sentence under 
, third 
paragraph, about this:

“Newline characters cause following text to appear on a new line, but other 
control characters are either replaced with a box or deleted.”

--
nosy: +martin.panter

___
Python tracker 

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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2019-01-26 Thread Dmitry Kazakov


Change by Dmitry Kazakov :


--
nosy:  -vaultah

___
Python tracker 

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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2019-01-26 Thread Dmitry Kazakov


Change by Dmitry Kazakov :


--
pull_requests:  -11522

___
Python tracker 

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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2019-01-26 Thread Dmitry Kazakov


Change by Dmitry Kazakov :


--
pull_requests:  -5065

___
Python tracker 

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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2019-01-26 Thread Dmitry Kazakov


Change by Dmitry Kazakov :


--
pull_requests: +11522

___
Python tracker 

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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2019-01-26 Thread Dmitry Kazakov


Dmitry Kazakov  added the comment:

It would seem no one is actually interested in this proposed enhancement. I'm 
closing my PR, since I'm not interested in resolving the file conflict. I'll 
probably submit a traceback-mutating patch to the issue 16217. This issue can 
be closed.

--

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2019-01-26 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch, patch, patch
pull_requests: +11518, 11519, 11520, 11521
stage: needs patch -> patch review

___
Python tracker 

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



[issue35834] get_type_hints exposes an instance of ForwardRef (internal class) in its result, with `from __future__ import annotations` enabled

2019-01-26 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith, lukasz.langa

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2019-01-26 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch
pull_requests: +11518, 11519
stage: needs patch -> patch review

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2019-01-26 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch, patch
pull_requests: +11518, 11519, 11520
stage: needs patch -> patch review

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2019-01-26 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +11518
stage: needs patch -> patch review

___
Python tracker 

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



[issue35834] get_type_hints exposes an instance of ForwardRef (internal class) in its result, with `from __future__ import annotations` enabled

2019-01-26 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue35834] get_type_hints exposes an instance of ForwardRef (internal class) in its result, with `from __future__ import annotations` enabled

2019-01-26 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Wait, I just noticed that PEP563 says:

"Note: if an annotation was a string literal already, it will still be wrapped 
in a string."

https://www.python.org/dev/peps/pep-0563/#id5

In 3.8.0a I get this:

py> from __future__ import annotations
py>
py> class A:
... f: 'Undef'
...
py> A.__annotations__
{'f': "'Undef'"}

which matches what the PEP says. So I expect that when calling get_type_hints 
it should return the unquoted string, rather than a ForwardReference.

get_type_hints(A)

expected {'f': 'Undef'}
actually got {'f': ForwardRef('Undef')}

--

___
Python tracker 

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



[issue35834] get_type_hints exposes an instance of ForwardRef (internal class) in its result, with `from __future__ import annotations` enabled

2019-01-26 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> Since Undef is not defined, I should get an exception when calling 
> get_type_hints


One of the motives of PEP-563 is to make it easier to use forward references. 
I'm not sure, but it seems to me that given that, we should not get an 
exception. So I think the only issue here is that the ForwardReference class is 
not documented, and should be.

But I admit I'm not confident about my understanding of PEP-563 so I could be 
wrong.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue35834] get_type_hints exposes an instance of ForwardRef (internal class) in its result, with `from __future__ import annotations` enabled

2019-01-26 Thread Lincoln Quirk


New submission from Lincoln Quirk :

Consider this code:

```
from __future__ import annotations

import typing

class A:
f: 'Undef'

hints = typing.get_type_hints(A)
```

Since Undef is not defined, I should get an exception when calling 
get_type_hints, something like "NameError: name 'Undef' is not defined". But 
instead, get_type_hints returns {'f': ForwardRef('Undef')}.

If I remove the `from __future__ import annotations` line, get_type_hints 
correctly raises this exception.

I think the behavior should be to raise an exception in both cases.

--
messages: 334396
nosy: Lincoln Quirk
priority: normal
severity: normal
status: open
title: get_type_hints exposes an instance of ForwardRef (internal class) in its 
result, with `from __future__ import annotations` enabled
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue35832] Installation error

2019-01-26 Thread Steve Dower


Steve Dower  added the comment:

You should have a set of log files in your %TEMP% directory. Their names will 
start with Python and end in .log. If you could collect these into a zip file 
and post them here, that would be very helpful.

--

___
Python tracker 

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



[issue35833] Backspace not working

2019-01-26 Thread Dude Roast


New submission from Dude Roast :

Whenever I try to use Backspace(\b) it always prints square boxes instead of 
deleting previous string.

Code Down:- 

import pyautogui
print("Press Ctrl+c to quit")

try:
while True:
x,y = pyautogui.position();
positionStr = "X: " + str(x).rjust(4) + " Y: " + str(y).rjust(4)
print(positionStr,end ='')
print('\b'*len(positionStr),end='',flush=True)

except KeyboardInterrupt:
print("\nDone")


O/P:- 

Press Ctrl+c to quit
X:  317 Y:  261X:  317 Y:  261X:  317 Y:  
261X:  317 Y:  261X:  317 Y:  
261X:  317 Y:  261X:  317 Y:  
261X:  317 Y:  261X:  317 Y:  
261X:  317 Y:  261X:  317 Y:  
261X:  317 Y:  261X:  317 Y:  261
Done

--
assignee: terry.reedy
components: IDLE
files: mousenow.py
messages: 334394
nosy: Dude Roast, terry.reedy
priority: normal
severity: normal
status: open
title: Backspace not working
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48079/mousenow.py

___
Python tracker 

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



[issue35832] Installation error

2019-01-26 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-01-26 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Yes, sorry I thought it was the format used for parsing too. Thanks for the 
example Martin. I am linking @MeiK PR to the issue where I asked them to open 
an issue for this.

--
keywords: +patch
pull_requests: +11517
stage:  -> patch review

___
Python tracker 

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



[issue35824] http.cookies._CookiePattern modifying regular expressions

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I presume MeiK wants to use BaseCookie to parse the Set-Cookie header field, as 
in

>>> BaseCookie('Hello=World; Expires=Thu, 31 Jan 2019 05:56:00 GMT;')

>>> BaseCookie('Hello=World; Expires=Thu,31 Jan 2019 05:56:00 GMT;')


Karthikeyan, if you meant the “sane-cookie-date” format 
(https://tools.ietf.org/html/rfc6265#page-9), that is just the IETF’s 
recommended date format. I suspect MeiK is trying to _parse_ the date rather 
than generate it, in which case the procedure in 
 may be more relevant. 
Spaces and commas are both treated as delimiters, so the problematic Expires 
attribute should parse fine.

BTW, this special handling of Set-Cookie attributes like Expires is not 
documented, though it does seem intentional. According to the documentation 
they should be treated as new Morsels.

--
nosy: +martin.panter

___
Python tracker 

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



[issue35828] test_multiprocessing_* - crash in PyDict_GetItem - segmentation error

2019-01-26 Thread Michael Felt


Michael Felt  added the comment:

OK, I have gone as far back as "where" in dbx can bring me.

Could this, somehow, be related with changes made in issue-33015 ?

In any case, does it seem correct that "pthread_wrapper(void *arg) can be 
correct if arg is nil?

  +155  /* bpo-33015: pythread_callback struct and pythread_wrapper() cast
  +156 "void func(void *)" to "void* func(void *)": always return NULL.
  +157
  +158 PyThread_start_new_thread() uses "void func(void *)" type, whereas
  +159 pthread_create() requires a void* return value. */
  +160  typedef struct {
  +161  void (*func) (void *);
  +162  void *arg;
  +163  } pythread_callback;
  +164
  +165  static void *
  +166  pythread_wrapper(void *arg)
  +167  {
  +168  /* copy func and func_arg and free the temporary structure */
  +169  pythread_callback *callback = arg;
  +170  void (*func)(void *) = callback->func;
  +171  void *func_arg = callback->arg;
  +172  PyMem_RawFree(arg);
  +173
  +174  func(func_arg);
  +175  return NULL;
  +176  }

(dbx) print boot
0x2030cab0
(dbx) which boot
_threadmodule.t_bootstrap.boot
(dbx) print boot
0x2030cab0
(dbx) print *boot
(interp = 0x2030cb00, func = 0xcbcbcbcb, args = 0x1018c460, keyw = 0xcbcbcbcb, 
tstate = 0xcbcbcbcb)
(dbx) which arg
thread.pythread_wrapper.arg
(dbx) print arg
(nil)
(dbx) print *arg
reference through nil pointer
(dbx) which callback
thread.pythread_wrapper.callback
(dbx) print callback
0x2030cb00
(dbx) print *callback
(func = 0x2030cb50, arg = 0x3500)

I am "nervous" when it comes to accepting a value such as 0xcbcbcbcb or 
0xdbdbdbdb as values for pointers to objects - or even "int" or unsigned values 
- look so "specific pattern" like.

Suggestions on how to look at this "better" would be appreciated.

Michael

--

___
Python tracker 

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



[issue35832] Installation error

2019-01-26 Thread Stefano Bonalumi


New submission from Stefano Bonalumi :

Hi
i get the following installation error code when i try to install python 3.7.2 
version on Windows 10
See the attached files

--
components: Installation
files: Annotazione 2019-01-26 132044.jpg
messages: 334390
nosy: Stefano Bonalumi
priority: normal
severity: normal
status: open
title: Installation error
type: crash
versions: Python 3.7
Added file: https://bugs.python.org/file48078/Annotazione 2019-01-26 132044.jpg

___
Python tracker 

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



[issue35828] test_multiprocessing_* - crash in PyDict_GetItem - segmentation error

2019-01-26 Thread Michael Felt


Change by Michael Felt :


--
title: test_multiprocessing_* tests - success versus fail varies over time -> 
test_multiprocessing_* - crash in PyDict_GetItem - segmentation error

___
Python tracker 

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



[issue23930] http.cookies.SimpleCookie doesn't parse comma-only separated cookies correctly

2019-01-26 Thread Martin Panter

Martin Panter  added the comment:

I think making a comma start a new cookie is dangerous, and perhaps this 
proposal should be rejected.

I’m not an expert on web programming, but this reminds me of some security 
problems that already affected Python: 
. In 
a web page, Java Script could set a cookie with a single name and a comma in 
the value.

document.cookie = 'a=b,csrftoken=INJECTED'

Currently, Python in the server would parse that the way the script intended:

>>> C = BaseCookie('a=b,csrftoken=INJECTED')
>>> C['a'].value
'b,csrftoken=INJECTED'
>>> C['csrftoken'].value
KeyError: 'csrftoken'

But with the proposed change, Python would be tricked into parsing it as two 
separate “morsels”:

>>> C['csrftoken'].value
'INJECTED'

--
nosy: +martin.panter
type: behavior -> enhancement

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-26 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset b2b023c657ba8c3f4a24d0c847d10fe8e2a73d44 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.7':
bpo-35780: Fix errors in lru_cache() C code (GH-11623) (GH-11682)
https://github.com/python/cpython/commit/b2b023c657ba8c3f4a24d0c847d10fe8e2a73d44


--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11515, 11516

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-26 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11515

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-26 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d8080c01195cc9a19af752bfa04d98824dd9fb15 by Raymond Hettinger in 
branch 'master':
bpo-35780: Fix errors in lru_cache() C code (GH-11623)
https://github.com/python/cpython/commit/d8080c01195cc9a19af752bfa04d98824dd9fb15


--

___
Python tracker 

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