[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Kenneth Reitz

Kenneth Reitz added the comment:

This addition to Python, specifically the bare assignment-free `red` syntax 
would be a huge mistake for the language. It looks like a syntax error to me, 
and completely destroys my mental model for how Python code either does work or 
should work. 

A simple assignment to `None`, `()`, or imported static `AUTO_ENUM` (or 
similar, akin to subprocess.PIPE) would be *much* preferred.

--
nosy: +kennethreitz

___
Python tracker 

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



[issue27558] SystemError with bare `raise` in threading or multiprocessing

2016-08-19 Thread SilentGhost

Changes by SilentGhost :


--
stage: patch review -> resolved

___
Python tracker 

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



[issue26050] Add new StreamReader.readuntil() method

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

Also it looks like the b'\n' default confuses Sphinx. Maybe it needs extra 
escaping?

--

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-19 Thread Mark Dickinson

Mark Dickinson added the comment:

The change to use PyMem_Calloc looks good to me.

--

___
Python tracker 

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



[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread Martijn Pieters

New submission from Martijn Pieters:

To reproduce, create an ASCII file with > io.DEFAULT_BUFFER_SIZE bytes (can be 
blank lines) and *UNIX line endings*, with the first two lines reading:

  #!/usr/bin/env python
  # -*- coding: cp1252 -*-

Try to run this as a script on Windows:

C:\Python35\python.exe encoding-problem-cp1252.py
 File "encoding-problem-cp1252.py", line 2
SyntaxError: encoding problem: cp1252

Converting the file to use CRLF (Windows) line endings makes the problem go 
away.

This appears to be a fallout from issue #20731.

Demo file that reproduces this issue at 710 bytes: 
https://github.com/techtonik/testbin/raw/fbb8aec3650b45f690c4febfd621fe5d6892b14a/python/encoding-problem-cp1252.py

First reported by anatoly techtonik at 
https://stackoverflow.com/questions/39032416/python-3-5-syntaxerror-encoding-prob-em-cp1252

--
components: Interpreter Core, Windows
messages: 273087
nosy: mjpieters, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: ASCII file with UNIX line conventions and enough lines throws 
SyntaxError when ASCII-compatible codec is declared
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-19 Thread Mark Dickinson

Mark Dickinson added the comment:

Also, if you're switching to `PyMem_Calloc`, I'd suggest dropping the assertion 
at the end, since that's now really an assertion for logic that appears in 
`PyMem_Calloc` rather than in this function.

--

___
Python tracker 

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



[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread SilentGhost

Changes by SilentGhost :


--
stage:  -> needs patch
type:  -> behavior
versions:  -Python 3.4

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c3498187f998 by Berker Peksag in branch 'default':
Issue #27157: Make only type() itself accept the one-argument form
https://hg.python.org/cpython/rev/c3498187f998

--
nosy: +python-dev

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-08-19 Thread Berker Peksag

Berker Peksag added the comment:

Thanks!

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

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks for your reply Mark. But I don't understand your message about the 
assertion. There is now no assertion in PyList_New. The changed assertion 
statement is in list_ass_subscript. If this confuses you I am quite sorry to 
bring in a somewhat unrelated change. :( I just thought it's not worth to open 
another issue to change that one. Really sorry.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

Would it be possible to use a auto or AUTO_ENUM constant from the enum in
the Enum class? (And drop AutoEnum class.)

--

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Eric V. Smith

Eric V. Smith added the comment:

Unfortunately I'm not going to have time to implement this before 3.6 beta 1, 
so I'm un-assigning it to myself. I'll post to python-dev and hopefully someone 
else can get to it. Apologies for waiting so long.

--
assignee: eric.smith -> 
versions: +Python 3.6

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-19 Thread Mark Dickinson

Mark Dickinson added the comment:

Right, sorry. I'm suggesting dropping that second assertion entirely; 
essentially, we're moving the responsibility for and knowledge about overflow 
checking into the PyMem_* functions/macros (which is where it belongs), and I 
don't see a need to check the equivalent condition in list_ass_subscript.

If you do keep the second assertion, you should probably drop the `(size_t)` 
cast, so that we're not comparing signed with unsigned.

--

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-19 Thread Mark Dickinson

Mark Dickinson added the comment:

There's also still a use of PY_SIZE_MAX in the list_resize function. Would it 
be worth fixing that one too?

--

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

Just remove it. Regenerate the patch. As for list_resize, I have already fired 
another issue27660.

--
Added file: http://bugs.python.org/file44147/List_New_Calloc_v2.patch

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage: commit review -> patch review
versions:  -Python 2.7

___
Python tracker 

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



[issue27662] Check against PY_SSIZE_T_MAX instead of PY_SIZE_MAX in List_New

2016-08-19 Thread Mark Dickinson

Mark Dickinson added the comment:

LGTM. Thanks!

I'll apply this later today, unless someone beats me to it.

--

___
Python tracker 

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



[issue12946] PyModule_GetDict() claims it can never fail, but it can

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bd2a4c138b76 by Berker Peksag in branch '3.5':
Issue #12946: Document that PyModule_GetDict can fail in some cases
https://hg.python.org/cpython/rev/bd2a4c138b76

New changeset c2e74b88947d by Berker Peksag in branch 'default':
Issue #12946: Merge from 3.5
https://hg.python.org/cpython/rev/c2e74b88947d

--
nosy: +python-dev

___
Python tracker 

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



[issue12946] PyModule_GetDict() claims it can never fail, but it can

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4b64a049f451 by Berker Peksag in branch 'default':
Issue #12946: Remove dead code in PyModule_GetDict
https://hg.python.org/cpython/rev/4b64a049f451

--

___
Python tracker 

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



[issue12946] PyModule_GetDict() claims it can never fail, but it can

2016-08-19 Thread Berker Peksag

Changes by Berker Peksag :


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

___
Python tracker 

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



[issue12946] PyModule_GetDict() claims it can never fail, but it can

2016-08-19 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report, Stefan!

--

___
Python tracker 

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



[issue23231] Fix codecs.iterencode/decode() by allowing data parameter to be omitted

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

Serhiy’s two proposals won’t work for codecs that include non-zero output for 
zero input:

>>> tuple(iterencode((), "utf-8-sig"))
(b'\xef\xbb\xbf',)
>>> encode(b"", "uu")
b'begin 666 \n \nend\n'
>>> encode(b"", "zlib")
b'x\x9c\x03\x00\x00\x00\x00\x01'

However I agree that changing the incremental codec APIs is not ideal. Since 
nobody seems to care that much, it might be simpler to document that:

* iterencode() only works where text str objects can be encoded, so 
base64-codec is not supported, but rot13-codec is supported
* iterdecode() only works where bytes objects can be decoded, so rot13-codec is 
not supported, but base64-codec should be supported (pending other aspects of 
Issue 20132)

--

___
Python tracker 

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



[issue27598] Add SizedIterable to collections.abc and typing

2016-08-19 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Thank you Neil, I agree that Sequence is a reversible collection.

I combined you documentation patch with updated _collections_abc and updated 
test_functools (it tests MRO) into a single patch.

--
Added file: http://bugs.python.org/file44148/collection_neil_combined.diff

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Vedran Čačić

Vedran Čačić added the comment:

I must say I never understood how exactly is assigning a constant better in 
this regard. To me, after

a = SOMETHING
b = SOMETHING

a and b should be the same, right? _Especially_ when SOMETHING is None or (), 
but also when it's some bare identifier like AUTO_ENUM.

Mental models are already broken. We are already "lying" according to semantics 
of type metaclass. There is no reason then to have to sprinkle some magic dust 
over our code, just so it looks like an assignment is the most important thing 
here, when it really isn't.

Either we should embrace Python's power in full and communicate to users that 
there's something weird going on, or we shouldn't have AutoEnum. To me, `green 
= None` is in no way better, in fact it seems more dishonest, than simply 
`green`. Again, _if_ we communicate (e.g. via style='declarative') that the 
semantics is not ordinary. (Alternatively, we might just write `green = 
uuid4()` and be done with it.:)

--

___
Python tracker 

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



[issue27798] test_sysconfig: test_srcdir() fails on "x86 Gentoo Installed with X 3.x" buildbot

2016-08-19 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/x86%20Gentoo%20Installed%20with%20X%203.x/builds/879/steps/test/logs/stdio

==
FAIL: test_srcdir (test.test_sysconfig.TestSysConfig)
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.6/test/test_sysconfig.py",
 line 346, in test_srcdir
self.assertTrue(os.path.isdir(srcdir), srcdir)
AssertionError: False is not true : 
/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.6/config-3.6m

==
FAIL: test_get_makefile_filename (test.test_sysconfig.MakefileTests)
--
Traceback (most recent call last):
  File 
"/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.6/test/test_sysconfig.py",
 line 414, in test_get_makefile_filename
self.assertTrue(os.path.isfile(makefile), makefile)
AssertionError: False is not true : 
/buildbot/buildarea/3.x.ware-gentoo-x86.installed/build/target/lib/python3.6/config-3.6m/Makefile

--

--
components: Distutils, Tests
keywords: buildbot
messages: 273104
nosy: dstufft, eric.araujo, haypo
priority: normal
severity: normal
status: open
title: test_sysconfig: test_srcdir() fails on "x86 Gentoo Installed with X 3.x" 
buildbot
versions: Python 3.6

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Kenneth Reitz

Kenneth Reitz added the comment:

Explicit is better than implicit :)

--

___
Python tracker 

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



[issue27799] Fix base64-codec and bz2-codec incremental decoders

2016-08-19 Thread Martin Panter

New submission from Martin Panter:

This is split off a large patch I posted at Issue 20132. My new patch here 
fixes the following two flaws.

1. There is special code in the bz2 decoder that returns an empty text str 
object at EOF, even though bz2-codec is a bytes-to-bytes codec:
>>> import codecs
>>> decoder = codecs.getincrementaldecoder("bz2")()
>>> decoder.decode(codecs.encode(b"data", "bz2"))
b'data'
>>> decoder.decode(b"", final=True)  # Should return bytes object
''

2. The base64 decoder does not handle partial sets of four codes, because it 
treats each input chunk as a stand-alone base64 encoding:
>>> tuple(codecs.iterdecode((b"AA", b"AA\r\n"), "base64"))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/codecs.py", line 1039, in iterdecode
output = decoder.decode(input)
  File "/usr/lib/python3.5/encodings/base64_codec.py", line 35, in decode
return base64.decodebytes(input)
  File "/usr/lib/python3.5/base64.py", line 554, in decodebytes
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

--
components: Library (Lib)
files: base64-decoder.patch
keywords: patch
messages: 273106
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Fix base64-codec and bz2-codec incremental decoders
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44149/base64-decoder.patch

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread Martin Panter

New submission from Martin Panter:

In the documentation for the “re” module, it says repetition codes like {4} and 
“*” operate on the preceding regular expression. But even though “a{4}” is a 
valid expression, the obvious way to apply a “*” repetition to it fails:

>>> re.compile("a{4}*")
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/proj/python/cpython/Lib/re.py", line 223, in compile
return _compile(pattern, flags)
  File "/home/proj/python/cpython/Lib/re.py", line 292, in _compile
p = sre_compile.compile(pattern, flags)
  File "/home/proj/python/cpython/Lib/sre_compile.py", line 555, in compile
p = sre_parse.parse(p, flags)
  File "/home/proj/python/cpython/Lib/sre_parse.py", line 792, in parse
p = _parse_sub(source, pattern, 0)
  File "/home/proj/python/cpython/Lib/sre_parse.py", line 406, in _parse_sub
itemsappend(_parse(source, state))
  File "/home/proj/python/cpython/Lib/sre_parse.py", line 610, in _parse
source.tell() - here + len(this))
sre_constants.error: multiple repeat at position 4

As a workaround, I found I can wrap the inner repetition in (?:. . .):

>>> re.compile("(?:a{4})*")
re.compile('(?:a{4})*')

The problems with the workaround are (a) it is far from obvious, and (b) it 
adds more complicated syntax. Either this limitation should be documented, or 
if there is no good reason for it, it should be lifted. It is not clear if my 
workaround is entirely valid, or if I just found a way to bypass some sanity 
check.

My original use case was scanning a base-64 encoding for Issue 27799:

# Without the second level of brackets, this raises a "multiple repeat" error
chunk_re = br'(?: (?: [^A-Za-z0-9+/=]* [A-Za-z0-9+/=] ){4} )*'

--
components: Regular Expressions
messages: 273107
nosy: ezio.melotti, martin.panter, mrabarnett
priority: normal
severity: normal
status: open
title: Regular expressions with multiple repeat codes
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue20132] Many incremental codecs don’t handle fragmented data

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

Split off Issue 27799 for the base-64 incremental decoder

--
dependencies: +Fix base64-codec and bz2-codec incremental decoders

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Vedran Čačić

Vedran Čačić added the comment:

Absolutely. How the hell is `green = None` explicit?!

On the other hand, `class Color(Enum, style='declarative'):` is explicit. 
People must learn something. Why then don't they learn the right thing instead 
of "hey, assigning None inside enums magically does the right thing" - except 
when it doesn't.

Just a hint of a nightmare scenario: you write a method decorator, but you 
forget to return a value from it (happened to me more times than I care to 
admit). Ooops, your method is now next member of your enum. Good luck debugging 
that. :-O

In fact, what _is_ explicit, is this:

class Color(metaclass=Enum):
green = object()
yellow = object()

I could live with it. :-)

--

___
Python tracker 

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



[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread Eryk Sun

Eryk Sun added the comment:

In issue 20844 I suggested opening the file in binary mode, i.e. change the 
call to _Py_wfopen(filename, L"rb") in Modules/main.c. That would also entail 
documenting that PyRun_SimpleFileExFlags requires a FILE pointer that's opened 
in binary mode. After making this change, there's no problem parsing 
"encoding-problem-cp1252.py":

>python --version
Python 3.6.0a4+

>python encoding-problem-cp1252.py
ok

When fp_setreadl is called while parsing "encoding-problem-cp1252.py", 47 bytes 
in the FILE buffer have been read -- up to the end of the coding spec. Let's 
verify this in the debugger:

0:000> bp python35_d!fp_setreadl
0:000> g
Breakpoint 0 hit
python35_d!fp_setreadl:
`662bee00 4889542410  mov qword ptr [rsp+10h],rdx
ss:00d7`6cfeead8=00d76cfeeaf8
0:000> ;as /x fp @@(((python35_d!tok_state *)@rcx)->fp)
0:000> ;as /x ptr @@(((ucrtbased!__crt_stdio_stream_data *)${fp})->_ptr)
0:000> ;as /x base @@(((ucrtbased!__crt_stdio_stream_data *)${fp})->_base)
0:000> ?? ${ptr} - ${base}
int64 0n47

ftell() should return 47, but instead it returns -1. You can see this by 
opening the file in Python 2 on Windows, which uses FILE streams:

>>> f = open('encoding-problem-cp1252.py')
>>> f.read(47)
'#!/usr/bin/env python\n# -*- coding: cp1252 -*-\n'
>>> f.tell()
Traceback (most recent call last):
  File "", line 1, in 
IOError: [Errno 0] Error

ftell starts by getting the file position from the OS and then subtracts the 
unread bytes in the buffer. The buffer has already undergone CRLF => LF 
translation, so ftell makes an assumption that the file uses CRLF line endings 
and thus subtracts 2 bytes for each unread LF. In this case the buffer happens 
to have 48 unread LFs, so ftell returns -1, with the only actual error being a 
fundamentally flawed design in the CRT's text mode.

--
nosy: +eryksun

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

Enhanced patch to address Nick's comments and fix mistakes. The new patch now 
also updates the documentation.

I restored the code in _random.Random.seed() to fallback on the system clock: 
_PyOS_URandomNonblock() *can* fail is /dev/urandom is missing or not readable. 
I enhanced this part to not only read the system clock, but also use the 
current process identifier and get also the monotonic clock. Moreover, 64 bits 
are now used instead of 32 bits from the system clock (use a resolution of 1 
nanoscond, not only 1 second).

I didn't test yet the fall back on clocks/pid. It should be tested manually by 
modifying _PyOS_URandomNonblock() to always fail.

--
Added file: http://bugs.python.org/file44150/urandom_nonblock-2.patch

___
Python tracker 

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



[issue27797] ASCII file with UNIX line conventions and enough lines throws SyntaxError when ASCII-compatible codec is declared

2016-08-19 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue27776] PEP 524: Make os.urandom() blocking on Linux

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

> _PyOS_URandomNonblock() *can* fail is /dev/urandom is missing or not readable

Oh. It looks like Python initialization currently fails with a fatal error in 
this case, see _PyRandom_Init().

Maybe we should also fall back on clocks/pid in _PyRandom_Init()?

--

___
Python tracker 

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



[issue27801] test_update_lines_cols fails from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Dwayne Crooks

New submission from Dwayne Crooks:

I was installing Python 3.5.2 from source on a Ubuntu 14.04 LTS virtual machine 
(it uses 
https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/20160816.0.0).

This is part of the result of running: ./python -m test -u curses -v test_curses

==
ERROR: test_update_lines_cols (test.test_curses.MiscTests)
--
Traceback (most recent call last):
  File "/tmp/Python-3.5.2/Lib/test/test_curses.py", line 397, in 
test_update_lines_cols
curses.update_lines_cols()
AttributeError: module 'curses' has no attribute 'update_lines_cols'

--
Ran 20 tests in 0.237s

FAILED (errors=1, skipped=4)

--
components: Tests
messages: 273113
nosy: dwaynecrooks
priority: normal
severity: normal
status: open
title: test_update_lines_cols fails from test.test_curses.MiscTests fails on 
Ubuntu 14.04 LTS
versions: Python 3.5

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Dwayne Crooks

Changes by Dwayne Crooks :


--
title: test_update_lines_cols fails from test.test_curses.MiscTests fails on 
Ubuntu 14.04 LTS -> test_update_lines_cols from test.test_curses.MiscTests 
fails on Ubuntu 14.04 LTS

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

New submission from Neil Girdhar:

Both Mapping and Set provide __eq__ and __ne__.  Why not have Sequence do the 
same?

--
messages: 273114
nosy: neil.g
priority: normal
severity: normal
status: open
title: Add __eq__ and __ne__ to collections.abc.Sequence.

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Changes by Neil Girdhar :


--
components: +Library (Lib)
versions: +Python 3.6

___
Python tracker 

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



[issue25144] 3.5 Win install fails with "TARGETDIR"

2016-08-19 Thread Jagannath Basu

Jagannath Basu added the comment:

I ran the python-3.5.2.exe file as administrator (right click > Run as Admin) 
and then followed the custom installation to set up target directory. It got 
installed without further complaints.

--
nosy: +basuj81

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Changes by Neil Girdhar :


--
keywords: +patch
Added file: http://bugs.python.org/file44151/abc_eq.diff

___
Python tracker 

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



[issue27598] Add SizedIterable to collections.abc and typing

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

Given issue http://bugs.python.org/issue27802, it might be worth considering 
that all Collections implement __eq__ and __ne__, so maybe these should be 
abstract methods on Collection?

--

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Chris Angelico added the comment:

Here's a first-cut patch. No docs, no tests, and applies only to decimal 
formatting. It involves redefining the thousands_separators flag from being a 
boolean to being a three-state flag (none, comma, or underscore), and (ab)uses 
LT_*_LOCALE to carry that same information around.

--
keywords: +patch
Added file: http://bugs.python.org/file44152/underscores_decimal_only.patch

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Changes by Chris Angelico :


--
nosy: +Rosuav

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

2016-08-19 14:19 GMT+02:00 Vedran Čačić :
> In fact, what _is_ explicit, is this:
>
> class Color(metaclass=Enum):
> green = object()
> yellow = object()
>
> I could live with it. :-)

For me, it's legit to use a singleton in an enum. I mean that I expect
that green != yellow. Some remark for an empty tuple.

So I woud really prefer a contant from enum like AUTO_ENUM.

--

___
Python tracker 

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



[issue27598] Add Collection to collections.abc and typing

2016-08-19 Thread Neil Girdhar

Changes by Neil Girdhar :


--
title: Add SizedIterable to collections.abc and typing -> Add Collection to 
collections.abc and typing

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Martin Panter

Martin Panter added the comment:

Your implementation looks like it will make a Sequence equal to a list and a 
tuple, even though lists and tuples are never equal to each other.

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

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Chris Angelico added the comment:

Hmm, adding bin/oct/hex support didn't turn out that hard. Although it feels 
like this code is getting hackish. Definitely needs code review!

--
Added file: http://bugs.python.org/file44153/underscores_all_bases.patch

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

That's a really good point.  Perhaps bring it up on ideas so that it can be 
discussed by more people?  I don't know what the answer is.

--

___
Python tracker 

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



[issue27792] bool % int has inconsistent return type.

2016-08-19 Thread Mark Dickinson

Changes by Mark Dickinson :


--
assignee:  -> mark.dickinson

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

(there's already an open thread.)

--

___
Python tracker 

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



[issue27080] Implement the formatting part of PEP 515, '_' in numeric literals.

2016-08-19 Thread Chris Angelico

Chris Angelico added the comment:

Hmm, strange. Comma formatting never seems to have had tests added. So I've 
added a couple of simple tests of comma formatting at the same time as adding 
underscore formatting tests. Also, test_long.py currently has a comment "# 
octal" preceding a bunch of tests of *binary* formatting, and no tests of 
octal. So I've added those too.

In any case, here's a patch with full functionality and tests.

--
Added file: http://bugs.python.org/file44154/underscores_with_tests.patch

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report! update_lines_cols() was added in 132b5376bf34. I guess 
we should just skip the test if update_lines_cols() is not available.

--
nosy: +berker.peksag
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.6

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Vedran Čačić

Vedran Čačić added the comment:

> For me, it's legit to use a singleton in an enum.

But you cannot explain _why_, right? Like Raymond says, it's not working like 
anything else in Python works.

To me, this looks almost the same as the gripes of those lazy people who want 
"myfile.close" expression to close myfile, or worse, "quit" to exit the Python 
interpreter. An irrational phobia of parentheses. Why not call your object, if 
you expect some code to be executed? [At least a dotted name like myfile.close 
_could_ be made to work using descriptors, but still I think everyone agrees 
it's not a good idea.]

To me, we either want to stay with default type metaclass 
(`style='imperative'`:), and write something like

class Color(Enum):
green = member()
yellow = member()

or we acknowledge that `style='declarative'` has its place under the sun (not 
only for Enums, of course... database models, namedtuples, even ABCs could 
profit from it), and embrace its full power, realizing it's not Python we 
usually see, but it's still Python.

Magic is not something to be afraid of, if you understand it. We are talking 
Py3.6 here... aren't formatted strings a totally insane magic? Yet they ended 
up in the language, because they are immensely better than the alternatives. 
Here the gain is much smaller, but the threshold is much lower too: we don't 
need new syntax at all.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Ethan Furman

Ethan Furman added the comment:

Vedran, you have some very interesting points.  However, if you really want to 
champion this you'll need to take it to Python Ideas.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Hey, I just realized that you can get pretty darn close with just a little bit
of extra typing, and existing stdlib:

from enum import Enum
from itertools import count

auto = count()

class Color(Enum):
red = next(auto)
green = next(auto)
blue = next(auto)

Look ma, no magic!

--

___
Python tracker 

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



[issue22021] shutil.make_archive() root_dir do not work

2016-08-19 Thread R. David Murray

R. David Murray added the comment:

"base_name is the name of the file to create, including the path".  So you 
should be able to specify the path to where you want it created.  If that 
doesn't work, that's a bug.

--

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

Yes. update_lines_cols is not always available. We can just treat it like other 
methods like resize_term.

Upload a trivial patch to fix this.

--
keywords: +patch
nosy: +xiang.zhang
Added file: http://bugs.python.org/file44155/issue27801.patch

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

Ping.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Ethan Furman

Ethan Furman added the comment:

No magic, but a whole heap of extra boiler-plate.  :(

--

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 51368991e858 by Berker Peksag in branch '3.5':
Issue #27801: Skip test_update_lines_cols when update_lines_cols() is not 
available
https://hg.python.org/cpython/rev/51368991e858

New changeset bd9183850965 by Berker Peksag in branch 'default':
Issue #27801: Merge from 3.5
https://hg.python.org/cpython/rev/bd9183850965

--
nosy: +python-dev

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread R. David Murray

R. David Murray added the comment:

It seems perfectly logical and consistent to me.  {4} is a repeat count, as is 
*.  You get the same error if you do 'a?*', and the same bypass if you do 
'(a?)*' (though I haven't tested if that does anything useful :).  You don't 
need the ?:, as far as I can tell, you just need to have the * modifying a 
group, making the group the "preceding regular expression".

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27801] test_update_lines_cols from test.test_curses.MiscTests fails on Ubuntu 14.04 LTS

2016-08-19 Thread Berker Peksag

Changes by Berker Peksag :


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

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Kenneth Reitz

Kenneth Reitz added the comment:

There's a difference between boiler-plate and "code".

> On Aug 19, 2016, at 10:53 AM, Ethan Furman  wrote:
> 
> 
> Ethan Furman added the comment:
> 
> No magic, but a whole heap of extra boiler-plate.  :(
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread R. David Murray

R. David Murray added the comment:

I was wondering the same thing recently, thanks for opening this issue.  

Here is my use case: I'm implementing a PersistentList, and I want it to be 
equal to a 'real' list, but not equal to a tuple.  Frankly, I hadn't thought 
about the latter problem before this issue, so my __eq__ code in my concrete 
class is currently broken.  I'll need to explicitly check for list subclasses 
and PersistentList subclasses.  I'm not sure there's any way to "generalize" 
that.  I presume that's why Sequence doesn't have the methods.  

The answer would seem to be to have explicit 'List' and 'Tuple' abcs.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a1a29d20f52d by Victor Stinner in branch 'default':
Add _PyObject_FastCall()
https://hg.python.org/cpython/rev/a1a29d20f52d

New changeset 89e4ad001f3d by Victor Stinner in branch 'default':
PyEval_CallObjectWithKeywords() uses fast call
https://hg.python.org/cpython/rev/89e4ad001f3d

New changeset 7cd479573de9 by Victor Stinner in branch 'default':
call_function_tail() uses fast call
https://hg.python.org/cpython/rev/7cd479573de9

New changeset 34af2edface9 by Victor Stinner in branch 'default':
Cleanup call_function_tail()
https://hg.python.org/cpython/rev/34af2edface9

New changeset adceb14cab96 by Victor Stinner in branch 'default':
Cleanup callmethod()
https://hg.python.org/cpython/rev/adceb14cab96

New changeset 10f1a4910adb by Victor Stinner in branch 'default':
PEP 7: add {...} around null_error() in abstract.c
https://hg.python.org/cpython/rev/10f1a4910adb

New changeset 5cf9524f2923 by Victor Stinner in branch 'default':
Avoid call_function_tail() for empty format str
https://hg.python.org/cpython/rev/5cf9524f2923

New changeset f1ad6f64a11e by Victor Stinner in branch 'default':
Fix PyObject_Call() parameter names
https://hg.python.org/cpython/rev/f1ad6f64a11e

--

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-19 Thread Berker Peksag

Berker Peksag added the comment:

I don't understand the second part of the patch.

*filename* is a filesystem encoding (:func:`os.fsdecode`) encoded string 
[...]

Do you want to document that filename should be encoded by using 
PyUnicode_EncodeFSDefault *before* passing it to Py_CompileStringExFlags (you 
will probably need to wrap it with something like PyBytes_AsString too)? If so, 
I think the os.fsdecode() part needs to be changed to os.fsencode().

I think the current wording is saying that filename is going to be decoded 
inside of Py_CompileStringExFlags (which is also correct.)

--
nosy: +berker.peksag, haypo
stage:  -> patch review
versions: +Python 3.5

___
Python tracker 

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



[issue27740] Fix doc of Py_CompileStringExFlags

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

> filename is going to be decoded inside of Py_CompileStringExFlags

Actually all I want to express is this, *filename* will be decoded inside. But 
now the wording looks to me is that *filename* is already a decoded string when 
passed. I don't want to document anything about PyUnicode_EncodeFSDefault. I 
should remove (:func:`os.fsdecode`). How do you think? I'm Okay if you think 
the current wording is correct.

--

___
Python tracker 

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



[issue27798] test_sysconfig: test_srcdir() fails on "x86 Gentoo Installed with X 3.x" buildbot

2016-08-19 Thread Zachary Ware

Zachary Ware added the comment:

This appears to be a duplicate of #23968.

--
nosy: +zach.ware
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> rename the platform directory from plat-$(MACHDEP) to 
plat-$(PLATFORM_TRIPLET)
type:  -> behavior

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2da6dc1c30d8 by Victor Stinner in branch 'default':
contains and rich compare slots use fast call
https://hg.python.org/cpython/rev/2da6dc1c30d8

New changeset 2d4d40da2aba by Victor Stinner in branch '3.5':
Fix a refleak in call_method()
https://hg.python.org/cpython/rev/2d4d40da2aba

New changeset 5b1ed48aedef by Victor Stinner in branch '2.7':
Fix a refleak in call_method()
https://hg.python.org/cpython/rev/5b1ed48aedef

New changeset df4efc23ab18 by Victor Stinner in branch '3.5':
Fix a refleak in call_maybe()
https://hg.python.org/cpython/rev/df4efc23ab18

New changeset 7669fb39a9ce by Victor Stinner in branch '2.7':
Fix a refleak in call_maybe()
https://hg.python.org/cpython/rev/7669fb39a9ce

--

___
Python tracker 

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



[issue27713] Spurious "platform dependent libraries" warnings when running make

2016-08-19 Thread Xiang Zhang

Xiang Zhang added the comment:

This is the design of getpath.c, when no exec/exec_prefix can be found it will 
emit warning and use the default one. Fortunately it gives use the ability to 
suppress the warnings. :) Simply set Py_FrozenFlag in _freeze_importlib.c can 
solve this problem. Upload a trivial patch to set the flag.

--
keywords: +patch
Added file: http://bugs.python.org/file44156/issue27713.patch

___
Python tracker 

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



[issue27126] Apple-supplied libsqlite3 on OS X is not fork safe; can cause crashes

2016-08-19 Thread Chris Jerdonek

Changes by Chris Jerdonek :


--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue27126] Apple-supplied libsqlite3 on OS X is not fork safe; can cause crashes

2016-08-19 Thread Chris Jerdonek

Chris Jerdonek added the comment:

FWIW, I just came across an issue in Django's test suite that I believe is 
caused by the issue reported here. Some of Django's unit tests were hanging for 
me when run in "parallel" mode (which uses multiprocessing). Here is the ticket 
I filed there:
https://code.djangoproject.com/ticket/27086

--

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 73b00fb1dc9d by Victor Stinner in branch 'default':
Cleanup call_method() and call_maybe()
https://hg.python.org/cpython/rev/73b00fb1dc9d

New changeset 8e085070ab28 by Victor Stinner in branch 'default':
call_method() and call_maybe() now use fast call
https://hg.python.org/cpython/rev/8e085070ab28

New changeset 2d2bc1906b5b by Victor Stinner in branch 'default':
Issue #27128: Cleanup slot_sq_item()
https://hg.python.org/cpython/rev/2d2bc1906b5b

New changeset 6eb586b85fa1 by Victor Stinner in branch 'default':
Issue #27128: slot_sq_item() uses fast call
https://hg.python.org/cpython/rev/6eb586b85fa1

New changeset 605a42a50496 by Victor Stinner in branch 'default':
Issue #27128: Cleanup slot_nb_bool()
https://hg.python.org/cpython/rev/605a42a50496

New changeset 6a21b6599692 by Victor Stinner in branch 'default':
slot_nb_bool() now uses fast call
https://hg.python.org/cpython/rev/6a21b6599692

New changeset 45d2b5c12b19 by Victor Stinner in branch 'default':
slot_tp_iter() now uses fast call
https://hg.python.org/cpython/rev/45d2b5c12b19

New changeset 124d5d0ef81f by Victor Stinner in branch 'default':
calliter_iternext() now uses fast call
https://hg.python.org/cpython/rev/124d5d0ef81f

New changeset 71c22e592a9b by Victor Stinner in branch 'default':
keyobject_richcompare() now uses fast call
https://hg.python.org/cpython/rev/71c22e592a9b

--

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3ab32f7add6e by Victor Stinner in branch 'default':
Issue #27128: _pickle uses fast call
https://hg.python.org/cpython/rev/3ab32f7add6e

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread David Hagen

David Hagen added the comment:

One solution similar to one proposed by Vedran works with the current Enum:

class Color(Enum):
red = object()
green = object()
blue= object()

I tested this in PyCharm and it is perfectly happy with the autocomplete and 
everything. The main disadvantage is the boilerplate, of course. And perhaps 
"object()" does not show the clearest intent, but it depends on your 
perspective. The repr also looks kind of funny:

>>>  repr(Color.red)
>

One possibility would be to add an auto() function to enum as a wrapper around 
object(), providing a more explicit name and a cleaner repr:

from enum import Enum, auto

class Color(Enum):
red = auto()
blue = auto()
green = auto()

repr(Color.red)

# auto() means it has no (meaningful) value, so show nothing

--

___
Python tracker 

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



[issue27792] bool % int has inconsistent return type.

2016-08-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This can only happen because of a hole in the tests.  
test_bool.BoolTest.test_math appears to test every binary int op, including 
bitwise, *except* %.

After
self.assertIsNot(False/1, False)
add
self.assertEqual(False%1, 0)
self.assertIsNot(False%1, False)  # currently fails
self.assertEqual(True%1, 1)
self.assertIsNot(True%1, True)

test_int tests int() calls, not int math, so I don't know where the equivalent 
tests on int math with subclasses are or would go.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread Matthew Barnett

Matthew Barnett added the comment:

"*" and the other quantifiers ("+", "?" and "{...}") operate on the preceding 
_item_, not the entire preceding expression. For example, "ab*" means "a" 
followed by zero or more repeats of "b".

You're not allowed to use multiple quantifiers together. The proper way is to 
use the non-capturing "(?:...)".

It's too late to change that because some of them already have a special 
meaning when used after another quantifier: "a*?" is a lazy quantifier, as are 
"a+?", "a??" and "a{1,4}?".

Many other regex implementations, including the "regex" module, use an 
additional "+" to signify a possessive quantifier: "a*+", "a++", "a?+" and 
"a{1,4}+".

That just leaves the additional "*", which is treated as an error in all the 
other regex implementations that I'm aware of.

--

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-08-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This appears to be a doc issue to clarify that * cannot directly follow a 
repetition code.  I believe there have been other (non)bug reports like this 
before.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue27803] ctypes automatic byref failing on custom classes attributes

2016-08-19 Thread Erwan Le Pape

New submission from Erwan Le Pape:

When using a custom class to store a ctype value, passing that class as a 
function argument explicitly declared to be a pointer type fails to pass the 
_as_parameter_ class attribute as a pointer and instead raises a TypeError.

For example:
>>> from ctypes import *
>>> from ctypes.wintypes import *
>>>
>>> class CustomPHKEY(object):
... def __init__(self, value):
... self._as_parameter_ = HKEY(value)
...
>>>
>>> function = windll.function
>>> function.argtypes = [POINTER(HKEY)]
>>> function.restype = LONG
>>> result = CustomPHKEY(0)
>>> function(result)
Traceback (most recent call last):
  File "", line 1, in 
ctypes.ArgumentError: argument 1: : expected 
LP_c_void_p instance instead of c_void_p

Shouldn't ctypes apply the required byref() conversion automatically? Or is 
this behavior normal and automatic byref() only concerns native ctypes types?

I only flagged Python 3.5 and Python 2.7 since they are the only ones I 
explicitly tested this on but I suspect other versions are affected.

--
components: ctypes
messages: 273149
nosy: amaury.forgeotdarc, belopolsky, lepaperwan, meador.inge
priority: normal
severity: normal
status: open
title: ctypes automatic byref failing on custom classes attributes
type: behavior
versions: Python 2.7, Python 3.5

___
Python tracker 

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



[issue27766] Add ChaCha20 Poly1305 to SSL ciphers

2016-08-19 Thread Francis MB

Francis MB added the comment:

Documentation cosmetic:

 #   * Prefer ECDHE over DHE for better performance
 #   * Prefer any AES-GCM over any AES-CBC for better performance and security
+#   * Prefer any AES-GCM over any AES-CBC for better performance and security

The patch seems to be adding the same preference comment? or did you
mean other preference?

--
nosy: +francismb

___
Python tracker 

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



[issue27802] Add __eq__ and __ne__ to collections.abc.Sequence.

2016-08-19 Thread Guido van Rossum

Changes by Guido van Rossum :


--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue12713] argparse: allow abbreviation of sub commands by users

2016-08-19 Thread Zachary Ware

Zachary Ware added the comment:

There's a bug in this patch, first reported at 
https://github.com/python/benchmarks/issues/1

Attached patch causes test_parse_args_abbreviation to show the failure:

test.test_argparse.ArgumentParserError: ('SystemExit', '', "usage: PROG [-h] 
[--foo] bar {1,2,3,lost,long,longer} ...\nPROG: error: ambiguous choice: 'long' 
could match long, longer\n")

--
assignee:  -> vinay.sajip
nosy: +zach.ware
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open
versions: +Python 3.6 -Python 3.4
Added file: http://bugs.python.org/file44157/abbr_bug_test.diff

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

Sylvain, have you brought this feature request up on the Distutils mailing 
list?  The PyPA there is responsible for packaging features.  One big issue 
with adding new features to Distutils is the backwards-compatibility tradeoff: 
many third-party package authors want to support their distributions on 
multiple Python versions which is one of the reasons why we are generally very 
cautious about changing or even adding APIs to Distutils at this point in its 
life.

https://mail.python.org/mailman/listinfo/distutils-sig

--
nosy: +ned.deily

___
Python tracker 

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



[issue27128] Add _PyObject_FastCall()

2016-08-19 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I updated the most simple forms of function calls.

I will open new issues for more complex calls and more sensible parts of
the code like ceval.c.

Buildbots seem to be happy.

--

___
Python tracker 

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



[issue26988] Add AutoNumberedEnum to stdlib

2016-08-19 Thread Vedran Čačić

Vedran Čačić added the comment:

# Just wait until I put the keys to the time machine in their usual place... :-)

Ok, while we're talking about whether declarative style is a good idea, Python 
has already got the initial seed of that style. With Guido's blessing! PEP 526 
enables us to mix declarative and imperative style in "ordinary" code, so we 
can write

@Enum
class Color:
green: member
yellow: member

without any additional syntax. I think it satisfies everyone: there are no 
parentheses, and there are no assignments. [_And_ there is no misleading 
analogy with existing syntax, because this is a new syntax.:] There are just 
declarations, and the decorator instantiates them.

Decorator is needed because formally we need to exclude the type checking 
semantics, and the only official way currently is through a decorator. But in 
fact we can use the forward references to _actually_ annotate the members with 
their real type:

class Color(Enum):
green: 'Color'
yellow: 'Color'

And once the forward references get a nicer syntax, and the unpacking issues 
are solved, we'll be able to write

class Color(Enum):
green, yellow: Color

And I think finally everyone will be happy. :-)

--

___
Python tracker 

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



[issue27804] IDLE 3.5.2 crashes when typing ^ on keyboard

2016-08-19 Thread Grégoire Cutzach

New submission from Grégoire Cutzach:

When typing ^ (CIRCUMFLEX ACCENT Unicode: U+005E, UTF-8: 5E) on azerty 
Keyboard, IDLE quits/crashes.
Encountered on a mac running OS X 10.11.6

--
assignee: terry.reedy
components: IDLE
messages: 273155
nosy: Grégoire Cutzach, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE 3.5.2 crashes when typing ^ on keyboard
type: crash
versions: Python 3.5

___
Python tracker 

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



[issue27804] IDLE 3.5.2 crashes when typing ^ on keyboard

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

You are almost certainly seeing a crash due to a critical bug in the 
Apple-supplied version of Tk 8.5 on OS X systems up through at least OS X 
10.11.  See here for more information: 
https://www.python.org/download/mac/tcltk/#apple-8-5-9.

The solution is to use a Python that links with a more, up-to-date third-party 
version of Tcl and Tk, such as Pythons from python.org OS X installers and 
current versions of ActiveTcl from ActiveState:
https://www.python.org/download/mac/tcltk/

--
nosy: +ned.deily
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Sylvain Corlay

Sylvain Corlay added the comment:

Thanks Ned. I posted a couple of messages on distutils-sig and got little 
attention.

I think that this feature is very important for detecting whether a compiler 
supports a certain flag like `-std=c++11` and provide a meaningful error when 
needed.

CMake has the same feature, implemented in a similar fashion 
(CHECK_CXX_COMPILER_FLAG).

--

___
Python tracker 

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



[issue27805] In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2016-08-19 Thread Shane Hathaway

New submission from Shane Hathaway:

With Python 2, the following call worked:

open('/dev/stdout', 'a')

Users of Supervisor have been depending on that for a long time. 

With Python 3.5, this is what happens:

>>> open('/dev/stdout', 'a')
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 29] Illegal seek

Presumably, this happens because Python 3 opens the file in 'w' mode and seeks 
to the end, while Python 2 passed the 'a' flag directly to the underlying C 
library; the underlying library is apparently smart enough to treat 'a' and 'w' 
identically when opening character device files and FIFOs.

It's a nasty little surprise for those upgrading from Python 2.

--
components: IO
messages: 273158
nosy: hathawsh
priority: normal
severity: normal
status: open
title: In Python 3, open('/dev/stdout', 'a') raises OSError with errno=ESPIPE
versions: Python 3.5

___
Python tracker 

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



[issue27806] 2.7 32-bit builds fail on future releases of OS X due to dependency on deleted header file

2016-08-19 Thread Ned Deily

New submission from Ned Deily:

Attempts to build Python 2.7 using OS X/macOS public beta versions of the 
latest command-line tools can fail due to the removal of the system header file 
for QuickTime/QuickTime.h, one of the long deprecated Carbon APIs.  Currently, 
Python only attempts to build modules dependent on this file when building for 
32-bit archs so this problem typically only affects builds with 
--with-universal-archs= configure options like "intel" or "intel-32".  It would 
be nice to preserve the ability to make use of QuickTime on older systems where 
the header file is still available.  Since the old Python mac modules don't 
exist in Python 3.x, this is only a 2.7 issue.

--
assignee: ned.deily
components: Build, Macintosh
messages: 273159
nosy: ned.deily, ronaldoussoren
priority: normal
severity: normal
stage: needs patch
status: open
title: 2.7 32-bit builds fail on future releases of OS X due to dependency on 
deleted header file
versions: Python 2.7

___
Python tracker 

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



[issue12713] argparse: allow abbreviation of sub commands by users

2016-08-19 Thread paul j3

Changes by paul j3 :


--
nosy: +paul.j3

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-19 Thread Brett Cannon

Brett Cannon added the comment:

Here is a patch that incorporates Serhiy's feedback.

--
Added file: http://bugs.python.org/file44159/path_converter.diff

___
Python tracker 

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



[issue27807] Prevent site-packages .pth files from causing test_site failure

2016-08-19 Thread Chris Angelico

Changes by Chris Angelico :


--
keywords: +patch
Added file: http://bugs.python.org/file44158/no-site-packages-in-test.patch

___
Python tracker 

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



[issue27807] Prevent site-packages .pth files from causing test_site failure

2016-08-19 Thread Chris Angelico

New submission from Chris Angelico:

Having matplotlib installed globally causes test_site to fail, due to the .pth 
file importing types. The point of the test is to monitor startup dependencies 
(and thus time) for the core interpreter and standard library, not third-party 
libraries, so having a test failure due to a .pth is not overly useful.

Solution suggested by Steve Dower: hack out all .pth handling during this one 
test, leaving everything else unchanged.

--
components: Tests
messages: 273160
nosy: Rosuav
priority: normal
severity: normal
status: open
title: Prevent site-packages .pth files from causing test_site failure
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue26027] Support Path objects in the posix module

2016-08-19 Thread Brett Cannon

Changes by Brett Cannon :


--
stage: test needed -> commit review

___
Python tracker 

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



[issue26689] Add `has_flag` method to `distutils.CCompiler`

2016-08-19 Thread Ned Deily

Ned Deily added the comment:

"I posted a couple of messages on distutils-sig and got little attention."

OK, for future reference, the start of the discussion was here:

https://mail.python.org/pipermail/distutils-sig/2016-May/029010.html

It looks like the first item, the one relative to this issue, got lost in the 
discussion of the second item.  I'm attempting to (re-)start the discussion 
there (my post may be awaiting moderation).

--

___
Python tracker 

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



[issue27283] Add a "What's New" entry for PEP 519

2016-08-19 Thread Brett Cannon

Brett Cannon added the comment:

While I wait on various patches related to PEP 519 to land, I have gone ahead 
and written the What's New entry.

--
keywords: +patch
Added file: http://bugs.python.org/file44160/pep_519_whatsnew.diff

___
Python tracker 

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



[issue27283] Add a "What's New" entry for PEP 519

2016-08-19 Thread Brett Cannon

Changes by Brett Cannon :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue27598] Add Collection to collections.abc and typing

2016-08-19 Thread Neil Girdhar

Neil Girdhar added the comment:

(never mind about the comparison operators :)  Turns out that would break 
backwards compatibility.)

--

___
Python tracker 

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



[issue27807] Prevent site-packages .pth files from causing test_site failure

2016-08-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I think hitting adventurous users like Chris who locally compile and test with 
this failure is wrong.  There is no core dev 'site' expert, so I picked 
'testing'.

--
nosy: +ezio.melotti, michael.foord, terry.reedy

___
Python tracker 

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



  1   2   >