[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually ignoring exceptions in _PyDict_GetItem_KnownHash causes a subtle 
difference between Python and C implementations. Making 
_PyDict_GetItem_KnownHash not ignoring exceptions looks right thing.

But dict_merge expects that _PyDict_GetItem_KnownHash don't raise an exception.

--

___
Python tracker 

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



[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-10-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
priority: normal -> high
stage:  -> patch review

___
Python tracker 

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



[issue26163] FAIL: test_hash_effectiveness (test.test_set.TestFrozenSet)

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Eric, did you tested with FNV or SipHash24 hashing algorithm?

Using standard Python hashing algorithm adds hash randomization for frozensets. 
This is worth at least be mentioned in What's New document.

--

___
Python tracker 

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



[issue28553] int.to_bytes docs logic error

2016-10-31 Thread Mark Dickinson

Mark Dickinson added the comment:

Patch LGTM

--

___
Python tracker 

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



[issue26163] FAIL: test_hash_effectiveness (test.test_set.TestFrozenSet)

2016-10-31 Thread Christian Heimes

Changes by Christian Heimes :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

I'll take a look at it, Emanuel. But I can't promise how much progress I'll be 
able to make today. I also think that at that point it becomes so complex that 
it fails Ned's test for inclusion in 3.6.

--

___
Python tracker 

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



[issue28553] int.to_bytes docs logic error

2016-10-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 32d8c89e90d1 by INADA Naoki in branch '3.5':
Issue #28553: Fix logic error in example code of int.to_bytes doc.
https://hg.python.org/cpython/rev/32d8c89e90d1

New changeset 2ae3f1599c34 by INADA Naoki in branch '3.6':
Issue #28553: Fix logic error in example code of int.to_bytes doc.
https://hg.python.org/cpython/rev/2ae3f1599c34

New changeset 66f255754ce9 by INADA Naoki in branch 'default':
Issue #28553: Fix logic error in example code of int.to_bytes doc.
https://hg.python.org/cpython/rev/66f255754ce9

--
nosy: +python-dev

___
Python tracker 

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



[issue28553] int.to_bytes docs logic error

2016-10-31 Thread INADA Naoki

Changes by INADA Naoki :


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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file45287/28128-3.diff

___
Python tracker 

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



[issue26936] android: test_socket fails

2016-10-31 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Entered https://code.google.com/p/android/issues/detail?id=226677 on the AOSP 
issue tracker.

--

___
Python tracker 

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



[issue28566] Python installation fails on Windows because of pip feature

2016-10-31 Thread Anish Patel

New submission from Anish Patel:

Originally created issue: 
https://github.com/pypa/pip/issues/4033#issuecomment-256865622

Copied text below:

I had already Python 3 installed with the environment variable 
PYTHONHOME=C:\Program Files\Python35. I attempted to install Python 2, but 
received this issue (although I was installing python 2 after having installed 
3):

http://stackoverflow.com/questions/23349957/solving-install-issues-with-python-3-4-on-windows

After multiple attempts, I was able to successfully install Python 2 by doing 
either of following:

* Removing the pip feature from Python 2 installation
* Removing my PYTHONHOME environment variable and running a complete Python 2 
installation

Although I resolved my issue, I would like to file this as a bug if it hasn't 
been filed already.

--
components: Installation, Windows
messages: 279774
nosy: Anish Patel, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python installation fails on Windows because of pip feature
type: crash
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



[issue28565] datetime.strptime %Z doesn't produce aware object

2016-10-31 Thread SilentGhost

SilentGhost added the comment:

According to documentation %z is the only directive that would result in the 
aware object. %Z is not capable of doing that, so what you're asking is a new 
feature - that could only go in 3.7

--
components: +Library (Lib)
nosy: +SilentGhost
title: datetime.strptime %Z doesn't get included in the result -> 
datetime.strptime %Z doesn't produce aware object
type: behavior -> enhancement
versions: +Python 3.7

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch emits DeprecationWarning instead of SyntaxError. I still not 
tested it.

--
Added file: http://bugs.python.org/file45288/28128-4.diff

___
Python tracker 

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



[issue28567] Bus error / segmentation fault on macOS debug build when using ctypes OpenGL

2016-10-31 Thread Alex Croitor

New submission from Alex Croitor:

Hi, I'm building Python 2.7.11 with debug symbols and no optimizations, but 
without the --with-debug switch, on macOS 10.11.5, El Capitan + XCode 7.3.1.

Whenever I try to execute an OpenGL demo or example, I get a segmentation fault 
or a bus error with a weird back trace.

If I build Python2 in regular release mode (-O2) the demos run fine without 
crashing. 
I also tried building Python 3.5.2, both in release, and debug mode, and the 
demos do not crash either.

What I tried after, was to update the files used in Modules/_ctypes/libffi_osx 
folder, with the latest version (libffi-3.2.1), and some small build 
adjustments, and then it doesn't crash anymore with -O0. 

But then I did a diff of libffi_osx on Python 2 and 3, and there are no 
significant differences there. So I assume the issue is somewhere in the 
_ctypes module code.

Providing configure line for python2 (it was mostly the same for python3)

 ./configure --prefix="/usr/local/Cellar/python/2.7.11_custom" --enable-ipv6 
--datarootdir=/usr/local/Cellar/python/2.7.11_custom/share 
--datadir=/usr/local/Cellar/python/2.7.11_custom/share 
--enable-framework=/usr/local/Cellar/python/2.7.11_custom/Frameworks 
--without-gcc MACOSX_DEPLOYMENT_TARGET=10.11 CFLAGS="-O0 -fno-inline 
-fno-omit-frame-pointer -g" LDFLAGS="-O0" CPPFLAGS="-O0" OPT="-O0 -g" CC="clang"

Setting just -O0 without the no-inline and no-omit-frame-pointer does not 
influence anything, Python2 still crashes.

Attaching a small python test from the opengl source package.

And here is the backtrace:

Process 32599 stopped
* thread #1: tid = 0x15ecc1, 0x7fff95bb2d11 AppKit`-[NSView 
_drawRect:clip:] + 3689, queue = 'com.apple.main-thread', stop reason = 
EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x7fff95bb2d11 AppKit`-[NSView _drawRect:clip:] + 3689
AppKit`-[NSView _drawRect:clip:]:
->  0x7fff95bb2d11 <+3689>: movss  %xmm0, (%r13,%r15)
0x7fff95bb2d18 <+3696>: movss  0x4(%r13,%r15), %xmm1 ; xmm1 = 
mem[0],zero,zero,zero
0x7fff95bb2d1f <+3703>: ucomiss %xmm0, %xmm1
0x7fff95bb2d22 <+3706>: jbe0x7fff95bb2d2b; <+3715>


(lldb) bt
error: unable to find CIE at 0x0018 for cie_id = 0x0004 for entry at 
0x0018.
error: unable to find CIE at 0x0050 for cie_id = 0x0004 for entry at 
0x0050.
error: time.so debug map object file 
'/Users/alex/Dev/python2_debug/Python-2.7.11/debug/build/temp.macosx-10.11-x86_64-2.7-pydebug/Users/alex/Dev/python2_debug/Python-2.7.11/Modules/timemodule.o'
 has changed (actual time is 0x58171936, debug map time is 0x58171933) since 
this executable was linked, file will be ignored
* thread #1: tid = 0x15ecc1, 0x7fff95bb2d11 AppKit`-[NSView 
_drawRect:clip:] + 3689, queue = 'com.apple.main-thread', stop reason = 
EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x7fff95bb2d11 AppKit`-[NSView _drawRect:clip:] + 3689
frame #1: 0x7fff95c0acad AppKit`-[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1873
frame #2: 0x7fff95c0b08a AppKit`-[NSView 
_recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2862
frame #3: 0x7fff95bb03fb AppKit`-[NSView 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 838
frame #4: 0x7fff95bafbe0 AppKit`-[NSThemeFrame 
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
 + 334
frame #5: 0x7fff95badfeb AppKit`-[NSView 
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 2449
frame #6: 0x7fff95ba93f5 AppKit`-[NSView displayIfNeeded] + 1950
frame #7: 0x7fff95ba8c3c AppKit`-[NSWindow displayIfNeeded] + 232
frame #8: 0x7fff9622d41b 
AppKit`___NSWindowGetDisplayCycleObserver_block_invoke6365 + 476
frame #9: 0x7fff95ba85d6 AppKit`__37+[NSDisplayCycle 
currentDisplayCycle]_block_invoke + 941
frame #10: 0x7fff8ba17f71 
QuartzCore`CA::Transaction::run_commit_handlers(CATransactionPhase) + 85
frame #11: 0x7fff8ba1742c 
QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 160
frame #12: 0x7fff8ba170ec QuartzCore`CA::Transaction::commit() + 508
frame #13: 0x7fff8ba22977 
QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned 
long, void*) + 71
frame #14: 0x7fff8dd47067 
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 
23
frame #15: 0x7fff8dd46fd7 CoreFoundation`__CFRunLoopDoObservers + 391
frame #16: 0x7fff8dd25ef8 CoreFoundation`CFRunLoopRunSpecific + 328
frame #17: 0x7fff8c95c3f6 Foundation`-[NSRunLoop(NSRunLoop) 
limitDateForMode:] + 201
frame #18: 0x0001051c0232 GLUT`-[GLUTApplication run] + 269
frame #19: 0x0001051cce59 GLUT`glutMainLoop + 254
frame #20: 0x0001017818af _ctypes.so`ffi_call_unix64 + 79 at 
darwin64.S:76
frame #21: 0x00010178253f _ctypes.so`ffi_call(cif=0x7fff5fbfe610, 
fn=(GLUT`gl

[issue28567] Bus error / segmentation fault on macOS debug build when using ctypes OpenGL

2016-10-31 Thread SilentGhost

Changes by SilentGhost :


--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Fixed bytes literals decoding (test_codecs was failed).

--
Added file: http://bugs.python.org/file45290/28128-5.diff

___
Python tracker 

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



[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2016-10-31 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue28563] Arbitrary code execution in gettext.c2py

2016-10-31 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue28440] ensurepip and pip install failures on macOS Sierra with non-system Python 2.7.x

2016-10-31 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Another reason to remove this feature: installing python 2.7.12 using the 
installer on www.python.org breaks the system install of Python, likely because 
of this issue.

I'm a bit sad that this feature has to go, but modern Python use (in particular 
virtualenv) has reduced the need for this feature.

--

___
Python tracker 

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



[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-10-31 Thread Xiang Zhang

Xiang Zhang added the comment:

dict_merge was altered after the patch. I make it ignore explicitly the error 
now, to not affect former behaviour.

Serhiy, I apply your suggestion to use _PyLong_AsByteArray for Py_hash_t, but I 
am not familiar with the API. It needs a review.

--
Added file: http://bugs.python.org/file45291/issue28123_v4.patch

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

Serihy:

I had tried this approach earlier, but it doesn't work. With your -5.diff 
patch, the output is (using Nick's test case):

$ rm -rf __pycache__/ ; ./python -Werror escape_warning.py 
Traceback (most recent call last):
  File "escape_warning.py", line 1, in 
import bad_escape
DeprecationWarning: invalid escape sequence \d
$ 

With my -4.diff patch, you get the desired full stack trace:

$ rm -rf __pycache__/ ; ./python -Wall escape_warning.py 
Traceback (most recent call last):
  File "escape_warning.py", line 1, in 
import bad_escape
  File "/home/eric/local/python/cpython/bad_escape.py", line 1
print('\d')
 ^
SyntaxError: invalid escape sequence \d
$ 

The trick is: how to make the DeprecationWarning version produce output similar 
to the SyntaxError case? Note that with DeprecationWarning, you don't see the 
line in bad_escape.py that actually contains the string with the invalid escape.

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added additional tests.

--
Added file: http://bugs.python.org/file45292/28128-6.diff

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

Also, you'll note that with or without your patch, you get the same behavior. 
The code in hg already raises DeprecationWarning, just in a different place. So 
unless we can improve the DeprecationWarning output, we're better off doing 
nothing.

--

___
Python tracker 

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



[issue1520879] make install change: Allow $DESTDIR to be relative

2016-10-31 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> out of date
stage: test needed -> resolved

___
Python tracker 

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



[issue28485] compileall.compile_dir(workers=) does not raise ValueError if multithreading disabled

2016-10-31 Thread Berker Peksag

Changes by Berker Peksag :


--
components: +Library (Lib)
stage: patch review -> commit review

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Following patch just raises SyntaxError if DeprecationWarning was raised as 
error. Still needed tests for this.

> Also, you'll note that with or without your patch, you get the same behavior.

Not the same. New warnings contain correct information about a file and a line.

$ ./python-unpatched -Wa escape_warning.py
_frozen_importlib:205: DeprecationWarning: invalid escape sequence '\d'
\d

$ ./python-patched -Wa escape_warning.py
/home/serhiy/py/cpython-3.6/bad_escape.py:2: DeprecationWarning: invalid escape 
sequence \d
  print('\d')
\d

$ ./python-unpatched -We escape_warning.py
Traceback (most recent call last):
  File "escape_warning.py", line 1, in 
import bad_escape
DeprecationWarning: invalid escape sequence '\d'

$ ./python-patched -We escape_warning.py
Traceback (most recent call last):
  File "escape_warning.py", line 1, in 
import bad_escape
  File "/home/serhiy/py/cpython-3.6/bad_escape.py", line 2
print('\d')
 ^
SyntaxError: invalid escape sequence \d

--
Added file: http://bugs.python.org/file45293/28128-7.diff

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

I'm not in front of a computer at the moment, but the output looks good. Also, 
my very quick glance at -7.diff's warn_invalid_escape_sequence looks 
reasonable, although I can't say for sure whether raising the error in 
PyErr_WarnExplicitObject followed by raising another error in ast_error is 
absolutely correct (it's outside my expertise).

--

___
Python tracker 

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



[issue28385] Bytes objects should reject all formatting codes with an error message

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

TypeError is documented as "Raised when an operation or function is applied to 
an object of inappropriate type". I think that fits this case: you're applying 
some format code to a type that doesn't support it.

--

___
Python tracker 

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



[issue28385] Bytes objects should reject all formatting codes with an error message

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

But on other hand, the error depends on the value of format specifier:

>>> format('abc', '')
'abc'
>>> format('abc', 'j')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: Unknown format code 'j' for object of type 'str'
>>> format([1, 2, 3], '')
'[1, 2, 3]'
>>> format([1, 2, 3], 'j')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unsupported format string passed to list.__format__

If keep TypeError I think it would be better to restore former error message 
"non-empty format string".

--

___
Python tracker 

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



[issue28566] Python installation fails on Windows because of pip feature

2016-10-31 Thread Steve Dower

Steve Dower added the comment:

Thanks for the write up. This has already been resolved for 2.7.13 (where 
install will complete but pip won't be available), and as you discovered you 
should never set PYTHONHOME (or PYTHONPATH) globally, since it will affect 
every version and not just the one you intended.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

I've pushed this to the default branch. I'll watch the buildbots.

Then Ned can decide if this goes in to 3.6.

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 259745f9a1e4 by Eric V. Smith in branch 'default':
Issue 28128: Print out better error/warning messages for invalid string escapes.
https://hg.python.org/cpython/rev/259745f9a1e4

--
nosy: +python-dev

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Searching on GitHub it seems to me that the most frequent issue with supporting 
Python 3.6 is eliminating or silencing warnings about invalid escape sequences. 
Any help with this is very important.

--

___
Python tracker 

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



[issue26163] FAIL: test_hash_effectiveness (test.test_set.TestFrozenSet)

2016-10-31 Thread Eric Appelt

Eric Appelt added the comment:

If I understand the reporting properly all tests so far have used SipHash24:

Python 3.7.0a0 (default:5b33829badcc+, Oct 30 2016, 17:29:47) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sysconfig
>>> sysconfig.get_config_var("Py_HASH_ALGORITHM")
0
>>> import sys
>>> sys.hash_info.algorithm
'siphash24'

It sounds like it is worth it for me to be more rigorous and perform a battery 
of tests using FNV and then SipHash24 to compare:

- Performing no dispersion after the frozenset hash is initially computed from 
XORing entry hashes (control)
- Performing dispersion using an LCG after the frozenset hash is initially 
computed from XORing entry hashes (current approach)
- Performing dispersion using the selected hash algorithm (FNV/SipHash24) after 
the frozenset hash is initially computed from XORing entry hashes (proposed 
approach)

I'll take the six plots and merge them into a single PNG, and also post my 
(short)testing and plotting scripts for reproducibility and checking of the 
results.

I can also write a regression test if you think that would be good to have in 
the test suite (perhaps skipped by default for time), where instead of using 
the same seven letters a-g as test strings and varying PYTHONHASHSEED, I could 
perform the letter test for n=7 with 1 different sets of short random 
strings to see if any fell below threshold.

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Emanuel Barry

Emanuel Barry added the comment:

As Nick pointed out in an earlier message on this thread and as Serhiy observed 
on GitHub issues, backporting this patch to 3.6 is a must. Large projects' use 
of Python 3.6 has shown that it's hard to track down the actual cause of the 
error; it only makes sense to improve that before the final release.

Serhiy, are you working on #28028 alongside this, or can it be removed from the 
dependencies?

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Ned Deily

Ned Deily added the comment:

I agree that the current behavior for 3.6 is very user-unfriendly so I think 
the risks of making such an extensive change at this point in the release cycle 
are outweighed by the severity of the problem.  So let's get it into 3.6 now; 
there's still time for it to make 360b3.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

I agree it would be nice to get this in to 3.6. I'm not sure I'd go so far as 
to say it's a must and can't wait for 3.6.1. It's a non-trivial change, and 
it's up to Ned to say if it can go in to 3.6.

If you don't run with -Wall or -Werror, then you won't notice any new behavior 
with invalid escapes, correct?

Maybe post to python-dev and see if we can get more reviewers?

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Emanuel Barry

Emanuel Barry added the comment:

Even better than what I was aiming for :)

--
dependencies:  -Convert warnings to SyntaxWarning in parser
priority: deferred blocker -> release blocker

___
Python tracker 

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



[issue28028] Convert warnings to SyntaxWarning in parser

2016-10-31 Thread Emanuel Barry

Changes by Emanuel Barry :


--
priority: high -> normal

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

I'll work on this as soon as I can, coordinating with Ned.

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Tim Graham

Tim Graham added the comment:

The patch is working well to identify warnings when running Django's test 
suite. Thanks!

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

The error message is much better now, thanks you all!

Seems the ^ pointer is not always correct. For example, in the function scope 
it's correct:

$ cat test.py 
def foo():
s = 'C:\Program Files\Microsoft'

$ python3.7 -W error test.py
  File "test.py", line 2
s = 'C:\Program Files\Microsoft'
   ^
SyntaxError: invalid escape sequence \P

On the other hand, top-level literals confuses the pointer:

$ cat test.py   
s = 'C:\Program Files\Microsoft'

$ python3.7 -W error test.py
  File "test.py", line 1
s = 'C:\Program Files\Microsoft'
   ^
SyntaxError: invalid escape sequence \P

Is that expected?

Using 259745f9a1e4 on Arch Linux 64-bit

--

___
Python tracker 

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



[issue28542] document cross compilation

2016-10-31 Thread Xavier de Gaye

Xavier de Gaye added the comment:

New patch, less verbose and taking into account the previous posts.

--
Added file: http://bugs.python.org/file45294/readme_4.patch

___
Python tracker 

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



[issue28028] Convert warnings to SyntaxWarning in parser

2016-10-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
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



[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2016-10-31 Thread Josh Rosenberg

Josh Rosenberg added the comment:

You need to cache the names up front because the loop is unlinking entries, and 
readdir isn't consistent when the directory entries are mutated between calls. 
https://github.com/kripken/emscripten/issues/2528

FindFirstFile/FindNextFile likely has similar issues, even if they're not 
consistently seen (due to DeleteFile itself not guaranteeing deletion until the 
last handle to the file is closed).

scandir might save some stat calls, but you'd need to convert it from generator 
to list before the loop begins, which would limit the savings a bit.

--
nosy: +josh.r

___
Python tracker 

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



[issue28568] Build files in PC/VS9.0 contain an outdated sqlite version number

2016-10-31 Thread Anselm Kruis

New submission from Anselm Kruis:

Python 2.7 only. Tested with 2.7.12.

Commit fa68df1d5e65 for #19450 changes the sqlite version for Python 2.7 on 
Windows from 3.6.21 to 3.8.11.0, but only for the build files in PCbuild. The 
documentation states, that the build files under PC\VS9.0 are also fully 
supported, but they still refer to sqlite version 3.6.21. This causes the 
command "PC\VS9.0\build.bat -r -e" to fail, because it first fetches sqlite 
3.9.11.0 from svn.python.org and then tries to build sqlite 3.6.21, which is of 
course not available.

The attached patch fixes the problem.

--
components: Build, Windows
files: fix-sqlite-version.patch
keywords: patch
messages: 279802
nosy: anselm.kruis, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Build files in PC/VS9.0 contain an outdated sqlite version number
type: compile error
versions: Python 2.7
Added file: http://bugs.python.org/file45295/fix-sqlite-version.patch

___
Python tracker 

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



[issue26919] android: test_cmd_line fails

2016-10-31 Thread Xavier de Gaye

Xavier de Gaye added the comment:

An interactive session confirms that the problem is indeed with the command 
line arguments of python invoked by subprocess (and the problem is fixed by the 
patch):

>>> from test.support import FS_NONASCII
>>> cmd = "assert(ord(%r) == %s)" % (FS_NONASCII, ord(FS_NONASCII))
>>> exec(cmd)
>>> import subprocess, sys
>>> subprocess.run([sys.executable, '-c', cmd])
Unable to decode the command from the command line:
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 12-13: 
surrogates not allowed
CompletedProcess(args=['/data/data/org.bitbucket.pyona/python/bin/python', 
'-c', "assert(ord('\xe6') == 230)"], returncode=1)

--

___
Python tracker 

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



[issue28530] Howto detect if an object is of type os.DirEntry

2016-10-31 Thread Brett Cannon

Brett Cannon added the comment:

As mentioned, this issue is fixed in Python 3.6 by exposing os.DirEntry which 
is just a direct import of what is in the posix module (which is the same thing 
as the nt module; name changes depending on the OS so just ignore the posix/nt 
part of all of this). And we can't backport the addition to the os module as 
that would break backwards-compatibility in a bug fix release. So I'm closing 
this as out of date.

--
nosy: +brett.cannon
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue26919] android: test_cmd_line fails

2016-10-31 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
assignee:  -> xdegaye
components: +Interpreter Core -Cross-Build, Library (Lib)
stage:  -> commit review
versions: +Python 3.7

___
Python tracker 

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



[issue26919] on Android python fails to decode/encode command line arguments

2016-10-31 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
title: android: test_cmd_line fails -> on Android python fails to decode/encode 
command line arguments

___
Python tracker 

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



[issue28544] Implement asyncio.Task in C

2016-10-31 Thread Brett Cannon

Brett Cannon added the comment:

Just an FYI, for testing code that has both pure Python and C versions you can 
follow the advice in https://www.python.org/dev/peps/pep-0399/#details . And if 
you want to really simplify things you start down the road of what 
test_importlib uses: 
https://github.com/python/cpython/blob/master/Lib/test/test_importlib/util.py#L81
 .

--
nosy: +brett.cannon

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Jason R. Coombs

Jason R. Coombs added the comment:

In https://github.com/pypa/setuptools/issues/836, I've pinpointed this commit 
as implicated in dictionaries spontaneously losing keys. I have not yet 
attempted to replicate the issue in a standalone environment, and I'm hoping 
someone with a better understanding of the implementation can devise a 
reproduction that distills the issue that setuptools seems only to hit in very 
specialized conditions.

Please let me know if I can help by providing more detail in the environment 
where this occurs or by filing another ticket. Somewhere we should capture that 
this is a regression pending release in 3.6.0b3 today, and for that reason, I'm 
adding Ned to this ticket.

--
nosy: +jason.coombs, ned.deily

___
Python tracker 

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



[issue28513] Document zipfile CLI

2016-10-31 Thread SilentGhost

SilentGhost added the comment:

Serhiy, this needs .. program:: zipfile directive specified before cmdoption. 
Without it :option:`-c` links to python's -c, rather than zipfile's. The -l and 
-e are linked correctly, but the option links would have be be changed for all 
three, i.e. to :option:`-c `

--
nosy: +SilentGhost
stage: commit review -> patch review

___
Python tracker 

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



[issue28518] execute("begin immediate") throwing OperationalError

2016-10-31 Thread Aviv Palivoda

Aviv Palivoda added the comment:

I looked into this error and I think the problem is the sqlite3_stmt_readonly 
check in _pysqlite_query_execute (cursor.c line 517):

if (self->connection->begin_statement && 
!sqlite3_stmt_readonly(self->statement->st) && !self->statement->is_ddl) {
if (sqlite3_get_autocommit(self->connection->db)) {
result = _pysqlite_connection_begin(self->connection);
if (!result) {
goto error;
}
Py_DECREF(result);
}
}

As you can see we check if the current statement is not readonly and if so we 
start a transaction. The problem is that sqlite3_stmt_readonly return false for 
the "begin immediate" statement. When this happens we open a transaction with 
_pysqlite_connection_begin and then executing the "begin immediate".

I think this is a error in sqlite as the documentation says:
"ransaction control statements such as BEGIN, COMMIT, ROLLBACK, SAVEPOINT, and 
RELEASE cause sqlite3_stmt_readonly() to return true,"
(https://www.sqlite.org/c3ref/stmt_readonly.html)

--
nosy: +palaviv

___
Python tracker 

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



[issue26959] pickle: respect dispatch for functions again

2016-10-31 Thread Vsevolod Velichko

Vsevolod Velichko added the comment:

Hi, any progress here?

--

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Ned Deily

Ned Deily added the comment:

Thanks, Jason, for the heads-up.  Serhiy, can you take a look at this quickly?  
I'm going to hold 360b3 until we have a better idea what's going on.

--
priority: normal -> release blocker
resolution: fixed -> duplicate
stage: resolved -> test needed
status: closed -> open

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Xiang Zhang

Xiang Zhang added the comment:

The bug seems to lies in 
https://hg.python.org/cpython/file/tip/Objects/dictobject.c#l1291. We should 
use oldkeys->dk_nentries instead of numentries.

--

___
Python tracker 

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



[issue28569] mock.attach_mock should work with return value of patch()

2016-10-31 Thread Andrey Fedorov

New submission from Andrey Fedorov:

The attach_mock in the following code sample fails silently:

>>> from mock import patch, Mock
>>> p = patch('requests.get', autospec=True)
>>> manager = Mock()
>>> manager.attach_mock(p.start(), 'requests_get')
>>> import requests
>>> requests.get('https://google.com')

>>> manager.mock_calls
[]
>>> p.stop()
>>> manager.mock_calls
[]

It seems this would be a useful use-case, especially given that this code would 
work as-expected if 'requests.get' in the second line were replaced with a path 
to a class.

--
components: Library (Lib)
messages: 279812
nosy: Andrey Fedorov, michael.foord
priority: normal
severity: normal
status: open
title: mock.attach_mock should work with return value of patch()
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue28569] mock.attach_mock should work with any return value of patch()

2016-10-31 Thread Andrey Fedorov

Changes by Andrey Fedorov :


--
title: mock.attach_mock should work with return value of patch() -> 
mock.attach_mock should work with any return value of patch()

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Xiang Zhang

Changes by Xiang Zhang :


--
Removed message: http://bugs.python.org/msg279811

___
Python tracker 

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



[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2016-10-31 Thread Marian Beermann

Marian Beermann added the comment:

The main issue on *nix is more likely that by using listdir you get directory 
order, while what you really need is inode ordering. scandir allows for that, 
since you get the inode from the DirEntry with no extra syscalls - especially 
without an open() or stat().

Other optimizations are also possible. For example opening the directory and 
using unlinkat() would likely shave off a bit of CPU. But the dominating factor 
here is likely the bad access pattern.

--

___
Python tracker 

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



[issue28550] if inline statement does not work with multiple assignment.

2016-10-31 Thread Eric Snow

Changes by Eric Snow :


--
status: pending -> closed

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I have rolled back the changes.

--

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Ned Deily

Ned Deily added the comment:

Thanks, Serhiy!  Jason, can you verify that there is no longer a 3.6 regression 
with your tests?

--

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Confirmed. Tests are now passing where they were failing before. Thanks for the 
quick response!

--

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Testing now...

--

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-10-31 Thread Ned Deily

Ned Deily added the comment:

Excellent, thanks everyone!  I'll leave this open for re-evaluation for 3.7.

--
priority: release blocker -> 
resolution: duplicate -> 
stage: test needed -> needs patch

___
Python tracker 

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



[issue28513] Document zipfile CLI

2016-10-31 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks SilentGhost!

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ee82266ad35b by Eric V. Smith in branch '3.6':
Issue 28128: Print out better error/warning messages for invalid string 
escapes. Backport to 3.6.
https://hg.python.org/cpython/rev/ee82266ad35b

New changeset 7aa001a48120 by Eric V. Smith in branch 'default':
Issue 28128: Null merge with 3.6: already applied to default.
https://hg.python.org/cpython/rev/7aa001a48120

--

___
Python tracker 

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



[issue28128] Improve the warning message for invalid escape sequences

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

Chi Hsuan Yen:

I'll investigate, and open another issue as needed.

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



[issue26920] android: test_sys fails

2016-10-31 Thread Xavier de Gaye

Xavier de Gaye added the comment:

For the record, on the Android emulator we have now (not sure where this change 
has been made):
>>> sys.getfilesystemencoding()
'utf-8'
>>> locale.getpreferredencoding(False)
'ascii'

So test_ioencoding_nonascii succeeds now. Anyway the problem with this test is 
being fixed at issue 19058.

--

___
Python tracker 

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



[issue26920] android: test_sys fails

2016-10-31 Thread Xavier de Gaye

Changes by Xavier de Gaye :


--
assignee:  -> xdegaye
components: +Interpreter Core -Cross-Build, Extension Modules
stage:  -> commit review
versions: +Python 3.7

___
Python tracker 

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



[issue28570] httplib mishandles unknown 1XX status codes

2016-10-31 Thread Cory Benfield

New submission from Cory Benfield:

Long story short


http.client does not tolerate non-100 or 101 status codes from the 1XX block in 
a sensible manner: it treats them as final responses, rather than as 
provisional ones.


Expected behaviour
~~

When http.client receives a 1XX status code that it does not recognise, it 
should either surface these to a user that expects them by means of a callback, 
or it should ignore them and only show the user the eventual final status code. 
This is required by RFC 7231 Section 6.2 (Informational 1xx), which reads:

> A client MUST be able to parse one or more 1xx responses received prior to a 
> final response, even if the client does not expect one. A user agent MAY 
> ignore unexpected 1xx responses.


Actual behaviour


http.client treats the 1XX status code as final. It parses the header block as 
though it were a response in the 2XX or higher range. http.client will assume 
that there is no content in the 1XX response, and so will leave the following 
final response unconsumed in the socket buffer. This means that if the 
HTTPConnection is re-used, the user will see the final response following the 
1XX as the response to the next request, even though it is not.


Steps to reproduce
~~

The following "server" can demonstrate the issue:

import socket
import time

document = b'''

  

title


  
  
Hello, world!
  

'''

s = socket.socket()
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(('localhost', 8080))
s.listen(5)

while True:
new_socket, _ = s.accept()
data = b''

while not data.endswith(b'\r\n\r\n'):
data += new_socket.recv(8192)

new_socket.sendall(
b'HTTP/1.1 103 Early Hints\r\n'
b'Server: socketserver/1.0.0\r\n'
b'Link: ; rel=preload; as=style\r\n'
b'Link: ; rel=preload; as=script\r\n'
b'\r\n'
)
time.sleep(1)
new_socket.sendall(
b'HTTP/1.1 200 OK\r\n'
b'Server: socketserver/1.0.0\r\n'
b'Content-Type: text/html\r\n'
b'Content-Length: %s\r\n'
b'Link: ; rel=preload; as=style\r\n'
b'Link: ; rel=preload; as=script\r\n'
b'Connection: close\r\n'
b'\r\n' % len(document)
)
new_socket.sendall(document)
new_socket.close()


If this server is run directly, the following client can be used to test it:

from http.client import HTTPConnection

c = HTTPConnection('localhost', 8080)
c.request('GET', '/')
r = c.getresponse()

print("Status: {} {}".format(r.status, r.reason))
print("Headers: {}".format(r.getheaders()))
print("Body: {}".format(r.read()))


This client will print

Status: 103 Early Hints
Headers: [('Content-Length', '0'), ('Server', 'socketserver/1.0.0'), ('Link', 
'; rel=preload; as=style'), ('Link', '; 
rel=preload; as=script')]
Body: b''


This response is wrong: the 200 header block is hidden from the client. 
Unfortunately, http.client doesn't allow us to ask for the next response: 
another call to "getresponse()" raises a "ResponseNotReady: Idle" exception.

--
components: Library (Lib)
messages: 279823
nosy: Lukasa
priority: normal
severity: normal
status: open
title: httplib mishandles unknown 1XX status codes
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

2016-10-31 Thread Michael Felt

Michael Felt added the comment:

There are so many places where there are references to where 32-bit and 64-bit 
are referred to - and, in particular, the value of os.uname()[4]

For the discussion I went back to 32-bit Python on AIX

A)
michael@x071:[/data/prj/python/archive/Python-2.7.3]python
Python 2.7.3 (default, Sep 26 2013, 20:43:10) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'AIX-1-00C291F54C00-powerpc-32bit'
>>> import os
>>> os.uname()[4]
'00C291F54C00'
>>> import sys
>>> sys.maxsize
2147483647

B)
root@x066:~# python
Python 2.7.3 (default, Mar 14 2014, 12:37:29)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Linux-3.2.0-4-powerpc64-ppc64-with-debian-7.8'
>>> import os
>>> os.uname()[4]
'ppc64'
>>> import sys
>>> sys.maxsize
2147483647
>>>

The data comes from the same hardware - just different OS.

re: os.uname()[4] and platform.platform()
for AIX os.uname()[4] says next to nothing - the only bit relavant to the 
"machine" are the letters C4 and those are likely to be found on any POWER 32 
and 64-bit (no longer have direct access to 32-bit hardware so must trust the 
documentation on that one) - for AIX platform.platform() does give proper 
machine and interpreter size.

For Linux (debian in this case) os.uname()[4] identifies the hardware platform, 
and platform.platform() "looks" 64-bit to me, but sys.maxsize clearly shows 
this is 32-bit.

I am willing to work on a patch - even digging on the POWER Linux side as well 
- but to write a patch the desired output is needed.

And, I would suggest replacing the -m output with either -M or -p output:
michael@x071:[/data/prj/python/archive/Python-2.7.3]uname -m -M
00C291F54C00 IBM,8203-E4A
michael@x071:[/data/prj/python/archive/Python-2.7.3]uname -m -p
00C291F54C00 powerpc

Again - what is the preferred output. IMHO - platform.platform() comes very 
close for what I would be expecting.
AIX (noise) powerpc 32bit 
or
AIX (noise) powerpc 64bit

Comments? (and has this ever been discussed/specified in a PEP? In another 
discussion someone mentioned something about a wheel specification - but that 
refers back to distutils and IMHO this is "core" first, and distutils (should 
be) following)

--

___
Python tracker 

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



[issue18987] distutils.utils.get_platform() for 32-bit Python on a 64-bit machine

2016-10-31 Thread Michael Felt

Michael Felt added the comment:

FYI: This is 'actual' as I am working on an implementation of a cloud-init 
distro for AIX and it is very difficult to figure out the correct approach for 
a replacement value for os.uname[4] - when comparing with "Linux" logic

I was thinking of using

platform.platform().split("-")[3]

but both are 32-bit on 64-bit hardware:

>>> platform.platform().split("-")
['AIX', '1', '00C291F54C00', 'powerpc', '32bit']
>>> platform.platform().split("-")[4]
'32bit'
>>> platform.platform().split("-")[3]
'powerpc'

>>> platform.platform().split("-")
['Linux', '3.2.0', '4', 'powerpc64', 'ppc64', 'with', 'debian', '7.8']
>>> platform.platform().split("-")[4]
'ppc64'
>>> platform.platform().split("-")[3]
'powerpc64'

This - also - seems tricky re: the placement of the -
>>> platform.platform()
'Linux-3.2.0-4-powerpc64-ppc64-with-debian-7.8'

compared with:
>>> platform.platform()
'AIX-1-00C291F54C00-powerpc-32bit'

Truely, some guidance from "the powers that be" is needed if there is ever to 
be uniformity. And if it 'cannot' be patched on 'old' versions, at least there 
will be a way to hack clarity into code (imho, a patch is better rather than 
hacks creating continued diversity - everyone continues to use their 
understanding of intent, creating new diverse wishes (aka features not 
benefits)) for what the code "must" do - because there are so many projects 
that used it this way (and others that used it that way) 

:)

--

___
Python tracker 

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



[issue28570] httplib mishandles unknown 1XX status codes

2016-10-31 Thread SilentGhost

SilentGhost added the comment:

The fix could be as small as the attached patched, though I'm not sure that is 
the correct way of handling 101 code.

--
keywords: +patch
nosy: +SilentGhost
Added file: http://bugs.python.org/file45296/28570.diff

___
Python tracker 

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



[issue28570] httplib mishandles unknown 1XX status codes

2016-10-31 Thread Cory Benfield

Cory Benfield added the comment:

101 should probably be special-cased, because in that case the underlying 
protocol is being totally changed.

--

___
Python tracker 

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



[issue28571] llist and scipy.stats conflicts, python segfault

2016-10-31 Thread Lluís

New submission from Lluís:

I'm running this small script that produces a segfault:

https://gist.github.com/anonymous/d24748d5b6de88b31f18965932744211

My python version is Python 3.5.2 (default, Jun 28 2016, 08:46:01) [GCC 6.1.1 
20160602] on linux. And running scipy version 0.18.1.

Can someone confirm if this segfaults with other systems ?

--
components: Interpreter Core
messages: 279828
nosy: Lluís
priority: normal
severity: normal
status: open
title: llist and scipy.stats conflicts, python segfault
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



[issue28572] IDLE: add tests for config dialog.

2016-10-31 Thread Terry J. Reedy

New submission from Terry J. Reedy:

The current test_configdialog creates an instance of ConfigDialog.  Time to add 
some real tests so I can comfortably work on multiple other configdialog issues.

  The challenge is to do it so tests run without a blocking mainloop call and 
without IDLE's tcl update calls.  Explicit root.update call can be added if 
needed.  I also want to test without making the dialog visible.  This is a 
problem for at least some event_generate calls, but their seem to be (mostly) 
better options.  Buttons and Radiobuttons for both tk and ttk have an invoke 
method that works fine.  Entry widget insert seems to work also to trigger that 
test action.

Attached are partial tests for two of the four main tabs.

--
assignee: terry.reedy
files: config_dialog_test.diff
keywords: patch
messages: 279829
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: add tests for config dialog.
type: enhancement
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45297/config_dialog_test.diff

___
Python tracker 

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



[issue28571] llist and scipy.stats conflicts, python segfault

2016-10-31 Thread Lluís

Lluís added the comment:

Confirmed with 2.7 as well.

--
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



[issue28572] IDLE: add tests for config dialog.

2016-10-31 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Patch makes two types of change to configdialog.  1. Make tested widgets 
visible to their methods can be called.  2. Delete an erroneous command 
argument for General tab radiobutton.  Calling SetKeysType on the General tab 
just redid adjustments on the Keys tab that were already done.

--

___
Python tracker 

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



[issue22595] F5 shortcut key not working in IDLE for OSX

2016-10-31 Thread Dave T

Dave T added the comment:

Its on a windows 10 

It doesn't come with the run application but the debug

--
nosy: +Dave T
versions: +Python 2.7 -Python 3.5
Added file: http://bugs.python.org/file45298/Py 2.7.JPG

___
Python tracker 

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



[issue28571] llist and scipy.stats conflicts, python segfault

2016-10-31 Thread R. David Murray

R. David Murray added the comment:

This involves two third party C extensions, so there isn't really anything for 
us to do here until those projects have taken a look.  If they can identify a 
CPython bug causing this, then we can do something.

--
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



[issue28572] IDLE: add tests for config dialog.

2016-10-31 Thread Terry J. Reedy

Terry J. Reedy added the comment:

msg279176 of #27755 describe experiments with ttk.combobox.

--

___
Python tracker 

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



[issue28513] Document zipfile CLI

2016-10-31 Thread Martin Panter

Martin Panter added the comment:

Apparently (haven’t tried myself) if you put “.. program:: zipfile” before the 
:option: invocations, it changes the default context and you don’t need the 
 bit.

The text in general looks fine. One very minor thing: I would use a hyphen when 
“command line” is a modifier on another noun, i.e. command-line interface, 
command-line options.

--

___
Python tracker 

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



[issue28208] update sqlite to 3.14.2

2016-10-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7e48e0557152 by Ned Deily in branch 'default':
Issue #28208: merge from 3.6
https://hg.python.org/cpython/rev/7e48e0557152

--

___
Python tracker 

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



[issue28028] Convert warnings to SyntaxWarning in parser

2016-10-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 88e3df38d591 by Ned Deily in branch '3.6':
Issue #28028: Update OS X installers to use SQLite 3.14.2.
https://hg.python.org/cpython/rev/88e3df38d591

--
nosy: +python-dev

___
Python tracker 

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



[issue28208] update sqlite to 3.14.2

2016-10-31 Thread Ned Deily

Ned Deily added the comment:

[typo in commit message, should be #28208]

New changeset 88e3df38d591 by Ned Deily in branch '3.6':
Issue #28028: Update OS X installers to use SQLite 3.14.2.
https://hg.python.org/cpython/rev/88e3df38d591

--

___
Python tracker 

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



[issue28028] Convert warnings to SyntaxWarning in parser

2016-10-31 Thread Ned Deily

Changes by Ned Deily :


--
Removed message: http://bugs.python.org/msg279836

___
Python tracker 

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



[issue28208] update sqlite to 3.14.2

2016-10-31 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch, Mariatta!  Pushed for release in 3.6.0b3.

--
priority: release blocker -> 
resolution:  -> fixed
stage: commit 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



[issue28530] Howto detect if an object is of type os.DirEntry

2016-10-31 Thread Eryk Sun

Eryk Sun added the comment:

To clarify, DirEntry is only exposed in the posix/nt and os modules starting in 
3.6. To get a reference to it in 3.5 you have to fall back on something like 
the following:

import os

try:
from os import DirEntry
except ImportError:
import tempfile
with tempfile.NamedTemporaryFile() as ftemp:
scan = os.scandir(os.path.dirname(ftemp.name))
DirEntry = type(next(scan))
del scan, ftemp, tempfile

In 3.5 os.scandir does not support the with statement or raise a resource 
warning. That behavior was added in 3.6, for which the workaround shouldn't be 
required.

--

___
Python tracker 

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



[issue28564] shutil.rmtree is inefficient due to listdir() instead of scandir()

2016-10-31 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +Add support of file descriptor in os.scandir()

___
Python tracker 

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



[issue28570] httplib mishandles unknown 1XX status codes

2016-10-31 Thread Martin Panter

Martin Panter added the comment:

Consuming and ignoring 1xx responses seems reasonable for general cases. 
Treating 101 (Switching Protocols) as a special case also seems reasonable.

I also agree it would be good to provide an API to return these responses (at 
least after the request is completely sent). Perhaps a new flag, 
c.getresponse(informational=True), or a new method, 
c.get_informational_response(timeout=...). The timeout is for servers that do 
not support “Expect: 100-continue” mode; see Issue 1346874.

There is also Issue 25919 discussing how to handle responses (including 1xx) 
while concurrently sending the request. That is a harder problem, but may be 
solvable with a few new APIs.

--
nosy: +martin.panter

___
Python tracker 

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



[issue28248] Upgrade installers to OpenSSL 1.0.2j

2016-10-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 33ad26897e30 by Ned Deily in branch '2.7':
Issue #28248: Update macOS installer build to use OpenSSL 1.0.2j.
https://hg.python.org/cpython/rev/33ad26897e30

New changeset a8799a63feb7 by Ned Deily in branch '3.5':
Issue #28248: Update macOS installer build to use OpenSSL 1.0.2j.
https://hg.python.org/cpython/rev/a8799a63feb7

New changeset c7e551f8c5d8 by Ned Deily in branch '3.6':
Issue #28248: merge from 3.5
https://hg.python.org/cpython/rev/c7e551f8c5d8

New changeset 9e66ffa7a791 by Ned Deily in branch 'default':
Issue #28248: merge from 3.6
https://hg.python.org/cpython/rev/9e66ffa7a791

--

___
Python tracker 

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



[issue28248] Upgrade installers to OpenSSL 1.0.2j

2016-10-31 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch, Mariatta.  Pushed for released in 2.7.13, 3.5.3, and 
3.6.0b3.

--
priority: release blocker -> 
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



[issue28385] Bytes objects should reject all formatting codes with an error message

2016-10-31 Thread Eric V. Smith

Eric V. Smith added the comment:

I don't have a strong feeling one way or the other. I'd be surprised if anyone 
is catching these errors.

--

___
Python tracker 

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



[issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

2016-10-31 Thread Xiang Zhang

Changes by Xiang Zhang :


Added file: http://bugs.python.org/file45299/issue28123_v5.patch

___
Python tracker 

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



[issue28542] document cross compilation

2016-10-31 Thread Martin Panter

Martin Panter added the comment:

Regarding 2.7, I guess it depends on your definition of “support”. People have 
been cross-compiling Python 2.7 longer than I have been working on Python. In 
the past I have tried to apply cross compilation fixes to 2.7. But if you are 
only confident about 3.6, let’s just stick with that for the moment.

FWIW, DESTDIR, --prefix, etc are not specific to cross compilation or Android. 
DESTDIR is also useful when building a package/tarball or whatever, rather than 
installing directly. And --prefix would be useful if you don’t have root access 
and want to install to $HOME or somewhere. These settings are mentioned in the 
2.7 README, but it looks like Guido trimmed them out for Python 3.0 (revision 
07d67a9725a7).

--

___
Python tracker 

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



[issue12857] Expose called function on frame object

2016-10-31 Thread Nick Coghlan

Nick Coghlan added the comment:

This topic came up in a discussion I was having with Yury, and thanks to 
generators and coroutines, I don't think "f_func" would be the right name for 
an attribute like this, with something more neutral like "f_origin" potentially 
being preferable

The specific runtime debugging use case I have in mind is this:

1. Given a frame reference, navigate to the generator-iterator or coroutine 
that spawned that frame
2. Given gi_back and cr_back doubly-linked counterparts to the current 
gi_yieldfrom and cr_await introspection attributes on generators and 
coroutines, expose the relevant generator and/or coroutine stack in addition to 
the frame stack

These secondary stacks could then potentially be incorporated into traceback 
outputs by default

--
nosy: +yselivanov

___
Python tracker 

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



[issue28548] http.server parse_request() bug and error reporting

2016-10-31 Thread Martin Panter

Changes by Martin Panter :


--
versions: +Python 3.7 -Python 3.5
Added file: http://bugs.python.org/file45300/parse-version.v2.patch

___
Python tracker 

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



  1   2   >