From report at bugs.python.org Fri Jan 1 02:45:03 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Fri, 01 Jan 2016 07:45:03 +0000
Subject: [New-bugs-announce] [issue25985] Use sys.version_info instead of
sys.version
Message-ID: <1451634303.31.0.471991642776.issue25985@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
Proposed patch replaces all occurrences of sys.version[:3] with '%d.%d' % sys.version_info[:2]. The former doesn't work with non-one-digit versions (such as 3.10 and 10.1).
----------
components: Distutils, Library (Lib)
files: use_version_info.patch
keywords: patch
messages: 257279
nosy: dstufft, eric.araujo, lemburg, serhiy.storchaka, tarek
priority: normal
severity: normal
stage: patch review
status: open
title: Use sys.version_info instead of sys.version
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file41463/use_version_info.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 1 15:48:20 2016
From: report at bugs.python.org (Terry J. Reedy)
Date: Fri, 01 Jan 2016 20:48:20 +0000
Subject: [New-bugs-announce] [issue25986] Collections.deque maxlen: added in
2.6 or 2.7?
Message-ID: <1451681300.68.0.792062287695.issue25986@psf.upfronthosting.co.za>
New submission from Terry J. Reedy:
https://docs.python.org/2.6/library/collections.html#collections.deque has this line "Changed in version 2.6: Added maxlen parameter."
https://docs.python.org/2.7/library/collections.html#collections.deque kept the sentence above and added this entry after the list of methods.
Deque objects also provide one read-only attribute:
maxlen
Maximum size of a deque or None if unbounded.
New in version 2.7.
Which is it?
----------
messages: 257299
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Collections.deque maxlen: added in 2.6 or 2.7?
type: behavior
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 1 17:00:33 2016
From: report at bugs.python.org (Andrew Barnert)
Date: Fri, 01 Jan 2016 22:00:33 +0000
Subject: [New-bugs-announce] [issue25987] collections.abc.Reversible
Message-ID: <1451685633.1.0.273350637631.issue25987@psf.upfronthosting.co.za>
New submission from Andrew Barnert:
This came up as a side issue in the -ideas discussion on deprecating the old-style sequence protocol that came out of Guido's suggestion on https://github.com/ambv/typehinting/issues/170 (http://article.gmane.org/gmane.comp.python.ideas/37599):
> I also think it's fine to introduce Reversible as another ABC and carefully fit it into the existing hierarchy. It should be a one-trick pony and be another base class for Sequence; it should not have a default implementation. (But this has been beaten to death in other threads -- it's time to just file an issue with a patch.)
I'll file a patch this weekend. But in case there's anything to bikeshed, here are the details:
* Reversible is a subclass of Iterable.
* It has a single abstract method, __reversed__, with no default implementation.
* Its subclass hook that checks for __reversed__ existing and not being None.
* Sequence is a subclass of Reversible, Sized, and Container rather than directly of Iterable, Sized, and Container.
Builtins tuple and list, and any subclasses of them, will be Reversible because they register with Sequence or MutableSequence. Subclasses of collections.abc.Sequence will be Reversible (and should be, as they inherit Sequence.__reversed__). Custom old-style sequences will not be Reversible, even though reversed works on them.
Builtins dict, set, and frozenset, and any subclasses of them, will not be Reversible (unless they add a __reversed__ method, as OrderedDict does). Subclasses of collections.abc.Mapping will not be Reversible (and should not be, as, assuming #25864 goes through, they inherit Mapping.__reversed__=None) (unless they add a __reversed__ method, as most third-party sorted-dict types do).
I'll include tests for all of those things.
I believe this is all exactly parallel with collections.abc.Iterable, and will make collections.abc.Reversible compatible with typing.Reversible[...] in exactly the same way collections.abc.Iterable is compatible with typing.Iterable[...].
Alternatives: We could make Reversible independent of Iterable. Alternatively, we could make it subclass both Iterable and Sized instead of just Iterable. But I think this is the simplest place to slot it in.
----------
components: Library (Lib)
messages: 257310
nosy: abarnert
priority: normal
severity: normal
status: open
title: collections.abc.Reversible
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 1 17:18:59 2016
From: report at bugs.python.org (Andrew Barnert)
Date: Fri, 01 Jan 2016 22:18:59 +0000
Subject: [New-bugs-announce] [issue25988] collections.abc.Indexable
Message-ID: <1451686739.56.0.219134772531.issue25988@psf.upfronthosting.co.za>
New submission from Andrew Barnert:
In an -ideas thread, Guido suggested (http://article.gmane.org/gmane.comp.python.ideas/37599):
> If we want some way to turn something that just defines __getitem__ and __len__ into a proper sequence, it should just be made to inherit from Sequence, which supplies the default __iter__ and __reversed__. (Registration is *not* good enough here.) If we really want a way to turn something that just supports __getitem__ into an Iterable maybe we can provide an additional ABC for that purpose; let's call it a HalfSequence until we've come up with a better name. (We can't use Iterable for this because Iterable should not reference __getitem__.)
Later in the thread, Nick Coghlan suggested (http://article.gmane.org/gmane.comp.python.ideas/37614):
> Perhaps collections.abc.Indexable would work? Invariant:
> for idx, val in enumerate(container):
> assert container[idx] is val
> That is, while enumerate() accepts any iterable, Indexable containers
have the additional property that the contained values can be looked
up by their enumeration index. Mappings (even ordered ones) don't
qualify, since they offer a key:value lookup, but enumerating them
produces an index:key relationship.
So, in particular:
* Indexable is a subclass of Iterable.
* Sequence is a subclass of Indexable, Sized, and Container instead of Iterable, Sized, and Container. (Or, if #25987 also goes through, of Reversible, Indexable, Sized, and Container.)
* The abstract method __getitem__ and the concrete __iter__ implementation get moved up from Sequence to Indexable.
* Indexable does _not_ have a subclass hook (to avoid making every Mapping, generic type, etc. accidentally Indexable).
This means that you can write this (borrowing an example from Steven D'Aprano in http://article.gmane.org/gmane.comp.python.ideas/23369/):
class Squares(collections.abc.Indexable):
def __getitem__(self, index):
return index**2
Because this no longer depends on the old-style sequence protocol, testing it with ABCs will work as expected.
For related issues, see #25987, #25864, #25958, and https://github.com/ambv/typehinting/issues/170
----------
components: Library (Lib)
messages: 257311
nosy: abarnert
priority: normal
severity: normal
status: open
title: collections.abc.Indexable
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 1 18:46:57 2016
From: report at bugs.python.org (Vincent Davis)
Date: Fri, 01 Jan 2016 23:46:57 +0000
Subject: [New-bugs-announce] [issue25989] documentation version switcher is
broken fro 2.6, 3.2, 3.3
Message-ID: <1451692017.71.0.123733949867.issue25989@psf.upfronthosting.co.za>
New submission from Vincent Davis:
>From the documentation pages for python 2.7 and 3.4, 3.5, 3.6 it is possible to select another python version in the breadcrumb at the top left of the page. This is not available for python 2.6, 3.2 and 3.3.
See related issue which is closed.
https://bugs.python.org/issue25113
I posted this on pythondotorg but I guess this is a cpython issue not a website issue. https://github.com/python/pythondotorg/issues/868
Berker Peksag response to the report
"The version switcher is activated via a versionswitcher option in Doc/Makefile in CPython codebase. Docs are generated daily by using that Makefile, but 2.6, 3.2 and 3.3 are in security-fix-only mode (which means they won't even get documentation fixes) so the daily build script skips generating docs for those versions."
----------
assignee: docs at python
components: Documentation
messages: 257317
nosy: Vincentdavis, docs at python
priority: normal
severity: normal
status: open
title: documentation version switcher is broken fro 2.6, 3.2, 3.3
type: behavior
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 1 21:15:52 2016
From: report at bugs.python.org (Steve Litt)
Date: Sat, 02 Jan 2016 02:15:52 +0000
Subject: [New-bugs-announce] [issue25990] Pydoc fails on Python file with
nonlocal
Message-ID: <1451700952.99.0.532162073876.issue25990@psf.upfronthosting.co.za>
New submission from Steve Litt:
Latest pydoc on Void linux 64 bit, I have no idea how to capture the version. Source file can be either Python 3.4 or 2.7, same result.
ERROR MESSAGE:
[slitt at mydesk ~]$ pydoc pydoc_fail
problem in ./pydoc_fail.py - : invalid syntax (pydoc_fail.py, line 6)
[slitt at mydesk ~]$
----------
files: pydoc_fail.py
hgrepos: 328
messages: 257321
nosy: stevelitt
priority: normal
severity: normal
status: open
title: Pydoc fails on Python file with nonlocal
type: crash
Added file: http://bugs.python.org/file41468/pydoc_fail.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 1 23:28:53 2016
From: report at bugs.python.org (Bruce Frederiksen)
Date: Sat, 02 Jan 2016 04:28:53 +0000
Subject: [New-bugs-announce] [issue25991] readline example eventually
consumes all memory
Message-ID: <1451708933.83.0.797303528676.issue25991@psf.upfronthosting.co.za>
New submission from Bruce Frederiksen:
The Example in the readline documentation (section 6.7 of the Library Reference) shows how to save your readline history in a file, and restore it each time you start Python.
The problem with the Example is that it does not include a call to readline.set_history_length and the default is -1 (infinite).
As a Python developer, I start Python quite a lot and had a .python_history file that was 850M bytes. Just starting Python was causing my system to thrash before the first prompt (>>>) even appeared.
I suggest adding the following line to the example to avoid this:
readline.set_history_length(1000)
I'm not sure how far back this goes in terms of earlier versions of Python, but probably quite far.
----------
assignee: docs at python
components: Documentation
messages: 257325
nosy: dangyogi, docs at python
priority: normal
severity: normal
status: open
title: readline example eventually consumes all memory
type: resource usage
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 2 00:50:06 2016
From: report at bugs.python.org (Bryce Miller)
Date: Sat, 02 Jan 2016 05:50:06 +0000
Subject: [New-bugs-announce] [issue25992] test_gdb fails
Message-ID: <1451713806.34.0.803842118103.issue25992@psf.upfronthosting.co.za>
New submission from Bryce Miller:
test_gdb fails for me on OSX
Steps I did to duplicate:
Checked out fresh '2.7' branch from https://github.com/python/cpython.git
>From the new cypthon dir ran:
./configure
make
make test
./Lib/test/regrtest.py -v test_gdb
Attached the full verbose output.
I am looking at Issue23137 and the output messages look different than mine, so I'm posting this as a separate issue. Perhaps it is duplicate.
34 tracebacks included in attachment, but below is a sample for reference:
======================================================================
FAIL: test_NULL_instance_dict (test.test_gdb.PrettyPrintTests)
Ensure that a PyInstanceObject with with a NULL in_dict is handled
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_gdb.py", line 521, in test_NULL_instance_dict
exptype='Foo')
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_gdb.py", line 459, in assertSane
cmds_after_breakpoint=cmds_after_breakpoint)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_gdb.py", line 239, in get_gdb_repr
import_site=import_site)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/test/test_gdb.py", line 224, in get_stack_trace
self.assertEqual(unexpected_errlines, [])
AssertionError: Lists differ: ['Unable to find Mach task por... != []
First list contains 4 additional elements.
First extra element 0:
Unable to find Mach task port for process-id 53220: (os/kern) failure (0x5).
----------
components: Tests
files: regrtest_test_gdb.log
hgrepos: 329
messages: 257326
nosy: Bryce Miller
priority: normal
severity: normal
status: open
title: test_gdb fails
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file41471/regrtest_test_gdb.log
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 2 03:49:38 2016
From: report at bugs.python.org (Xiongzhi Gao)
Date: Sat, 02 Jan 2016 08:49:38 +0000
Subject: [New-bugs-announce] [issue25993] Crashed when call time.time()
after using _mm_xor_si64
Message-ID: <1451724578.62.0.704000687465.issue25993@psf.upfronthosting.co.za>
New submission from Xiongzhi Gao:
The version of windows is Windows 7 Service Pack 1.
The version of Python is 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32.
The version of compiler in visual studio 10 is 16.00.40219.01 for 80x86.
I try to use SWIG to port a function that use _mm_xor_si64 like this:
packed_sse.i
> %module packed_sse
> %{
> extern long long _packed_mm_xor_si64(long long m1, long long m2);
> %}
> extern long long _packed_mm_xor_si64(long long m1, long long m2);
packed_sse.c
> #include
>
> __inline __m64 int64_to_m64 (const long long i) {
> union {
> long long i;
> __m64 v;
> } u;
> u.i = i;
> return u.v;
> }
>
> __inline long long m64_to_int64 (const __m64 v) {
> union {
> long long i;
> __m64 v;
> } u;
> u.v = v;
> return u.i;
> }
>
> long long _packed_mm_xor_si64(long long m1, long long m2) {
> __m64 m64_m1 = int64_to_m64(m1), m64_m2 = int64_to_m64(m2);
> __m64 m64_result = _mm_xor_si64(m64_m1, m64_m2);
> return m64_to_int64(m64_result);
I use swig and compiler to port C to Python.
I try to test like this, it works:
test_swig.py
> # -*- coding: utf-8 -*-
> # !/bin/env python2
>
> import random
>
> import packed_sse
>
>
> if __name__ == "__main__":
> for i in range(100000):
> a, b = random.getrandbits(20), random.getrandbits(20)
> _ = packed_sse._packed_mm_xor_si64(
> a, b
> )
> assert a ^ b == _
But when I try to profile the function like this, the output of first `print time.time() - _beg` is `nan` and Python crashed when run into second `print time.time() - _beg`:
profile_swig.py
> # -*- coding: utf-8 -*-
> # !/bin/env python2
>
> import random
> import time
>
> import packed_sse
>
>
> if __name__ == "__main__":
> _beg = time.time()
> for i in range(100000):
> _ = packed_sse._packed_mm_xor_si64(
> random.getrandbits(20), random.getrandbits(20)
> )
> print time.time() - _beg # First
> _beg = time.time()
> for i in range(100000):
> _ = random.getrandbits(20) ^ random.getrandbits(20)
> print time.time() - _beg # Second
I try to use `gdb` on MingGW to debug it, it said:
> (gdb) stop
> (gdb) c
> Continuing.
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 7172.0xadc]
> 0x534fbe6c in python27!_Py_dg_dtoa () from C:\Windows\system32\python27.dll
----------
components: Windows
messages: 257337
nosy: Xiongzhi Gao, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Crashed when call time.time() after using _mm_xor_si64
type: crash
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 2 12:48:16 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Sat, 02 Jan 2016 17:48:16 +0000
Subject: [New-bugs-announce] [issue25994] File descriptor leaks in
os.scandir()
Message-ID: <1451756896.24.0.122789607597.issue25994@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
os.scandir() opens a file descriptor and closes it only in its destructor. This can causes file descriptor leaks in Python implementations without reference counting and if the scandir iterator becomes a part of reference loop or long living object. Since the number of open file descriptors is limited, this can leads to problems.
We need to add the close() method to the scandir iterator (as in files and generators). It would be useful also to make it a context manager.
In 3.5 we have to add a warning about this behavior.
----------
components: Extension Modules
messages: 257351
nosy: benhoyt, haypo, serhiy.storchaka
priority: high
severity: normal
status: open
title: File descriptor leaks in os.scandir()
type: resource usage
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 2 12:57:05 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Sat, 02 Jan 2016 17:57:05 +0000
Subject: [New-bugs-announce] [issue25995] os.walk() consumes a lot of file
descriptors
Message-ID: <1451757425.39.0.0524932176307.issue25995@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
Since 3.5 os.walk() consumes a lot of file descriptors. Its number equals to the deep of directories tree. Since the number of file descriptors is limited, this can cause problems.
This was the main reason for rejecting fwalk-based implementation of os.walk() (issue15200).
----------
components: Library (Lib)
messages: 257352
nosy: benhoyt, haypo, larry, serhiy.storchaka
priority: normal
severity: normal
status: open
title: os.walk() consumes a lot of file descriptors
type: resource usage
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 2 13:10:38 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Sat, 02 Jan 2016 18:10:38 +0000
Subject: [New-bugs-announce] [issue25996] Add support of file descriptor in
os.scandir()
Message-ID: <1451758238.49.0.729670752807.issue25996@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
For now os.scandir() on Unix is implemented using opendir()/readdir()/closedir(). It accepts bytes and str pathname. But most functions in the os module that accept a pathname, accept also an open file descriptor. It is possible to implement this feature in scandir() with using fdopendir() instead of opendir(). This would allow to add a support of the dir_fd parameter in scandir(). And that would allow to implement os.fwalk() with scandir() and make more efficient implementation of os.walk() (because we no longer need to walk long path for deep directories, see issue15200).
----------
components: Extension Modules
messages: 257353
nosy: benhoyt, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add support of file descriptor in os.scandir()
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 2 14:53:25 2016
From: report at bugs.python.org (Patrik Dufresne)
Date: Sat, 02 Jan 2016 19:53:25 +0000
Subject: [New-bugs-announce] [issue25997] Tarfile.add with bytes path is
failling
Message-ID: <1451764405.28.0.333419880033.issue25997@psf.upfronthosting.co.za>
New submission from Patrik Dufresne:
With python 3.4, Tarfile doesn't properly support adding a files with bytes path. Only unicode is supported. It's failing with exception similar to:
tar.add(os.path.join(dirpath, filename), filename)
File "/usr/lib/python3.4/tarfile.py", line 1907, in add
tarinfo = self.gettarinfo(name, arcname)
File "/usr/lib/python3.4/tarfile.py", line 1767, in gettarinfo
arcname = arcname.replace(os.sep, "/")
TypeError: expected bytes, bytearray or buffer compatible object
It uses os.sep, and u"/". Instead, it should use something like posixpath.py:_get_sep(path).
----------
components: Unicode
messages: 257355
nosy: Patrik Dufresne, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Tarfile.add with bytes path is failling
type: behavior
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 2 17:30:43 2016
From: report at bugs.python.org (Lasse Schuirmann)
Date: Sat, 02 Jan 2016 22:30:43 +0000
Subject: [New-bugs-announce] [issue25998] doctest crashes when accessing
__wrapped__ fails other than AttributeError
Message-ID: <1451773843.64.0.986014558431.issue25998@psf.upfronthosting.co.za>
New submission from Lasse Schuirmann:
You can see this when importing the Flask `request` object in a file that is doctested. The `request` object will throw a RuntimeError when one tries to access any attribute. Doctest tries to `inspect.unwrap` all objects in the file in order to find out if they're doctestable functions - and apparently only catches the `AttributeError` exception. Thus it crashes :)
----------
components: Tests
files: shell
messages: 257378
nosy: Lasse Schuirmann
priority: normal
severity: normal
status: open
title: doctest crashes when accessing __wrapped__ fails other than AttributeError
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file41477/shell
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 3 06:45:05 2016
From: report at bugs.python.org (SonokoMizuki)
Date: Sun, 03 Jan 2016 11:45:05 +0000
Subject: [New-bugs-announce] [issue25999] Add support of native number in
bin()
Message-ID: <1451821505.72.0.958245773106.issue25999@psf.upfronthosting.co.za>
New submission from SonokoMizuki:
Add support of negative number in bin().
Currently, bin(-5) returns '-0b101', It is not intuitive.
I think bin() should return two's complement.
I suggest new bin().
New second argument is bit size.
if first argument is negative number and bit size is given, bin() will return two's complement.
example)
>>> bin(12)
'0b1100'
>>> bin(-12)
'-0b1100'
>>> bin(-12,8)
'0b11110100'
>>> bin(-12,3) # if not enough bit size, bin will return value as usual.
'-0b100'
----------
components: Argument Clinic
messages: 257408
nosy: larry, mizuki
priority: normal
severity: normal
status: open
title: Add support of native number in bin()
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 3 08:50:57 2016
From: report at bugs.python.org (William Bowling)
Date: Sun, 03 Jan 2016 13:50:57 +0000
Subject: [New-bugs-announce] [issue26000] Crash in Tokenizer -
Heap-use-after-free
Message-ID: <1451829057.23.0.675213101615.issue26000@psf.upfronthosting.co.za>
New submission from William Bowling:
Similar to https://bugs.python.org/issue25388 the following causes a crash on 3.5.1 and the latest 3.5 branch:
./python -c 'with open("vuln.py", "wb") as f: f.write(b"\x61\x73\x00\x0a\x79\x6e\x63\x5c\x0a\xef")'
./python vuln.py
Python 3.5.1+ (default, Jan 4 2016, 00:05:40)
=================================================================
==24400==ERROR: AddressSanitizer: heap-use-after-free on address 0xf270f100 at pc 0x080ad09e bp 0xffef5ee8 sp 0xffef5ac0
READ of size 2 at 0xf270f100 thread T0
#0 0x80ad09d in strncpy (/home/will/python/cpython/python+0x80ad09d)
#1 0x8589b56 in parsetok /home/will/python/cpython/Parser/parsetok.c:235:13
#2 0x858b301 in PyParser_ParseFileObject /home/will/python/cpython/Parser/parsetok.c:134:12
#3 0x8439e0b in PyParser_ASTFromFileObject /home/will/python/cpython/Python/pythonrun.c:1150:15
#4 0x843aa37 in PyRun_FileExFlags /home/will/python/cpython/Python/pythonrun.c:916:11
#5 0x8438a98 in PyRun_SimpleFileExFlags /home/will/python/cpython/Python/pythonrun.c:396:13
#6 0x84382a6 in PyRun_AnyFileExFlags /home/will/python/cpython/Python/pythonrun.c:80:16
#7 0x813f194 in run_file /home/will/python/cpython/Modules/main.c:318:11
#8 0x813f194 in Py_Main /home/will/python/cpython/Modules/main.c:768
#9 0x8138070 in main /home/will/python/cpython/./Programs/python.c:69:11
#10 0xf7558496 in __libc_start_main (/usr/lib32/libc.so.6+0x18496)
#11 0x80715b7 in _start (/home/will/python/cpython/python+0x80715b7)
0xf270f100 is located 0 bytes inside of 8194-byte region [0xf270f100,0xf2711102)
freed by thread T0 here:
#0 0x810c2a4 in __interceptor_cfree.localalias.1 (/home/will/python/cpython/python+0x810c2a4)
#1 0x8139560 in _PyMem_RawFree /home/will/python/cpython/Objects/obmalloc.c:90:5
#2 0x813852b in PyMem_Free /home/will/python/cpython/Objects/obmalloc.c:349:5
#3 0x8596b05 in error_ret /home/will/python/cpython/Parser/tokenizer.c:198:9
#4 0x8596b05 in decoding_fgets /home/will/python/cpython/Parser/tokenizer.c:636
#5 0x8594df0 in tok_nextc /home/will/python/cpython/Parser/tokenizer.c:1016:21
#6 0x858ebba in tok_get /home/will/python/cpython/Parser/tokenizer.c:1457:13
#7 0x858fc79 in tok_get /home/will/python/cpython/Parser/tokenizer.c:1524:34
#8 0x858e1da in PyTokenizer_Get /home/will/python/cpython/Parser/tokenizer.c:1804:18
#9 0x85899a7 in parsetok /home/will/python/cpython/Parser/parsetok.c:208:16
#10 0x858b301 in PyParser_ParseFileObject /home/will/python/cpython/Parser/parsetok.c:134:12
#11 0x8439e0b in PyParser_ASTFromFileObject /home/will/python/cpython/Python/pythonrun.c:1150:15
#12 0x843aa37 in PyRun_FileExFlags /home/will/python/cpython/Python/pythonrun.c:916:11
#13 0x8438a98 in PyRun_SimpleFileExFlags /home/will/python/cpython/Python/pythonrun.c:396:13
#14 0x84382a6 in PyRun_AnyFileExFlags /home/will/python/cpython/Python/pythonrun.c:80:16
#15 0x813f194 in run_file /home/will/python/cpython/Modules/main.c:318:11
#16 0x813f194 in Py_Main /home/will/python/cpython/Modules/main.c:768
#17 0x8138070 in main /home/will/python/cpython/./Programs/python.c:69:11
#18 0xf7558496 in __libc_start_main (/usr/lib32/libc.so.6+0x18496)
previously allocated by thread T0 here:
#0 0x810c784 in realloc (/home/will/python/cpython/python+0x810c784)
#1 0x8139541 in _PyMem_RawRealloc /home/will/python/cpython/Objects/obmalloc.c:84:12
#2 0x8138506 in PyMem_Realloc /home/will/python/cpython/Objects/obmalloc.c:343:12
#3 0x8594f1c in tok_nextc /home/will/python/cpython/Parser/tokenizer.c:1058:31
#4 0x858e4c9 in tok_get /home/will/python/cpython/Parser/tokenizer.c:1354:17
#5 0x858e1da in PyTokenizer_Get /home/will/python/cpython/Parser/tokenizer.c:1804:18
#6 0x85899a7 in parsetok /home/will/python/cpython/Parser/parsetok.c:208:16
#7 0x858b301 in PyParser_ParseFileObject /home/will/python/cpython/Parser/parsetok.c:134:12
#8 0x8439e0b in PyParser_ASTFromFileObject /home/will/python/cpython/Python/pythonrun.c:1150:15
#9 0x843aa37 in PyRun_FileExFlags /home/will/python/cpython/Python/pythonrun.c:916:11
#10 0x8438a98 in PyRun_SimpleFileExFlags /home/will/python/cpython/Python/pythonrun.c:396:13
#11 0x84382a6 in PyRun_AnyFileExFlags /home/will/python/cpython/Python/pythonrun.c:80:16
#12 0x813f194 in run_file /home/will/python/cpython/Modules/main.c:318:11
#13 0x813f194 in Py_Main /home/will/python/cpython/Modules/main.c:768
#14 0x8138070 in main /home/will/python/cpython/./Programs/python.c:69:11
#15 0xf7558496 in __libc_start_main (/usr/lib32/libc.so.6+0x18496)
SUMMARY: AddressSanitizer: heap-use-after-free (/home/will/python/cpython/python+0x80ad09d) in strncpy
Shadow bytes around the buggy address:
0x3e4e1dd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3e4e1de0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3e4e1df0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3e4e1e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x3e4e1e10: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x3e4e1e20:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x3e4e1e30: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x3e4e1e40: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x3e4e1e50: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x3e4e1e60: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
0x3e4e1e70: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==24400==ABORTING
----------
components: Interpreter Core
messages: 257417
nosy: William Bowling
priority: normal
severity: normal
status: open
title: Crash in Tokenizer - Heap-use-after-free
type: crash
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 3 08:56:15 2016
From: report at bugs.python.org (Dimitri Papadopoulos Orfanos)
Date: Sun, 03 Jan 2016 13:56:15 +0000
Subject: [New-bugs-announce] [issue26001] Tutorial: write() does not expect
string in binary mode
Message-ID: <1451829375.45.0.0188699168911.issue26001@psf.upfronthosting.co.za>
New submission from Dimitri Papadopoulos Orfanos:
About section "7.2.1. Methods of File Objects" of the tutorial:
1. Method read() is documented as follows:
reads some quantity of data and returns it as a string or bytes object.
Indeed read() returns a string in text mode and bytes in binary mode. For the sake of clarity, I suggest changing to:
reads some quantity of data and returns it as a string (in text mode) or bytes object (in binary mode).
This might seem long-winded but I believe it would help those moving from Python 2 to Python 3.
2. Method write() is documented as follows:
To write something other than a string, it needs to be converted to a string first
While this is correct in text mode, it is wrong in binary mode. May I suggest:
To write something other than a string (in text mode) or bytes object (in binary mode), it needs to be converted first
----------
assignee: docs at python
components: Documentation
messages: 257418
nosy: Dimitri Papadopoulos Orfanos, docs at python
priority: normal
severity: normal
status: open
title: Tutorial: write() does not expect string in binary mode
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 3 09:21:58 2016
From: report at bugs.python.org (Upendra Kumar)
Date: Sun, 03 Jan 2016 14:21:58 +0000
Subject: [New-bugs-announce] [issue26002] make statistics.median_grouped
more efficient
Message-ID: <1451830918.88.0.211778162331.issue26002@psf.upfronthosting.co.za>
New submission from Upendra Kumar:
statistics.median_grouped currently uses cf=data.index(x) to find the leftmost position of x in data ( line number 445 ). Here, data.index() has linear time complexity, which may not be good for long lists.
But, here since the list 'data' is sorted beforehand, we can use binary search ( bisect_left() ) to find the leftmost occurrence of 'x' in 'data'.
Similarly, for counting number of occurrence of 'x' in data after sorting, we can find the position of rightmost occurrence of 'x' in data[l1....len(data)], where l1 is position of leftmost occurrence of 'x' (line number 447 )
----------
components: Library (Lib)
files: median_grouped.patch
keywords: patch
messages: 257419
nosy: upendra-k14
priority: normal
severity: normal
status: open
title: make statistics.median_grouped more efficient
type: performance
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41484/median_grouped.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 3 14:04:26 2016
From: report at bugs.python.org (tzickel)
Date: Sun, 03 Jan 2016 19:04:26 +0000
Subject: [New-bugs-announce] [issue26003] Issues with PyEval_InitThreads and
PyGILState_Ensure
Message-ID: <1451847866.91.0.926666566382.issue26003@psf.upfronthosting.co.za>
New submission from tzickel:
A few issues regarding threads:
A. (Python 2 & 3) The documentation (https://docs.python.org/3/c-api/init.html) about initializing the GIL/Threading system does not specify that calling PyEval_InitThreads actually binds the calling thread as the main_thread in the ceval.c, meaning that the thread will be in charge till the process goes down for handling Py_AddPendingCall calls, and if it ends/dies, they won't be handled anymore.
This ceval.c's main_thread is different BTW from the one in signalmodule.c which is bound to the thread that called Py_InitializeEx.
Maybe there is sense for both main_thread to be the same one and initialized in the same time ? (even without a GIL existing)
B. (Python 3) Besides the bad documentation regarding this, python 3.4 added issue #19576 which actually hides the call for PyEval_InitThreads inside PyGILState_Ensure. Without careful care and knowledge by the programmer, this might cause for a short lived thread created in C to actually bind the ceval.c's main_thread and when the thread dies main_thread will never be changed again.
The reason this is important is beforehand, the programmer needed to think about PyEval_InitThreads now it's hidden and not even mentioned in the documentation.
C. (Python 2 & 3) In PyEval_InitThreads documentation it's written "It is not safe to call this function when it is unknown which thread (if any) currently has the global interpreter lock." Thus it should be mentioned that PyGILState_Ensure is now calling it in the documentation ?
Also I believe the reason this quote exists is because a potential race condition between thread A which might be running code in PyEval_EvalFrameEx (before PyEval_InitThreads is called, and thus is not GIL aware), and thread B which calls PyEval_InitThreads then calls PyGILState_Ensure, then running Python code, while thread A is still running python code as well. I think it should be explained more clearly in the documentation the implications (race condition).
I think there might be a way to make an PyEval_InitThreads variant which can overcome this race condition. Basically it involves using Py_AddPendingCall to a C function which calls PyEval_InitThreads, and notifies the calling command/thread when it's done. This way we can be sure that the GIL is taken by one thread, and all the others are blocked. (maybe a signal should be sent as well, in case the main_thread is blocked on an I/O operation).
D. (Python 2) If the main_thread finishes it's job, while other python threads are still alive, signal handling isn't processed anymore (Example will be added as a file).
----------
components: Interpreter Core
files: signalexample.py
messages: 257425
nosy: tzickel
priority: normal
severity: normal
status: open
title: Issues with PyEval_InitThreads and PyGILState_Ensure
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file41485/signalexample.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 03:45:06 2016
From: report at bugs.python.org (Debashish Maity)
Date: Mon, 04 Jan 2016 08:45:06 +0000
Subject: [New-bugs-announce] [issue26004] pip install lifetimes - throwing
error and unable to install packages
Message-ID: <1451897106.72.0.251427221401.issue26004@psf.upfronthosting.co.za>
New submission from Debashish Maity:
Not able to install "lifetimes" package using pip script.
Need urgent help.
Followed the following links for help, but still no success
http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/
http://stackoverflow.com/questions/26473854/python-pip-has-issues-with-path-for-ms-visual-studio-2010-express-for-64-bit-ins/26513378#26513378
----------
components: Windows
files: log.txt
messages: 257445
nosy: dudestc, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: pip install lifetimes - throwing error and unable to install packages
type: compile error
versions: Python 3.5
Added file: http://bugs.python.org/file41489/log.txt
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 03:54:10 2016
From: report at bugs.python.org (Richard Clifford)
Date: Mon, 04 Jan 2016 08:54:10 +0000
Subject: [New-bugs-announce] [issue26005] Denial of Service in
SimpleHTTPServer and BaseHTTPServer
Message-ID: <1451897650.58.0.64883073344.issue26005@psf.upfronthosting.co.za>
New submission from Richard Clifford:
The issue comes when there is a malformed HTTP request not ending in a new line, it causes the server to hang, not timeout and causes a DoS.
The request that I sent to the server was as follows:
const char *headers = "GET / HTTP/1.1\r\nHost: localhost:8000\r\n";
Which should have been:
const char *headers = "GET / HTTP/1.1\r\nHost: localhost:8000\r\n\r\n";
This causes a the application to await the second set of new-line sequences and hang until they are received which prevents any further connections from being made.
I have just tested this against the latest versions of the library and I can supply a proof of concept code if that would be useful - just let me know.
A recommended fix would be to ensure that all HTTP requests are received in full and in the correct manor prior to being parsed.
----------
components: Extension Modules
files: basehttpdos.c
messages: 257446
nosy: Richard Clifford
priority: normal
severity: normal
status: open
title: Denial of Service in SimpleHTTPServer and BaseHTTPServer
type: security
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41490/basehttpdos.c
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 07:06:49 2016
From: report at bugs.python.org (Artur Korobeynyk)
Date: Mon, 04 Jan 2016 12:06:49 +0000
Subject: [New-bugs-announce] [issue26006] 32 bits python ctypes creates 64
bits process from 32 bits executable
Message-ID: <1451909209.14.0.184769502954.issue26006@psf.upfronthosting.co.za>
New submission from Artur Korobeynyk:
Hi,
I have a 32 bits python on 64 bits Windows and 32 bits executable (compiled from native C).
When I do kernel32.CreateProcessA(path_to_exe, ...) python creates a process which is 64 bit (ctypes IsWow64Process returns true).
I expect it to be 32 as well. Am I wrong or that is a bug?
I attached testprog.exe but it requires testdll.dll
The sources of testprog.c:
#include
#include
int main()
{
Sleep(15000);
printf("%d", testSum(5,10));
return 0;
}
testdll.c
#include
__declspec(dllexport) int __cdecl testSum(int a, int b)
{
return(a+b);
}
compiled as:
/usr/bin/i686-pc-mingw32-gcc.exe -c testdll.c
/usr/bin/i686-pc-mingw32-gcc.exe --shared -o testdll.dll testdll.o
/usr/bin/i686-pc-mingw32-gcc.exe -o testprog testprog.c -L. -ltestdll
Process creation:
if kernel32.CreateProcessA(path_to_exe,
None,
None,
None,
None,
creation_flags,
None,
None,
byref(startupinfo),
byref(process_information))
----------
components: ctypes
files: testprog.exe
messages: 257461
nosy: Artur Korobeynyk
priority: normal
severity: normal
status: open
title: 32 bits python ctypes creates 64 bits process from 32 bits executable
versions: Python 2.7
Added file: http://bugs.python.org/file41492/testprog.exe
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 11:13:13 2016
From: report at bugs.python.org (Phil Thompson)
Date: Mon, 04 Jan 2016 16:13:13 +0000
Subject: [New-bugs-announce] [issue26007] Request for Support for Embedding
the Standard Library in an Executable
Message-ID: <1451923993.52.0.708853061063.issue26007@psf.upfronthosting.co.za>
New submission from Phil Thompson:
The use case is a packaging tool that can create a single executable for a Python application. Like similar tools it embeds frozen Python code (including the standard library) and is linked (often statically) against the interpreter library.
Executables are usually configured so that they cannot import packages from the filesystem. They can only import packages embedded in the executable. This is done directly, ie. the package is not written out to the filesystem and imported from there. This is done by a specially written importer.
The importer is installed by adding it to sys.path_hooks. However this must be done early on in the bootstrap process so that the parts of the standard library that are implemented as Python packages can be found by the installer. For example, the point at which the zipimport importer is added to sys.path_hooks is too late.
Currently a modified version of bootstrap_external.py is embedded in the executable which updates sys.path_hooks at the end of the _install() function.
What I would like is some way to avoid having to modify bootstrap_external.py to install a new importer sufficiently early in the bootstrap process to allow it to import the standard library.
----------
components: Interpreter Core
messages: 257464
nosy: philthompson10
priority: normal
severity: normal
status: open
title: Request for Support for Embedding the Standard Library in an Executable
type: enhancement
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 12:18:51 2016
From: report at bugs.python.org (=?utf-8?q?Antonio_=C3=81lvarez?=)
Date: Mon, 04 Jan 2016 17:18:51 +0000
Subject: [New-bugs-announce] [issue26008] Different behaviour
platform.linux_distribution() on Python2.7 and 3.6
Message-ID: <1451927931.59.0.302771657902.issue26008@psf.upfronthosting.co.za>
New submission from Antonio ?lvarez:
Hi! I have a doubt, is this behaviour in Python2.7.11 usual, or is it a bug?
>>> import platform
>>> platform.linux_distribution()
('', '', '')
In Python3.5.1 I get
>>> import platform
>>> platform.linux_distribution()
('arch', 'Arch', 'Linux')
I work with Archlinux x86_64 with lsb-release installed. Thanks!
----------
components: Extension Modules
messages: 257471
nosy: analca3
priority: normal
severity: normal
status: open
title: Different behaviour platform.linux_distribution() on Python2.7 and 3.6
type: behavior
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 12:35:38 2016
From: report at bugs.python.org (Jason Sachs)
Date: Mon, 04 Jan 2016 17:35:38 +0000
Subject: [New-bugs-announce] [issue26009] HTMLParser lacking a few features
to reconstruct input exactly
Message-ID: <1451928938.48.0.712719588041.issue26009@psf.upfronthosting.co.za>
New submission from Jason Sachs:
The HTMLParser class (https://docs.python.org/2/library/htmlparser.html) is lacking a few features to reconstruct input exactly. For the most part it can do this, but I found two items where it falls short (there may be others):
- There is a get_starttag_text() method but no get_endtag_text() method, which is necessary if the end tag is not in canonical form, e.g. instead of
it is or P >
- The effect of the parse_bogus_comment() internal method is to call handle_comment(), so content like cannot be distinguished by subclasses of HTMLParser from actual comments
Suggested changes:
- Add a get_endtag_text() method to return the exact endtag text
- change parse_bogus_comment to call self.handle_bogus_comment(), and define self.handle_bogus_comment() to call self.handle_comment(). This way it is backwards-compatible with existing behavior, but subclasses can redefine self.handle_bogus_comment() to do what they want.
----------
messages: 257472
nosy: jason_s
priority: normal
severity: normal
status: open
title: HTMLParser lacking a few features to reconstruct input exactly
type: behavior
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 16:43:19 2016
From: report at bugs.python.org (Yury Selivanov)
Date: Mon, 04 Jan 2016 21:43:19 +0000
Subject: [New-bugs-announce] [issue26010] document CO_* constants
Message-ID: <1451943799.55.0.170174957696.issue26010@psf.upfronthosting.co.za>
Changes by Yury Selivanov :
----------
assignee: docs at python
components: Documentation
keywords: needs review
nosy: docs at python, r.david.murray, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: document CO_* constants
type: enhancement
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 18:32:19 2016
From: report at bugs.python.org (Karl Richter)
Date: Mon, 04 Jan 2016 23:32:19 +0000
Subject: [New-bugs-announce] [issue26011] Document necesities for cmp
argument of sorted
Message-ID: <1451950339.23.0.203915233375.issue26011@psf.upfronthosting.co.za>
New submission from Karl Richter:
The docstring of `sorted` doesn't explain what can be passed to the `cmp` and `key` argument of `sorted`.
----------
assignee: docs at python
components: Documentation
messages: 257505
nosy: docs at python, krichter
priority: normal
severity: normal
status: open
title: Document necesities for cmp argument of sorted
type: enhancement
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 4 21:13:51 2016
From: report at bugs.python.org (Guido van Rossum)
Date: Tue, 05 Jan 2016 02:13:51 +0000
Subject: [New-bugs-announce] [issue26012] pathlib.Path().rglob() is fooled
by symlink loops
Message-ID: <1451960031.51.0.813695149526.issue26012@psf.upfronthosting.co.za>
New submission from Guido van Rossum:
I created a symlink loop as follows:
mkdir tmp
cd tmp
ln -s ../tmp baz
cd ..
Then I tried to list it recursively using rglob():
>>> list(pathlib.Path('tmp').rglob('**/*')
This caused an infinite regress:
Traceback (most recent call last):
File "", line 1, in
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 1065, in rglob
for p in selector.select_from(self):
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 549, in _select_from
for p in successor_select(starting_point, is_dir, exists, listdir):
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 548, in _select_from
for starting_point in self._iterate_directories(parent_path, is_dir, listdir):
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 538, in _iterate_directories
for p in self._iterate_directories(path, is_dir, listdir):
[...]
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 538, in _iterate_directories
for p in self._iterate_directories(path, is_dir, listdir):
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 537, in _iterate_directories
if is_dir(path):
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 1303, in is_dir
return S_ISDIR(self.stat().st_mode)
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 1111, in stat
return self._accessor.stat(self)
File "/Users/guido/src/cpython36/Lib/pathlib.py", line 371, in wrapped
return strfunc(str(pathobj), *args)
OSError: [Errno 62] Too many levels of symbolic links: 'tmp/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz/baz'
----------
messages: 257511
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: pathlib.Path().rglob() is fooled by symlink loops
versions: Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 02:39:44 2016
From: report at bugs.python.org (Anil Kulkarni)
Date: Tue, 05 Jan 2016 07:39:44 +0000
Subject: [New-bugs-announce] [issue26013] Pickle protocol 2.0 not loading in
python 3.5
Message-ID: <1451979584.96.0.927777070704.issue26013@psf.upfronthosting.co.za>
New submission from Anil Kulkarni:
Pickles created with python 3.4.X will not load with python 3.5.X if they include a collections.OrderedDict
To reproduce this issue, simply create a pickle of an OrderedDict on python 3.4.3 with protocol=2 and try to open it on 3.5. I have included a simple script to demonstrate this issue.
I believe this is related to this bug: https://bugs.python.org/issue18473
As to the real-world implications: The python package Celery uses protocol=2 by default when serializing with pickle, and thus a celery web running 3.5 cannot receive the results of a worker running 3.4
For celery specifically, there is a workaround by setting the PICKLE_PROTOCOL environment variable, but this is a core python issue.
P.S. This is the first bug I've filed with python so please let me know if there's something else I should be including.
Thanks!
----------
files: b.py
messages: 257524
nosy: anilredshift
priority: normal
severity: normal
status: open
title: Pickle protocol 2.0 not loading in python 3.5
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file41503/b.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 08:04:25 2016
From: report at bugs.python.org (Nick Coghlan)
Date: Tue, 05 Jan 2016 13:04:25 +0000
Subject: [New-bugs-announce] [issue26014] Guide users to the newer package
install instructions
Message-ID: <1451999065.99.0.467691766338.issue26014@psf.upfronthosting.co.za>
New submission from Nick Coghlan:
The up to date module installation docs are at:
* https://docs.python.org/2/installing/index.html
* https://docs.python.org/3/installing/index.html
However, legacy deep links still resolve to the old docs:
* https://docs.python.org/2/install/index.html
* https://docs.python.org/3/install/index.html
Those link out to packaging.python.org, the link is buried in a longish note, rather than being highlighted as a more obvious See Also link.
The top level landing page in the Python 2.7 docs also still links to the legacy docs rather than the new ones, and the "(Legacy)" notation hasn't been appended to the headings on the legacy docs the way it has in 3.x.
There's a few long hanging fruit for cleanup here:
* add See Also links to the modern docs from the legacy docs
* append the (Legacy) suffix in the 2.x docs
* fix the 2.x top level docs page to link to the new docs rather than the legacy ones
* link to the legacy docs from the distutils package docs in 2.7 (as has already been done in 3.x)
----------
assignee: docs at python
components: Documentation
messages: 257529
nosy: docs at python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Guide users to the newer package install instructions
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 09:47:37 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Tue, 05 Jan 2016 14:47:37 +0000
Subject: [New-bugs-announce] [issue26015] Add new tests for pickling
iterators of mutable sequences
Message-ID: <1452005257.2.0.950563811675.issue26015@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
Proposed patch updates tests for iterators of mutable sequences. Now tested iterators in all four states (initial, running, empty and exhausted), and tested that unpickled iterator is linked with a sequence, not with an independed copy (as in case of dict iterators).
Note that there is a difference in the behavior of exhausted array iterator from other iterators. Perhaps this should be changed.
----------
components: Tests
files: iterators_pickle_tests.patch
keywords: patch
messages: 257530
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add new tests for pickling iterators of mutable sequences
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41507/iterators_pickle_tests.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 10:05:36 2016
From: report at bugs.python.org (=?utf-8?b?7J207Iuc66eMIChFY21hWHAp?=)
Date: Tue, 05 Jan 2016 15:05:36 +0000
Subject: [New-bugs-announce] [issue26016] io.TextIOWrapper.tell() report
65bit number when mix readline() + tell()
Message-ID: <1452006336.5.0.310653434385.issue26016@psf.upfronthosting.co.za>
New submission from ??? (EcmaXp):
I did test on
- Python 3.5.1 on Windows 64 Bit and 32 Bit (Machine A)
- Python 3.4.4 on Windows 32 Bit (Machine A)
- Python 3.4.3+ on Ubuntu 15.10 64 Bit (Virtual Machine on Machine A)
- Python 3.4.2 on Machine B and C
- Python 3.3.5 on Windows 32 Bit (Machine A)
I did test but not produce bug. (report 8 correctly)
- Python 3.2.5 on Windows 32 Bit (Machine A)
- Python 3.1.4 on Windows 32 Bit (Machine A)
- Python 2.7.10 on Windows 64 Bit (Machine A)
Machine A: i7-5775C with Windows 10 (build 10586.36) 64 Bit
Machine B: http://www.tutorialspoint.com/execute_python3_online.php
Machine C: https://repl.it/languages/python3
Code are here
import io
with io.TextIOWrapper(io.BytesIO(b'.\r\n...\r\n\r\n\r\n')) as fp:
fp.readline() # '.\n'
fp.readline() # '......\n'
print(fp.tell()) # 18446744073709551628 = 0x10000000000000009
Not only those string produce bug, also adding more dot make produce bug sometimes.
----------
components: IO, Library (Lib)
messages: 257531
nosy: ??? (EcmaXp)
priority: normal
severity: normal
status: open
title: io.TextIOWrapper.tell() report 65bit number when mix readline() + tell()
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 12:43:16 2016
From: report at bugs.python.org (Brett Cannon)
Date: Tue, 05 Jan 2016 17:43:16 +0000
Subject: [New-bugs-announce] [issue26017] Update
https://docs.python.org/3/installing/index.html to always quote arguments
Message-ID: <1452015796.73.0.274069830205.issue26017@psf.upfronthosting.co.za>
New submission from Brett Cannon:
If you look at https://docs.python.org/3/installing/index.html it lists two commands:
python -m pip install SomePackage==1.0.4 # specific version
python -m pip install 'SomePackage>=1.0.4' # minimum version
If you notice that beyond the change from `==` to `>=`, you will notice one quotes its argument while the other one doesn't. This is a UNIX shell thing due to what `>` means. But if you don't know how the UNIX shell works this could be easily overlooked. It would be best to simply quote both examples and avoid people messing up by leaving off the quotes.
----------
assignee: docs at python
components: Documentation
messages: 257536
nosy: alexis, brett.cannon, docs at python, dstufft, eric.araujo, lemburg, ncoghlan, paul.moore, tarek
priority: normal
severity: normal
stage: needs patch
status: open
title: Update https://docs.python.org/3/installing/index.html to always quote arguments
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 19:06:41 2016
From: report at bugs.python.org (Martin von Gagern)
Date: Wed, 06 Jan 2016 00:06:41 +0000
Subject: [New-bugs-announce] [issue26018] documentation of ZipFile file name
encoding
Message-ID: <1452038801.7.0.594053315947.issue26018@psf.upfronthosting.co.za>
New submission from Martin von Gagern:
https://docs.python.org/3/library/zipfile.html#zipfile.ZipFile.write writes:
?Note: There is no official file name encoding for ZIP files. If you have unicode file names, you must convert them to byte strings in your desired encoding before passing them to write(). WinZip interprets all file names as encoded in CP437, also known as DOS Latin.?
I think this is wrong in many ways. Firstly, APPNOTE.TXT used to explicitely define CP437 as the standard, and it's still the standard in the absence of general purpose bit 11 and a more specific description using the 0x0008 Extra Field. On the other hand, we do have that general purpose bit these days, so there are now not just one but two well-defined file name encodings. And thirdly, encoding the string to bytes as suggested will in fact lead to a run time error, since ZipInfo expects to do this conversion itself.
See work towards issue1734346, starting at commit 8e33f316ce14, for details on when this was addressed in the source code.
----------
assignee: docs at python
components: Documentation
messages: 257567
nosy: docs at python, gagern
priority: normal
severity: normal
status: open
title: documentation of ZipFile file name encoding
type: behavior
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 21:05:12 2016
From: report at bugs.python.org (Andrew Barnert)
Date: Wed, 06 Jan 2016 02:05:12 +0000
Subject: [New-bugs-announce] [issue26019] collections.abc documentation
incomplete
Message-ID: <1452045912.74.0.509683701942.issue26019@psf.upfronthosting.co.za>
New submission from Andrew Barnert:
Some of the modules in collections.abc have a subclass hook that implicitly registers any type that declares the right methods, like Iterator. Others do not, like Sequence. For those that do have the hook, it's not always obvious what methods are tested. And some of them test the methods for truthiness, others only for existence (although #25958 will fix that last bit).
The documentation doesn't even mention this, much less describe which ABCs are of which kind.
For someone who just wants to know how to write isinstance(arg, Iterable), that's fine. But anyone who wants to create new classes, or integrate third-party classes that weren't ABC-friendly, has to read the collections.abc module source to figure out what they want to do.
----------
assignee: docs at python
components: Documentation
messages: 257577
nosy: abarnert, docs at python
priority: normal
severity: normal
status: open
title: collections.abc documentation incomplete
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 5 21:42:21 2016
From: report at bugs.python.org (Hamish Campbell)
Date: Wed, 06 Jan 2016 02:42:21 +0000
Subject: [New-bugs-announce] [issue26020] set_display evaluation order
doesn't match documented behaviour
Message-ID: <1452048141.82.0.22346371212.issue26020@psf.upfronthosting.co.za>
New submission from Hamish Campbell:
It looks like the behaviour of set displays do not match behaviour in some cases. The documentation states:
"A set display yields a new mutable set object, the contents being specified by either a sequence of expressions or a comprehension. When a comma-separated list of expressions is supplied, its elements are evaluated from left to right and added to the set object. When a comprehension is supplied, the set is constructed from the elements resulting from the comprehension."
Note the following:
>>> foo = { True, 1 }
>>> print(foo)
{1}
However, if we add elements 'left to right':
>>> foo = set()
>>> foo.add(True)
>>> foo.add(1)
>>> print(foo)
{True}
Note that similar documentation for dict displays produces the expected result.
"If a comma-separated sequence of key/datum pairs is given, they are evaluated from left to right to define the entries of the dictionary: each key object is used as a key into the dictionary to store the corresponding datum. This means that you can specify the same key multiple times in the key/datum list, and the final dictionary?s value for that key will be the last one given."
>>> foo = {}
>>> foo[True] = 'bar'
>>> foo[1] = 'baz'
>>> print(foo)
{True: 'baz'}
Which matches the dict display construction:
>>> foo = { True: 'bar', 1: 'baz'}
>>> print(foo)
{True: 'baz'}
Note that I've tagged this as a documentation bug, but it seems like the documentation might be the preferred implementation.
----------
assignee: docs at python
components: Documentation
messages: 257579
nosy: Hamish Campbell, docs at python
priority: normal
severity: normal
status: open
title: set_display evaluation order doesn't match documented behaviour
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 04:37:23 2016
From: report at bugs.python.org (=?utf-8?q?Torsten_Z=C3=BChlsdorff?=)
Date: Wed, 06 Jan 2016 09:37:23 +0000
Subject: [New-bugs-announce] [issue26021] Missing IPv6 support for
pypi.python.org
Message-ID: <1452073043.01.0.523357649838.issue26021@psf.upfronthosting.co.za>
New submission from Torsten Z?hlsdorff:
Hello,
i'm done some research about the impact of missing IPv6 support at the FreeBSD ports-tree, which is the list of supported software for FreeBSD.
Python and many libs written in python are supported for FreeBSD, but if you have an IPv6 only server, they are not usable at all. Currently python has the biggest impact on the ports-tree: (https://wiki.freebsd.org/IPv6PortsTODO#TOP_25_hosts_with_missing_IPv6_support)
This is because the server pypi.python.org lacks support for IPv6. There is also no AAAA record in DNS:
$ drill pypi.python.org aaaa
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 9429
;; flags: qr rd ra ; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;; pypi.python.org. IN AAAA
;; ANSWER SECTION:
pypi.python.org. 6983 IN CNAME prod.python.map.fastly.net.
prod.python.map.fastly.net. 5 IN CNAME prod.python.map.fastlylb.net.
;; AUTHORITY SECTION:
;; ADDITIONAL SECTION:
;; Query time: 33 msec
;; SERVER: 192.168.0.23
;; WHEN: Wed Jan 6 10:34:12 2016
;; MSG SIZE rcvd: 112
Please add IPv6 support to your server(s). If you need any help/feedback/tests i will gladly help you!
Thank you very much,
Torsten
----------
messages: 257592
nosy: thorny
priority: normal
severity: normal
status: open
title: Missing IPv6 support for pypi.python.org
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 07:26:47 2016
From: report at bugs.python.org (Roland Eichman)
Date: Wed, 06 Jan 2016 12:26:47 +0000
Subject: [New-bugs-announce] [issue26022] string.replace(' ',
' ') has to be called 2 times before it works
Message-ID: <1452083207.08.0.345721672406.issue26022@psf.upfronthosting.co.za>
New submission from Roland Eichman:
Windows 10
python 3.5
small function in a small module
contained a string len(str1) == 5000 {approx}
str1 = str1.replace(' ',' ')
did not work
added, via copy & paste, a second identical line
str1 = str1.replace(' ',' ')
str1 = str1.replace(' ',' ')
AND IT WORKED
----------
components: Interpreter Core
messages: 257603
nosy: roland_eichman
priority: normal
severity: normal
status: open
title: string.replace(' ',' ') has to be called 2 times before it works
type: behavior
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 08:07:55 2016
From: report at bugs.python.org (Freddy Rietdijk)
Date: Wed, 06 Jan 2016 13:07:55 +0000
Subject: [New-bugs-announce] [issue26023] Missing signatures operator module
Message-ID: <1452085675.2.0.944148741894.issue26023@psf.upfronthosting.co.za>
New submission from Freddy Rietdijk:
The operator module has no signatures for (most) of the functions defined in it.
Use case:
The multipledispatch module uses inspect.getfullargspec and therefore the functions in operator cannot be used in combination with the @dispatch decorator
----------
components: Library (Lib)
messages: 257606
nosy: Freddy Rietdijk
priority: normal
severity: normal
status: open
title: Missing signatures operator module
type: enhancement
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 09:28:10 2016
From: report at bugs.python.org (Vidar Fauske)
Date: Wed, 06 Jan 2016 14:28:10 +0000
Subject: [New-bugs-announce] [issue26024] Non-ascii Windows locale names
Message-ID: <1452090490.23.0.240691672935.issue26024@psf.upfronthosting.co.za>
New submission from Vidar Fauske:
The Norwegian locale on Windows has the honor of having the only locale name with a non-ASCII character ('Norwegian Bokm?l_Norway', see e.g. https://wiki.postgresql.org/wiki/Changes_To_Norwegian_Locale). It does not seem like python 3 is able to handle this properly, as the following code demonstrates:
>python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_TIME, 'swedish')
'Swedish_Sweden.1252'
>>> loc_sw = locale.getlocale(locale.LC_TIME)
>>> locale.setlocale(locale.LC_TIME, 'norwegian')
'Norwegian Bokm?l_Norway.1252'
>>> loc_no = locale.getlocale(locale.LC_TIME)
>>> locale.setlocale(locale.LC_TIME, loc_sw)
'Swedish_Sweden.1252'
>>> locale.setlocale(locale.LC_TIME, loc_no)
Traceback (most recent call last):
File "", line 1, in
File "C:\prog\WinPython-64bit-3.4.3.7\python-3.4.3.amd64\lib\locale.py", line 593, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
As can be seen, this can be worked around when setting the locale manually, but if the locale has already been set to Norwegian, the value returned from getlocale is invalid when passed to setlocale.
Following the example of postgres in the link above, I suggest changing the behavior of locale.getlocale to alias 'Norwegian Bokm?l_Norway.1252' as 'Norwegian_Norway.1252', which is completely ASCII, and therefore fine.
----------
components: Unicode, Windows
messages: 257608
nosy: ezio.melotti, haypo, paul.moore, steve.dower, tim.golden, vidartf, zach.ware
priority: normal
severity: normal
status: open
title: Non-ascii Windows locale names
type: behavior
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 12:39:34 2016
From: report at bugs.python.org (Brett Cannon)
Date: Wed, 06 Jan 2016 17:39:34 +0000
Subject: [New-bugs-announce] [issue26025] Document pathlib.Path.__truediv__()
Message-ID: <1452101974.47.0.473485918535.issue26025@psf.upfronthosting.co.za>
New submission from Brett Cannon:
I noticed that the documentation for pathlib only mentions the overloading of __truediv__ in examples and not anywhere in the actual docs for the Path object itself.
----------
assignee: docs at python
components: Documentation
messages: 257617
nosy: brett.cannon, docs at python, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: Document pathlib.Path.__truediv__()
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 13:38:14 2016
From: report at bugs.python.org (Hristo Venev)
Date: Wed, 06 Jan 2016 18:38:14 +0000
Subject: [New-bugs-announce] [issue26026] True%2==True
Message-ID: <1452105494.05.0.152464370821.issue26026@psf.upfronthosting.co.za>
New submission from Hristo Venev:
Should be 1. This comes from the (a%b=a if a
_______________________________________
From report at bugs.python.org Wed Jan 6 16:05:29 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Wed, 06 Jan 2016 21:05:29 +0000
Subject: [New-bugs-announce] [issue26027] Support Path objects in the posix
module
Message-ID: <1452114329.99.0.617690911804.issue26027@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
path_converter should be changed to accept objects with the "path" attribute. See issue22570 for details.
----------
assignee: serhiy.storchaka
components: Extension Modules
messages: 257642
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Support Path objects in the posix module
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 16:33:53 2016
From: report at bugs.python.org (Hassan Mahroof)
Date: Wed, 06 Jan 2016 21:33:53 +0000
Subject: [New-bugs-announce] [issue26028] .sort() Causing Strings to Be
Listed on the same line
Message-ID: <1452116033.54.0.131066296483.issue26028@psf.upfronthosting.co.za>
New submission from Hassan Mahroof:
I am a student @ Burnley College and we were learning how to use the .write(), .close(), .readlines() and .sort().
I have a list of names within a text file which I am trying sort, These are random names generated using my Random Mind. However, when the sorted text file is created, what seems to be under certain circumstances with my list only (or words similar, This bug did not occur within my whole class till I stumbled upon it) it seems to instead of writing each term to seperate lines, it seems to connect two of the words (in this case names) on the same line. I have tried to find a pattern in this madness however being the rookie student I am I can only seem to break things aha. I have attached the 2 files which I am using and Hopefully someone can correct this cause I am confused.
This is a list of the names:
Robertas
Hassan
Bob
Connor
Camera
Billy
Maz
Richard
Mo
----------
components: IDLE
files: SortFile2.py
messages: 257644
nosy: Hassan Mahroof
priority: normal
severity: normal
status: open
title: .sort() Causing Strings to Be Listed on the same line
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file41520/SortFile2.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 16:44:08 2016
From: report at bugs.python.org (Julien)
Date: Wed, 06 Jan 2016 21:44:08 +0000
Subject: [New-bugs-announce] [issue26029] Broken sentence in extending
documentation
Message-ID: <1452116648.24.0.989848174126.issue26029@psf.upfronthosting.co.za>
New submission from Julien:
Hello,
While translating the documentation to French, I found a bug here :
https://docs.python.org/3/extending/building.html#building-c-and-c-extensions-with-distutils
The sentence: "Normally, a package will contain of addition modules:"
Should probably be: "Normally, a package will contain additional modules:"
Bests.
----------
assignee: docs at python
components: Documentation
messages: 257645
nosy: docs at python, sizeof
priority: normal
severity: normal
status: open
title: Broken sentence in extending documentation
type: enhancement
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 17:06:04 2016
From: report at bugs.python.org (Julien)
Date: Wed, 06 Jan 2016 22:06:04 +0000
Subject: [New-bugs-announce] [issue26030] Use PEP8 in documentation examples
Message-ID: <1452117964.46.0.438153899324.issue26030@psf.upfronthosting.co.za>
New submission from Julien:
Hi,
Shouldn't Python use PEP8 in its examples in the documentation ? I found a lot of missing spaces around binary operators, and things like "setup (name = 'PackageName'," (found in the Distributing section, but that's just a single example) which hurt my eyes and will probably teach bad practices to newcomers reading it.
If everybody agree documentation examples should be PEP8 compliant, I'll can gladly provide some patches.
I also found http://bugs.python.org/issue23921 which is probably not merged as it's still open, and the patch don't fix my example, so there is probably some problems left.
----------
assignee: docs at python
components: Documentation
messages: 257649
nosy: docs at python, sizeof
priority: normal
severity: normal
status: open
title: Use PEP8 in documentation examples
type: enhancement
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 17:41:29 2016
From: report at bugs.python.org (Guido van Rossum)
Date: Wed, 06 Jan 2016 22:41:29 +0000
Subject: [New-bugs-announce] [issue26031] Add stat caching option to pathlib
Message-ID: <1452120089.84.0.0792910513701.issue26031@psf.upfronthosting.co.za>
New submission from Guido van Rossum:
There are concerns that pathlib is inefficient because it doesn't cache stat() operations. Thus, for example this code calls stat() for each result twice (once internal to the glob, a second time to answer the is_symlink() question):
p = pathlib.Path('/usr')
links = [x for x in p.rglob('*') if x.is_symlink()]
I have a tentative patch (without tests). On my Mac it only gives modest speedups (between 5 and 20 percent) but things may be different on other platforms or for applications that make a lot of inquiries about the same path.
The API I am proposing is that by default nothing changes; to benefit from caching you must instantiate a StatCache() object and pass it to Path() constructor calls, e.g. Path('/usr', stat_cache=cache_object). All Path objects derived from this path object will share the cache. To force an uncached Path object you can use Path(p).
The patch is incomplete; there are no tests for the new functionality (though existing tests pass) and __eq__ should be adjusted so that Path objects using different caches always compare unequal.
Question for Antoine: Did you perhaps anticipate a design like this? Each Path instance has an _accessor slot, but there is only one accessor instance defined that is used everywhere (the global _normal_accessor). So you could have avoided a bunch of complexity in the code around setting the proper _accessor unless you were planning to use multiple accessors.
----------
files: statcache.diff
keywords: patch
messages: 257651
nosy: gvanrossum, pitrou
priority: normal
severity: normal
stage: test needed
status: open
title: Add stat caching option to pathlib
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41521/statcache.diff
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 17:55:27 2016
From: report at bugs.python.org (Guido van Rossum)
Date: Wed, 06 Jan 2016 22:55:27 +0000
Subject: [New-bugs-announce] [issue26032] Use scandir() to speed up pathlib
globbing
Message-ID: <1452120927.04.0.31788168865.issue26032@psf.upfronthosting.co.za>
New submission from Guido van Rossum:
The globbing functionality in pathlib (Path.glob() and Path.rglob()) might benefit from using the new optimized os.scandir() interface. It currently just uses os.listdir(). The Path.iterdir() method might also benefit (though less so).
There's also a sideways connection with http://bugs.python.org/issue26031 (adding an optional stat cache) -- the cache could possibly keep the DirEntry objects and use their (hopefully cached) attributes. This is more speculative though (and what if the platform's DirEntry doesn't cache?)
----------
messages: 257653
nosy: gvanrossum
priority: normal
severity: normal
status: open
title: Use scandir() to speed up pathlib globbing
type: performance
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 19:32:48 2016
From: report at bugs.python.org (Stefan Seefeld)
Date: Thu, 07 Jan 2016 00:32:48 +0000
Subject: [New-bugs-announce] [issue26033] distutils default compiler API is
incomplete
Message-ID: <1452126768.68.0.403890898516.issue26033@psf.upfronthosting.co.za>
New submission from Stefan Seefeld:
I'm trying to use the distutil compiler to preprocess some header (to be used with the cffi package).
The code is
compiler = distutils.ccompiler.new_compiler()
compiler.add_include_dir(join(sys.prefix, 'include'))
compiler.preprocess(source)
This raises this exception (on Linux):
File ".../distutils/unixccompiler.py", line 88, in preprocess
pp_args = self.preprocessor + pp_opts
TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'
caused by 'set.preprocessor' to be set to None (with the preceding comment:
# The defaults here
# are pretty generic; they will probably have to be set by an outsider
# (eg. using information discovered by the sysconfig about building
# Python extensions).
Seems that code never got fully implemented.
Further, the MSVC version of the compiler (msvccompiler.py) doesn't even implement a "preprocess()" method, so this falls back to the CCompiler.preprocess() default, which does nothing !
----------
components: Distutils
messages: 257663
nosy: dstufft, eric.araujo, stefan
priority: normal
severity: normal
status: open
title: distutils default compiler API is incomplete
type: behavior
versions: Python 2.7, Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 23:38:52 2016
From: report at bugs.python.org (Dan Sadowski)
Date: Thu, 07 Jan 2016 04:38:52 +0000
Subject: [New-bugs-announce] [issue26034] venv documentation out of date
Message-ID: <1452141532.31.0.700374014076.issue26034@psf.upfronthosting.co.za>
New submission from Dan Sadowski:
The listing for the --clear option in the documentation is outdated. This is from the actual current 3.5 usage text:
--clear Delete the contents of the environment directory if it
already exists, before environment creation.
----------
assignee: docs at python
components: Documentation
messages: 257669
nosy: docs at python, dsadowski
priority: normal
severity: normal
status: open
title: venv documentation out of date
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 6 23:47:35 2016
From: report at bugs.python.org (Nicholas Chammas)
Date: Thu, 07 Jan 2016 04:47:35 +0000
Subject: [New-bugs-announce] [issue26035] traceback.print_tb() takes `tb`,
not `traceback` as a keyword argument
Message-ID: <1452142055.04.0.968906484949.issue26035@psf.upfronthosting.co.za>
New submission from Nicholas Chammas:
Here is traceback.print_tb()'s signature [0]:
```
def print_tb(tb, limit=None, file=None):
```
However, its documentation reads [1]:
```
.. function:: print_tb(traceback, limit=None, file=None)
```
Did the keyword argument change recently, or was this particular doc always wrong?
[0] https://github.com/python/cpython/blob/1fe0fd9feb6a4472a9a1b186502eb9c0b2366326/Lib/traceback.py#L43
[1] https://raw.githubusercontent.com/python/cpython/1fe0fd9feb6a4472a9a1b186502eb9c0b2366326/Doc/library/traceback.rst
----------
assignee: docs at python
components: Documentation
messages: 257670
nosy: Nicholas Chammas, docs at python
priority: normal
severity: normal
status: open
title: traceback.print_tb() takes `tb`, not `traceback` as a keyword argument
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 07:16:23 2016
From: report at bugs.python.org (Cal Leeming)
Date: Thu, 07 Jan 2016 12:16:23 +0000
Subject: [New-bugs-announce] [issue26036] Unnecessary arguments on
smtpd.SMTPServer
Message-ID: <1452168983.71.0.914590889995.issue26036@psf.upfronthosting.co.za>
New submission from Cal Leeming:
`smtpd.SMTPServer` takes argument `remoteaddr`, however this is only used in subclass `smtpd.DebuggingServer`.
Would anyone object to a patch which removes `remoteaddr` from `smtpd.SMTPServer.__init__` and places it into `smtpd.DebuggingServer.__init__` instead?
Naturally this would be backwards incompatible
----------
components: Library (Lib)
messages: 257684
nosy: sleepycal
priority: normal
severity: normal
status: open
title: Unnecessary arguments on smtpd.SMTPServer
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 07:43:44 2016
From: report at bugs.python.org (=?utf-8?b?ZXBoIOKAiw==?=)
Date: Thu, 07 Jan 2016 12:43:44 +0000
Subject: [New-bugs-announce] [issue26037] Crash when reading
sys.stdin.buffer in a daemon thread
Message-ID: <1452170624.64.0.0901256170606.issue26037@psf.upfronthosting.co.za>
New submission from eph ?:
I wrote a script to non-blocking reading binary data from stdin like this:
import sys, threading
def _thread():
data = sys.stdin.buffer.readline()
thread = threading.Thread(target=_thread)
thread.daemon = True
thread.start()
and the output is like this:
Fatal Python error: could not acquire lock for <_io.BufferedReader name=''> at interpreter shutdown, possibly due to daemon threads
Thread 0x00007faf54ebf700 (most recent call first):
File "pipetcpadapter.py", line 8 in func
File "/usr/lib/python3.5/threading.py", line 862 in run
File "/usr/lib/python3.5/threading.py", line 914 in _bootstrap_inner
File "/usr/lib/python3.5/threading.py", line 882 in _bootstrap
Current thread 0x00007faf566da700 (most recent call first):
Aborted (core dumped)
----------
components: IO
messages: 257685
nosy: eph ?
priority: normal
severity: normal
status: open
title: Crash when reading sys.stdin.buffer in a daemon thread
type: crash
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 08:29:43 2016
From: report at bugs.python.org (Brett Rosen)
Date: Thu, 07 Jan 2016 13:29:43 +0000
Subject: [New-bugs-announce] [issue26038] zipfile cannot handle zip files
where the archive size for a file does not match actual contents
Message-ID: <1452173383.07.0.105152287179.issue26038@psf.upfronthosting.co.za>
New submission from Brett Rosen:
In python 2.7 it was able to handle this. It looks like this was introduced in https://github.com/python/cpython/commit/ae489fa76bb02daa636afe3bebec232e5aa9fac5 .
I'm not really sure if this should be considered a regression or not since the zip files that trigger this could be considered bad, even though unzip and older versions of zipfile.py could handle them.
I've attached a copy of a local diff I applied that worked around this issue, but I don't think it is a proper fix.
----------
components: Library (Lib)
files: changes.diff
keywords: patch
messages: 257687
nosy: Brett Rosen
priority: normal
severity: normal
status: open
title: zipfile cannot handle zip files where the archive size for a file does not match actual contents
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file41523/changes.diff
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 10:10:51 2016
From: report at bugs.python.org (Thomas Kluyver)
Date: Thu, 07 Jan 2016 15:10:51 +0000
Subject: [New-bugs-announce] [issue26039] More flexibility in zipfile
interface
Message-ID: <1452179451.89.0.468945044395.issue26039@psf.upfronthosting.co.za>
New submission from Thomas Kluyver:
I was working recently on some code writing zip files, and needed a bit more flexibility than the interface of zipfile provides. To do what I wanted, I ended up copying the entirety of ZipFile.write() into my own code with modifications. That's ugly, and to make it worse, the code I copied from the Python 3.4 stdlib didn't work properly with Python 3.5.
Specifically, I want to:
* Override the timestamp, which write() unconditionally takes from the mtime of the file.
* Do extra processing on the data (e.g. calculating a checksum) as it is read. Being able to pass a file-like object in to be read, rather than just a filename, would work for this.
I could do both by using ZipFile.writestr(), but then the entire file must be loaded into memory at once, which I would much rather avoid.
The patch attached is one proposal which would make it easier to do what I want, but it's intended as a starting point for discussion. I'm not particularly attached to the API.
- Should this be a new method, or new functionality for either the write or writestr method? I favour a new method, because the existing methods are already quite long, and I think it's nicer to break write() up into two parts like this.
- If a new method, what should it be called? I opted for writefile()
- What should its signature be? It's currently writefile(file_obj, zinfo, force_zip64=False), but I can see an argument for aligning it with writestr(zinfo_or_arcname, data, compress_type=None).
- What to do about ZIP64: the code has to decide whether to use ZIP64 format before writing, because it affects the header size, but we may not know the length before we have read it all. I've used a force_zip64 boolean parameter, and documented that people should pass it True if a file of unknown size could exceed 2 GiB.
- Are there other points where it could be made more flexible while we're thinking about this? I'd quite like to split out the code for writing a directory entry to a separate method ('writedir'?). I'd also like to allow datetime objects to be passed in for timestamps as well as the 6-tuples currently expected.
----------
components: Library (Lib)
files: zipfile-flexibility.patch
keywords: patch
messages: 257694
nosy: takluyver
priority: normal
severity: normal
status: open
title: More flexibility in zipfile interface
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41525/zipfile-flexibility.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 10:41:22 2016
From: report at bugs.python.org (Jeff Allen)
Date: Thu, 07 Jan 2016 15:41:22 +0000
Subject: [New-bugs-announce] [issue26040] Improve coverage and rigour of
test.test_math
Message-ID: <1452181282.79.0.203850145541.issue26040@psf.upfronthosting.co.za>
New submission from Jeff Allen:
In many cases, test_math does not exercise the functions defined by the math module, other than at a few values needing special handling. Where it does test a function with values representative of the domain, the accuracy demanded is often loose in one place and tight in another. By comparison, test_cmath uses more interesting values and a rational approach to accuracy.
In most implementations, math simply proxies an expertly built (and tested) platform library or firmware, so it is unlikely we are the victims of mathematical inexactitude.
We observed this as a problem in the Jython project, where failures in cmath were traced eventually to the naive (but passing) implementation of some functions in math. For Jython, we now supplement test_math with stronger tests more like those in test_cmath. So this issue is really an offer to fold that work back into the CPython test_math, to strengthen testing for all.
Coverage:
--------
In the attached program, in the coverge section, I logged the calls to selected functions from test_math to see what range of values they used. It produces results like:
sqrt
[9.881e-324, 7.905e-323, 1.862e-309, 1e-305, 1e-150, ..., 2, 23, 1e+16, 1e+150, 1e+299]
[-1]
[-0.0, -inf, 0.0, inf, nan]
sin
[1.571]
[-1.571]
[-0.0, -inf, 0.0, inf, nan]
exp
[]
[-745]
[-0.0, -inf, 0.0, inf, nan]
sinh
[]
[]
[-0.0, -inf, 0.0, inf, nan]
The three rows here are positive, negative and "special" arguments, and "..." means I abridged the list.
Accuracy:
--------
Where functions are tested, results are expected with a maximum error of 1e-5. On sqrt(1e150), this demands bit-perfect accuracy; on sqrt(1e-150) it demands virtually nothing.
In the attached program, in the accuracy section, I wrap most of the functions so as to fuzz their results by plus or minus 2e-6, test_math will still pass them. test_cmath uses a relative measure of error (so many ulps of the expected value), which is worth emulating.
If people think it better, coverage and accuracy can be tracked as separate issues.
----------
components: Tests
files: stat_math.py
messages: 257695
nosy: jeff.allen, mark.dickinson
priority: normal
severity: normal
status: open
title: Improve coverage and rigour of test.test_math
type: behavior
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file41526/stat_math.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 12:18:20 2016
From: report at bugs.python.org (Berker Peksag)
Date: Thu, 07 Jan 2016 17:18:20 +0000
Subject: [New-bugs-announce] [issue26041] Update deprecation messages of
platform.dist() and platform.linux_distribution()
Message-ID: <1452187100.03.0.384540652472.issue26041@psf.upfronthosting.co.za>
New submission from Berker Peksag:
We need to remove "and will be removed in Python 3.7" from deprecation messages of platform.dist() and platform.linux_distribution() and update the relevant whatsnew entry in Doc/whatsnew/3.5.rst.
See msg256111 in issue 1322 for details.
----------
components: Library (Lib)
keywords: easy
messages: 257704
nosy: berker.peksag
priority: normal
severity: normal
stage: needs patch
status: open
title: Update deprecation messages of platform.dist() and platform.linux_distribution()
type: enhancement
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 12:52:21 2016
From: report at bugs.python.org (Brett Cannon)
Date: Thu, 07 Jan 2016 17:52:21 +0000
Subject: [New-bugs-announce] [issue26042] Consider dropping magic number for
more detailed .pyc file name
Message-ID: <1452189141.27.0.112439951883.issue26042@psf.upfronthosting.co.za>
New submission from Brett Cannon:
The reason the magic number exists in .pyc files is because back in Python 2 we only had a single .pyc file per module, which meant if you suddenly switched versions of Python you needed a way to know that the .pyc file was wrong for the running version of Python.
This is not the case in Python 3. Thanks to __pycache__ directories we have separate .pyc files per release version of Python (we also have .pyc files for each optimization level of Python). If we changed the sys.implementation.cache_tag to include the bugfix version -- and maybe even release level -- then the magic number wouldn't be necessary for users. It does make developing bytecode a little bit more difficult for core developers since they will have to clear out their .pyc files during development, but users wouldn't be affected.
Now I don't know if this is really worth the simplification it provides. I don't think it's worth the compatibility break for any code that may be reading .pyc files and I doubt there is any measurable performance benefit. But the realization struck me and I figured I should at least write it down in case anyone else thinks of it.
----------
components: Interpreter Core
messages: 257705
nosy: brett.cannon, eric.snow, ncoghlan
priority: low
severity: normal
stage: test needed
status: open
title: Consider dropping magic number for more detailed .pyc file name
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 13:57:09 2016
From: report at bugs.python.org (Vitaminus Maximus)
Date: Thu, 07 Jan 2016 18:57:09 +0000
Subject: [New-bugs-announce] [issue26043] ON DELETE CASCADE does not work
when using sqlite3 library
Message-ID: <1452193029.87.0.593726838819.issue26043@psf.upfronthosting.co.za>
New submission from Vitaminus Maximus:
Let me provide a completely reproducible code, which demonstrates the issue:
>>> import sqlite3
>>> cnx = sqlite3.connect("mytest.db")
>>> cnx.isolation_level = None
>>> cursor = cnx.cursor()
>>> cnx.execute("BEGIN")
>>> cursor.execute("CREATE TABLE test_table (id integer)")
>>> cursor.execute("CREATE UNIQUE INDEX id_primary ON test_table(id)")
>>> cursor.execute("INSERT INTO test_table (id) VALUES (1),(2),(3)")
>>> cursor.execute("CREATE TABLE test_table_2(id_fk integer, txt text, FOREIGN KEY (id_fk) REFERENCES test_table(id) ON DELETE CASCADE)")
>>> cursor.execute("INSERT INTO test_table_2 (id_fk, txt) VALUES (1,\"one\"),(2,\"two\"),(3,\"three\")")
>>> res = cursor.execute("SELECT * FROM test_table_2")
>>> res
>>> for r in res:
... print(r)
...
(1, 'one')
(2, 'two')
(3, 'three')
>>> cursor.execute("PRAGMA foreign_keys = ON")
>>> cursor.execute("DELETE FROM test_table WHERE id = 1")
>>> res = cursor.execute("SELECT * FROM test_table_2")
>>> for r in res:
... print(r)
...
(1, 'one')
(2, 'two')
(3, 'three')
As you can see, even though I explicitly set isolation_level, start transaction and specify PRAGMA foreign_keys = ON, it does not work. The expected behaviour is that when I run the last SELECT command, it should return only two rows (because a "parent" raw with id = 1 was deleted). By the way, if I run these commands in pure sqlite prompt, then I get what I expect to see.
----------
components: Library (Lib)
messages: 257709
nosy: Vitaminus Maximus
priority: normal
severity: normal
status: open
title: ON DELETE CASCADE does not work when using sqlite3 library
type: behavior
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 14:28:19 2016
From: report at bugs.python.org (Joseph Fox-Rabinovitz)
Date: Thu, 07 Jan 2016 19:28:19 +0000
Subject: [New-bugs-announce] [issue26044] Name mangling overrides externally
defined names
Message-ID: <1452194899.15.0.985986475185.issue26044@psf.upfronthosting.co.za>
New submission from Joseph Fox-Rabinovitz:
I will begin by including three code snippets that do not work to illustrate the issue. All snippets were run as python modules/scripts from the command line using "python snippet.py":
**1**
__a = 3
print(locals())
class T:
def __init__(self):
global __a
self.a = __a
t1 = T()
**2**
__a = 3
print(locals())
class T:
def __init__(self):
self.a = __a
t2 = T()
**3**
__a = 3
print(locals())
class T:
def __init__(self):
m = sys.modules[__name__]
self.a = m.__a
t3 = T()
All three snippets fail in the line assigning `self.a`. The first two produce `NameError: name '_T__a' is not defined`. The third produces `AttributeError: module '__main__' has no attribute '_T__a'`. The problem in all three cases is that name mangling supercedes any other operation to the point that it mangles elements that are explicitly stated not to belong to the class. This behavior is not intuitive or expected.
I am running `Python 3.5.1 :: Continuum Analytics, Inc.` (using the Anaconda platform) on a Red Hat 6.5 machine. I have tried the same thing on Arch Linux (also with Python 3.5.1 and anaconda) with identical results.
----------
components: Interpreter Core
messages: 257714
nosy: madphysicist
priority: normal
severity: normal
status: open
title: Name mangling overrides externally defined names
type: behavior
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 17:27:17 2016
From: report at bugs.python.org (=?utf-8?q?Emil_Stenstr=C3=B6m?=)
Date: Thu, 07 Jan 2016 22:27:17 +0000
Subject: [New-bugs-announce] [issue26045] Improve error message for
http.client when posting unicode string
Message-ID: <1452205637.36.0.0359255361227.issue26045@psf.upfronthosting.co.za>
New submission from Emil Stenstr?m:
This issue is in response to this thread on python-ideas: https://mail.python.org/pipermail/python-ideas/2016-January/037678.html
Note that Cory did a lot of encoding background work here:
https://mail.python.org/pipermail/python-ideas/2016-January/037680.html
---
Bug description:
When posting an unencoded unicode string directly with python-requests you get the following stacktrace:
import requests
r = requests.post("http://example.com", data="Celebrate ?")
...
File "../lib/python3.4/http/client.py", line 1127, in _send_request
body = body.encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 14-15: ordinal not in range(256)
This is because requests uses http.client, and http.client assumes the encoding to be latin-1 if given a unicode string. This is a very common source of bugs for beginners who assume sending in unicode would automatically encode it in utf-8, like in the libraries of many other languages.
The simplest fix here is to catch the UnicodeEncodeError and improve the error message to something that points beginners in the right direction.
Another option would be to:
- Keep encoding in latin-1 first, and if that fails try utf-8
Other possible solutions (that would be backwards incompatible) includes:
- Changing the default encoding to utf-8 instead of latin-1
- Detect an unencoded unicode string and fail without encoding it with a descriptive error message
---
Just to show that this is a problem that exists in the wild, here are a few examples that all crashes on the same line in http.client (not all going through the requests library:
- https://github.com/kennethreitz/requests/issues/2838
- https://github.com/kennethreitz/requests/issues/1822
- http://stackoverflow.com/questions/34618149/post-unicode-string-to-web-service-using-python-requests-library
- https://www.reddit.com/r/learnpython/comments/3violw/unicodeencodeerror_when_searching_ebay_with/
- https://github.com/codecov/codecov-python/issues/35
- https://github.com/google/google-api-python-client/issues/145
- https://bugs.launchpad.net/ubuntu/+source/lazr.restfulclient/+bug/1414063
----------
components: Unicode
messages: 257721
nosy: Emil Stenstr?m, ezio.melotti, haypo
priority: normal
severity: normal
status: open
title: Improve error message for http.client when posting unicode string
type: enhancement
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 7 19:46:20 2016
From: report at bugs.python.org (David Sterry)
Date: Fri, 08 Jan 2016 00:46:20 +0000
Subject: [New-bugs-announce] [issue26046] Typo
Message-ID: <1452213980.49.0.122824663371.issue26046@psf.upfronthosting.co.za>
New submission from David Sterry:
In https://docs.python.org/2/library/unittest.html#basic-example the word "details" should be "detail".
----------
assignee: docs at python
components: Documentation
messages: 257731
nosy: David Sterry, docs at python
priority: normal
severity: normal
status: open
title: Typo
type: enhancement
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 04:18:18 2016
From: report at bugs.python.org (Christof Hanke)
Date: Fri, 08 Jan 2016 09:18:18 +0000
Subject: [New-bugs-announce] [issue26047] argparse.ArgumentError
documentation wrong
Message-ID: <1452244698.45.0.106083471244.issue26047@psf.upfronthosting.co.za>
New submission from Christof Hanke:
On https://docs.python.org/2/library/argparse.html (and on those of the 3.6-Version) it says at the bottom:
"""
ArgumentParser.error(message)
This method prints a usage message including the message to the standard error and terminates the program with a status code of 2.
"""
In fact, the returned staus code is 1.
----------
assignee: docs at python
components: Documentation
messages: 257745
nosy: Christof Hanke, docs at python
priority: normal
severity: normal
status: open
title: argparse.ArgumentError documentation wrong
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 06:58:49 2016
From: report at bugs.python.org (Divyang Patel)
Date: Fri, 08 Jan 2016 11:58:49 +0000
Subject: [New-bugs-announce] [issue26048] New user in community
Message-ID: <1452254329.64.0.275249688938.issue26048@psf.upfronthosting.co.za>
New submission from Divyang Patel:
Greetings to all!
Hi,
please Guide me to understand how to contributing python ??
----------
messages: 257752
nosy: devtechnofreak
priority: normal
severity: normal
status: open
title: New user in community
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 08:36:38 2016
From: report at bugs.python.org (Sergi Almacellas Abellana)
Date: Fri, 08 Jan 2016 13:36:38 +0000
Subject: [New-bugs-announce] [issue26049] Poor performance when reading
large xmlrpc data
Message-ID: <1452260198.15.0.426497706706.issue26049@psf.upfronthosting.co.za>
New submission from Sergi Almacellas Abellana:
By default, python xmlrpclib parser reads data by chunks of 1024 bytes [1], which leads to a lot of data concatenations when reading large data, which is very slow in python.
Increasing the chuck size from 1024 bytes to a higher value makes improve in performance.
On the same machine, we have tested with 20MB of data and we've got the following results:
Chucks of 1024: 1min 48.933491sec
Chucks of 10 * 1024 * 1024: 0.245282sec
We have chosen 10 * 1024 * 1024, as it is the same value used in issue792570
We have done our tests on python2.7, but same code exists for default branch [2] (and 3.x branches also [3][4][5][6]), so I belive all the versions are affected.
I can work on a patch if you think this change is acceptable.
IMHO it's logical to allow the developer to customize the chunk size instead of using a hard coded one.
[1] https://hg.python.org/cpython/file/2.7/Lib/xmlrpclib.py#l1479
[2] https://hg.python.org/cpython/file/default/Lib/xmlrpc/client.py#l1310
[3] https://hg.python.org/cpython/file/3.5/Lib/xmlrpc/client.py#l1310
[4] https://hg.python.org/cpython/file/3.4/Lib/xmlrpc/client.py#l1324
[5] https://hg.python.org/cpython/file/3.3/Lib/xmlrpc/client.py#l1316
[6] https://hg.python.org/cpython/file/3.2/Lib/xmlrpc/client.py#l1301
----------
components: XML
messages: 257756
nosy: pokoli
priority: normal
severity: normal
status: open
title: Poor performance when reading large xmlrpc data
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 15:37:56 2016
From: report at bugs.python.org (=?utf-8?b?0JzQsNGA0Log0JrQvtGA0LXQvdCx0LXRgNCz?=)
Date: Fri, 08 Jan 2016 20:37:56 +0000
Subject: [New-bugs-announce] [issue26050] Add new StreamReader.readuntil()
method
Message-ID: <1452285476.14.0.419432816204.issue26050@psf.upfronthosting.co.za>
New submission from ???? ?????????:
See code discussion here:
https://github.com/python/asyncio/pull/297
----------
components: asyncio
messages: 257776
nosy: gvanrossum, haypo, mmarkk, yselivanov
priority: normal
severity: normal
status: open
title: Add new StreamReader.readuntil() method
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 18:21:49 2016
From: report at bugs.python.org (Antony Lee)
Date: Fri, 08 Jan 2016 23:21:49 +0000
Subject: [New-bugs-announce] [issue26051] Non-data descriptors in pydoc
Message-ID: <1452295309.05.0.476253695659.issue26051@psf.upfronthosting.co.za>
New submission from Antony Lee:
Consider the following minimal example:
class readonlyprop:
__init__ = lambda self, func: None
__get__ = lambda self, inst, cls=None: None
class C:
def bar(self):
pass
@readonlyprop
def foo(self):
pass
def quux(self):
pass
the output of `pydoc modname.C` is
<... cropped ...>
modname.C = class C(builtins.object)
| Methods defined here:
|
| bar(self)
|
| foo = None
| quux(self)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
<... cropped ...>
It would be nice if
1. a newline was added after `foo = None`, and
2. foo was *also* marked as being a non-data-descriptor of class readonlyprop (basically what you'd get without invoking the __get__).
----------
assignee: docs at python
components: Documentation
messages: 257782
nosy: Antony.Lee, docs at python
priority: normal
severity: normal
status: open
title: Non-data descriptors in pydoc
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 18:30:07 2016
From: report at bugs.python.org (Antony Lee)
Date: Fri, 08 Jan 2016 23:30:07 +0000
Subject: [New-bugs-announce] [issue26052] pydoc for __init__ with not
docstring
Message-ID: <1452295807.98.0.613500169742.issue26052@psf.upfronthosting.co.za>
New submission from Antony Lee:
For a class whose __init__ has no docstring, e.g.
class C:
def __init__(self, arg):
pass
pydoc outputs
<... cropped ...>
class C(builtins.object)
| Methods defined here:
|
| __init__(self, arg)
| Initialize self. See help(type(self)) for accurate signature.
<... cropped ...>
The last part "See help(type(self)) for accurate signature." could arguably be cropped as the correct signature is already displayed (I see that this is the docstring of object.__init__, it's not clear to me why it needs this sentence.).
----------
assignee: docs at python
components: Documentation
messages: 257784
nosy: Antony.Lee, docs at python
priority: normal
severity: normal
status: open
title: pydoc for __init__ with not docstring
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 18:43:41 2016
From: report at bugs.python.org (Doug Hellmann)
Date: Fri, 08 Jan 2016 23:43:41 +0000
Subject: [New-bugs-announce] [issue26053] regression in pdb output between
2.7 and 3.5
Message-ID: <1452296621.32.0.373600761217.issue26053@psf.upfronthosting.co.za>
New submission from Doug Hellmann:
Under python 2.7 using the "run" command within pdb and passing it arguments causes those arguments to be printed out. Under 3.5, this is no longer true.
$ python2.7 -m pdb pdb_run.py
> /Users/dhellmann/Dropbox/PyMOTW/Python3/pymotw-3/source/pdb/pdb_run.py(7)()
-> import sys
(Pdb) c
('Command-line args:', ['pdb_run.py'])
The program finished and will be restarted
> /Users/dhellmann/Dropbox/PyMOTW/Python3/pymotw-3/source/pdb/pdb_run.py(7)()
-> import sys
(Pdb) run a b c "this is a long argument"
Restarting pdb_run.py with arguments:
a b c this is a long argument
> /Users/dhellmann/Dropbox/PyMOTW/Python3/pymotw-3/source/pdb/pdb_run.py(7)()
-> import sys
$ python3.5 -m pdb pdb_run.py
> /Users/dhellmann/Dropbox/PyMOTW/Python3/pymotw-3/source/pdb/pdb_run.py(7)()
-> import sys
(Pdb) c
Command-line args: ['pdb_run.py']
The program finished and will be restarted
> /Users/dhellmann/Dropbox/PyMOTW/Python3/pymotw-3/source/pdb/pdb_run.py(7)()
-> import sys
(Pdb) run a b c "this is a long argument"
Restarting pdb_run.py with arguments:
pdb_run.py
> /Users/dhellmann/Dropbox/PyMOTW/Python3/pymotw-3/source/pdb/pdb_run.py(7)()
-> import sys
It looks like the issue is in the pdb main loop. Under 2.7 the restart logic has:
except Restart:
print "Restarting", mainpyfile, "with arguments:"
print "\t" + " ".join(sys.argv[1:])
but under 3.5 that was changed to:
except Restart:
print("Restarting", mainpyfile, "with arguments:")
print("\t" + " ".join(args))
The do_run() method has already reset sys.argv before throwing Restart, so to print the correct arguments sys.argv[1:] should be used.
----------
files: pdb_run.py
keywords: 3.5regression
messages: 257785
nosy: doughellmann
priority: normal
severity: normal
status: open
title: regression in pdb output between 2.7 and 3.5
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41538/pdb_run.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 21:44:40 2016
From: report at bugs.python.org (David Jackson)
Date: Sat, 09 Jan 2016 02:44:40 +0000
Subject: [New-bugs-announce] [issue26054] Unable to run scripts: idle3 -r
script.py
Message-ID: <1452307480.34.0.944770933211.issue26054@psf.upfronthosting.co.za>
New submission from David Jackson:
[Raspberry Jessie] Idle3(4.2]
If I open a idle3 shell (from menu) and enter >>import pandas as pd it accepts the command, but if I trying and run it from the shell>> idle3 -r script.py I get the following errors:
Traceback (most recent call last):
File "test.py", line 1, in
import pandas as pd
File "/home/pi/python/pandas.py", line 3, in
from pandas_datareader import data, wb
File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/__init__.py", line 3, in
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo,
File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/data.py", line 7, in
from pandas_datareader.google.daily import GoogleDailyReader
File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/google/daily.py", line 1, in
from pandas_datareader.base import _DailyBaseReader
File "/usr/local/lib/python3.4/dist-packages/pandas_datareader-0.2.1-py3.4.egg/pandas_datareader/base.py", line 9, in
from pandas import to_datetime
ImportError: cannot import name 'to_datetime'
----------
components: IDLE
messages: 257792
nosy: davidjackson1955
priority: normal
severity: normal
status: open
title: Unable to run scripts: idle3 -r script.py
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Fri Jan 8 23:38:16 2016
From: report at bugs.python.org (YoungBoy)
Date: Sat, 09 Jan 2016 04:38:16 +0000
Subject: [New-bugs-announce] [issue26055] sys.argv[0] is the python file,
not ""
Message-ID: <1452314296.6.0.563314730517.issue26055@psf.upfronthosting.co.za>
New submission from YoungBoy:
python tutorial 2.1.1
You can access this list by executing import sys. The length of the list is at least one; when no script and no arguments are given, sys.argv[0] is an empty string.
but, when i try it, the sys.argv[0]is the filename,not empty string.
----------
assignee: docs at python
components: Documentation
messages: 257795
nosy: Wei, docs at python
priority: normal
severity: normal
status: open
title: sys.argv[0] is the python file, not ""
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 03:22:39 2016
From: report at bugs.python.org (Amandeep Singh Sohal)
Date: Sat, 09 Jan 2016 08:22:39 +0000
Subject: [New-bugs-announce] [issue26056] installation failure
Message-ID: <1452327759.39.0.705157588806.issue26056@psf.upfronthosting.co.za>
New submission from Amandeep Singh Sohal:
when i trying to install the python 3.5.1. It gives a error "window 7 service pack 1 and all applicable updates are required to install python 3.5.1". here i am also uploading the log file of installation.
----------
components: Installation
files: Python 3.5.1 (32-bit)_20160109133257.log
messages: 257801
nosy: Amandeep Singh Sohal
priority: normal
severity: normal
status: open
title: installation failure
type: compile error
versions: Python 3.5
Added file: http://bugs.python.org/file41540/Python 3.5.1 (32-bit)_20160109133257.log
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 03:41:41 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Sat, 09 Jan 2016 08:41:41 +0000
Subject: [New-bugs-announce] [issue26057] Avoid nonneeded use of
PyUnicode_FromObject()
Message-ID: <1452328901.15.0.65828251852.issue26057@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
In Python 2 PyUnicode_FromObject() was used for coercing 8-bit strings to unicode by decoding them with the default encoding. But in Python 3 there is no such coercing. The effect of PyUnicode_FromObject() in Python 3 is ensuring that the argument is a string and convert an instance of str subtype to exact str. The latter often is just a waste of memory and time, since resulted string is used only for retrieving UTF-8 representation or raw data.
Proposed patch makes following things:
1. Avoids unneeded copying of string's content.
2. Avoids raising some unneeded exceptions.
3. Gets rid of unneeded incref/decref.
4. Makes some error messages more correct or informative.
5. Converts runtime checks PyBytes_Check() for results of string encoding to asserts.
Example of performance gain:
Unpatched:
$ ./python -m timeit -s "a = 'a'*100; b = 'b'*1000" -- "a in b"
1000000 loops, best of 3: 0.404 usec per loop
$ ./python -m timeit -s "class S(str): pass" -s "a = S('a'*100); b = S('b'*1000)" -- "a in b"
1000000 loops, best of 3: 0.723 usec per loop
Patched:
$ ./python -m timeit -s "a = 'a'*100; b = 'b'*1000" -- "a in b"
1000000 loops, best of 3: 0.383 usec per loop
$ ./python -m timeit -s "class S(str): pass" -s "a = S('a'*100); b = S('b'*1000)" -- "a in b"
1000000 loops, best of 3: 0.387 usec per loop
----------
components: Interpreter Core
files: no_unicode_copy.patch
keywords: patch
messages: 257806
nosy: haypo, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Avoid nonneeded use of PyUnicode_FromObject()
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41541/no_unicode_copy.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 04:30:48 2016
From: report at bugs.python.org (STINNER Victor)
Date: Sat, 09 Jan 2016 09:30:48 +0000
Subject: [New-bugs-announce] [issue26058] Add dict.__version__ read-only
property
Message-ID: <1452331848.43.0.271164045437.issue26058@psf.upfronthosting.co.za>
New submission from STINNER Victor:
Attached patch implements the following PEP currently discussed on python-ideas:
https://faster-cpython.readthedocs.org/pep_dict_version.html#pep-dict-version
----------
files: dict_version.patch
keywords: patch
messages: 257809
nosy: haypo
priority: normal
severity: normal
status: open
title: Add dict.__version__ read-only property
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41542/dict_version.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 04:43:43 2016
From: report at bugs.python.org (Ramin Farajpour Cami)
Date: Sat, 09 Jan 2016 09:43:43 +0000
Subject: [New-bugs-announce] [issue26059] Integer Overflow
Message-ID: <1452332623.28.0.0160182788623.issue26059@psf.upfronthosting.co.za>
New submission from Ramin Farajpour Cami:
this work on python 2.7.10 and 2.7.11 crash,
C:\Users\RaminFP>cdb -g python C:\Users\RaminFP\Desktop\1.py
Microsoft (R) Windows Debugger Version 6.11.0001.404 X86
Copyright (c) Microsoft Corporation. All rights reserved.
CommandLine: python C:\Users\RaminFP\Desktop\1.py
Symbol search path is: srv*c:\pubsymbols*http://msdl.microsoft.com/download/symbols
Executable search path is:
ModLoad: 1d000000 1d00a000 python.exe
ModLoad: 76fe0000 77159000 ntdll.dll
ModLoad: 76ac0000 76bb0000 C:\Windows\SysWOW64\KERNEL32.DLL
ModLoad: 74e30000 74fa6000 C:\Windows\SysWOW64\KERNELBASE.dll
ModLoad: 1e000000 1e264000 C:\Windows\SysWOW64\python27.dll
ModLoad: 71a10000 71ab3000 C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.9158_none_5091b51ebcb97cdc\MSVCR90.dll
ModLoad: 748f0000 74a30000 C:\Windows\SysWOW64\USER32.dll
ModLoad: 747a0000 748ed000 C:\Windows\SysWOW64\GDI32.dll
ModLoad: 763e0000 7645b000 C:\Windows\SysWOW64\ADVAPI32.dll
ModLoad: 74bd0000 74c8e000 C:\Windows\SysWOW64\msvcrt.dll
ModLoad: 76bd0000 76c13000 C:\Windows\SysWOW64\sechost.dll
ModLoad: 76c30000 76cdc000 C:\Windows\SysWOW64\RPCRT4.dll
ModLoad: 740f0000 7410e000 C:\Windows\SysWOW64\SspiCli.dll
ModLoad: 740e0000 740ea000 C:\Windows\SysWOW64\CRYPTBASE.dll
ModLoad: 74080000 740d9000 C:\Windows\SysWOW64\bcryptPrimitives.dll
ModLoad: 74fb0000 7636f000 C:\Windows\SysWOW64\SHELL32.dll
ModLoad: 742c0000 7479d000 C:\Windows\SysWOW64\windows.storage.dll
ModLoad: 76900000 76aba000 C:\Windows\SysWOW64\combase.dll
ModLoad: 74de0000 74e24000 C:\Windows\SysWOW64\shlwapi.dll
ModLoad: 767c0000 767cc000 C:\Windows\SysWOW64\kernel.appcore.dll
ModLoad: 76d40000 76dcd000 C:\Windows\SysWOW64\shcore.dll
ModLoad: 767d0000 76814000 C:\Windows\SysWOW64\powrprof.dll
ModLoad: 76bc0000 76bcf000 C:\Windows\SysWOW64\profapi.dll
ModLoad: 76670000 7669b000 C:\Windows\SysWOW64\IMM32.DLL
ModLoad: 766a0000 767c0000 C:\Windows\SysWOW64\MSCTF.dll
(13a4.1030): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=02555630 ebx=5708ac94 ecx=00003c7a edx=00000000 esi=02546448 edi=57091000
eip=71a4ae7a esp=0028fc98 ebp=0028fca0 iopl=0 nv up ei pl nz ac pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010216
MSVCR90!memcpy+0x5a:
71a4ae7a f3a5 rep movs dword ptr es:[edi],dword ptr [esi]
0:000> r
eax=02555630 ebx=5708ac94 ecx=00003c7a edx=00000000 esi=02546448 edi=57091000
eip=71a4ae7a esp=0028fc98 ebp=0028fca0 iopl=0 nv up ei pl nz ac pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010216
MSVCR90!memcpy+0x5a:
71a4ae7a f3a5 rep movs dword ptr es:[edi],dword ptr [esi]
0:000> db esi
*** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\SysWOW64\python27.dll -
02546448 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
02546458 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
02546468 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
02546478 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
02546488 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
02546498 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
025464a8 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
025464b8 41 41 41 41 41 41 41 41-41 41 41 41 41 41 41 41 AAAAAAAAAAAAAAAA
0:000> db edi
57091000 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
57091010 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
57091020 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
57091030 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
57091040 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
57091050 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
57091060 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
57091070 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
0:000>
----------
components: ctypes
files: 1.py
messages: 257812
nosy: Ramin Farajpour Cami
priority: normal
severity: normal
status: open
title: Integer Overflow
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file41543/1.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 07:56:11 2016
From: report at bugs.python.org (Nick Coghlan)
Date: Sat, 09 Jan 2016 12:56:11 +0000
Subject: [New-bugs-announce] [issue26060] Class __dict__ iteration order
changing due to type instance key-sharing
Message-ID: <1452344171.87.0.895462140972.issue26060@psf.upfronthosting.co.za>
New submission from Nick Coghlan:
Dave Beazley found some odd behaviour in Python 3.4.1+, where the order of the keys in a class dictionary can be changed by assigning a new value to an existing key: https://gist.github.com/dabeaz/617a5b0542d57e003433
Dave's original reproducer showed a case where iterating over class attributes replacing some of them with new values worked correctly as a class decorator on a normal instance of type, but was unreliable when the same operation was called from a metaclass __new__ or __init__ method.
Further investigation showed that it wasn't the timing of the assignment that mattered, but rather the use of a subclass of type rather than type itself as the metaclass.
Checking between 3.4.0 and 3.4.1 with hg bisect using the simpler attached script as the reproducer identified the enabling of key sharing with subclass instances in #20637 as the apparent culprit.
My current theory is that from 3.3.0 to 3.4.0, keys weren't being shared between instances of type and instances of type subclasses at all, and changing that in 3.4.1 broke a subtle assumption somewhere in type_new.
----------
files: ns_reordering_bug.py
messages: 257824
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Class __dict__ iteration order changing due to type instance key-sharing
Added file: http://bugs.python.org/file41550/ns_reordering_bug.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 09:12:01 2016
From: report at bugs.python.org (Aviv Palivoda)
Date: Sat, 09 Jan 2016 14:12:01 +0000
Subject: [New-bugs-announce] [issue26061] logging LogRecordFactory allow
kwargs
Message-ID: <1452348721.62.0.0659441609169.issue26061@psf.upfronthosting.co.za>
New submission from Aviv Palivoda:
The logging LogRecord factory receives kwargs. However because _log and makeRecord functions in the Logger class don't support kwargs we can't actually pass additional positional arguments to LogRecord.
A use case for this is attached.
I had made a patch to fix this by changing _log and makeRecord to accept kwargs and pass them.
----------
components: Library (Lib)
files: usecase.py
messages: 257831
nosy: palaviv, vinay.sajip
priority: normal
severity: normal
status: open
title: logging LogRecordFactory allow kwargs
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file41553/usecase.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 09:25:36 2016
From: report at bugs.python.org (=?utf-8?q?Christoph_B=C3=B6ddeker?=)
Date: Sat, 09 Jan 2016 14:25:36 +0000
Subject: [New-bugs-announce] [issue26062] IPython4 bash magic ! with {} does
not work with Python 3.5.1
Message-ID: <1452349536.45.0.55048690622.issue26062@psf.upfronthosting.co.za>
New submission from Christoph B?ddeker:
Hello,
I found a wrong behavior with IPython 4 in combination with Python 3.5.1.
Normally in a command like "In [2]: !echo {a}" everything inside {} is interpreted with python and inserted to executed the line with bash. After I done a upgrade tp Python 3.5.1 this wasn't working. After a downgrade (3.5.0) it was working.
In the bottom is an example, where "In [2]: !echo {a}" are the important lines.
In [2]: !echo {a}
* Python 3.5.0 -> 3
* Python 3.5.1 -> {a}
Best regards
Christoph
-----------------------------------------------------------------------
$ ipython
Python 3.5.1 |Anaconda 2.4.0 (64-bit)| (default, Dec 7 2015, 11:16:01)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: a = 3
In [2]: !echo {a}
{a}
In [3]:
-----------------------------------------------------------------------
conda install python=3.5.0
Fetching package metadata: ....
Solving package specifications: ................
Package plan for installation in environment /opt/anaconda3:
The following packages will be DOWNGRADED:
python: 3.5.1-0 --> 3.5.0-1
Proceed ([y]/n)? y
Unlinking packages ...
[ COMPLETE ]|###################################################| 100%
Linking packages ...
[ COMPLETE ]|###################################################| 100%
-----------------------------------------------------------------------
$ ipython
Python 3.5.0 |Anaconda 2.4.0 (64-bit)| (default, Oct 19 2015, 21:57:25)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: a = 3
In [2]: !echo {a}
3
In [3]:
----------
messages: 257833
nosy: Christoph B?ddeker
priority: normal
severity: normal
status: open
title: IPython4 bash magic ! with {} does not work with Python 3.5.1
type: behavior
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 09:30:37 2016
From: report at bugs.python.org (Ezio Melotti)
Date: Sat, 09 Jan 2016 14:30:37 +0000
Subject: [New-bugs-announce] [issue26063] Update copyright in the devguide
Message-ID: <1452349837.88.0.575893993486.issue26063@psf.upfronthosting.co.za>
New submission from Ezio Melotti:
The copyright in the devguide needs to be updated for 2016.
----------
components: Devguide
messages: 257834
nosy: ezio.melotti, willingc
priority: normal
severity: normal
stage: needs patch
status: open
title: Update copyright in the devguide
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 13:25:26 2016
From: report at bugs.python.org (Sagar Kar)
Date: Sat, 09 Jan 2016 18:25:26 +0000
Subject: [New-bugs-announce] [issue26064] directory is getting separated
Message-ID: <1452363926.86.0.702790160127.issue26064@psf.upfronthosting.co.za>
New submission from Sagar Kar:
In [108]: os.mkdir('newdir') # make new dir
In [140]: p = os.path.abspath('newdir')
In [141]: p
Out[141]: '/media/sagarkar10/sdrive/programing/python/SciPy/scipy-notebook/newdir'
## here 'newdir' is also a directory with a file inside
In [143]: os.path.dirname(p)
Out[143]: '/media/sagarkar10/sdrive/programing/python/SciPy/scipy-notebook'
## but os.path.dirname() dont show it under directory it treats as if its a file and till the last '/' is the directory
and also
In [145]: os.path.basename(p)
Out[145]: 'newdir'
## basename shows it
----------
components: Extension Modules
messages: 257849
nosy: sagarkar10
priority: normal
severity: normal
status: open
title: directory is getting separated
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 14:15:02 2016
From: report at bugs.python.org (Laurent Dufrechou)
Date: Sat, 09 Jan 2016 19:15:02 +0000
Subject: [New-bugs-announce] [issue26065] python embedded 3.5 amd64 crash
when using venv
Message-ID: <1452366902.23.0.484622853391.issue26065@psf.upfronthosting.co.za>
New submission from Laurent Dufrechou:
Install python-3.5.1-embed-amd64 to c:\dev\python-3.5.1-embed-amd64
Open terminal window:
cd c:\dev\python-3.5.1-embed-amd64
python -m venv c:\dev\myenv
-> crash
Error: Command '['C:\\dev\\myenv\\Scripts\\python.exe', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 3221226505
Using debugger (VS2015) shows error:
Exception non g?r?e ? 0x00007FFDA1D05A4E (ucrtbase.dll) dans python.exe?
And stopping debugger leave this log:
C:\dev\python-3.5.1-embed-amd64>python -m venv C:\dev\python35_x64_rtquickreport
Traceback (most recent call last):
File "runpy.py", line 170, in _run_module_as_main
File "runpy.py", line 85, in _run_code
File "venv\__main__.py", line 6, in
File "venv\__init__.py", line 442, in main
File "venv\__init__.py", line 85, in create
File "venv\__init__.py", line 257, in _setup_pip
File "subprocess.py", line 629, in check_output
File "subprocess.py", line 698, in run
File "subprocess.py", line 1055, in communicate
KeyboardInterrupt
----------
components: Windows
messages: 257855
nosy: Laurent Dufrechou, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: python embedded 3.5 amd64 crash when using venv
type: crash
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 15:41:56 2016
From: report at bugs.python.org (Alex Gaynor)
Date: Sat, 09 Jan 2016 20:41:56 +0000
Subject: [New-bugs-announce] [issue26066] Language on the "Cryptographic
Services" is out of date
Message-ID: <1452372116.19.0.623367169611.issue26066@psf.upfronthosting.co.za>
New submission from Alex Gaynor:
https://docs.python.org/2/library/crypto.html
https://docs.python.org/3/library/crypto.html
This language has a number of issues:
- Crypto isn't just for "Hardcore cypherpunks" anymore, it's a necessary component of a great many software projects
- PyCrypto isn't maintained by A.M. Kuchling any longer
- (IMO) it's no longer the recommended library for cryptography in Python
- The page should probably also point people towards the ssl module.
----------
assignee: docs at python
components: Documentation
messages: 257857
nosy: alex, docs at python
priority: normal
severity: normal
status: open
title: Language on the "Cryptographic Services" is out of date
versions: Python 2.7, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 16:10:35 2016
From: report at bugs.python.org (Dinesh Wijekoon)
Date: Sat, 09 Jan 2016 21:10:35 +0000
Subject: [New-bugs-announce] [issue26067] test_shutil fails when gid name is
missing
Message-ID: <1452373835.73.0.278108988814.issue26067@psf.upfronthosting.co.za>
New submission from Dinesh Wijekoon:
./python.exe -m test -j3 -v test_shutil
The above test fails when id name is missing. The fail message is
group = grp.getgrgid(gid)[0]
KeyError: 'getgrgid(): gid not found: 203135016'
Following is the results from console "id" command, when the failure happens.
uid=1336551206(athukora) gid=203135016 groups=203135016,402(com.apple.sharepoint.group.2),12(everyone),62(netaccounts),80(admin),401(com.apple.sharepoint.group.1),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),398(com.apple.access_screensharing),399(com.apple.access_ssh)
And again when I change user to sudo the "id" command returns the following and test get passed.
uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),401(com.apple.sharepoint.group.1),402(com.apple.sharepoint.group.2),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),398(com.apple.access_screensharing),399(com.apple.access_ssh)
PS:
We tried to debug this a bit and found the bug is possibly in Modules/grpmodule.c, may be at method grp_getgrall_impl. Adding "PyString_AsString(v);" before if command " PyList_Append(d, v) != 0" will fix the issue in test. But we have no idea how its working with this change.
----------
components: Extension Modules
messages: 257858
nosy: Dinesh Wijekoon, ezio.melotti
priority: normal
severity: normal
status: open
title: test_shutil fails when gid name is missing
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 16:18:18 2016
From: report at bugs.python.org (ThiefMaster)
Date: Sat, 09 Jan 2016 21:18:18 +0000
Subject: [New-bugs-announce] [issue26068] re.compile() repr end quote
truncated
Message-ID: <1452374298.65.0.166509982693.issue26068@psf.upfronthosting.co.za>
New submission from ThiefMaster:
```
Python 3.4.3 (default, Jan 5 2016, 23:13:10)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> for n in range(198, 201):
... print(re.compile('x' * n))
...
re.compile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
re.compile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
re.compile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
```
The closing quote in the repr goes away once the regex exceeds a certain length. This smells like an off-by-one somewhere that results in the last character to be lost. In any case, it's pretty ugly since the repr clearly pretends to be executable Python code, which is not the case anymore with this quote missing.
----------
components: Regular Expressions
messages: 257860
nosy: ThiefMaster, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.compile() repr end quote truncated
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 19:20:26 2016
From: report at bugs.python.org (Senthil Kumaran)
Date: Sun, 10 Jan 2016 00:20:26 +0000
Subject: [New-bugs-announce] [issue26069] Remove the Deprecated API in trace
module
Message-ID: <1452385226.89.0.6584761467.issue26069@psf.upfronthosting.co.za>
New submission from Senthil Kumaran:
A number of old methods in trace module were deprecated in issue10371. They should be removed in 3.6 release.
----------
components: Library (Lib)
messages: 257877
nosy: belopolsky, orsenthil
priority: normal
severity: normal
stage: needs patch
status: open
title: Remove the Deprecated API in trace module
type: behavior
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 19:59:35 2016
From: report at bugs.python.org (Mark Hammond)
Date: Sun, 10 Jan 2016 00:59:35 +0000
Subject: [New-bugs-announce] [issue26070] Launcher fails to find in-place
built binaries from earlier Python versions
Message-ID: <1452387575.38.0.184373942558.issue26070@psf.upfronthosting.co.za>
New submission from Mark Hammond:
The launcher was recently updated to look in PCBuild/win32 to support the win32 binaries being built in this directory instead of the top-level PCBuild directory. However, when this new launcher tries to find a binary for, say, Python 2.7, it doesn't find an executable because it's directly in PCBuild, not one of the win32 or amd64 sub-directories.
Note this only impacts Python when it is built in the directory - it doesn't impact installed versions.
The fix I came up with is to continue looking in PCBuild if it isn't found in one of those dirs.
Vinay, what do you think?
----------
components: Windows
files: launcher.patch
keywords: patch
messages: 257878
nosy: mhammond, paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware
priority: normal
severity: normal
status: open
title: Launcher fails to find in-place built binaries from earlier Python versions
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41560/launcher.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sat Jan 9 20:06:48 2016
From: report at bugs.python.org (Mark Hammond)
Date: Sun, 10 Jan 2016 01:06:48 +0000
Subject: [New-bugs-announce] [issue26071] bdist_wininst created binaries
fail to start and find 32bit Pythons
Message-ID: <1452388008.63.0.0329055331541.issue26071@psf.upfronthosting.co.za>
New submission from Mark Hammond:
Binaries created by bdist_wininst fail on 3.5+ for 2 reasons:
* The built binary links against the DLL version of the CRT. This means the binary will typically fail to start as the CRT DLL isn't found.
* When looking for 32bit Python versions, it fails to take the recent "-32" change for the registry key, so it tells you no Python is installed.
This patch:
* Uses the static CRT, which IIRC, was the case in previous Python versions.
* Changes directory to the directory with pythonxx.dll before attempting to loadlibrary it - this allows the loadlibrary to succeed as the CRT DLL in that directory is found.
* Appends "-32" to registry keys on 32bit builds.
With these patches I can successfully get a pywin32 build working and installing.
Steve (or anyone), what do you think?
(Note that the attached patch does *not* include a newly built wininst-14.exe, but that would obviously need to be updated before checking in.)
----------
components: Windows
files: bdist.patch
keywords: patch
messages: 257879
nosy: mhammond, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: bdist_wininst created binaries fail to start and find 32bit Pythons
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41561/bdist.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 10 00:16:24 2016
From: report at bugs.python.org (Antony Lee)
Date: Sun, 10 Jan 2016 05:16:24 +0000
Subject: [New-bugs-announce] [issue26072] pdb fails to access variables
closed over
Message-ID: <1452402984.12.0.000738362264887.issue26072@psf.upfronthosting.co.za>
New submission from Antony Lee:
Consider the following example:
def f(x=1):
def g():
y = 2
raise Exception
g()
f()
$ python -mpdb -ccontinue example.py
<... traceback ...>
> /tmp/example.py(4)g()
-> raise Exception
(Pdb) p x
##### this can be worked around using "up"
*** NameError: name 'x' is not defined
(Pdb) p y
2
(Pdb) p (lambda: y)()
##### this is more awkward to work around, e.g. (lambda *, y=y: y)()
*** NameError: name 'y' is not defined
Use case: I wan to pass a lambda to a numerical optimizer, but the optimizer fails using the default starting point. Within pdb, I'd like to pass a different starting point but the same lambda, to see whether this helps.
----------
components: Library (Lib)
messages: 257888
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: pdb fails to access variables closed over
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 10 02:49:53 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Sun, 10 Jan 2016 07:49:53 +0000
Subject: [New-bugs-announce] [issue26073] Update the list of magic numbers
in launcher
Message-ID: <1452412193.99.0.751958856998.issue26073@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
There is a list of magic numbers in PC/launcher.c for mapping magic number to Python version. But it ends on 3.3 (and even only on 3.3a0). Proposed patch updates the list (by values taken from Lib/importlib/_bootstrap_external.py).
----------
components: Windows
files: launcher_magic_numbers.patch
keywords: patch
messages: 257896
nosy: brett.cannon, eric.snow, ncoghlan, paul.moore, serhiy.storchaka, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Update the list of magic numbers in launcher
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41564/launcher_magic_numbers.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 10 05:52:00 2016
From: report at bugs.python.org (Blaize Rhodes)
Date: Sun, 10 Jan 2016 10:52:00 +0000
Subject: [New-bugs-announce] [issue26074] Add a method to pip..
pip.require("package_name")
Message-ID: <1452423120.4.0.471254538905.issue26074@psf.upfronthosting.co.za>
New submission from Blaize Rhodes:
The idea is to add a method to pip that tries to import a package and if the import fails then try to download and install the package handling the UI.
Yes, you can put the package as a dependency in your pip config for
your code. This is intended for the case when you have a bunch of
python tools/libs in some shared repository in your organization.
People check the code out and expect it to run but it has third party
dependencies. There is no install step for your code, per se. Furthermore the people using your code don't know enough about python to install things themselves.
Proposed syntax is:
import pip
pip.require("foo")
If you search online for pip.main you'll see a whole bunch of hall-baked brittle solutions to this problem that look like this:
try:
import foo
except ImportError:
pip.main("install", "foo")
----------
files: require.py
messages: 257903
nosy: Blaize Rhodes
priority: normal
severity: normal
status: open
title: Add a method to pip.. pip.require("package_name")
type: enhancement
Added file: http://bugs.python.org/file41565/require.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 10 07:57:34 2016
From: report at bugs.python.org (=?utf-8?q?Alex_Gr=C3=B6nholm?=)
Date: Sun, 10 Jan 2016 12:57:34 +0000
Subject: [New-bugs-announce] [issue26075] typing.Union unifies types too
broadly
Message-ID: <1452430654.78.0.244173734721.issue26075@psf.upfronthosting.co.za>
New submission from Alex Gr?nholm:
>>> from typing import Union, Iterable
>>> Union[str, Iterable[int]]
typing.Iterable[int]
The union loses the "str" parameter because issubclass(str, collections.abc.Iterable) returns True and the check completely disregards generics.
Guido mentioned that issubclass() support for generic types should be going away. In the mean time, maybe the subclass check in typing.GenericMeta should be modified not to do it with types from Typing, but how can we accurately identify them?
----------
components: Extension Modules
messages: 257910
nosy: alex.gronholm, gvanrossum, lukasz.langa
priority: normal
severity: normal
status: open
title: typing.Union unifies types too broadly
type: behavior
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 10 14:00:00 2016
From: report at bugs.python.org (Oren Milman)
Date: Sun, 10 Jan 2016 19:00:00 +0000
Subject: [New-bugs-announce] [issue26076] redundant checks in tok_get in
Parser\tokenizer.c
Message-ID: <1452452400.02.0.853203557937.issue26076@psf.upfronthosting.co.za>
New submission from Oren Milman:
In Parser\tokenizer.c, in tok_get, in the identification of a potential NUMBER token, in case the token starts with a '0', the next char of the token is retrieved, followed by two redundant checks:
if (c == '.')
goto fraction;
if (c == 'j' || c == 'J')
goto imaginary;
These two are redundant, because they check for the case of a token starting with '0.' or '0j', but even without them, the flow in either of these would reach the code after the /* maybe old-style octal; c is first char of it */ comment.
This code (after consuming all zeros and all decimal digits) would again perform those exact two checks, and handle them exactly the same.
My proposal is simply to remove the first two checks.
I have attached the patched tokenizer.c (the redundant checks are just commented out).
----------
components: Interpreter Core
files: tokenizer.c.withoutRedundantChecks.c
messages: 257927
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: redundant checks in tok_get in Parser\tokenizer.c
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41572/tokenizer.c.withoutRedundantChecks.c
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 10 15:45:56 2016
From: report at bugs.python.org (Filip Haglund)
Date: Sun, 10 Jan 2016 20:45:56 +0000
Subject: [New-bugs-announce] [issue26077] Make slicing of immutable
structures return a view instead of a copy
Message-ID: <1452458756.3.0.749991798075.issue26077@psf.upfronthosting.co.za>
New submission from Filip Haglund:
Slicing tuples returns a copy, which is O(n) time. This could be O(1) since tuples are immutable, by just pointing to the same data.
This probably applies to other immutable structures as well, such as strings.
----------
components: Interpreter Core
messages: 257937
nosy: Filip Haglund
priority: normal
severity: normal
status: open
title: Make slicing of immutable structures return a view instead of a copy
type: performance
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Sun Jan 10 16:24:42 2016
From: report at bugs.python.org (Edward)
Date: Sun, 10 Jan 2016 21:24:42 +0000
Subject: [New-bugs-announce] [issue26078] Python launcher options enhancement
Message-ID: <1452461082.93.0.268338836984.issue26078@psf.upfronthosting.co.za>
New submission from Edward:
The Python launcher in Windows is a neat tool for running multiple versions of Python 2 and Python 3 at different times. It allows as options the ability to specify the latest version of either Python 2 or Python 3 defaulting to the 64-bit version if both exist, or a specific 32-bit or 64-bit version of Python 2 or Python 3. What is missing is the ability to specify the latest 32-bit version of Python 2 or Python 3. The equivalent syntax would be '-2-32' or '-3-32'. Is there some reason why this option has been disallowed ? If not I would like to see this logical enhancement to the Python launcher in Windows added to its functionality.
----------
components: Windows
messages: 257940
nosy: edienerlee, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python launcher options enhancement
type: enhancement
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 08:34:40 2016
From: report at bugs.python.org (Bjoern Thiel)
Date: Mon, 11 Jan 2016 13:34:40 +0000
Subject: [New-bugs-announce] [issue26079] Build with Visual Studio 2015
using PlatformToolset=v120
Message-ID: <1452519280.93.0.432725713668.issue26079@psf.upfronthosting.co.za>
New submission from Bjoern Thiel:
Fixing the build output folder for tix-8.4.3.6.
----------
components: Build
files: build.patch
keywords: patch
messages: 257956
nosy: bjoernthiel
priority: normal
severity: normal
status: open
title: Build with Visual Studio 2015 using PlatformToolset=v120
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file41578/build.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 12:09:29 2016
From: report at bugs.python.org (W. Trevor King)
Date: Mon, 11 Jan 2016 17:09:29 +0000
Subject: [New-bugs-announce] [issue26080] "abandonned" -> "abandoned" in PEP
510's https://hg.python.org/peps/rev/b463c740990c
Message-ID: <1452532169.85.0.59348007279.issue26080@psf.upfronthosting.co.za>
New submission from W. Trevor King:
In the recently-landed [1],
There was also the Unladen Swallow project, but it was abandonned in 2011.
Should have used ?abandoned? instead of ?abandonned?.
[1]: https://hg.python.org/peps/rev/b463c740990c
changeset: 6155:b463c740990c
user: Victor Stinner gmail.com>
date: Sun Jan 10 14:58:17 2016 +0100
summary: PEP 510: rationale for static optimize vs JIT compiler
http://permalink.gmane.org/gmane.comp.python.cvs/114604
----------
assignee: docs at python
components: Documentation
messages: 257974
nosy: docs at python, labrat
priority: normal
severity: normal
status: open
title: "abandonned" -> "abandoned" in PEP 510's https://hg.python.org/peps/rev/b463c740990c
type: enhancement
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 12:23:42 2016
From: report at bugs.python.org (Yury Selivanov)
Date: Mon, 11 Jan 2016 17:23:42 +0000
Subject: [New-bugs-announce] [issue26081] Implement asyncio Future in C to
improve performance
Message-ID: <1452533022.97.0.443242974791.issue26081@psf.upfronthosting.co.za>
New submission from Yury Selivanov:
Some info on this: https://github.com/python/asyncio/issues/282#issuecomment-155957235 Long story short, Future implemented in C can speedup some asyncio code up to 25%.
I'm attaching a patch with a WIP implementation. There are some failing assertions deep in GC, which I need to track down. 'Future.remove_done_callback' still needs to be properly implemented.
----------
assignee: yselivanov
components: asyncio
files: futures.patch
keywords: patch
messages: 257984
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: Implement asyncio Future in C to improve performance
type: performance
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41579/futures.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 14:23:57 2016
From: report at bugs.python.org (Chiu-Hsiang Hsu)
Date: Mon, 11 Jan 2016 19:23:57 +0000
Subject: [New-bugs-announce] [issue26082] functools.lru_cache user specified
cachedict support
Message-ID: <1452540237.19.0.595360503064.issue26082@psf.upfronthosting.co.za>
New submission from Chiu-Hsiang Hsu:
Currently, lru_cache will automatically construct a Python dictionary in the function as cachedict. IMHO, it will be much more flexible to let users specified their cachedict, so they can use any kind of dict-like calss as their cachedict. Thus, users can use any dictionary implementation and save result in any form they want.
for example :
use OrderedDict
.. code-block:: python
from functools import lru_cache
from collections import OrderedDict
@lru_cache(maxsize=None, cache=OrderedDict())
def func(*args, **kwargs):
pass
save by pickle
.. code-block:: python
import os
import pickle
from functools import lru_cache
filename = "cache.pickle"
cache = {}
def load_cache():
global cache
if os.path.isfile(filename):
with open(filename, "rb") as f:
cache = pickle.load(f)
def store_cache():
with open(filename, "wb") as f:
pickle.dump(cache, f)
load_cache()
@lru_cache(maxsize=None, cache=cache)
def func(*args, **kwargs):
pass
----------
components: Library (Lib)
files: functools.lru_cache-user-specified-cachedict.patch
keywords: patch
messages: 258001
nosy: wdv4758h
priority: normal
severity: normal
status: open
title: functools.lru_cache user specified cachedict support
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41584/functools.lru_cache-user-specified-cachedict.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 15:43:15 2016
From: report at bugs.python.org (Chi Hsuan Yen)
Date: Mon, 11 Jan 2016 20:43:15 +0000
Subject: [New-bugs-announce] [issue26083] ValueError: insecure string pickle
in subprocess.Popen on Python 2
Message-ID: <1452544995.42.0.684031601483.issue26083@psf.upfronthosting.co.za>
New submission from Chi Hsuan Yen:
Originally reported at [1] and [2].
On Mac OS X, read() on pipes may return only the first 512 bytes. The remaining bytes are not read into `data` in _execute_child(). There's a patch proposal at [3]. I didn't test it myself because I can't reproduce the broken situation.
[1] https://github.com/rg3/youtube-dl/issues/6840
[2] https://github.com/matplotlib/matplotlib/issues/5386
[3] https://github.com/matplotlib/matplotlib/issues/5386#issuecomment-161111817
----------
components: Library (Lib), Macintosh
messages: 258011
nosy: Chi Hsuan Yen, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: ValueError: insecure string pickle in subprocess.Popen on Python 2
type: crash
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 15:48:45 2016
From: report at bugs.python.org (Tom Anderl)
Date: Mon, 11 Jan 2016 20:48:45 +0000
Subject: [New-bugs-announce] [issue26084] HTMLParser mishandles last
attribute in self-closing tag
Message-ID: <1452545325.06.0.546064798317.issue26084@psf.upfronthosting.co.za>
New submission from Tom Anderl:
When the HTMLParser encounters a start tag element that includes:
1. an unquoted attribute as the final attribute
2. an optional '/' character marking the start tag as self-closing
3. no space between the final attribute and the '/' character
the '/' character gets attached to the attribute value and the element is interpreted as not self-closing. This can be illustrated with the following:
===============================================================================
import HTMLParser
# Begin Monkeypatch
#import re
#HTMLParser.attrfind = re.compile(
# r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*'
# r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^/>\s]*))?(?:\s|/(?!>))*')
# End Monkeypatch
class MyHTMLParser(HTMLParser.HTMLParser):
def handle_starttag(self, tag, attrs):
print('got starttag: {0} with attributes {1}'.format(tag, attrs))
def handle_endtag(self, tag):
print('got endtag: {0}'.format(tag))
MyHTMLParser().feed('
')
==============================================================================
Running the above code yields the output:
got starttag: img with attributes [('height', '1.0'), ('width', '2.0/')]
Note the trailing '/' on the 'width' attribute. If I uncomment the monkey patch, the script then yields:
got starttag: img with attributes [('height', '1.0'), ('width', '2.0')]
got endtag: img
Note that the trailing '/' is gone, and an endtag event was generated.
----------
components: Library (Lib)
messages: 258013
nosy: Tom Anderl
priority: normal
severity: normal
status: open
title: HTMLParser mishandles last attribute in self-closing tag
type: behavior
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 16:12:36 2016
From: report at bugs.python.org (fresh_nick)
Date: Mon, 11 Jan 2016 21:12:36 +0000
Subject: [New-bugs-announce] [issue26085] Tkinter spoils the input text
Message-ID: <1452546756.92.0.853539899898.issue26085@psf.upfronthosting.co.za>
New submission from fresh_nick:
Hello, I have Python 3.4.3 and Tk/Tcl 8.5 (built in Python; reported by tk.TclVersion and tk.TkVersion). When I assign printing 'This works' to a hotkey, the program prints 'This worsk'. After pressing the hotkey again, 'worsk' is replaced with 'works', but when the hotkey is pressed repeatedly, we can see 'worsk' sometimes (see the attachment).
Have a nice day.
----------
components: Tkinter
files: 2016-01-11--1452545267_1920x1080_scrot.png
messages: 258019
nosy: fresh_nick
priority: normal
severity: normal
status: open
title: Tkinter spoils the input text
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file41585/2016-01-11--1452545267_1920x1080_scrot.png
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 16:35:26 2016
From: report at bugs.python.org (Hana Larsen)
Date: Mon, 11 Jan 2016 21:35:26 +0000
Subject: [New-bugs-announce] [issue26086] Bug in standardmodule os
Message-ID: <1452548126.01.0.956593686661.issue26086@psf.upfronthosting.co.za>
New submission from Hana Larsen:
I get a error in the stardard module "os" (I use Python 3.5.1 64bit for Windows 10!)
What is wrong and have someone a patch
See the "os-bug.PNG"-file.
----------
files: os-bug.PNG
messages: 258023
nosy: Johano
priority: normal
severity: normal
status: open
title: Bug in standardmodule os
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file41586/os-bug.PNG
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Mon Jan 11 23:14:31 2016
From: report at bugs.python.org (Chi Hsuan Yen)
Date: Tue, 12 Jan 2016 04:14:31 +0000
Subject: [New-bugs-announce] [issue26087] PEP 0373 should be updated
Message-ID: <1452572071.97.0.659652590609.issue26087@psf.upfronthosting.co.za>
New submission from Chi Hsuan Yen:
Current PEP 0373 lists Python 2.7.11 as a future release, and there's no information about Python 2.7.12. Please update it, thanks!
----------
assignee: docs at python
components: Documentation
messages: 258063
nosy: Chi Hsuan Yen, docs at python
priority: normal
severity: normal
status: open
title: PEP 0373 should be updated
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 03:14:44 2016
From: report at bugs.python.org (Hana Larsen)
Date: Tue, 12 Jan 2016 08:14:44 +0000
Subject: [New-bugs-announce] [issue26088] re
Message-ID: <5694B5F2.5000806@mail.dk>
New submission from Hana Larsen:
--
Hans Larsen Galgebakken S?nder 4-11A 2620 Albertslund Danmark/Danio
----------
messages: 258073
nosy: Johano
priority: normal
severity: normal
status: open
title: re
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 04:44:50 2016
From: report at bugs.python.org (Augustin Laville)
Date: Tue, 12 Jan 2016 09:44:50 +0000
Subject: [New-bugs-announce] [issue26089] Duplicated keyword in distutils
metadata
Message-ID: <1452591890.07.0.0660802423296.issue26089@psf.upfronthosting.co.za>
New submission from Augustin Laville:
The line https://hg.python.org/cpython/file/tip/Lib/distutils/dist.py#l1016 contains the word "licence" twice.
Check only on Python, 3.5 and 3.6, may be in others versions.
----------
components: Distutils
messages: 258091
nosy: Augustin Laville, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: Duplicated keyword in distutils metadata
type: resource usage
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 04:54:14 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Tue, 12 Jan 2016 09:54:14 +0000
Subject: [New-bugs-announce] [issue26090] More correct string truncating in
PyUnicode_FromFormat()
Message-ID: <1452592454.92.0.0368970992087.issue26090@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
The C code often uses %. in PyUnicode_FromFormat(). %.200s protects from unlimited output when broken pointer points on random non-null-terminated data. %.200R is used to limit the size of human-readable messages.
In all these case formatted string can look well-formed with short data, but mis-formed (not closed quote, truncated backslash escaping or ? decoded from truncated UTF-8 sequence) with long data.
I propose to make truncating in PyUnicode_FromFormat() more smart.
1. Truncated %R should keep at least one end character (the quote or ">").
2. Truncated output should include "..." or "[...]" as truncating sign.
3. \c, \OOO, \xXX, \uXXXX, and \UXXXXXXXX should not be truncated. It is better to omit these sequences at all (cut the string before them) that output them truncated.
4. Doesn't truncate UTF-8 sequence inside a character for %s.
----------
components: Interpreter Core
messages: 258092
nosy: gvanrossum, haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: More correct string truncating in PyUnicode_FromFormat()
type: enhancement
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 12:59:25 2016
From: report at bugs.python.org (Joseph Pyott)
Date: Tue, 12 Jan 2016 17:59:25 +0000
Subject: [New-bugs-announce] [issue26091] decimal.Decimal(0)**0 throws
decimal.InvalidOperation
Message-ID: <1452621565.71.0.961155486004.issue26091@psf.upfronthosting.co.za>
Changes by Joseph Pyott :
----------
components: Extension Modules
files: decimal pow error.py
nosy: Pyottamus
priority: normal
severity: normal
status: open
title: decimal.Decimal(0)**0 throws decimal.InvalidOperation
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file41593/decimal pow error.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 13:20:57 2016
From: report at bugs.python.org (Sergey B Kirpichev)
Date: Tue, 12 Jan 2016 18:20:57 +0000
Subject: [New-bugs-announce] [issue26092] doctest should allow custom
sys.displayhook
Message-ID: <1452622857.37.0.137754453324.issue26092@psf.upfronthosting.co.za>
New submission from Sergey B Kirpichev:
The purpose of doctest's - verify interactive examples. But if
your users will use custom displayhook all the time (consider, as
examples CAS like SymPy or https://github.com/skirpichev/omg/) - why
you must show them examples with the builtin's displayhook?
After https://bugs.python.org/issue8048, sys.displayhook can't be
customized for doctest. I think, that decision was wrong and we
should have a better solution.
PS: In fact, right now this issue can be workarrounded if you instead
override sys.__displayhook__ before doctest call. But I believe
this "solution" has own problems.
----------
components: Library (Lib)
messages: 258115
nosy: Sergey.Kirpichev
priority: normal
severity: normal
status: open
title: doctest should allow custom sys.displayhook
type: behavior
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 17:33:48 2016
From: report at bugs.python.org (Dino Viehland)
Date: Tue, 12 Jan 2016 22:33:48 +0000
Subject: [New-bugs-announce] [issue26093] __qualname__ different when
calling generator object w/ functions.partial
Message-ID: <1452638028.1.0.595104762218.issue26093@psf.upfronthosting.co.za>
New submission from Dino Viehland:
import functools
def f():
def g():
yield 1
return g
functools.partial(f())().__qualname__ != f()().__qualname__
The qualified name gets passed in via the interpreter loop with _PyEval_EvalCodeWithName calling PyGen_NewWithQualName. If a generator object gets called from C then the qualified name gets lost.
It seems like _PyEval_EvalCodeWithName shouldn't exist and the generator code object should be able to get back to its qualified name so subtle differences like this don't happen.
----------
components: Interpreter Core
messages: 258119
nosy: dino.viehland
priority: normal
severity: normal
status: open
title: __qualname__ different when calling generator object w/ functions.partial
type: behavior
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 19:39:59 2016
From: report at bugs.python.org (khyox)
Date: Wed, 13 Jan 2016 00:39:59 +0000
Subject: [New-bugs-announce] [issue26094] ConfigParser.get() doc to be
updated according to the configparser.py header doc
Message-ID: <1452645599.68.0.959713633048.issue26094@psf.upfronthosting.co.za>
New submission from khyox:
For the sake of clarity, in https://docs.python.org/3.5/library/configparser.html#configparser.ConfigParser the ConfigParser.get() method doc could be properly updated with merging the information written in the header doc of the source file, as found in https://hg.python.org/cpython/file/3.5/Lib/configparser.py
Concretely, this sentence there, "Return a string value for the named option." could be considered quite relevant to be added to the doc of the method, as some packages are (incorrectly) expecting boolean values returned by the ConfigParser.get() method. The reality is that a "True" in the configuration file is returning the string "True" and not the boolean constant True.
To sum up, the suggested update would be:
def get(self, section, option, *, raw=False, vars=None, fallback=_UNSET):
"""Returns a string value for the named option for a given section.
If `vars' is provided, it must be a dictionary. The option is looked up
in `vars' (if provided), `section', and in `DEFAULTSECT' in that order.
If the key is not found and `fallback' is provided, it is used as
a fallback value. `None' can be provided as a `fallback' value.
If interpolation is enabled and the optional argument `raw' is False,
all interpolations are expanded in the return values.
Arguments `raw', `vars', and `fallback' are keyword only.
The section DEFAULT is special.
"""
(...)
----------
assignee: docs at python
components: Documentation
messages: 258124
nosy: docs at python, khyox
priority: normal
severity: normal
status: open
title: ConfigParser.get() doc to be updated according to the configparser.py header doc
type: enhancement
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 21:16:37 2016
From: report at bugs.python.org (Brett Cannon)
Date: Wed, 13 Jan 2016 02:16:37 +0000
Subject: [New-bugs-announce] [issue26095] Update porting HOWTO to
special-case Python 2 code, not Python 3
Message-ID: <1452651397.71.0.110404454924.issue26095@psf.upfronthosting.co.za>
New submission from Brett Cannon:
As pointed out by http://astrofrog.github.io/blog/2016/01/12/stop-writing-python-4-incompatible-code/, special-casing Python 3 code instead of Python 2 code when writing Python 2/3 code will lead to breakage when Python 3 comes out. There should probably be a note in the porting HOWTO mentioning that you should always special-case Python 2 code and not Python 3 code.
----------
assignee: docs at python
components: Documentation
messages: 258126
nosy: brett.cannon, docs at python
priority: normal
severity: normal
status: open
title: Update porting HOWTO to special-case Python 2 code, not Python 3
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Tue Jan 12 21:17:53 2016
From: report at bugs.python.org (JitterMan)
Date: Wed, 13 Jan 2016 02:17:53 +0000
Subject: [New-bugs-announce] [issue26096] '*' glob string matches dot files
in pathlib
Message-ID: <1452651473.17.0.586447787765.issue26096@psf.upfronthosting.co.za>
New submission from JitterMan:
Path('.').glob('*') generates all files and directories in '.' including hidden files (those that begin with '.'). This behavior is inconsistent with the shell and with the old glob module, which only generate hidden files if the glob pattern starts with a '.'.
----------
messages: 258128
nosy: jitterman
priority: normal
severity: normal
status: open
title: '*' glob string matches dot files in pathlib
type: behavior
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 06:07:08 2016
From: report at bugs.python.org (=?utf-8?q?Nicolas_=C3=89vrard?=)
Date: Wed, 13 Jan 2016 11:07:08 +0000
Subject: [New-bugs-announce] [issue26097] 2.7 documentation about
TextTestRunner do not specify all the arguments
Message-ID: <1452683228.39.0.232346799389.issue26097@psf.upfronthosting.co.za>
New submission from Nicolas ?vrard:
Some of the arguments although specified further in the documentation do not appear in the signature of TextTestRunner.
Here's a simple patch to include them.
----------
assignee: docs at python
components: Documentation
files: unittest_doc_bug.diff
keywords: patch
messages: 258140
nosy: docs at python, nicoe
priority: normal
severity: normal
status: open
title: 2.7 documentation about TextTestRunner do not specify all the arguments
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file41600/unittest_doc_bug.diff
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 07:52:48 2016
From: report at bugs.python.org (STINNER Victor)
Date: Wed, 13 Jan 2016 12:52:48 +0000
Subject: [New-bugs-announce] [issue26098] PEP 510: Specialize functions with
guards
Message-ID: <1452689568.12.0.253530674137.issue26098@psf.upfronthosting.co.za>
New submission from STINNER Victor:
Attached patch implements the PEP 510 "Specialize functions with guards".
Changes on the C API are described in the PEP:
https://www.python.org/dev/peps/pep-0510/#changes
Additions of the patch:
* Add func_specialize() and func_get_specialized() to _testcapi
* Add _testcapi.PyGuard: Python wrapper to the Guard C API
* Add Lib/test/test_pep510.py
----------
files: specialize.patch
keywords: patch
messages: 258141
nosy: haypo
priority: normal
severity: normal
status: open
title: PEP 510: Specialize functions with guards
versions: Python 3.6
Added file: http://bugs.python.org/file41601/specialize.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 09:46:44 2016
From: report at bugs.python.org (STINNER Victor)
Date: Wed, 13 Jan 2016 14:46:44 +0000
Subject: [New-bugs-announce] [issue26099] site ignores ImportError when
running sitecustomize and usercustomize
Message-ID: <1452696404.05.0.367833198211.issue26099@psf.upfronthosting.co.za>
New submission from STINNER Victor:
If the code of sitecustomize raises an ImportError because the requested module doesn't exist, sitecustomize exception is silently ignored because site.py uses "try: import sitecustomize except ImportError: pass".
It's possible to log a warning since ImportError now has a name attribute since Python 3.3.
There is a similar issue on usercustomize.
Attached patch fixes the issue.
----------
files: site.patch
keywords: patch
messages: 258144
nosy: haypo
priority: normal
severity: normal
status: open
title: site ignores ImportError when running sitecustomize and usercustomize
type: enhancement
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41603/site.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 11:32:31 2016
From: report at bugs.python.org (STINNER Victor)
Date: Wed, 13 Jan 2016 16:32:31 +0000
Subject: [New-bugs-announce] [issue26100] Add
test.support.optim_args_from_interpreter_flags()
Message-ID: <1452702751.92.0.809582535795.issue26100@psf.upfronthosting.co.za>
New submission from STINNER Victor:
Attached patch adds a new optim_args_from_interpreter_flags() function to the test.support module, similar to the existing args_from_interpreter_flags() function. The function creates command line arguments related to optimization. The function is required by test_compileall.py and test_inspect.py.
The patch enables test_details() test of test_inspect when -O or -OO command line options are used.
----------
files: optim_args.patch
keywords: patch
messages: 258152
nosy: haypo
priority: normal
severity: normal
status: open
title: Add test.support.optim_args_from_interpreter_flags()
versions: Python 3.6
Added file: http://bugs.python.org/file41606/optim_args.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 11:40:57 2016
From: report at bugs.python.org (STINNER Victor)
Date: Wed, 13 Jan 2016 16:40:57 +0000
Subject: [New-bugs-announce] [issue26101] Lib/test/test_compileall.py fails
when run directly
Message-ID: <1452703257.16.0.0951114007651.issue26101@psf.upfronthosting.co.za>
New submission from STINNER Victor:
"./python Lib/test/test_compileall.py" fails on test_compile_path() because the Lib/test/ directory is in sys.path and this directory contains invalid Python scripts like Lib/test/badsyntax_pep3120.py
Attached patch fixes the issue by removing temporarely Lib/test/ from sys.path.
Note: Python 3.5 doesn't test compileall.compile_path() which fails. The new test was added by the changeset 71f071f2e074 of the issue #25768.
----------
files: test_compileall.patch
keywords: patch
messages: 258154
nosy: brett.cannon, haypo
priority: normal
severity: normal
status: open
title: Lib/test/test_compileall.py fails when run directly
versions: Python 3.6
Added file: http://bugs.python.org/file41607/test_compileall.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 14:47:51 2016
From: report at bugs.python.org (Christian Berger)
Date: Wed, 13 Jan 2016 19:47:51 +0000
Subject: [New-bugs-announce] [issue26102] access violation in PyErrFetch if
tcur==null in PyGILState_Release
Message-ID: <1452714471.66.0.669763876009.issue26102@psf.upfronthosting.co.za>
New submission from Christian Berger:
I've been messing with PyGILState_... handling for my embedded python interpreter and came across this issue:
code in PyGILState_Release:
PyThreadState *tcur = (PyThreadState *)PyThread_get_key_value(
autoTLSkey);
if (tcur == NULL)
Py_FatalError("auto-releasing thread-state, "
"but no thread-state for this thread");
The Py_FatalError() call will then invoke PyErr_Fetch() which won't check if PyThreadState_GET() returns a valid ptr (!= NULL):
PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback)
{
PyThreadState *tstate = PyThreadState_GET();
*p_type = tstate->curexc_type;
----------
components: Interpreter Core
messages: 258164
nosy: cberger
priority: normal
severity: normal
status: open
title: access violation in PyErrFetch if tcur==null in PyGILState_Release
type: crash
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 15:56:52 2016
From: report at bugs.python.org (Aaron Hall)
Date: Wed, 13 Jan 2016 20:56:52 +0000
Subject: [New-bugs-announce] [issue26103] Contradiction in definition of
"data descriptor" between (dotted lookup behavior/datamodel documentation)
and (inspect lib/descriptor how-to)
Message-ID: <1452718612.1.0.925403449689.issue26103@psf.upfronthosting.co.za>
New submission from Aaron Hall:
Based on the data-model documentation (https://docs.python.org/2/reference/datamodel.html#invoking-descriptors) and the dotted lookup behavior, the follow definitions are correct:
"If the descriptor defines __set__() and/or __delete__(), it is a data descriptor; if it defines neither, it is a non-data descriptor."
def has_data_descriptor_attrs(obj):
return set(['__set__', '__delete__']) & set(dir(obj))
def is_data_descriptor(obj):
return bool(has_data_descriptor_attrs(obj))
However, the inspect module has the following, which is also reflected in the descriptor how-to (https://docs.python.org/2/howto/descriptor.html#descriptor-protocol):
"If an object defines both __get__() and __set__(), it is considered a data descriptor."
def isdatadescriptor(object):
"""Return true if the object is a data descriptor.
Data descriptors have both a __get__ and a __set__ attribute..."""
if isclass(object) or ismethod(object) or isfunction(object):
# mutual exclusion
return False
tp = type(object)
return hasattr(tp, "__set__") and hasattr(tp, "__get__")
I'm willing to sign a contributor release and fix myself.
----------
messages: 258168
nosy: Aaron Hall
priority: normal
severity: normal
status: open
title: Contradiction in definition of "data descriptor" between (dotted lookup behavior/datamodel documentation) and (inspect lib/descriptor how-to)
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 17:24:30 2016
From: report at bugs.python.org (Josh Rosenberg)
Date: Wed, 13 Jan 2016 22:24:30 +0000
Subject: [New-bugs-announce] [issue26104] Reference leak in
functools.partial constructor in failure case
Message-ID: <1452723870.39.0.274687476417.issue26104@psf.upfronthosting.co.za>
New submission from Josh Rosenberg:
Minor bug introduced while implementing the fix for #7830:
In the case where functools.partial is wrapping another functools.partial instance, both of them providing positional arguments, the value nargs is not freed when the tuple concatenation fails and the constructor raises an Exception/returns NULL. Only nargs has the problem (it's a slice of the args passed to the function); pargs is a borrowed reference so there is no leak there. Admittedly, the odds of failure is incredibly low, but best to fix it on principle.
Code link: https://hg.python.org/cpython/file/5a2692911a43/Modules/_functoolsmodule.c#l77
The simplest fix is to add the explicit DECREF in the error path:
pto->args = PySequence_Concat(pargs, nargs);
if (pto->args == NULL) {
pto->kw = NULL;
Py_DECREF(nargs); // <-- New
Py_DECREF(pto);
return NULL;
}
All other code paths hit a DECREF later on, no other fixes required. I'd submit a proper patch, but I'm on a new machine and I've got a lot of work to get the repos set up again.
----------
components: Extension Modules
messages: 258176
nosy: belopolsky, josh.r
priority: normal
severity: normal
status: open
title: Reference leak in functools.partial constructor in failure case
versions: Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 18:15:13 2016
From: report at bugs.python.org (Connor Wolf)
Date: Wed, 13 Jan 2016 23:15:13 +0000
Subject: [New-bugs-announce] [issue26105] Python JSON module doesn't
actually produce JSON
Message-ID: <1452726913.68.0.934947942911.issue26105@psf.upfronthosting.co.za>
New submission from Connor Wolf:
The Python library JSON library doesn't emit JSON by default.
Basically, `json.dumps(float('nan'))` produces something that kind of looks like json, but isn't (specifically, `'NaN'`). Valid JSON must be `null`.
JSON *does not allow `NaN`, `infinity`, or `-infinity`.
`json.dump[s]` has the parameter `allow_nan`, but it's `False` by default, so basically it's not actually JSON by default.
The default for emitting JSON should actually emit JSON. `allow_nan` must be `True` by default.
----------
components: Library (Lib)
messages: 258179
nosy: Connor.Wolf
priority: normal
severity: normal
status: open
title: Python JSON module doesn't actually produce JSON
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Wed Jan 13 18:16:27 2016
From: report at bugs.python.org (Julien)
Date: Wed, 13 Jan 2016 23:16:27 +0000
Subject: [New-bugs-announce] [issue26106] Move licences to literal blocks
Message-ID: <1452726987.73.0.8328489013.issue26106@psf.upfronthosting.co.za>
New submission from Julien:
In the context of translating the documentation:
I'd like to move the licence texts in https://docs.python.org/3.5/license.html to literal blocks, so they won't pollute the po files with legal (untranslatable) stuff, and it's visually more appealing (as far as it's possible for a licence text).
Here is what it gives graphically when applying the patch (it's the translation, don't mind the french text): http://www.afpy.org/doc/python/3.5/license.html
I also took the liberty to drop a dangling "ACCEPT", while reformating centered "titles" to real titles and building paragraphs from licence text, hope it wasn't legal stuff / part of the licence (a line before the licence mention an "accept" button ...).
----------
assignee: docs at python
components: Documentation
files: literal-licence.patch
keywords: patch
messages: 258180
nosy: docs at python, sizeof
priority: normal
severity: normal
status: open
title: Move licences to literal blocks
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41612/literal-licence.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 04:12:43 2016
From: report at bugs.python.org (STINNER Victor)
Date: Thu, 14 Jan 2016 09:12:43 +0000
Subject: [New-bugs-announce] [issue26107] code.co_lnotab: use signed line
number delta to support moving instructions in an optimizer
Message-ID: <1452762763.46.0.511729382261.issue26107@psf.upfronthosting.co.za>
New submission from STINNER Victor:
Python doesn't store the original line number in the .pyc file in the bytecode. Instead, an efficient table is used to find the line number from the current in the bytecode: code.co_lnotab.
Basically, it's a list of (offset_delta, line_number_delta) pairs where offset_delta and line_number_delta are unsigned 8 bits numbers. If an offset delta is larger than 255, (offset_delta % 255, line_number_delta) and (offset_delta // 255, 0) pairs are emited. Same for line_number_delta. (In fact, more than two pairs can be created.)
The format is described in Objects/lnotab_notes.txt.
I implemented an optimizer which can generate *negative* line number. For example, the loop:
for i in range(2): # line 1
print(i) # line 2
is replaced with:
i = 0 # line 1
print(i) # line 2
i = 1 # line 1
print(i) # line 2
The third instruction has a negative line number delta.
I'm not the first one hitting the issue, but it's just that no one proposed a patch before. Previous projects bitten by this issue:
* issue #10399: "AST Optimization: inlining of function calls"
* issue #11549: "Build-out an AST optimizer, moving some functionality out of the peephole optimizer"
Attached patch changes the type of line number delta from unsigned 8-bit integer to *signed* 8-bit integer. If a line number delta is smaller than -128 or larger than 127, multiple pairs are created (as before).
My code in Lib/dis.py is inefficient. Maybe unpack the full lnotab than *then* skip half of the bytes? (instead of calling struct.unpack times for each byte).
The patch adds also "assert(Py_REFCNT(lnotab_obj) == 1);" to PyCode_Optimize(). The assertion never fails, but it's just to be extra safe.
The patch renames variables in PyCode_Optimize() because I was confused between "offset" and "line numbers". IMHO variables were badly named.
I changed the MAGIC_NUMBER of importlib, but it was already changed for f-string:
# Python 3.6a0 3360 (add FORMAT_VALUE opcode #25483)
Is it worth to modify it again?
You may have to recompile Python/importlib_external.h if it's not recompiled automatically (just touch the file before running make).
Note: this issue is related to the PEP 511 (the PEP is not ready for a review, but it gives a better overview of the use cases.)
----------
files: lnotab.patch
keywords: patch
messages: 258189
nosy: brett.cannon, haypo, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: code.co_lnotab: use signed line number delta to support moving instructions in an optimizer
versions: Python 3.6
Added file: http://bugs.python.org/file41613/lnotab.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 04:53:50 2016
From: report at bugs.python.org (David Heffernan)
Date: Thu, 14 Jan 2016 09:53:50 +0000
Subject: [New-bugs-announce] [issue26108] Calling PyInitialize with 2.7.11
on Windows x64 terminates process
Message-ID: <1452765230.72.0.612722422255.issue26108@psf.upfronthosting.co.za>
New submission from David Heffernan:
Environment:
- Python 2.7.11 from python.org, x64.
- Windows 10 or Windows 8.1
- MSVC 2015
I compiled the most basic embedding example, taken from the Python docs:
#include
int
main(int argc, char *argv[])
{
Py_SetProgramName(argv[0]); /* optional but recommended */
Py_Initialize();
PyRun_SimpleString("from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
Py_Finalize();
return 0;
}
When run the call to Py_Initialize does not return and the process is terminated.
----------
components: Windows
messages: 258194
nosy: David Heffernan, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Calling PyInitialize with 2.7.11 on Windows x64 terminates process
type: crash
versions: Python 2.7
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 08:10:34 2016
From: report at bugs.python.org (John Malmberg)
Date: Thu, 14 Jan 2016 13:10:34 +0000
Subject: [New-bugs-announce] [issue26109] _Py_DumpTraceback should be
PyAPI_FUNC
Message-ID: <1452777034.65.0.00477411953399.issue26109@psf.upfronthosting.co.za>
New submission from John Malmberg:
The _PyDumpTraceback and _Py_DumpTracebackThreads routines in traceback.h are tagged with PyAPI_DATA attributes when they should be tagged with PyAPI_FUNC.
For platforms that use those attributes, this can cause run-time issues if those methods are called.
----------
components: Interpreter Core
messages: 258199
nosy: John.Malmberg
priority: normal
severity: normal
status: open
title: _Py_DumpTraceback should be PyAPI_FUNC
versions: Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 12:09:07 2016
From: report at bugs.python.org (Yury Selivanov)
Date: Thu, 14 Jan 2016 17:09:07 +0000
Subject: [New-bugs-announce] [issue26110] Speedup method calls 1.2x
Message-ID: <1452791347.05.0.923215900831.issue26110@psf.upfronthosting.co.za>
New submission from Yury Selivanov:
This issue supersedes issue #6033. I decided to open a new one, since the patch is about Python 3.6 (not 2.7) and is written from scratch.
The idea is to add new opcodes to avoid instantiation of BoundMethods. The patch only affects method calls of Python functions with positional arguments.
I'm working on the attached patch in this repo: https://github.com/1st1/cpython/tree/call_meth2
If the patch gets accepted, I'll update it with the docs etc.
Performance Improvements
------------------------
Method calls in micro-benchmarks are 1.2x faster:
### call_method ###
Avg: 0.330371 -> 0.281452: 1.17x faster
### call_method_slots ###
Avg: 0.333489 -> 0.280612: 1.19x faster
### call_method_unknown ###
Avg: 0.304949 -> 0.251623: 1.21x faster
Improvements in mini-benchmarks, such as Richards are less impressive, I'd say it's 3-7% improvement. The full output of benchmarks/perf.py is here: https://gist.github.com/1st1/e00f11586329f68fd490
When the full benchmarks suite is run, some of them report that they were slow. When I ran them separately several times, they all show no real slowdowns. It's just some of them (such as nbody) are highly unstable.
It's actually possible to improve the performance another 1-3% if we fuse __PyObject_GetMethod with ceval/LOAD_METHOD code. I've tried this here: https://github.com/1st1/cpython/tree/call_meth4, however I don't like to have so many details of object.c into ceval.c.
Changes in the Core
-------------------
Two new opcodes are added -- LOAD_METHOD and CALL_METHOD. Whenever compiler sees a method call "obj.method(..)" with positional arguments it compiles it as follows:
LOAD_FAST(obj)
LOAD_METHOD(method)
{call arguments}
CALL_METHOD
LOAD_METHOD implementation in ceval looks up "method" on obj's type, and checks that it wasn't overridden in obj.__dict__. Apparently, even with the __dict__ check this is still faster then creating a BoundMethod instance etc.
If the method is found and not overridden, LOAD_METHOD pushes the resolved method object, and 'obj'. If the method was overridden, the resolved method object and NULL are pushed to the stack.
CALL_METHOD then looks at the two stack values after call arguments. If the first one isn't NULL, it means that we have a method call.
Why CALL_METHOD?
----------------
It's actually possible to hack CALL_FUNCTION to support LOAD_METHOD. I've tried this approach in https://github.com/1st1/cpython/tree/call_meth3. It looks like that adding extra checks in CALL_FUNCTION have negative impact on many benchmarks. It's really easier to add another opcode.
Why only pure-Python methods?
-----------------------------
LOAD_METHOD atm works only with methods defined in pure Python. C methods, such as `list.append` are still wrapped into a descriptor, that creates a PyCFunction object on each attribute access. I've tried to do that in https://github.com/1st1/cpython/tree/call_cmeth. It does impact C method calls in a positive way, although my implementation is very hacky. It still uses LOAD_METHOD and CALL_METHOD opcodes, so my idea is to consider merging this patch first, and then introduce the necessary refactoring of PyCFunction and MethodDesctiptors in a separate issue.
Why only calls with positional arguments?
-----------------------------------------
As showed in "Why CALL_METHOD?", making CALL_FUNCTION to work with LOAD_METHOD slows it down. For keyword and var-arg calls we have three more opcodes -- CALL_FUNCTION_VAR, CALL_FUNCTION_KW, and CALL_FUNCTION_VAR_KW. I suspect that making them work with LOAD_METHOD would slow them down too, which will probably require us to add three (!) more opcodes for LOAD_METHOD.
And these kind of calls require much more overhead anyways, I don't expect them to be as optimizable as positional arg calls.
----------
assignee: yselivanov
components: Interpreter Core
files: call_method_1.patch
keywords: patch
messages: 258204
nosy: benjamin.peterson, brett.cannon, gvanrossum, haypo, ncoghlan, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Speedup method calls 1.2x
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file41614/call_method_1.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 13:45:10 2016
From: report at bugs.python.org (Remy Roy)
Date: Thu, 14 Jan 2016 18:45:10 +0000
Subject: [New-bugs-announce] [issue26111] On Windows,
os.scandir will keep a handle on the directory until the iterator
is exhausted
Message-ID: <1452797110.0.0.310492336724.issue26111@psf.upfronthosting.co.za>
New submission from Remy Roy:
On Windows, os.scandir will keep a handle on the directory being scanned until the iterator is exhausted. This behavior can cause various problems if try to use some filesystem calls like os.chmod or os.remove on the directory while the handle is still being kept.
There are some use cases where the iterator is not going to be exhausted like looking for a specific entry in a directory and breaking from the loop prematurely.
This behavior should at least be documented. Alternatively, it might be interesting to provide a way prematurely end the scan without having to exhaust it and close the handle.
As a workaround, you can force the exhaustion after you are done with the iterator with something like:
for entry in iterator:
pass
This is going to affect os.walk as well since it uses os.scandir .
The original github issue can be found on https://github.com/benhoyt/scandir/issues/58 .
----------
components: Windows
messages: 258212
nosy: paul.moore, remyroy, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: On Windows, os.scandir will keep a handle on the directory until the iterator is exhausted
type: behavior
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 14:29:52 2016
From: report at bugs.python.org (=?utf-8?b?0JLQsNGB0LjQu9GMINCa0L7Qu9C+0LzRltGU0YbRjA==?=)
Date: Thu, 14 Jan 2016 19:29:52 +0000
Subject: [New-bugs-announce] [issue26112] Error on example using "dialect"
parameter. have to be: "dialect=dialect"
Message-ID: <1452799792.3.0.65685555924.issue26112@psf.upfronthosting.co.za>
New submission from ?????? ?????????:
with open('example.csv') as csvfile:
dialect = csv.Sniffer().sniff(csvfile.read(1024))
csvfile.seek(0)
reader = csv.reader(csvfile, dialect)
# ... process CSV file contents here ...
--
have to be:
...
reader = csv.reader(csvfile, dialect=dialect)
# ... process CSV file contents here ...
It's here:
https://docs.python.org/3.4/library/csv.html
----------
assignee: docs at python
components: Documentation
messages: 258214
nosy: docs at python, ?????? ?????????
priority: normal
severity: normal
status: open
title: Error on example using "dialect" parameter. have to be: "dialect=dialect"
type: enhancement
versions: Python 3.4
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 15:16:18 2016
From: report at bugs.python.org (JitterMan)
Date: Thu, 14 Jan 2016 20:16:18 +0000
Subject: [New-bugs-announce] [issue26113] pathlib p.match('') should return
False rather than raising exception
Message-ID: <1452802578.55.0.628676824088.issue26113@psf.upfronthosting.co.za>
New submission from JitterMan:
One can use '*' as an 'accept all' pattern to match(). It would be nice to also use '' as a 'reject all' pattern. These 'accept all' and 'reject all' rules are useful as defaults. Currently passing '' to match() causes an exception. While it is easy enough to catch the exception, the need to constrains the way match() must be called and makes the calling code needlessly complicated and fussy.
----------
files: example.py
messages: 258216
nosy: jitterman
priority: normal
severity: normal
status: open
title: pathlib p.match('') should return False rather than raising exception
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file41615/example.py
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 15:35:41 2016
From: report at bugs.python.org (Brett Cannon)
Date: Thu, 14 Jan 2016 20:35:41 +0000
Subject: [New-bugs-announce] [issue26114] Rewrite math.erf() and math.erfc()
from scratch
Message-ID: <1452803741.39.0.631242355329.issue26114@psf.upfronthosting.co.za>
New submission from Brett Cannon:
If you look Modules/mathmodule.c you will notice there is a comment that goes with erf() and erfc() stating that the algorithms were taken from a book entitled 'Numerical Recipes'. Unfortunately that book has a license dictating that any information from the book is only allowed for non-commercial use; commercial use requires negotiating a license (http://numerical.recipes/aboutNR3license.html). That's bad for anyone who has a commercial distribution of Python as that's a special requirement they have to follow.
It would be best to do a clean room implementation of both math.erf() and math.erfc() that does not use information from 'Numerical Recipes' in order to not be violating that license. That way Python can be sold commercially without having to negotiate a separate license just for those two functions.
Unfortunately this code exists since at least Python 2.7, so I have flagged all Python releases as needing the eventual clean room implementation applied to it (although Python 3.2 goes out of security maintenance next month so I don't know how critical it is to fix that far back).
----------
components: Library (Lib)
messages: 258218
nosy: benjamin.peterson, brett.cannon, eric.smith, georg.brandl, larry, lemburg, mark.dickinson, stutzbach
priority: release blocker
severity: normal
stage: needs patch
status: open
title: Rewrite math.erf() and math.erfc() from scratch
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 16:20:32 2016
From: report at bugs.python.org (JitterMan)
Date: Thu, 14 Jan 2016 21:20:32 +0000
Subject: [New-bugs-announce] [issue26115] pathlib.glob('**') returns only
directories
Message-ID: <1452806432.12.0.827592335617.issue26115@psf.upfronthosting.co.za>
New submission from JitterMan:
The title says it all.
The shell version of '*' and '**' return both directories and files.
Path('.').glob('*') returns both directories and files, but Path('.').glob('**') returns only directories. That seems wrong to me.
----------
messages: 258223
nosy: jitterman
priority: normal
severity: normal
status: open
title: pathlib.glob('**') returns only directories
type: behavior
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 16:50:32 2016
From: report at bugs.python.org (=?utf-8?b?0JLQsNGB0LjQu9GMINCa0L7Qu9C+0LzRltGU0YbRjA==?=)
Date: Thu, 14 Jan 2016 21:50:32 +0000
Subject: [New-bugs-announce] [issue26116] CSV-module. The example code don't
work. Have to be: reader = csv.reader(csvfile, dialect=dialect)
Message-ID: <1452808232.54.0.345665768771.issue26116@psf.upfronthosting.co.za>
New submission from ?????? ?????????:
with open('example.csv') as csvfile:
dialect = csv.Sniffer().sniff(csvfile.read(1024))
csvfile.seek(0)
reader = csv.reader(csvfile, dialect)
# ... process CSV file contents here ...
--
have to be:
...
reader = csv.reader(csvfile, dialect=dialect)
# ... process CSV file contents here ...
It's here:
https://docs.python.org/3.4/library/csv.html
----------
assignee: docs at python
components: Documentation
messages: 258227
nosy: Vasyl Kolomiets, docs at python
priority: normal
severity: normal
status: open
title: CSV-module. The example code don't work. Have to be: reader = csv.reader(csvfile, dialect=dialect)
type: enhancement
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 17:10:22 2016
From: report at bugs.python.org (Serhiy Storchaka)
Date: Thu, 14 Jan 2016 22:10:22 +0000
Subject: [New-bugs-announce] [issue26117] Close directory descriptor in
scandir iterator on error
Message-ID: <1452809422.76.0.117373240485.issue26117@psf.upfronthosting.co.za>
New submission from Serhiy Storchaka:
Since scandir iterator has no close method, the most safe way to avoid file descriptors leaks when use os.scandir() is accumulating yielded results into a list before processing them:
entries = list(os.scandir(path))
But this doesn't save us from all leaks. If an error happened during yielding next entry, opened file descriptor left open.
Proposed patch makes scandir to close the file descriptor not only when an iteration is exhausted, but when any error (expected OSError or MemoryError) is raised.
This is needed to fix possible leaks in os.walk() in 3.5 (see also issue25995).
----------
components: Extension Modules
files: scandir_closedir_on_error.patch
keywords: patch
messages: 258232
nosy: benhoyt, gvanrossum, haypo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Close directory descriptor in scandir iterator on error
type: resource usage
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41616/scandir_closedir_on_error.patch
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 17:47:44 2016
From: report at bugs.python.org (poostenr)
Date: Thu, 14 Jan 2016 22:47:44 +0000
Subject: [New-bugs-announce] [issue26118] String performance issue using
single quotes
Message-ID: <1452811664.45.0.761474192648.issue26118@psf.upfronthosting.co.za>
New submission from poostenr:
There appears to be a significant performance issue between the following two statements. Unable to explain performance impact.
s = "{0},".format(columnvalue) # fast
s = "'{0}',".format(columnvalue) # ~30x slower
So far, no luck trying to find other statements to improve performance, such as:
s = "\'{0}\',".format(columnvalue)
s = "'" + "%s" %(columnvalue) + "'"+","
s = "{0}{1}{2},".format("'",columnvalue,"'")
----------
components: Windows
messages: 258243
nosy: paul.moore, poostenr, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: String performance issue using single quotes
type: performance
versions: Python 3.5
_______________________________________
Python tracker
_______________________________________
From report at bugs.python.org Thu Jan 14 22:54:11 2016
From: report at bugs.python.org (Paul Hammant)
Date: Fri, 15 Jan 2016 03:54:11 +0000
Subject: [New-bugs-announce] [issue26119] Windows Installer can sometimes
silently fail pip stage
Message-ID: <1452830051.37.0.928414799264.issue26119@psf.upfronthosting.co.za>
New submission from Paul Hammant:
It NEEDS to communicate more as to why it is rolling back the pip install (progress bar goes backwards, install fails).
Reasons can be:
1. older/wrong versions of Python listed in the PATH - eg c:\Python27 encountered when c:\Python34 is being installed. User should redo PATH env-var.
2. PYTHONPATH similarly set to the wrong thing. User should delete PYTHONPATH env-vars.
3. Incompatible Python installed. User should uninstall other Python's first.
The windows install does not have to silently fail on the pip piece. It can do more to inform them end-user, and not drive them off to stackoverflow.
----------
components: Windows
messages: 258266
nosy: Paul Hammant, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows Installer can sometimes silently fail pip stage
versions: Python 3.5
_______________________________________
Python tracker