[issue22264] Add wsgiref.util helpers for dealing with WSGI strings

2014-08-25 Thread Nick Coghlan

Nick Coghlan added the comment:

After reviewing the stdlib code as Serhiy suggested and reflecting on the 
matter for a while, I now think it's better to think of this idea in terms of 
formalising the concept of a WSGI string. That is, data that has been decoded 
as latin-1 not because that's necessarily correct, but because it creates a 
valid str object that doesn't lose any information, doesn't have any surrogate 
escapes in it, yet can still handle arbitrary binary data.

Under that model, and using a dumps/loads inspired naming scheme (since this is 
effectively a serialisation format for the WSGI server/application boundary), 
the appropriate helpers would be:

def dump_wsgistr(data, encoding, errors='strict'):
data.encode(encoding, errors).decode('iso-8859-1')

def load_wsgistr(data, encoding, errors='strict'):
data.encode('iso-8859-1').decode(encoding, errors)

As Victor says, using surrogateescape by default is not correct. However, some 
of the code in wsgiref.handlers does pass a custom errors setting, so it's 
appropriate to make that configurable.

With this change, there would be several instances in wsgiref.handlers that 
could be changed from the current:

data.encode(encoding).decode('iso-8859-1')

to:

dump_wsgistr(data, encoding)

The point is that it isn't iso-8859-1 that's significant - it's the 
compliance with the data format mandated by the WSGI 1.0.1 specification (which 
just happens to be latin-1 decoded string).

--
title: Add wsgiref.util.fix_decoding - Add wsgiref.util helpers for dealing 
with WSGI strings

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



[issue21704] _multiprocessing module builds incorrectly when POSIX semaphores are disabled

2014-08-25 Thread koobs

koobs added the comment:

For reference and breadcrumbs, this also occurs when:

checking for sem_open... yes
checking for sem_timedwait... yes
checking for sem_getvalue... yes
checking for sem_unlink... yes
snip
checking whether POSIX semaphores are enabled... no
checking for broken sem_getvalue... yes
snip
*** WARNING: renaming _multiprocessing since importing it failed: 
build/lib.freebsd-8.4-RELEASE-i386-3.4/_multiprocessing.so: Undefined symbol 
_PyMp_sem_unlink

This can occur on FreeBSD jails, among other things, when host  jail versions 
differ.

Attaching full QA log from RedPorts on FreeBSD 8.4-RELEASE

--
Added file: http://bugs.python.org/file36464/freebsd-python34.log

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



[issue18814] Add tools for cleaning surrogate escaped strings

2014-08-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Ideally we'd have string modification support for all the translations we offer 
as codec error handlers:

* Unicode replacement character ('replace' on input)
* ASCII question mark ('replace' on output)
* Dropping them entirely ('ignore')
* XML character reference ('xmlcharrefreplace')
* Python escape sequence ('backslashreplace')

The reason it's beneficial to be able to do these as string transformations 
rather than only in the codecs is that you may just be contributing part of the 
output, with the actual encoding operation handled elsewhere (e.g. you may be 
storing it in a data structure that will later be encoded as JSON or XML, or my 
earlier example of generating a list of files to be included in an email). 
Surrogates are great when you're just passing data straight back to the 
operating system. They're not so great when you're passing them on to other 
parts of the application as text. I'd prefer to be able to deal with them 
closer to the point of origin, at least in some cases.

Now, some of these things *can* be done today using Serhiy's trick of encoding 
to UTF-8 and then decoding again:

data.encode('utf-8', 'surrogatepass').decode('utf-8', 'replace')
data.encode('utf-8', 'replace').decode('utf-8')
data.encode('utf-8', 'ignore').decode('utf-8')

However, these two don't work properly:

data.encode('utf-8', 'xmlcharrefreplace').decode('utf-8')
data.encode('utf-8', 'backslashreplace').decode('utf-8')

The reason those don't work is because they'll encode the *surrogate escaped 
bytes*, rather than the originals.

Mapping the escaped bytes to percent encoding has the same problem - you likely 
want to do a two step transformation (escaped surrogate - original byte - 
percent encoded value), rather than directly percent encoding the already 
escaped bytes.

--

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



[issue1483545] Wave.py support for ulaw and alaw audio

2014-08-25 Thread Eric Woudenberg

Changes by Eric Woudenberg ewoudenb...@users.sourceforge.net:


--
versions: +Python 2.7 -Python 3.4
Added file: http://bugs.python.org/file36465/wave.py

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



[issue1483545] Wave.py support for ulaw and alaw audio

2014-08-25 Thread Eric Woudenberg

Changes by Eric Woudenberg ewoudenb...@users.sourceforge.net:


Added file: http://bugs.python.org/file36466/test_wave.py

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



[issue21986] Pickleability of code objects is inconsistent

2014-08-25 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage: needs patch - patch review

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



[issue20752] Difflib should provide the option of overriding the SequenceMatcher

2014-08-25 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage:  - patch review

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



[issue1764286] inspect.getsource does not work with decorated functions

2014-08-25 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage: test needed - patch review

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



[issue9731] Add ABCMeta.has_methods and tests that use it

2014-08-25 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage: needs patch - patch review

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



[issue22182] distutils.file_util.move_file unpacks wrongly an exception

2014-08-25 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage:  - patch review

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



[issue21740] doctest doesn't allow duck-typing callables

2014-08-25 Thread Claudiu Popa

Changes by Claudiu Popa pcmantic...@gmail.com:


--
stage: needs patch - patch review

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



[issue22098] Behavior of Structure inconsistent with BigEndianStructure when using __slots__

2014-08-25 Thread Claudiu Popa

Claudiu Popa added the comment:

Here's a short patch.

--
keywords: +patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file36467/issue22098.patch

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



[issue516762] have a way to search backwards for re

2014-08-25 Thread Drekin

Drekin added the comment:

Hello, I wanted to use this feature and found this issue. It is marked as 
closed, being a duplicate of another closed issue. However the feature is 
actually not present. In 2008 it was planned to be added by Matthew Barnett in 
#3825, but the work of improving re module moved to bigger project under #2636 
which resulted in regex package to be evenually included in stdlib. So unless 
regex is included in stdlib, one should try regex package (e.g. pip install 
regex).

I've put here this summary just in case there is someone like me who looked for 
the feature and found this issue.

--
nosy: +Drekin

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



[issue22098] Behavior of Structure inconsistent with BigEndianStructure when using __slots__

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks Claudiu, the patch looks good to me.

--

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



[issue22232] str.splitlines splitting on non-\r\n characters

2014-08-25 Thread R. David Murray

R. David Murray added the comment:

The existing related open doc issue issue 12855.

--

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



[issue22232] str.splitlines splitting on non-\r\n characters

2014-08-25 Thread R. David Murray

R. David Murray added the comment:

Ideally str.splitlines would split on whatever the unicode database says are 
mandatory line break characters.  I take it this is currently not true?  That 
is, that the list is hardcoded?

--

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



[issue18814] Add tools for cleaning surrogate escaped strings

2014-08-25 Thread R. David Murray

R. David Murray added the comment:

Right now having has_escaped_bytes isn't too important, since I've done nothing 
to profile and improve the performance of the new email code.  But eventually 
I'll need it, because detecting the existence of escaped bytes is inside some 
of the inner loops in the header processing code.  s != 
s.clean_escaped_bytes() (or whatever you call it) just smells wrong as a way 
to spell has_escaped_bytes.

--

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



[issue22266] fix reliance on refcounting in tarfile.gzopen

2014-08-25 Thread Brian Kearns

Brian Kearns added the comment:

Updated to backport all the cases where 3.x handles this issue.

--
Added file: http://bugs.python.org/file36468/tarfile2.patch

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



[issue1102] Add support for _msi.Record.GetString() and _msi.Record.GetInteger()

2014-08-25 Thread Anthony Tuininga

Anthony Tuininga added the comment:

I note that this patch has still not been accepted! Please let me know what 
needs to be done. I just tried against Python 3.4 and the patch works as 
expected -- other than the starting line number is now 715. I have signed the 
contributor agreement if that is what is holding things up.

--

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



[issue22266] fix reliance on refcounting in tarfile.gzopen

2014-08-25 Thread Brian Kearns

Changes by Brian Kearns bdkea...@gmail.com:


Removed file: http://bugs.python.org/file36468/tarfile2.patch

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



[issue22266] fix reliance on refcounting in tarfile.gzopen

2014-08-25 Thread Brian Kearns

Changes by Brian Kearns bdkea...@gmail.com:


Added file: http://bugs.python.org/file36469/tarfile2.patch

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



[issue22203] inspect.getargspec() returns wrong spec for builtins

2014-08-25 Thread Yury Selivanov

Changes by Yury Selivanov yselivanov...@gmail.com:


--
nosy: +yselivanov

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



[issue22272] sqlite3 memory leaks in cursor.execute

2014-08-25 Thread A. Libotean

New submission from A. Libotean:

There are significant memory leaks when multiple insert statements are executed 
with distinct values.

sqlite3 version is 2.6.0

The attached file contains two variants:

* one which uses string interpolation to build the query: this generates severe 
leakeage
* the other one is using parametrized queries and the leakeage is not as bad

I'm assuming that somehow the query string reference is not freed properly.

--
components: Extension Modules
files: leaking.py
messages: 225878
nosy: alibotean, ghaering
priority: normal
severity: normal
status: open
title: sqlite3 memory leaks in cursor.execute
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file36470/leaking.py

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



[issue22272] sqlite3 memory leaks in cursor.execute

2014-08-25 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue22272] sqlite3 memory leaks in cursor.execute

2014-08-25 Thread STINNER Victor

STINNER Victor added the comment:

leaking_tracemalloc.py: leaking.py adapted for tracemalloc.

Output:

[ Top 3 lines ]
leaking_tracemalloc.py:24: size=46.0 KiB (+46.0 KiB), count=476 (+476), 
average=99 B
leaking_tracemalloc.py:17: size=847 B (+847 B), count=6 (+6), average=141 B
/home/haypo/prog/python/default/Lib/_weakrefset.py:37: size=368 B (+368 B), 
count=2 (+2), average=184 B

I'm not sure that it's a leak because it doesn't depend on the number of 
queries nor the number of run of the test. It's maybe an internal sqlite cache.

--
Added file: http://bugs.python.org/file36471/leaking_tracemalloc.py

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



[issue22269] Resolve distutils option conflicts with priorities

2014-08-25 Thread Tim Smith

Changes by Tim Smith pythonb...@tim-smith.us:


--
nosy: +tdsmith

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



[issue22257] PEP 432: Redesign the interpreter startup sequence

2014-08-25 Thread Gregory Salvan

Gregory Salvan added the comment:

In case it helps, I've experienced a similar refactoring.

we used a pattern of stages and services:
- stages represent a state of the application (like Pre-Initialization, 
Initializing, Initialized...), they are composed of services
- services represent a key responsability over the system (set program name, 
set python home...)

The launching sequence was determined by a game of dependencies.
  ex: Initialized claims it requires Initializing which claims it requires 
Pre-Initialisation...
So when you ask to load stage Initialized the launcher can construct then run 
the sequence: Pre-Initialisation - Initializing - Initialized.

We used same mechanisms for Services.

This way you can insert/append new stages or services just by creating them and 
declaring they should be run after X and/or before Y.  

Key benefits:
- easy to maintain and extend, flexible
- thread safe, launcher/runner can take the decision to parallelize. To serve 
this purpose each service can take a context object and return the context 
object that will be passed to the next service, between each stages contexts 
are merged if parallelized...
- easy to debug: you've got error messages like: At Stage X, service Y fails 
with error message Z.
- optimization friendly: while debugging you can measure the time taken by each 
service and compare it with and older version of the system for example.
- few changes to original code, it's just copy/pasting chunk of code.

Drawbacks:
- it's hard for developpers to have a picture of what happens, this require to 
make a launcher/debugger which can dump the launching sequence.

--
nosy: +Gregory.Salvan

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



[issue22273] abort when passing certain structs by value using ctypes

2014-08-25 Thread Weeble

New submission from Weeble:

I'm not 100% certain this is a bug yet, but I'm beginning to think it's likely.

On 64-bit Linux, I can't pass a struct like this:

struct S { uint8_t data[16]; };

...to a function declared like this:

void f(struct S);

From experimentation with various integer types and array sizes, it seems this 
causes an abort somewhere in libffi any time the array is between 9 and 16 
bytes in size. If the array is smaller or larger than that, the calls work as 
expected.

I've asked about this here: 
http://stackoverflow.com/questions/25487928/is-this-the-correct-way-to-pass-a-struct-by-value-in-ctypes

Here's some test code:

## sum.cpp

#include cstdint

using std::size_t;

struct ArrayStruct {
// We'll define ARRAY_TYPE and ARRAY_SIZE on the
// command-line when we compile.
std::ARRAY_TYPE data[ARRAY_SIZE];
};

extern C int64_t sum(struct ArrayStruct array)
{
int64_t acc=0;
for (size_t i=0; i!=ARRAY_SIZE; ++i)
{
acc+=array.data[i];
}
return acc;
}

## sum.py
import ctypes
import sys

def main():
array_size = int(sys.argv[1])
array_type = sys.argv[2]

libsum = ctypes.cdll.LoadLibrary('./libsum.so')

ArrType = getattr(ctypes, 'c_' + array_type) * array_size

class MyStruct(ctypes.Structure):
_fields_ = [(data, ArrType)]

m=MyStruct()
for i in range(array_size):
m.data[i]=i

print(libsum.sum(m))

if __name__ == '__main__':
main()

## Build/run

$ g++ -g -shared -Wall -fPIC sum.cpp -o libsum.so -std=c++11 -D 
ARRAY_SIZE=16 -D ARRAY_TYPE=uint8_t  python3 sum.py 16 uint8
Aborted (core dumped)

I poked around a little bit in gdb. It's aborting in libffi's ffi_call 
function: https://github.com/atgreen/libffi/blob/v3.0.13/src/x86/ffi64.c#L516

(gdb) bt
#0  0x7782cf79 in __GI_raise (sig=sig@entry=6) at 
../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1  0x77830388 in __GI_abort () at abort.c:89
#2  0x767134f5 in ffi_call (cif=0x7fffd7b0, fn=0x7650c625 
sum(ArrayStruct), rvalue=0x7fffd6f0, avalue=0x7fffd6d0) at 
../src/x86/ffi64.c:516
#3  0x7691fee3 in _ctypes_callproc () from 
/usr/lib/python3.4/lib-dynload/_ctypes.cpython-34m-x86_64-linux-gnu.so
#4  0x76920578 in ?? () from 
/usr/lib/python3.4/lib-dynload/_ctypes.cpython-34m-x86_64-linux-gnu.so
#5  0x0043810a in PyObject_Call ()
#6  0x00579f45 in PyEval_EvalFrameEx ()
#7  0x0057d3d3 in PyEval_EvalCodeEx ()
#8  0x0057bfaa in PyEval_EvalFrameEx ()
#9  0x0057d3d3 in PyEval_EvalCodeEx ()
#10 0x0060ba83 in PyRun_FileExFlags ()
#11 0x0060bc85 in PyRun_SimpleFileExFlags ()
#12 0x0060d3ac in Py_Main ()
#13 0x0041ec0d in main ()
(gdb) frame 2
#2  0x767134f5 in ffi_call (cif=0x7fffd7b0, fn=0x7650c625 
sum(ArrayStruct), rvalue=0x7fffd6f0, avalue=0x7fffd6d0) at 
../src/x86/ffi64.c:516
516   abort();
(gdb) info args
cif = 0x7fffd7b0
fn = 0x7650c625 sum(ArrayStruct)
rvalue = 0x7fffd6f0
avalue = 0x7fffd6d0
(gdb) info locals
a = optimized out
j = optimized out
size = 8
n = optimized out
classes = {X86_64_INTEGER_CLASS, X86_64_NO_CLASS, 4294956784, 32767}
stack = 0x7fffd4f0 
argp = 0x7fffd5a0 \001
arg_types = 0x7fffd6b0
gprcount = 1
ssecount = optimized out
ngpr = 1
nsse = 0
i = optimized out
avn = optimized out
ret_in_memory = optimized out
reg_args = 0x7fffd4f0
(gdb) print *cif
$2 = {abi = FFI_UNIX64, nargs = 1, arg_types = 0x7fffd6b0, rtype = 
0x76b5e228, bytes = 0, flags = 10}

It looks like we're trying to pass the struct in two registers, which I think 
is what's supposed to happen, but something is going wrong with the second 
register. It aborted because it has class X86_64_NO_CLASS and that's not 
handled by the switch.

I don't know if this is a bug in libffi, or if ctypes is feeding it bad 
information, or if I'm feeding ctypes bad information. I hope this information 
is useful for anyone investigating.

I get the same abort in both Python 2.7.6 and 3.4.0.

I originally stumbled across this issue trying to use PySDL2:

http://pysdl2.readthedocs.org/en/rel_0_9_3/

I was trying to call SDL_JoystickGetGUIDString, which uses a similar 
struct-by-value call:

http://hg.libsdl.org/SDL/file/92ca74200ea5/include/SDL_joystick.h

--
components: ctypes
messages: 225881
nosy: weeble
priority: normal
severity: normal
status: open
title: abort when passing certain structs by value using ctypes
type: crash
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22273
___
___
Python-bugs-list mailing list
Unsubscribe: 

[issue18530] posixpath.ismount performs extra lstat calls

2014-08-25 Thread Alex Gaynor

Alex Gaynor added the comment:

Ok, this was landed, 3.3 is no longer open so closing this.

--
resolution:  - fixed
status: open - closed

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



[issue22239] asyncio: nested event loop

2014-08-25 Thread Guido van Rossum

Guido van Rossum added the comment:

While I understand your problem, I really do not want to enable recursive event 
loops. While they are popular in some event systems (IIRC libevent relies 
heavily on the concept), I have heard some strong objections from other parts, 
and I am trying to keep the basic event loop functionality limited to encourage 
interoperability with other even loop systems (e.g. Tornado, Twisted).

In my own experience, the very programming technique that you are proposing has 
caused some very hard to debug problems that appeared as very infrequent and 
hard to predict stack overflows.

I understand this will make your code slightly less elegant in some cases, but 
I think in the end it is for the best if you are required to define an explicit 
method (declared to be a coroutine) for membership testing of a remote object.  
The explicit yield from will help the readers of your code understand that 
global state may change (due to other callbacks running while you are blocked), 
and potentially help a static analyzer find bugs in your code before they take 
down your production systems.

--
resolution:  - wont fix
status: open - closed

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



[issue20994] Disable TLS Compression

2014-08-25 Thread Alex Gaynor

Alex Gaynor added the comment:

Pinging on this, since the SSL backport landed, concerns about an inability to 
change this behavior on python2 are no longer there. At a minimum I think we 
should include this flag in the default and stdlib contexts.

--

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



[issue20994] Disable TLS Compression

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Now that the backport has landed, I think you're welcome to do any further 
necessary tweaks.

By the way, as mentioned in the comments, I think we could add 
SSL_OP_NO_COMPRESSION to ssl.OP_ALL in all versions.

--

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



[issue21307] PEP 466: backport hashlib changes

2014-08-25 Thread Donald Stufft

Donald Stufft added the comment:

This Look good to me. +1

--

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



[issue22260] Rearrange tkinter tests, use test discovery

2014-08-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Currently when I run

DISPLAY= ./python -Wall -b -m test.regrtest -vu gui test_tcl test_tk 
test_ttk_textonly test_ttk_guionly

skipped tests are enumerated at the end of test log:

2 tests OK.
2 tests skipped:
test_tk test_ttk_guionly

With the patch the result of

DISPLAY= ./python -Wall -b -m test.regrtest -vuall test_tcl test_tkinter

is:

OK (skipped=33)
All 2 tests OK.

There is a difference. In first case it is clean that entire component is 
unusable on current platform or configuration. In second case entire test is 
reported as successfully passed in general, only several testcases are skipped, 
but their reports are lost in the middle of long log.

--

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



[issue18530] posixpath.ismount performs extra lstat calls

2014-08-25 Thread Berker Peksag

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


--
stage: patch review - resolved

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



[issue22269] Resolve distutils option conflicts with priorities

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hmm... if it's only about --prefix vs. --user, we could let --user take 
precedence and issue a warning instead of an error.

--
nosy: +pitrou

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



[issue18814] Add tools for cleaning surrogate escaped strings

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

data.encode('utf-8', 'replace').decode('utf-8')
data.encode('utf-8', 'ignore').decode('utf-8')

Why not the reverse:

os.fsencode(data).decode('utf-8', 'replace')
os.fsencode(data).decode('utf-8', 'ignore')

Note that backslashreplace needs to be enhanced to work when decoding too.
Note that xmlcharrefreplace doesn't make sense here: it encodes a *character* 
reference, but you're precisely trying to represent something which fails 
interpreting as a character.

(AFAIK, XML can't represent non-text data, except in NDATA sequences)

--

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



[issue22213] Make pyvenv style virtual environments easier to configure when embedding Python

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That workaround would definitely deserve being wrapped in a higher-level API 
invokable by embedding applications, IMHO.

--
nosy: +pitrou
versions: +Python 3.5 -Python 3.4

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



[issue21480] A build now requires...

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Dict comprehensions actually work with Python 2.7 as well. I don't think making 
that part of the build process 2.6-compatible would bring us much.

Unless you're specifically modifying the Python syntax, you should be able to 
skip that part by running make touch.

--

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



[issue22235] httplib: TypeError with file() object in ssl.py

2014-08-25 Thread Etienne Robillard

Etienne Robillard added the comment:

the bug appear to be reproducible with python 2.7.2 as well. I wonder
if --enable-shared is relevant to this problem.
My configuration options:

./configure --prefix=/usr/local --enable-unicode=ucs4 --with-threads 
--enable-shared --disable-ipv6 --with-pymalloc

openssl version:
OpenSSL version
OpenSSL 1.0.1e 11 Feb 2013

perhaps this openssl version breaks specifically python 2.7.x ?

--

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



[issue21965] Add support for Memory BIO to _ssl

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Geert, are you still trying to work on this?

--

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



[issue22182] distutils.file_util.move_file unpacks wrongly an exception

2014-08-25 Thread Berker Peksag

Berker Peksag added the comment:

LGTM. The second test should be named different, but I will fix it myself. 
Thanks for the patch!

--
assignee:  - berker.peksag
nosy: +berker.peksag
stage: patch review - commit review
versions: +Python 3.4

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



[issue21965] Add support for Memory BIO to _ssl

2014-08-25 Thread Geert Jansen

Geert Jansen added the comment:

Antoine, yes, I just got back from holiday. I will have an updated patch 
tomorrow.

--

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



[issue22263] Add a resource for CLI tests

2014-08-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Or you could use the existing cpu resource.

--

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



[issue21965] Add support for Memory BIO to _ssl

2014-08-25 Thread Alex Gaynor

Changes by Alex Gaynor alex.gay...@gmail.com:


--
nosy: +alex

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



[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

2014-08-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 877c8442b992 by Victor Stinner in branch '3.4':
asyncio: sync with Tulip
http://hg.python.org/cpython/rev/877c8442b992

New changeset 63cabfde945f by Victor Stinner in branch 'default':
(Merge 3.4) asyncio: sync with Tulip
http://hg.python.org/cpython/rev/63cabfde945f

--

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



[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-25 Thread Akira Li

New submission from Akira Li:

The following command should not produce any output but it does:

  $ ./python /dev/null -c 'import subprocess as S, sys; 
S.call([sys.executable, -c, import sys; print(42, file=sys.stderr)], 
stderr=S.STDOUT)'

Its stdout is redirected to /dev/null. It starts a subprocess with its
stderr redirected to stdout. See Redirect subprocess stderr to
stdout [1] on Stackoverflow.

[1] 
http://stackoverflow.com/questions/11495783/redirect-subprocess-stderr-to-stdout

I've uploaded a patch that fixes the issue on POSIX.

Please, run the provided test (in the patch), to see whether the code
should be fixed on Windows too (it might work as is there).

No documentation changes are required.

Please, review.

--
components: Library (Lib)
files: subprocess-stderr_redirect_with_no_stdout_redirect.diff
keywords: patch
messages: 225898
nosy: akira
priority: normal
severity: normal
status: open
title: subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to 
stdout
type: behavior
versions: Python 3.4
Added file: 
http://bugs.python.org/file36472/subprocess-stderr_redirect_with_no_stdout_redirect.diff

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



[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-25 Thread Ned Deily

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


--
nosy: +gregory.p.smith
stage:  - patch review

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



[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-25 Thread R. David Murray

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


--
nosy: +r.david.murray

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



[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

2014-08-25 Thread STINNER Victor

STINNER Victor added the comment:

sock_nonblocking_doc.patch: fix connect_read_pipe/connect_write_pipe, 
sock_sendall/sock_recv/sock_accept/sock_connect documentation to mention that 
the non-blocking behaviour is specific to the SelectorEventLoop.

--
keywords: +patch
Added file: http://bugs.python.org/file36473/sock_nonblocking_doc.patch

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



[issue12933] Update or remove claims that distutils requires external programs

2014-08-25 Thread Vishal Lal

Vishal Lal added the comment:

ping

--

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



[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

2014-08-25 Thread Guido van Rossum

Guido van Rossum added the comment:

LGTM

--

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



[issue22275] asyncio: enhance documentation of OS support

2014-08-25 Thread STINNER Victor

New submission from STINNER Victor:

When reading asyncio documentation, it's not easy to catch limitations of each 
operating system and event loop. I propose to mention in each mention if the 
method is not supported in some cases. See attached patch.

--
assignee: docs@python
components: Documentation, asyncio
files: asyncio_os_support.patch
keywords: patch
messages: 225902
nosy: docs@python, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: enhance documentation of OS support
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file36474/asyncio_os_support.patch

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



[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

2014-08-25 Thread STINNER Victor

STINNER Victor added the comment:

 It may also help to mention directly in BaseEventLoop.connect_read_pipe() doc 
 that it is not available on Windows when using the SelectorEventLoop.

I created the issue #22275 for this point.

--

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



[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

2014-08-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b94da2b69d13 by Victor Stinner in branch '3.4':
Issue #22063: Fix asyncio documentation of socket and pipe operations regarding
http://hg.python.org/cpython/rev/b94da2b69d13

New changeset 74236c8bf064 by Victor Stinner in branch 'default':
(Merge 3.4) Issue #22063: Fix asyncio documentation of socket and pipe
http://hg.python.org/cpython/rev/74236c8bf064

--

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



[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

2014-08-25 Thread STINNER Victor

STINNER Victor added the comment:

 LGTM

Thanks for the review. I commited sock_nonblocking_doc.patch.

This issue is now fully fixed. It was more tricky than what I expected.

--

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



[issue22063] asyncio: sock_xxx() methods of event loops should check ath sockets are non-blocking

2014-08-25 Thread STINNER Victor

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


--
resolution:  - fixed
status: open - closed

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



[issue22117] Rewrite pytime.h to work on nanoseconds

2014-08-25 Thread STINNER Victor

STINNER Victor added the comment:

 The Linux kernel is going to use 64-bit integer even on 32-bit CPU to store 
 timestamps, to simplify the code (to avoid the structure).

Read this article: http://lwn.net/Articles/607741/

One of the first changes merged for 3.17 is to simply get rid of the 
non-scalar form of ktime_t and force all architectures to use the 64-bit 
nanosecond count representation. This change may slow things down on 32-bit 
systems; in particular, conversions from other time formats may be 
significantly slower. But, as noted in the changelog, the ARM and x86 
architectures were already using the scalar format anyway, so they will not get 
any slower.

--

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



[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-25 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Okay, dumb question: Is there a reason the Windows code explicitly initializes 
c2pwrite in the stdout not passed case, while the Linux code leaves it as -1? 
Windows doesn't look like it would have the problem (because c2pwrite is always 
set to a non-default value), and it seems like the fix for Linux could just 
mimic the Windows approach; the code that sets errwrite wouldn't change, but 
instead of a pass, when stdout is None, we'd explicitly set it to 
os.STDOUT_FILENO, and the stderr=subprocess.STDOUT (stdout unset) case would 
work automatically, and the code would be more similar.

Haven't explored the negative consequences of that change, if any.

--
nosy: +josh.rosenberg

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



[issue22274] subprocess.Popen(stderr=STDOUT) fails to redirect subprocess stderr to stdout

2014-08-25 Thread STINNER Victor

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


--
nosy: +haypo

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