[issue34565] Launcher does not validate major versions

2018-09-02 Thread Brendan Gerrity


Brendan Gerrity  added the comment:

The function's comment says otherwise; I just noticed when I was messing with 
34565. Supporting arbitrary major versions makes the -0 arg ambiguous so 
alternatively that could be the special case?

--

___
Python tracker 

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



[issue34532] Windows launcher exits with error after listing available versions

2018-09-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +easy (C)

___
Python tracker 

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



[issue34532] Windows launcher exits with error after listing available versions

2018-09-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
stage:  -> needs patch

___
Python tracker 

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



[issue34565] Launcher does not validate major versions

2018-09-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is wrong with supporting version 7.0?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29386] select.epoll.poll may behave differently if timeout = -1 vs timeout = None

2018-09-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See similar issue31334. It may be worth to make the code similar. Only -1 is 
documented as a special timeout value for epoll_wait().

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23855] Missing Sanity Check for malloc() in PC/_msi.c

2018-09-02 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +8499
stage:  -> patch review

___
Python tracker 

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



[issue23855] Missing Sanity Check for malloc() in PC/_msi.c

2018-09-02 Thread Zackery Spytz


Zackery Spytz  added the comment:

The suggested patch is not acceptable: MemoryError should be raised in the 
unlikely event of a malloc() failure, there's a missing call to 
MsiCloseHandle(), the use of tabs violates PEP 7, and there's a blatant syntax 
error.

--
nosy: +ZackerySpytz
versions: +Python 2.7, Python 3.6, Python 3.7, Python 3.8 -Python 3.4

___
Python tracker 

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



[issue34535] queue.Queue(timeout=0.001) avg delay Windows:14.5ms, Ubuntu: 0.063ms

2018-09-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Another possibility might be to not use the Windows timeout clock, at least not 
for short timeouts.  The following shows that tk does about 970 1 millesecond 
timeouts in 1 second (on my machine).
---
import tkinter as tk

root = tk.Tk()
cbid = None
cbcount = 0

def cb():
global cbid, cbcount
cbcount += 1
cbid = root.after(1, cb)

def cbcancel():
print(cbcount)
root.after_cancel(cbid)

root.after(1000, cbcancel)
cbid = root.after(1, cb)
root.mainloop()
---

Here is a proof-of-concept queue-get-with-timeout function with sub-millesecond 
resolution.
---
import tkinter as tk
from queue import Queue, Empty
from time import perf_counter

q = Queue()
fails = 0
value = ''

def qcb():
try:
global value
value = q.get(block=False)
except Empty:
global fails
fails += 1
if perf_counter() < stop:
root.after(0, qcb)
return
root.destroy()

def qget_to(timeout):
global root, stop
root = tk.Tk()
root.withdraw()
stop = perf_counter() + timeout
qid = root.after(0, qcb)
#q.put(1)
root.mainloop()
print('failures:', fails, 'value:', value)

qget_to(.001)
---

With the put commented out, there are 27 fails (on my machine).  When a value 
is already available, there are none.  The loop could be parameterized to 
repeatedly call the no-block version of any similar function.  Large enough 
time-outs could be partially fulfilled using the system timeout function.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue34505] urllib2 fails for proxy credentials that contains a '/' character

2018-09-02 Thread Xiang Zhang


Change by Xiang Zhang :


--
type: crash -> behavior

___
Python tracker 

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



[issue34563] invalid assert on big output of multiprocessing.Process

2018-09-02 Thread Xiang Zhang


Change by Xiang Zhang :


--
nosy: +davin, pitrou

___
Python tracker 

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



[issue34486] "RuntimeError: release unlocked lock" when starting a thread

2018-09-02 Thread Xiang Zhang


Xiang Zhang  added the comment:

It looks to me pure Python implementation could not handle such cases. Put 
aside other possible bugs, threading.Condition.wait re-acquire the lock using 
threading.Condition._acquire_restore which could be interrupted and not able to 
acquire the lock. So it seems in any way using Pure Python, it's not possible 
to guarantee the lock is acquired.

--

___
Python tracker 

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



[issue29386] select.epoll.poll may behave differently if timeout = -1 vs timeout = None

2018-09-02 Thread Gabriel McManus


Gabriel McManus  added the comment:

I don't know of any other OS that implements epoll, so this is issue is likely 
no longer a problem. Although it is strange to convert -1 to -1000 (as though 
from seconds to milliseconds), it may not be worth changing.

--

___
Python tracker 

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



[issue34532] Windows launcher exits with error after listing available versions

2018-09-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I shrank the title to fit in the space and clarified that it does list the 
versions (at least on my Win 10).  So this is invisible in normal use.

--
nosy: +terry.reedy
title: Python launcher on Windows exits with error when requesting list of 
available versions -> Windows launcher exits with error after listing available 
versions

___
Python tracker 

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



[issue34500] Fix ResourceWarning in difflib.py

2018-09-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Using 'with open' is now standard.  Thanks for the update.
In the message above, /us/is/.

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

___
Python tracker 

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



[issue34500] Fix ResourceWarning in difflib.py

2018-09-02 Thread Terry J. Reedy

Terry J. Reedy  added the comment:


New changeset 30af2e737aad427d4da97f8dadeeecff6c2b28f5 by Terry Jan Reedy 
(Mickaël Schoentgen) in branch '2.7':
bpo-34500: Fix ResourceWarning in difflib.py (GH-8926)
https://github.com/python/cpython/commit/30af2e737aad427d4da97f8dadeeecff6c2b28f5


--

___
Python tracker 

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



[issue34500] Fix ResourceWarning in difflib.py

2018-09-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The change to Tools/scripts/diff.py us effectively a backport of the the patch 
merged for #7582. The git log  labels it as 
a2637729f23dc993e820fd92f0d1759ad714c9b2.

The change to Doc/library/difflib.rst does not apply to current 3.x as the test 
code is no longer present.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue34543] _struct.Struct: calling functions without calling __init__ results in SystemError

2018-09-02 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I've tried running this code in Python 3.6:

from _struct import Struct
for i in range(10):
L = [Struct.__new__(Struct) for j in range(1000)]
for s in L:
try:
x = s.pack_into(bytearray())
except SystemError:
pass

I've run it 6 times, for a total of 600 million calls to Struct.__new__ 
and pack_into, and I cannot reproduce any crash or segfault. An 
exception (SystemError) is the correct behaviour.

Is anyone able to try it under Python 3.7?

Unless somebody is able to demonstrate a segfault or core dump, or 
otherwise demonstrate a problem with the C code, I think this ticket 
ought to be closed.

--

___
Python tracker 

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



[issue34565] Launcher does not validate major versions

2018-09-02 Thread Brendan Gerrity


Change by Brendan Gerrity :


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

___
Python tracker 

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



[issue34565] Launcher does not validate major versions

2018-09-02 Thread Brendan Gerrity


New submission from Brendan Gerrity :

When a version argument is passed to the launcher (e.g. `py -3.4` or `py 
-7.0`), contrary to the launcher help text, the major version isn't validated 
as 2 or 3.

--
components: Windows
messages: 324483
nosy: bgerrity, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Launcher does not validate major versions
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



[issue34564] Tutorial Section 2.1 Windows Installation Path Correction

2018-09-02 Thread Tom Berry


New submission from Tom Berry :

The listed installation location is incorrect in the 02 Sep 18 release of the 
tutorial. It shows the default install path as C:\python36 vice C:\Program 
Files\python37. 

This may be related to an installer issue, as installing single-user places the 
program in an entirely different directory. Changing the installer to default 
back to C:\python37 would remove the need to differentiate Program Files (x86) 
for a 32-bit installer, as well as Program Files\ for the 64-bit. 

Corrected Tutorial attached reflecting change FROM C:\python36 TO C:\Program 
Files\Python37.

--
assignee: docs@python
components: Documentation
files: Tutorial_EDIT.pdf
messages: 324482
nosy: aperture, docs@python
priority: normal
severity: normal
status: open
title: Tutorial Section 2.1 Windows Installation Path Correction
type: enhancement
versions: Python 3.7
Added file: https://bugs.python.org/file47781/Tutorial_EDIT.pdf

___
Python tracker 

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



[issue18307] Relative path in co_filename for zipped modules

2018-09-02 Thread Nick Coghlan


Nick Coghlan  added the comment:

Serhiy's analysis sounds right to me - for precompiled bytecode files, we 
really want co_filename to reflect the import time filename *not* the compile 
time filename.

While zipimport is one way to get the compile time and import time paths to 
differ, there are others:

- move an existing directory to another location
- copy a directory tree to a different machine
- move an implicitly cached pyc file to another location

Concrete example from a recent'ish build where I convert an implicitly cached 
pyc to a standalone one, but co_filename still references the original source 
file:

===
$ ./python -c "import contextlib; print(contextlib.__file__); 
print(contextlib.contextmanager.__code__.co_filename)"
/home/ncoghlan/devel/cpython/Lib/contextlib.py
/home/ncoghlan/devel/cpython/Lib/contextlib.py
$ mkdir -p /tmp/example
$ cd /tmp/example
$ cp /home/ncoghlan/devel/cpython/Lib/__pycache__/contextlib.cpython-38.pyc 
contextlib.pyc
$ /home/ncoghlan/devel/cpython/python -c "import contextlib; 
print(contextlib.__file__); 
print(contextlib.contextmanager.__code__.co_filename)"
/tmp/example/contextlib.pyc
/home/ncoghlan/devel/cpython/Lib/contextlib.py
===

--

___
Python tracker 

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



[issue29750] smtplib doesn't handle unicode passwords

2018-09-02 Thread Windson Yang


Windson Yang  added the comment:

I added a pitch to support utf-8.

--

___
Python tracker 

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



[issue34552] Clarify built-in types comparisons

2018-09-02 Thread Windson Yang


Change by Windson Yang :


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

___
Python tracker 

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



[issue34284] Nonsensical exception message when calling `__new__` on non-instaniable objects

2018-09-02 Thread ppperry


ppperry  added the comment:

Also happens for some objects in the `_tkinter` module:
>>> _tkinter.TkttType.__new__(_tkinter.TkttType)
Traceback (most recent call last):
  File "", line 1, in 
_tkinter.TkttType.__new__(_tkinter.TkttType)
TypeError: object.__new__(_tkinter.tktimertoken) is not safe, use 
_tkinter.tktimertoken.__new__()
>>> _tkinter.Tcl_Obj.__new__(_tkinter.Tcl_Obj)
Traceback (most recent call last):
  File "", line 1, in 
_tkinter.Tcl_Obj.__new__(_tkinter.Tcl_Obj)
TypeError: object.__new__(_tkinter.Tcl_Obj) is not safe, use 
_tkinter.Tcl_Obj.__new__()
>>> _tkinter.TkappType.__new__(_tkinter.TkappType)
Traceback (most recent call last):
  File "", line 1, in 
_tkinter.TkappType.__new__(_tkinter.TkappType)
TypeError: object.__new__(_tkinter.tkapp) is not safe, use 
_tkinter.tkapp.__new__()

--

___
Python tracker 

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



[issue34200] importlib: python -m test test_pkg -m test_7 fails randomly

2018-09-02 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

Since my buildbot has been infected with this bug, I took some time to hunt it 
out.  It turns out that issue is caused by an internal import triggered by the 
open() function (at least on Windows).

A recent change to the interpreter (commit 9e4994d) changed the order of 
internal imports wrt file encodings so the default encoding for text files 
triggers a walking of sys.path thus seeing an incomplete test tree.

The reason being that the path for the test tree is added to sys.path prior to 
it being completely flushed out.  In theory this should not be a problem due to 
mtimes, but it seems that the all the additions occur within the time 
resolution of the directory's mtime.

A quick fix for how internal imports happen *now* is:

@@ -81,7 +81,7 @@ class TestPkg(unittest.TestCase):
 if contents is None:
 os.mkdir(fullname)
 else:
-f = open(fullname, "w")
+f = open(fullname, "w", encoding="utf-8")
 f.write(contents)
 if contents and contents[-1] != '\n':
 f.write('\n')

however, to prevent further changes to internal imports cauing further 
problems, the following seems to be prudent:

@@ -70,7 +70,6 @@ class TestPkg(unittest.TestCase):

 def mkhier(self, descr):
 root = tempfile.mkdtemp()
-sys.path.insert(0, root)
 if not os.path.isdir(root):
 os.mkdir(root)
 for name, contents in descr:
@@ -86,6 +85,7 @@ class TestPkg(unittest.TestCase):
 if contents and contents[-1] != '\n':
 f.write('\n')
 f.close()
+sys.path.insert(0, root)
 self.root = root
 # package name is the name of the first item
 self.pkgname = descr[0][0]

--
nosy: +jkloth

___
Python tracker 

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



[issue34282] Enum._convert shadows members named _convert

2018-09-02 Thread orlnub123


Change by orlnub123 :


--
pull_requests: +8496

___
Python tracker 

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



[issue5038] urrlib2/httplib doesn't reset file position between requests

2018-09-02 Thread Martin Panter

Martin Panter  added the comment:

Here is a demonstration script in case it helps. I haven’t tested it with 
versions before Python 2.6.

Older versions send “Content-Length: 11”, but leave the server hanging trying 
to read the data. Newer versions (I presume since Issue 12319, 3.6+) send a 
valid HTTP 1.1 chunked request, but with empty data.

--
Added file: https://bugs.python.org/file47780/auth-mmap.py

___
Python tracker 

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



[issue23949] Number of elements display in error message is wrong while unpacking in traceback

2018-09-02 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage:  -> 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



[issue5038] urrlib2/httplib doesn't reset file position between requests

2018-09-02 Thread Lorenz Mende


Lorenz Mende  added the comment:

Issue shall be closed, as no reproduction code is provided.
No patch provided and no comments since 2015.

--
nosy: +LorenzMende

___
Python tracker 

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



[issue34529] add the option for json.dumps to return newline delimited json

2018-09-02 Thread ron


ron  added the comment:

Well... when handling GBs of data - it's preferred to generate the file 
directly in the required format rather than doing conversions. 

The new line is a format... protocols don't matter here...
I still think the library should allow the user to create this format directly.

Lets get out of the scope of Google or others... The new line is a great format 
it allows you to take a "row" in the middle of the file and see it. You don't 
need to read 1gb file into parser in order to see it you can use copy 1 row... 
We are adopting this format for all our jsons, so it would be nice to get the 
service directly from the library.

--

___
Python tracker 

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



[issue23949] Number of elements display in error message is wrong while unpacking in traceback

2018-09-02 Thread Lorenz Mende


Lorenz Mende  added the comment:

This issue shall be closed, as the solution is already on master with 
4171bbe687904582329c7977d571686953275b45.

--
nosy: +LorenzMende

___
Python tracker 

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



[issue23460] Decimals do not obey ':g' exponential notation formatting rules

2018-09-02 Thread Lorenz Mende


Lorenz Mende  added the comment:

I want to bring this issue up again.
As the others correctly stated, either the documentation or the implementation 
of Decimal 'g' formatting is incorrect.

For floats the implementation suits the docu:
>>> '{:g}'.format(0.1)
'1e-05'
For decimals:
>>> '{:g}'.format(decimal.Decimal('0.1'))
'0.1'

As there is a deviation between documentation and implementation, I advise to 
modify one of both.

--
nosy: +LorenzMende

___
Python tracker 

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