[issue34841] Script’s directory not in sys.path with embeddable Windows distribution
Simon Sapin added the comment: Removing python37._pth restores the documented behavior, I don’t know if it has adverse effects. -- ___ Python tracker <https://bugs.python.org/issue34841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34841] Script’s directory not in sys.path with embeddable Windows distribution
New submission from Simon Sapin : https://docs.python.org/3/library/sys.html#sys.path documents: > As initialized upon program startup, the first item of this list, path[0], is > the directory containing the script that was used to invoke the Python > interpreter. On Windows with an embeddable zip file distribution, this does not happen. Steps to reproduce: * Create a foo.py file that contains `import bar` * Create an empty bar.py file * With your usual Python installed from the "normal" executable installer, check that `python foo.py` runs without output or error * Download and extract https://www.python.org/ftp/python/3.7.0/python-3.7.0-embed-amd64.zip * Run `..\python-3.7.0-embed-amd64\python foo.py` Expected result: The script runs again without output or error. Actual result: Traceback (most recent call last): File "foo.py", line 1, in import bar ModuleNotFoundError: No module named 'bar' This might be an occurrence of https://bugs.python.org/issue33698, since the embeddable distribution has a python37._pth file that contains "python37.zip" and "." print(sys.path) shows [ 'C:\\Users\\example\\python-3.7.0-embed-amd64\\python37.zip', 'C:\\Users\\example\\python-3.7.0-embed-amd64' ] This StackOverflow question describes the same issue: https://stackoverflow.com/q/51403126/1162888 -- messages: 326671 nosy: ssapin priority: normal severity: normal status: open title: Script’s directory not in sys.path with embeddable Windows distribution type: behavior ___ Python tracker <https://bugs.python.org/issue34841> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue33698] `._pth` does not allow to populate `sys.path` with empty entry
Change by Simon Sapin : -- nosy: +ssapin ___ Python tracker <https://bugs.python.org/issue33698> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content
New submission from Simon Sapin: When given a file-like object, html5lib calls .read(0) in order to check if the result is bytes or Unicode: https://github.com/html5lib/html5lib-python/blob/e269a2fd0aafcd83af7cf1e65bba65c0e5a2c18b/html5lib/inputstream.py#L434 When given the result of urllib.client.urlopen(), it parses an empty document because of this bug. Test case: from urllib.request import urlopen response = urlopen('http://python.org') response.read(0) b'' len(response.read()) 0 For comparison: response = urlopen('http://python.org') len(response.read()) 20317 The bug is here: http://hg.python.org/cpython/file/d489394a73de/Lib/http/client.py#l541 'if not n:' assumes that zero bytes have been read indicates EOF, which is not the case when we ask for zero bytes. -- messages: 206446 nosy: ssapin priority: normal severity: normal status: open title: .read(0) on http.client.HTTPResponse drops the rest of the content type: behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20007 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content
Simon Sapin added the comment: Adding a proposed patch. -- keywords: +patch Added file: http://bugs.python.org/file33179/python-issue20007.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20007 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content
Simon Sapin added the comment: html5lib issue: https://github.com/html5lib/html5lib-python/issues/127 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20007 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20007] .read(0) on http.client.HTTPResponse drops the rest of the content
Simon Sapin added the comment: I could reproduce on 3.3.3 and tip, but not 3.2.3 or 2.7.6. -- versions: +Python 3.5 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20007 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Simon Sapin added the comment: I just remembered about this. I suppose it is too late for 3.3? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Simon Sapin simon.sa...@kozea.fr added the comment: heapq_merge_key_duplicate.patch is a new patch with two code path. It also updates the function’s docstring (which the previous patch did not). Raymond, do you think the speed is worth the DRY violation? -- Added file: http://bugs.python.org/file24248/heapq_merge_key_duplicate.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
New submission from Simon Sapin simon.sa...@kozea.fr: Hi, The attached patch adds a 'key' optional parameter to the heapq.merge function that behaves as in sorted(). Related discussion: http://mail.python.org/pipermail/python-ideas/2012-January/013295.html This is my first contribution to CPython. -- components: Library (Lib) files: heapq_merge_key.patch keywords: patch messages: 150927 nosy: SimonSapin, rhettinger priority: normal severity: normal status: open title: Add a key parameter (like sorted) to heapq.merge type: enhancement versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file24184/heapq_merge_key.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Simon Sapin simon.sa...@kozea.fr added the comment: The attached script benchmarks the basline (current implementation) against 3 new implementations, as suggested on http://mail.python.org/pipermail/python-ideas/2012-January/013296.html On my machine, the output is: merge_baseline per run, min of 3 = 7.527 ms merge_1 per run, min of 3 = 9.894 ms 131.449 % of baseline merge_2 per run, min of 3 = 7.948 ms 105.594 % of baseline merge_3 per run, min of 3 = 7.581 ms 100.716 % of baseline On this particular input, merge_2 adds 6% of overhead when the key parameter is not used. While merge_3 only adds 1% of overhead, it almost doubles the amount of code. (Which was admittedly not that long to begin with.) The patch in the previous message is with the merge_2 implementation, which seemed like the best compromise to me. -- Added file: http://bugs.python.org/file24185/benchmark_heapq_merge.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Simon Sapin simon.sa...@kozea.fr added the comment: Oops, the patch to the documentation would also need 'New in 3.3: the key parameter', with the right Sphinx directive. But that depends on whether this change ends up in 3.3 or 3.4. Does 3.3 still get new features? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5441] Convenience API for timeit.main
Changes by Simon Sapin simon.sa...@kozea.fr: -- nosy: +ssapin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5441 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13742] Add a key parameter (like sorted) to heapq.merge
Simon Sapin simon.sa...@kozea.fr added the comment: Raymond, please have a look at merge_3 in benchmark_heapq_merge.py. It is implemented as you say. Do you think the speed is worth the code duplication? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13742 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com