[issue11097] MSI: Remove win32com dependency from installer generator

2015-03-03 Thread Mark Lawrence

Mark Lawrence added the comment:

This can now be closed as out of date.

--
components: +Windows
nosy: +steve.dower, tim.golden, zach.ware

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



[issue23569] unittest.mock.MagicMock.__div__ works but __truediv__ doesn't (3.3 only)

2015-03-03 Thread Zygmunt Krynicki

New submission from Zygmunt Krynicki:

Hey.

I'm the upstream developer of padme https://github.com/zyga/padme -- the mostly 
transparent proxy class for Python. While working on unit tests for proxying 
numeric methods I realized that there are a few bugs in the mock library.

The bug I'd like to report now is that __truemod__ cannot be mocked by 
MagicMock but __div__ can (despite __div__ being gone from Python 3 entirely). 
This bug is specific to Python 3.3 and it is fixed in 3.4 and 3.5a1

--
messages: 237113
nosy: zkrynicki
priority: normal
severity: normal
status: open
title: unittest.mock.MagicMock.__div__ works  but  __truediv__ doesn't (3.3 
only)
type: behavior
versions: Python 3.3

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



[issue17352] Be clear that __prepare__ must be declared as a class method

2015-03-03 Thread Nick Coghlan

Nick Coghlan added the comment:

__new__ is a little weird - it's actually special cased as a staticmethod.

Your questions is still valid, though.

For existing versions, documenting the requirement is the only option. 

For future versions, we could conceivably implement a decorate it if it isn't 
already decorated fallback, but for backwards compatibility we'd have to avoid 
double-decorating explicitly decorated implementations.

--

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



[issue23571] Raise SystemError if a function returns a result with an exception set

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 If the patch has a significant overhead: _Py_CheckFunctionResult() may be
 marked to be inlined, and PyCFunction_Call() and PyObject_Call() checks may
 be marked as unlikely using GCC __builtin_expect(), something like:

Could you please open separate issue or even a topic on Python-Ideas for 
Py_likely/Py_unlikely? I prefer spelling _Py_LIKELY.

--

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread Nikita Kovaliov

Changes by Nikita Kovaliov nik...@maizy.ru:


--
nosy: +maizy

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread Roumen Petrov

Roumen Petrov added the comment:

STINNER Victor wrote:
 [SNIP]I attach hang2.py which doesn't force the Python implementation 
 of RLock.[SNIP]
Ok. Fine with me.

--

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



[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

support_leap_seconds.patch: different approach, accept second=60. Problem: 
fromtimestamp() returns the wrong day.

haypo@smithers$ ./python
Python 3.5.0a1+ (default:760f222103c7+, Mar  3 2015, 15:36:36) 
 import datetime
 datetime.datetime(2012, 6, 30, 23, 59, 60)
datetime.datetime(2012, 6, 30, 23, 59, 60)
 dt1=datetime.datetime(2012, 6, 30, 23, 59, 60)
 t1=datetime.datetime(2012, 6, 30, 23, 59, 60).timestamp()
 dt2=datetime.datetime.fromtimestamp(t1)
 dt2
datetime.datetime(2012, 7, 1, 0, 0)
 dt2 == dt1
False
 dt1
datetime.datetime(2012, 6, 30, 23, 59, 60)
 print(dt1)
2012-06-30 23:59:60
 print(dt2)
2012-07-01 00:00:00

 import time
 time.mktime((2012, 6, 30, 23, 59, 60, -1, -1, -1))
1341093600.0
 t1
1341093600.0
 t2=time.mktime((2012, 6, 30, 23, 59, 60, -1, -1, -1))
 t2 == t1
True
 time.localtime(time.mktime((2012, 6, 30, 23, 59, 60, -1, -1, -1)))
time.struct_time(tm_year=2012, tm_mon=7, tm_mday=1, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=6, tm_yday=183, tm_isdst=1)


http://cr.yp.to/proto/utctai.html


For many years, the UNIX localtime() time-display routine didn't support leap 
seconds.
(...)
Why not fix it?
(...)
The main obstacle is POSIX. POSIX is a ``standard'' designed by a vendor 
consortium several years ago to eliminate progress and protect the installed 
base. The behavior of the broken localtime() libraries was documented and 
turned into a POSIX requirement.


--
Added file: http://bugs.python.org/file38319/support_leap_seconds.patch

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



[issue23574] datetime: support leap seconds

2015-03-03 Thread Doug Hellmann

Changes by Doug Hellmann doug.hellm...@gmail.com:


--
nosy: +doughellmann

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



[issue11097] MSI: Remove win32com dependency from installer generator

2015-03-03 Thread Steve Dower

Changes by Steve Dower steve.do...@microsoft.com:


--
resolution:  - out of date
status: open - closed

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



[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

Oh, mktime() returns the same timestamp with and without the leap second:

 time.mktime((2012, 6, 30, 23, 59, 59, -1, -1, -1))
1341093599.0
 time.mktime((2012, 6, 30, 23, 59, 60, -1, -1, -1))
1341093600.0
 time.mktime((2012, 7, 1, 0, 0, 0, -1, -1, -1))
1341093600.0

--

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



[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

Ignoring leap seconds introduces unexpected result.

datetime.timestamp - datetime.fromtimestamp drops one second:

$ ./python
Python 3.5.0a1+ (default:760f222103c7+, Mar  3 2015, 15:36:36) 
 t=datetime.datetime(2012, 6, 30, 23, 59, 60).timestamp()
 datetime.datetime.fromtimestamp(t)
datetime.datetime(2012, 6, 30, 23, 59, 59)

time and datetime modules behave differently:

$ ./python
Python 3.5.0a1+ (default:760f222103c7+, Mar  3 2015, 15:36:36) 
 import datetime, time
 t1=datetime.datetime(2012, 6, 30, 23, 59, 59).timestamp()
 t2=datetime.datetime(2012, 6, 30, 23, 59, 60).timestamp()
 t2-t1
0.0

 t3=time.mktime((2012, 6, 30, 23, 59, 59, -1, -1, -1))
 t4=time.mktime((2012, 6, 30, 23, 59, 60, -1, -1, -1))
 t4-t3
1.0

 t1 == t2 == t3
True
 t3, t4
(1341093599.0, 1341093600.0)

--

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



[issue21619] Cleaning up a subprocess with a broken pipe

2015-03-03 Thread Martin Panter

Martin Panter added the comment:

Aha! So perhaps Windows can accept a small amount of data into its pipe buffer 
even if we know the pipe has been broken. That kind of makes sense. Test case 
could be modified to:

proc = subprocess.Popen([...], bufsize=support.PIPE_MAX_SIZE, 
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
proc.stdout.read()  # Make sure subprocess has closed its input
proc.stdin.write(bytes(support.PIPE_MAX_SIZE))
self.assertIsNone(proc.returncode)
# Expect EPIPE under POSIX and EINVAL under Windows
self.assertRaises(OSError, proc.__exit__, None, None, None)

--

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



[issue23505] Urlparse insufficient validation leads to open redirect

2015-03-03 Thread Yassine ABOUKIR

Yassine ABOUKIR added the comment:

I am not quiet sure about the first proposal but I strongly believe the 
appropriate method to fix this is by checking if the path starts with double 
slashes and then URL encoding the two leading slashes.

--

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



[issue23575] MIPS64 needs ffi's n32.S

2015-03-03 Thread Simon Hoinkis

New submission from Simon Hoinkis:

MIPS64 needs ffi's n32.S linking in for _ctypes to work otherwise build errors 
will occur (e.g. python-setuptools).

--
components: ctypes
files: mips64.patch
keywords: patch
messages: 237150
nosy: Simon Hoinkis
priority: normal
severity: normal
status: open
title: MIPS64 needs ffi's n32.S
type: compile error
versions: Python 2.7
Added file: http://bugs.python.org/file38320/mips64.patch

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't see a difference between buffered file and Popen object. Both are 
useless 
after closing, both can raise an exception when flush a buffer on closing. Why 
suppress an exception in one case but not in other? I think this question 
needs wider discussion in Python-Dev.

--

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 New patch to fix the bug seen by Serhiy.

I thought about different solution:

try:
if input:
self.stdin.write(input)
finally:
self.stdin.close()

But your approach looks working too,

--

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

 I thought about different solution:

Your solution is different: I would prefer to also ignore broken pipe errors on 
close(). I'm not sure that close() can raise a BrokenPipeError in practice.

--

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



[issue23571] Raise SystemError if a function returns a result with an exception set

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

2015-03-03 13:49 GMT+01:00 Serhiy Storchaka rep...@bugs.python.org:
 If the patch has a significant overhead: _Py_CheckFunctionResult() may be
 marked to be inlined, and PyCFunction_Call() and PyObject_Call() checks may
 be marked as unlikely using GCC __builtin_expect(), something like:

 Could you please open separate issue or even a topic on Python-Ideas for
 Py_likely/Py_unlikely? I prefer spelling _Py_LIKELY.

I'm not really interested by micro-benchmark here :-) I also propose
solutions *if* my patch makes the code slower.

Since __builtin_expect() may have a negative effect on performances, I
would prefer to avoid it if we can :-)

--

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Your solution is different: I would prefer to also ignore broken pipe errors
 on close(). I'm not sure that close() can raise a BrokenPipeError in
 practice.

Of course all this code should be inside try/except block that ignores a 
BrokenPipeError.

--

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This bug has existed for ages. People who want sane behaviour should just 
switch to Python 3. Closing.

--
resolution:  - rejected
stage: needs patch - resolved
status: open - closed

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

 The attached test script demonstrates the issue on Python 2.6 and 3.2, and 
 code inspection suggests this is still valid for 2.7 and 3.4.

I disagree that Python 3.4 is affected: RLock has been reimplemented in C in 
Python 3.2. Only the Python implementation of RLock has the bug, but it's not 
used by fault, you have to explicitly use a private attribute of the threading 
module to get it.

Python 2.6 only accept security fixes, so in fact only Python 2.7 may get a fix.

The question is if it worth to backport 300 lines of C code from Python 3 to 
Python 2 in the _thread module.

@Benjamin, release manager of Pythn 2.7: What do you think? I may help to 
backport the C implementation of RLock.

--
nosy: +benjamin.peterson
versions:  -Python 3.2, Python 3.3

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



[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic

2015-03-03 Thread Jan Kratochvil

Jan Kratochvil added the comment:

It even crashes applications due to pollution of dynamic symbols namespace by 
application symbols as seen in:
  https://bugzilla.redhat.com/show_bug.cgi?id=1198158

--

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



[issue23512] The list of built-in functions is not alphabetical on https://docs.python.org/2/library/functions.html

2015-03-03 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
assignee: docs@python - ezio.melotti

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



[issue23577] Add tests for wsgiref.validate

2015-03-03 Thread Alex Shkop

New submission from Alex Shkop:

These tests increase coverage of wsgiref.validate module. They test 
InputWrapper and ErrorWrapper used to validate env['wsgi.input'] and 
env['wsgi.errors'].

--
components: Tests
files: wsgiref_test_wrappers.patch
keywords: patch
messages: 237152
nosy: ashkop
priority: normal
severity: normal
status: open
title: Add tests for wsgiref.validate
versions: Python 3.5
Added file: http://bugs.python.org/file38321/wsgiref_test_wrappers.patch

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



[issue19884] Importing readline produces erroneous output

2015-03-03 Thread Isaac Schwabacher

Isaac Schwabacher added the comment:

From the OP:

 This was reported at [1] and originally at [2]. The readline maintainer 
 suggests [3] using:
 
 rl_variable_bind (enable-meta-key, off);
 
 which was introduced in readline 6.1. Do you think it'd be safe to add the 
 above line?

From 3.4.3 final:

 @unittest.skipIf(readline._READLINE_VERSION  0x0600
  and libedit not in readline.__doc__,
  not supported in this library version)


The test currently fails on readline version 6.0.  The version to test on needs 
a bump to 0x0610.

--
nosy: +ischwabacher

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



[issue23576] HTTPS reads can block when content length not available and timeout set.

2015-03-03 Thread Cory Benfield

New submission from Cory Benfield:

Initially reported on the requests bug list at 
https://github.com/kennethreitz/requests/issues/2467

In cases when a remote web server sends a non-chunked response that does not 
have a content length, it is possible to get http.client to hang on a read. To 
hit it requires a specific set of circumstances:

- Python 3 (this bug is not seen on Python 2 in my testing)
- HTTPS (using plaintext HTTP resolves the problem)
- A socket timeout must be set (leaving it unset, i.e. leaving the socket in 
blocking mode, resolves this problem)
- The server must not send a content-length or set Transfer-Coding: chunked.
- The reads must not be an even divisor of the content's length.
- The timeout must be longer than the time the server is willing to keep the 
connection open (otherwise an exception is thrown).

The following code can be used as a sample to demonstrate the bug:

import http.client
import time

def test(connection_class=http.client.HTTPSConnection, timeout=10, read_size=7):
start = time.time()
c = connection_class('sleepy-reaches-6892.herokuapp.com')
c.connect()
if timeout is not None:
c.sock.settimeout(timeout)
c.request('GET', '/test')
r = c.getresponse()
while True:
data = r.read(read_size)
if not data:
break
print('Finished in {}'.format(time.time() - start))


Below are the results from several different runs:

test(): Finished in 4.8294830322265625
test(connection_class=http.client.HTTPConnection): Finished in 
0.3060309886932373
test(timeout=None): Finished in 0.6070599555969238
test(read_size=2): Finished in 0.6600658893585205

As you can see, only this particular set of features causes the bug. Note that 
if you change the URL to one that does return a Content-Length (e.g. 
http2bin.org/get), this bug also goes away.

This is a really weird edge case bug. There's some extensive investigation over 
at the requests bug report, but I've not been able to convincingly point at the 
problem yet.

--
components: Library (Lib)
messages: 237151
nosy: Lukasa
priority: normal
severity: normal
status: open
title: HTTPS reads can block when content length not available and timeout set.
versions: Python 3.4

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



[issue23578] struct.pack error messages do not indicate which argument was invalid

2015-03-03 Thread Alistair Lynn

New submission from Alistair Lynn:

In this example:

  struct.pack('!', 0x5FFF, 0x6FFF, 0x7FFF, 0x8FFF)

Python errors that the 'h' format requires -32768 = number = 32767, but it 
does not indicate which of the arguments is at fault. In this contrived example 
it's clearly the fourth one, but in dealing with large amounts of data it would 
be useful to indicate which argument was invalid.

This would hopefully not be a functional change, just a slightly more helpful 
error message.

--
components: Library (Lib)
messages: 237153
nosy: alynn
priority: normal
severity: normal
status: open
title: struct.pack error messages do not indicate which argument was invalid
type: enhancement
versions: Python 2.7, Python 3.4

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



[issue19884] Importing readline produces erroneous output

2015-03-03 Thread Isaac Schwabacher

Isaac Schwabacher added the comment:

Whoops, that's 0x0601.  Though Maxime gives evidence that the version should in 
fact be 0x0603.  (Note that while OS X ships with libedit over libreadline, 
anyone who wants to can install the real thing instead of that pale imitation; 
the test would have been skipped if Maxime were using libedit.)

--

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



[issue23563] Faster urllib.urlparse utility functions

2015-03-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


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

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



[issue23563] Faster urllib.urlparse utility functions

2015-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 461afc24fabc by Serhiy Storchaka in branch 'default':
Issue #23563: Optimized utility functions in urllib.parse.
https://hg.python.org/cpython/rev/461afc24fabc

--
nosy: +python-dev

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



[issue23576] HTTPS reads can block when content length not available and timeout set.

2015-03-03 Thread Zachary Salzbank

Changes by Zachary Salzbank z...@key.me:


--
nosy: +Zachary Salzbank

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



[issue23367] integer overflow in unicodedata.normalize

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The test doesn't hurt.

--

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



[issue23576] HTTPS reads can block when content length not available and timeout set.

2015-03-03 Thread Demian Brecht

Changes by Demian Brecht demianbre...@gmail.com:


--
nosy: +demian.brecht

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



[issue20271] urllib.parse.urlparse() accepts wrong URLs

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

With optimizations in issue23563 and weaken IPv6 check the implementation of 
urlsplit() can be faster.

$ ./python -m timeit -s from urllib.parse import urlparse, clear_cache -- 
urlparse('http://python.org:80'); clear_cache()
1 loops, best of 3: 86.3 usec per loop
$ ./python -m timeit -s from urllib.parse import urlparse, clear_cache -- 
urlparse('http://[2001:4802:7901:0:e60a:1375:0:5]:80'); clear_cache()
1 loops, best of 3: 88.6 usec per loop

--
Added file: http://bugs.python.org/file38322/urlparse_2.patch

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



[issue23579] Amazon.com links

2015-03-03 Thread Edrie Ddrie

New submission from Edrie Ddrie:

Keywords:easy
Priority: normal

--
assignee: docs@python
components: Documentation
messages: 237160
nosy: Edrie Ddrie, docs@python
priority: normal
severity: normal
status: open
title: Amazon.com links
type: enhancement
versions: Python 3.4

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



[issue23550] Add to unicodedata a function to query the Quick_Check property for a character

2015-03-03 Thread Hammerite

Hammerite added the comment:

Here is a better patch that includes the changes to unicodedata.h

The problem before was that the diff tool can't cope with line ending 
differences. I just fixed the line endings manually.

--
Added file: http://bugs.python.org/file38323/quick_check_2.patch

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



[issue23575] MIPS64 needs ffi's n32.S

2015-03-03 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +amaury.forgeotdarc, belopolsky, doko, meador.inge
stage:  - patch review
versions: +Python 3.4, Python 3.5

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



[issue23579] Amazon.com links

2015-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

If the mentioned books have official Web sites we could use a link to them.
Feel free to submit a patch.

--
nosy: +pitrou
versions: +Python 2.7, Python 3.5

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



[issue23285] PEP 475 - EINTR handling

2015-03-03 Thread Charles-François Natali

Charles-François Natali added the comment:

@Victor: please commit.
Would be nice to have a test for it;

--

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



[issue23505] Urlparse insufficient validation leads to open redirect

2015-03-03 Thread Paul McMillan

Paul McMillan added the comment:

While some websites may use urlunparse(urlparse(url)) to validate a url, this 
is far from standard practice. Django, for instance, does not use this method. 
While I agree we should clean this behavior up, this is not a vulnerability in 
core python, and we need to invalidate the assigned CVE.

--
nosy: +PaulMcMillan

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-03-03 Thread Robert Collins

Robert Collins added the comment:

Ok, all changes applied, lets see how this looks to folk.

--
Added file: http://bugs.python.org/file38324/issue17911-5.patch

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



[issue23576] HTTPS reads can block when content length not available and timeout set.

2015-03-03 Thread Piotr Dobrogost

Changes by Piotr Dobrogost p...@bugs.python.dobrogost.net:


--
nosy: +piotr.dobrogost

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



[issue23579] Amazon.com links

2015-03-03 Thread Edrie Ddrie

Edrie Ddrie added the comment:

There a links to Amazon in the official documentation.
(In Python 3.4 in the tkinter.html and othergui.html)

It's not right to advertise for a certain business.
When will the official documentation guide people to eat at MacDonalds ?
I is a sign of a low moral.

A more honest alternative is just to call the book title and author
and let people decide where they buy books.

--

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



[issue23580] Amazon.com links

2015-03-03 Thread Edrie Ddrie

New submission from Edrie Ddrie:

Keywords: easy
Priority: normal

--
assignee: docs@python
components: Documentation
messages: 237161
nosy: Edrie Ddrie, docs@python
priority: normal
severity: normal
status: open
title: Amazon.com links
type: enhancement
versions: Python 3.4

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



[issue23504] Add __all__ into types

2015-03-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cb5fe8cc60eb by Serhiy Storchaka in branch '2.7':
Issue #23504: Added an __all__ to the types module.
https://hg.python.org/cpython/rev/cb5fe8cc60eb

New changeset 4888f9498db6 by Serhiy Storchaka in branch '3.4':
Issue #23504: Added an __all__ to the types module.
https://hg.python.org/cpython/rev/4888f9498db6

New changeset 5c73b01d58ac by Serhiy Storchaka in branch 'default':
Issue #23504: Added an __all__ to the types module.
https://hg.python.org/cpython/rev/5c73b01d58ac

--
nosy: +python-dev

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



[issue23578] struct.pack error messages do not indicate which argument was invalid

2015-03-03 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +mark.dickinson, meador.inge

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



[issue23576] HTTPS reads can block when content length not available and timeout set.

2015-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Reproducing seems a bit irregular. Note that the last bytestring (the empty 
bytestring) is what takes time to read.

Also note that HTTPResponse is a buffered I/O object, so normally you don't 
need to read up to the empty string. You can stop when you got less bytes than 
what you asked for.

--
nosy: +pitrou
versions: +Python 3.5

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



[issue23504] Add __all__ into types

2015-03-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

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



[issue23576] HTTPS reads can block when content length not available and timeout set.

2015-03-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Varying reproduceability may have to do with sleepy-reaches-6892.herokuapp.com 
resolving to different endpoints (that domain name has a stupidly small TTL, by 
the way).

Anyway, for an unknown reason the following patch seems to fix the issue.

--
keywords: +patch
Added file: http://bugs.python.org/file38326/ssl_read_fixup.patch

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



[issue23580] Amazon.com links

2015-03-03 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman
resolution:  - duplicate
status: open - closed
superseder:  - Amazon.com links

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



[issue23579] Amazon.com links

2015-03-03 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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



[issue23568] unittest.mock.MagicMock doesn't support __rdivmod__

2015-03-03 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +michael.foord, rbcollins

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



[issue23569] unittest.mock.MagicMock.__div__ works but __truediv__ doesn't (3.3 only)

2015-03-03 Thread Ned Deily

Ned Deily added the comment:

Thanks for the report, however, per our support policy, Python 3.3 is now open 
only for security fixes for the remainder of its support window.

--
nosy: +ned.deily
resolution:  - wont fix
stage:  - resolved
status: open - closed

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



[issue17911] traceback: add a new thin class storing a traceback without storing local variables

2015-03-03 Thread Robert Collins

Changes by Robert Collins robe...@robertcollins.net:


Added file: http://bugs.python.org/file38325/issue17911-6.patch

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



[issue23310] MagicMock constructor configuration fails for magic methods

2015-03-03 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +michael.foord, rbcollins

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



[issue23504] Add __all__ into types

2015-03-03 Thread Berker Peksag

Berker Peksag added the comment:

LGTM.

--
nosy: +berker.peksag
stage: patch review - commit review

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



[issue22933] Misleading sentence in doc for shutil.move

2015-03-03 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag

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



[issue23572] functools.singledispatch fails when not BaseClass is True

2015-03-03 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +lukasz.langa

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



[issue23568] unittest.mock.MagicMock doesn't support __rdivmod__

2015-03-03 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag

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



[issue15795] Zipfile.extractall does not preserve file permissions

2015-03-03 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
stage: commit review - needs patch

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



[issue20059] Inconsistent urlparse/urllib.parse handling of invalid port values?

2015-03-03 Thread Berker Peksag

Berker Peksag added the comment:

 I think it is worth to be applied to maintained releases.

I'd commit this only to the default branch. Changing the return value from None 
to an exception after three 3.4 bugfix releases(3.4.1, 3.4.2 and 3.4.3 -- also 
since 3.4.3 was released in Feb 2015, 3.4.4 will probably be the last bugfix 
release of 3.4) would not be the best action. I understand that the current 
situation is inconsistent, but I'm not sure it's worth it to commit to the 2.7 
and 3.4 branches.

--

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



[issue23400] Inconsistent behaviour of multiprocessing.Queue() if sem_open is not implemented

2015-03-03 Thread Berker Peksag

Berker Peksag added the comment:

LGTM

--
stage: patch review - commit review

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



[issue23577] Add tests for wsgiref.validate

2015-03-03 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag, pje
stage:  - patch review
type:  - enhancement
versions: +Python 3.4

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



[issue23539] Content-length not set for HTTP methods expecting body when body is None

2015-03-03 Thread R. David Murray

R. David Murray added the comment:

Single patch, yes, but FYI we actually prefer a python3 patch against default 
as the single patch.  (Unless there are major differences, which there aren't 
in this case.)

I've made some minor review comments.  You can either ack my changes (or 
disagree :) and I'll make them when I commit, or update the patch yourself if 
you are so moved.

--

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



[issue23512] The list of built-in functions is not alphabetical on https://docs.python.org/2/library/functions.html

2015-03-03 Thread Carlo Beccarini

Changes by Carlo Beccarini hackdiablo...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file38316/issue23512.diff

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread Roumen Petrov

Roumen Petrov added the comment:

hmm issue still exist in master branch. 
Lets wait python 4 for sane behaviour.

--
nosy: +rpetrov

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



[issue15795] Zipfile.extractall does not preserve file permissions

2015-03-03 Thread Alexey Boriskin

Alexey Boriskin added the comment:

I'm working on updating the patch to unify tarfile and zipfile interfaces and 
to restore owner/timestamp for zipfile

--

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

 hmm issue still exist in master branch. 

For the third time, only the Python implementation has the bug, and it's not 
used by default. So the bug was fixed in Python 3 since 3.2. It's time to 
upgrade guys ;-)

--

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



[issue23573] Avoid redundant allocations in str.find and like

2015-03-03 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Currently str.find() and similar methods can make a copy of self or searched 
string if they have different kinds. In some cases this is redundant because 
the result can be known before trying to search. Longer string can't be found 
in shorter string and wider string can't be found in narrower string. Proposed 
patch avoid creating temporary widened copies in such corner cases. It also 
adds special cases for searching 1-character strings.

Some sample microbenchmark results:

$ ./python -m timeit -s a = 'x'; b = 'x\U00012345' -- b.find(a)
Unpatched: 100 loops, best of 3: 1.92 usec per loop
Patched:   100 loops, best of 3: 1.03 usec per loop

$ ./python -m timeit -s a = 'x'; b = 'x\U00012345' -- a in b
Unpatched: 100 loops, best of 3: 0.543 usec per loop
Patched:   100 loops, best of 3: 0.25 usec per loop

$ ./python -m timeit -s a = '\U00012345'; b = 'x'*1000 -- b.find(a)
Unpatched: 10 loops, best of 3: 4.58 usec per loop
Patched:   100 loops, best of 3: 0.969 usec per loop

$ ./python -m timeit -s a = 'x'*1000; b = '\U00012345' -- b.find(a)
Unpatched: 10 loops, best of 3: 3.77 usec per loop
Patched:   100 loops, best of 3: 0.97 usec per loop

$ ./python -m timeit -s a = 'x'*1000; b = '\U00012345' -- a in b
Unpatched: 10 loops, best of 3: 2.4 usec per loop
Patched:   100 loops, best of 3: 0.225 usec per loop

--
components: Interpreter Core
files: str_find_faster.patch
keywords: patch
messages: 237137
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Avoid redundant allocations in str.find and like
type: performance
versions: Python 3.5
Added file: http://bugs.python.org/file38315/str_find_faster.patch

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



[issue20210] Provide configure options to enable/disable Python modules and extensions

2015-03-03 Thread Thomas Petazzoni

Thomas Petazzoni added the comment:

@Mark I would be happy to, but if you refer to the previous discussion about 
this bug report, the feedback was quite negative. And since I'm not really 
willing to do some clean up to finally get the patches rejected, I'd like to at 
least have 1/ an agreement on the principle itself, and 2/ some guidance as to 
what needs to be changed in the currently proposed patches to get them accepted.

--

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



[issue21619] Cleaning up a subprocess with a broken pipe

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

I opened the issue #23570: Change with subprocess.Popen(): (context manager) 
to ignore broken pipe error.

 FAIL: test_broken_pipe_cleanup (test.test_subprocess.ContextManagerTests)

Serhiy: see existing test_communicate_epipe() and 
test_communicate_epipe_only_stdin() tests which are now reliable and portable.

You should write more data (2**20 bytes) and set the buffer size to a value 
larger than the input data, to buffer all data, so the write occurs at 
stdin.close() in Popen.__exit__().

By the way, instead of an hardcoded value (2**20), support.PIPE_MAX_SIZE may be 
more appropriate.

--

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread Martin Panter

Martin Panter added the comment:

I left some minor comments on the documentation.

As a side effect of your rearranging of _stdin_write(), I think it would fix 
the bug with communicate() leaking a BrokenPipeError and leaving a zombie when 
there is less than a buffer’s worth of data to send.

--

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-03-03 Thread Cyd Haselton

Cyd Haselton added the comment:

Ryan,
Sounds good. I think I've got all of the bug tracker patches 
committed/pushed...now I need to do all of the other edits.  Aiming to be 
finished by Friday/Saturday.

--

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



[issue23571] Raise SystemError if a function returns a result with an exception set

2015-03-03 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch changes PyObject_Call() and PyCFunction_Call() to raise a 
SystemError and destroy the result (Py_DECREF) if a function returns a result 
with an exception set.

I also refactored PyCFunction_Call() and added assert(!PyErr_Occurred()); at 
the beginning of PyCFunction_Call().

I removed duplicate checks in ceval.c.

--

I didn't check the impact on performances.

If the patch has a significant overhead: _Py_CheckFunctionResult() may be 
marked to be inlined, and PyCFunction_Call() and PyObject_Call() checks may be 
marked as unlikely using GCC __builtin_expect(), something like:

#ifdef __GNUC__
#  define Py_likely(x)   __builtin_expect((x),1)
#  define Py_unlikely(x) __builtin_expect((x),0)
#else
#  define Py_likely(x)   x
#  define Py_unlikely(x) x
#endif

Be careful of __builtin_expect(), misused it can make the code slower! 
(benchmark, benchmark, benchmark!)

--
components: Interpreter Core
messages: 237123
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Raise SystemError if a function returns a result with an exception set
versions: Python 3.5

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



[issue23571] Raise SystemError if a function returns a result with an exception set

2015-03-03 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file38312/check_result.patch

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Do you want to modify IOBase.__exit__ to ignore I/O errors in close()? I think 
such changes should be discussed in Python-Dev.

--

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



[issue21619] Cleaning up a subprocess with a broken pipe

2015-03-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you provide a patch Martin?

--

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

 Do you want to modify IOBase.__exit__ to ignore I/O errors in close()?

Nope. On files, you want to want to know if your data has been fully written. 
For a subprocess, it's different. You only expect best effort.

The BrokenPipeError exception is raised by Python when an OS function fails 
with EPIPE. This exception has the same purpose than the SIGPIPE signal: warn 
the application that it's now useless to send more data, the consumer will 
ignore it. By the way, since Python checks the result of *all* OS functions, 
SIGPIPE is simply ignored. SIGPIPE and EPIPE have the same purpose.

In the subprocess module, if we get BrokenPipeError, it means that the child 
process stopped reading from stdin (closed it or the process already exited).

Popen.communicate() must close stdin, so why would we pass BrokenPipeError to 
the caller? It's useless, we just stop writing and close the pipe.

Since Popen.__exit__() also closes stdin, I use the same rationale: it useless 
to pass BrokenPipeError to the caller. The caller expects that the process 
exited.

Anyway, we closed all pipes, it's not more possible to communicate with the 
child process. The following example displays is proc stdin closed? True:
---
import subprocess, sys

args = [sys.executable, '-c', 'pass']
proc = subprocess.Popen(args, stdin=subprocess.PIPE)
try:
with proc:
proc.stdin.write(b'x' * (2**20))
except BrokenPipeError:
pass
print(is proc stdin closed?, proc.stdin.closed)
---

See also: Why does SIGPIPE exist?
https://stackoverflow.com/questions/8369506/why-does-sigpipe-exist

--
nosy: +neologix

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



[issue21619] Cleaning up a subprocess with a broken pipe

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

I would be safer to use a bufsize a little bit larger :-)

proc = subprocess.Popen([...], bufsize=support.PIPE_MAX_SIZE * 2,
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
...
proc.stdin.write(b'x' * support.PIPE_MAX_SIZE)

--

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

New patch to fix the bug seen by Serhiy.

 Anyway, we closed all pipes

Oh, I forgot to explain that TextIOWrapper.close() closes the buffered file 
even if flush() raised an exception. BufferedWriter.close() does the same.

So stdin.close() always closes the text (binary or text, buffered or not). It's 
not more possible to use stdin after stdin.close(), even if stdin.close() 
raised an exception.

--
Added file: http://bugs.python.org/file38313/popen_exit-2.patch

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



[issue23572] functools.singledispatch fails when not BaseClass is True

2015-03-03 Thread Sergio Pascual

New submission from Sergio Pascual:

I admit this case is rather convoluted, but I have been debugging a few hours 
so I think I should share my findings.

I have a metaclass MetaA that provides to the classes constructed with it have 
a dictionary interface. Of all the functions only __len__ is important. In some 
cases, the result of __len__ is 0 and that is what triggers the error

class MetaA(type):
def __len__(self):
return 0

class A(metaclass=MetaA):
pass

class AA(A):
pass

Now, I construct a function with single dispatch and register the case of class 
A but not the class AA

@singledispatch
def fun(a):
print('base case')

@fun.register(A)
def _(a):
print('fun A')

And then, call fun with an object of class AA

fun(AA())

This should call the function for the class up in the hierarchy, A
Instead it raises an exception 

RuntimeError: Inconsistent hierarchy

in function functools._c3_merge
because in the line

if not candidate:
raise RuntimeError(Inconsistent hierarchy)

not candidate evaluates to True due to __len__ returning 0


This can be avoided by:

* adding __nonzero__ to MetaA

* not adding the map interface to a class in the first place

* changing the code in _c3_merge 

I'm not really sure, but instead of:

if not candidate:
raise RuntimeError(Inconsistent hierarchy)

would this work?

if candidate is None:
raise RuntimeError(Inconsistent hierarchy)


I attach a test case

--
components: Library (Lib)
files: singledispatch-test.py
messages: 237126
nosy: Sergio Pascual
priority: normal
severity: normal
status: open
title: functools.singledispatch fails when not BaseClass is True
versions: Python 3.4
Added file: http://bugs.python.org/file38314/singledispatch-test.py

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



[issue23568] unittest.mock.MagicMock doesn't support __rdivmod__

2015-03-03 Thread Zygmunt Krynicki

Changes by Zygmunt Krynicki zygmunt.kryni...@canonical.com:


--
title: unittest.mock.MagicMock doesn't support __rdivmod__t - 
unittest.mock.MagicMock doesn't support __rdivmod__

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



[issue23568] unittest.mock.MagicMock doesn't support __rdivmod__t

2015-03-03 Thread Zygmunt Krynicki

New submission from Zygmunt Krynicki:

Hey.

I'm the upstream developer of padme https://github.com/zyga/padme -- the mostly 
transparent proxy class for Python. While working on unit tests for proxying 
numeric methods I realized that there are a few bugs in the mock library.

The bug I'd like to report now is that __rdivmod__ cannot be mocked by 
MagicMock. This seems to be caused by the fact that it is listed as magic but 
not as numeric (for which right-hand-side variants are created).

Note that it cannot be simply added to numeric as it doesn't have the augmented 
assignment variant (there is no __idivmod__).

The bug is present in all versions of Python that come with unittest.mock (3.3, 
3.4 and 3.5) and it is also present in the upstream/standalone version of mock

--
components: Library (Lib)
messages: 237112
nosy: zkrynicki
priority: normal
severity: normal
status: open
title: unittest.mock.MagicMock doesn't support __rdivmod__t
versions: Python 3.4, Python 3.5

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



[issue23568] unittest.mock.MagicMock doesn't support __rdivmod__

2015-03-03 Thread Zygmunt Krynicki

Changes by Zygmunt Krynicki zygmunt.kryni...@canonical.com:


--
type:  - behavior
versions: +Python 3.3 -Python 3.4, Python 3.5

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



[issue23570] Change with subprocess.Popen(): (context manager) to ignore broken pipe error

2015-03-03 Thread STINNER Victor

New submission from STINNER Victor:

The Popen.communicate() method ignores broken pipe error when writing to stdin. 
I propose to modify Popen.__exit__() to do the same in Python 3.5.

Attached patch implements this suggestion and document it. I added this 
paragraph to Popen doc:

The context manager ignores broken pipe errors when closing the process’s 
stdin: call explicitly proc.stdin.flush() and proc.stdin.close() to get broken 
pipe errors.

So it's still possible to get broken pipe errors if you need them.

Do you know applications or libraries which rely on broken pipe errors and do 
something different than just ignoring them?

I prefer to leave Python 3.4 unchanged to avoid subtle behaviour changes in 
minor Python releases.

See also:

- issue #21619 which modified Popen.__exit__() to call wait() even if 
stdin.close() raised an exception
- issue #19612 which modified communicate() to handle EINVAL on stdin.write() 
on Windows

--
files: popen_exit.patch
keywords: patch
messages: 237115
nosy: haypo, serhiy.storchaka, vadmium
priority: normal
severity: normal
status: open
title: Change with subprocess.Popen(): (context manager) to ignore broken 
pipe error
versions: Python 3.5
Added file: http://bugs.python.org/file38311/popen_exit.patch

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread Roumen Petrov

Roumen Petrov added the comment:

STINNER Victor wrote:
 For the third time, only the Python implementation has the bug, and 
 it's not used by default. So the bug was fixed in Python 3 since 3.2. 
 It's time to upgrade guys ;-)
Did you mean to downgrade? Tested with Python 3.5.0a1+ (default, Feb 28 
2015, 09:49:09)

--

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



[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file38317/datetime_leapsecond.patch

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



[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor

New submission from STINNER Victor:

A leap second will be added in June 2015:
http://www.usatoday.com/story/tech/2015/01/08/computer-chaos-feares/21433363/

The datetime module explicitly doesn't support leap seconds:
https://docs.python.org/dev/library/datetime.html#datetime.date.fromtimestamp
Note that on non-POSIX systems that include leap seconds in their notion of a 
timestamp, leap seconds are ignored by fromtimestamp().

The following bug in oslo.utils was reported because datetime is indirectly 
used to unserialize a date, but it fails with ValueError(second must be in 
0..59) if the second is 60:
https://bugs.launchpad.net/oslo.utils/+bug/1427212

Would it be possible to silently drop ignore leap seconds in datetime.datetime 
constructor, as already done in datetime.datetime.fromtimestamp?

Attached patch modified datetime constructor to drop leap seconds: replace 
second=60 with second=59. I also changed the error message for second (valid 
range is now 0..60).

--
components: Library (Lib)
messages: 237142
nosy: belopolsky, haypo
priority: normal
severity: normal
status: open
title: datetime: support leap seconds
versions: Python 3.5

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



[issue23574] datetime: support leap seconds

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

Leap seconds are ignored, so a difference of datetime before the leap second 
and datetime with the leap second is zero:

 import datetime
 t1=datetime.datetime(2012, 6, 30, 23, 59, 59)
 t2=datetime.datetime(2012, 6, 30, 23, 59, 59)
 t2-t1
datetime.timedelta(0)

Supporting leap seconds might be possible, but it requires much more work.

--

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



[issue13697] python RLock implementation unsafe with signals

2015-03-03 Thread STINNER Victor

STINNER Victor added the comment:

 Did you mean to downgrade? Tested with Python 3.5.0a1+ (default, Feb 28 
2015, 09:49:09)

Please make some effort to try to understand the issue.

I attach hang2.py which doesn't force the Python implementation of RLock. You 
might try hang2.py on Python 2 and Python 3 if you are not convinced yet that 
Python 3 has not the bug...

--
Added file: http://bugs.python.org/file38318/hang2.py

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