[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Better way is data = data.cast('B').

--

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



[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

 Better way is data = data.cast('B').

Why is this cast required? Can you please elaborate? If some memoryview must be 
rejected, again, we need more unit tests.

--

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



[issue23685] Fix usage of PyMODINIT_FUNC

2015-03-17 Thread Steve Dower

Steve Dower added the comment:

I don't think we should be using PyMODINIT_FUNC for builtin modules, since that 
will make the init functions publicly available from python35.dll. That said, I 
do like being able to be consistent here... can we define PyMODINIT_FUNC 
differently when building pythoncore? That at least would keep the definitions 
in the same place if we ever change it (and since there's an open PEP regarding 
extension modules, it doesn't seem impossible).

The change for pyexpat looks right, since that's an external module. I have no 
ideas why PyMODINIT_FUNC wouldn't always be defined there.

--

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



[issue23685] Fix usage of PyMODINIT_FUNC

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

I don't think we should be using PyMODINIT_FUNC for builtin modules, since 
that will make the init functions publicly available from python35.dll.

Do you mean that my change on PC/config.c is wrong?

For example, Modules/arraymodule.c already contains:

PyMODINIT_FUNC PyInit_array(void).

Is the PyInit_array symbol exported today or not on Windows?

If you think that the PyInit_array symbol should be private, maybe there is 
already an issue in Modules/arraymodule.c?

can we define PyMODINIT_FUNC differently when building pythoncore?

We can add a different macro for builtin modules. Using the issue #11410, we 
may use it to hide the symbols: __attribute__((visibility(hidden))).

--

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



[issue23695] idiom for clustering a data series into n-length groups

2015-03-17 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger
nosy: +rhettinger

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



[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-17 Thread Martin Panter

Martin Panter added the comment:

I would say that the current patch looks correct enough, in that it would still 
get the correct lengths when a memoryview() object is passed in. The zlib 
module’s crc32() function and compress() method already seem to support 
arbitrary bytes-like objects.

But to make GzipFile.write() also accept arbitrary bytes-like objects, you 
probably only need to change the code calculating the length to something like:

with memoryview(data) as view:
length = view.nbytes

# Go on to call compress(data) and crc32(data)

--
nosy: +vadmium

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



[issue23207] logging.basicConfig does not validate keyword arguments

2015-03-17 Thread Jeremy Goss

Jeremy Goss added the comment:

The argument validation in basicConfig has introduced another problem.
I cannot pass in an optional filename/filemode argument pair.

Previously, I passed in an optional logfile argument from ArgumentParser (which 
could be None). Now, I get a ValueError because filemode is not popped if 
filename is None.

logging.basicConfig(..., filename=args.logfile, filemode=w)
...
ValueError: Unrecognised argument(s): filemode

Suggested fix to place mode assignment alongside filename in basicConfig():
filename = kwargs.pop(filename, None)
mode = kwargs.pop(filemode, 'a')
if filename:
h = FileHandler(filename, mode)

--
nosy: +Jeremy Goss

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



[issue19495] context manager for measuring duration of blocks of code

2015-03-17 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue19351] python msi installers - silent mode

2015-03-17 Thread Doug Rohm

Doug Rohm added the comment:

I realize this hasn't been commented on for a long time, but I'm noticing the 
same issue trying to do a silent install with the 3.4.3 x64 windows installer.  
The 3.4.2 x64 windows installer worked perfectly fine, but I can't seem to get 
the registry and add/remove entries to work with 3.4.3.  I tried fiddling with 
ALLUSERS=1 and ALLUSERS= and the results were the same.

Were there any changes to the windows x64 installer from 3.4.2 to 3.4.3 in 
regards to this issue?

--
nosy: +drohm

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



[issue23695] idiom for clustering a data series into n-length groups

2015-03-17 Thread Paddy McCarthy

Paddy McCarthy added the comment:

Hmmm. It seems that the problem isn't to do with the fact that it works, or how 
to apply it; the problem is with *how* it works. 

Making it an idiom means that too many will use it without knowing why it works 
which could lead to later maintenance issues. I think a better description of 
how it works may be needed for the docs.

Unfortunately my description of the how at 
http://paddy3118.blogspot.co.uk/2012/12/that-grouping-by-zipiter-trick-explained.html
 was not written with the docs in mind, but you are welcome to any part or the 
whole, for the Python docs.

--

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



[issue23441] rlcompleter: tab on empty prefix = insert spaces

2015-03-17 Thread R. David Murray

R. David Murray added the comment:

The CLI is a UI.  We're using readline facilities (ie: the terminal) to 
improve it.  And people cut and paste from the interactive terminal, so I think 
the presence of tab characters is a negative from that perspective as well.

--

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-03-17 Thread Ned Deily

Ned Deily added the comment:

FD_CLOEXEC is first support on OS X 10.5.  Here's a patch to skip the test on 
earlier systems: tested on 10.4, 10.5, and 10.10.

--
nosy: +ned.deily
stage:  - commit review
Added file: http://bugs.python.org/file38516/issue23458_tiger.patch

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



[issue12855] linebreak sequences should be better documented

2015-03-17 Thread Martin Panter

Martin Panter added the comment:

Note to self, or anyone else handling this patch: See 
https://bugs.python.org/issue22232#msg225769 for further improvement ideas:

* Might be good to bring back the reference to universal newlines, but say it 
accepts additional line boundaries
* Terry also suggested a doc string improvement

--

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



[issue22233] http.client splits headers on none-\r\n characters

2015-03-17 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22233
___
___
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

2015-03-17 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

___
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



[issue23624] str.center inconsistent with format ^

2015-03-17 Thread Vedran Čačić

Vedran Čačić added the comment:

Only one detail to resolve: you say format is quite capable of handing a 
variable width field.

It does, but not in a really nice way. Honestly, would you really rather see

{:^{}}.format(title, width)

than

title.center(width)

? Nested formats are ugly, I think that's a consensus. :-) Not to mention that 
.center is more explicit about what's going on - that ^ is almost lost in 
that brace-forest.

--

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



[issue22852] urllib.parse wrongly strips empty #fragment

2015-03-17 Thread Demian Brecht

Demian Brecht added the comment:

 I cannot imagine some existing code (other than an exploit) that would be 
 broken by restoring the empty “//” component; do you have an example?

You're likely right about the usage (I can't think of a plausible use case at 
any rate).

At first read of #23505, I think I agree with the changes you've made to allow 
for successful round-tripping, but I'd think it'll have to be vetted by at 
least more than one core dev.

--

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



[issue2211] Cookie.Morsel interface needs update

2015-03-17 Thread Demian Brecht

Demian Brecht added the comment:

Thanks for the updates Serhiy. All look good to me.

--

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



[issue1553375] Add traceback.print_full_exception()

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

That should be straightforward - its just sequence suffix/prefix overlap 
detection, and FrameSummary (unlike frames) can be compared with ==. So yes, I 
think it makes it easier. It's not on my immediate itch-scratching though, but 
if someone were to poke at it and need any feedback / thoughts I'd be delighted 
to do so.

--

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



[issue18983] Specify time unit for timeit CLI

2015-03-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1ebf8d5b7d60 by Robert Collins in branch 'default':
Issue #18983: Allow selection of output units in timeit.
https://hg.python.org/cpython/rev/1ebf8d5b7d60

--
nosy: +python-dev

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



[issue2211] Cookie.Morsel interface needs update

2015-03-17 Thread Demian Brecht

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


--
stage: patch review - commit review

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



[issue23552] Have timeit warn about runs that are not independent of each other

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

I think for PyPI its actually important here - the JIT'd state of the code is 
essentially global state being mutated - you can't assess how fast the code is 
without first warming up the JIT, and if it warms up half way through your 
fastest run, you're still not actually finding out what you might want to find 
out.

E.g. do you want to know:
 - how fast is this unjitted [e.g. CLI's]
 - how fast will this be once its hot [e.g. services]

Personally, I think as a first approximation, warning about massive variance is 
a good thing. We could add an option to turn it off, and we could also look at 
hooking properly into the jit to allow detection of stable state and benchmark 
only from there on in. But those extra things don't detract from the utility of 
warning about suspect runs.

--
nosy: +rbcollins

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



[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

With the pystate_cplusplus.patch I was able to compile both min_example.tar.gz 
and my actual extension.  So I with your patch, it does work.  Thank you.

Cool! I applied this simple patch instead of trying to write an ugly glue in 
pyatomic.h between C and C++.

C and C++ simply look to be incompatible for handling atomic types :-/ The good 
news is that we don't them atomic types for Python extensions, only to compile 
Python core.

Thanks for the report. I prefer to detect such annoying issue before a .0 
release (3.5.0). FYI it's a regression introduced by the issue #22038 which 
started to use stdatomic.h (but it's now fixed).

--
resolution:  - fixed
status: open - closed

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



[issue18983] Specify time unit for timeit CLI

2015-03-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed34dd00405e by Robert Collins in branch 'default':
Fix patch attribution for issue 18983.
https://hg.python.org/cpython/rev/ed34dd00405e

--

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



[issue23183] timeit CLI best of 3: undocumented output format

2015-03-17 Thread Robert Collins

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


--
nosy: +rbcollins

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



[issue23606] ctypes.util.find_library(c) no longer makes sense

2015-03-17 Thread Steve Dower

Steve Dower added the comment:

Pretty much, except the entry point DLL version won't increment unless there's 
a breaking change to the API. So you have to know where it's from, but (AIUI) 
the l1-0-0 file will always be available. At some point it may turn into a 
wrapper rather than a redirect, but that doesn't really matter.

I'm not sure there's any better way to provide access to the functions other 
than adding them to msvcrtmodule. It's more work, but far more friendly. I hope 
we have a pretty low bar for adding functions to that module.

--

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



[issue23689] Memory leak in Modules/sre_lib.h

2015-03-17 Thread Serhiy Storchaka

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


--
nosy: +serhiy.storchaka

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



[issue18983] Specify time unit for timeit CLI

2015-03-17 Thread Robert Collins

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


--
nosy: +rbcollins
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue23631] 3.5 (a2) traceback regression snarls Idle

2015-03-17 Thread Berker Peksag

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


--
stage: needs patch - resolved

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



[issue23183] timeit CLI best of 3: undocumented output format

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

Here is a patch with some prose - feedback appreciated!

--
keywords: +patch
Added file: http://bugs.python.org/file38531/issue-23183-1.patch

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



[issue23183] timeit CLI best of 3: undocumented output format

2015-03-17 Thread Robert Collins

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


--
stage:  - patch review

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



[issue23689] Memory leak in Modules/sre_lib.h

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

Oh cool, you wrote a script to reproduce the issue! And Serhiy wrote a patch, 
great! Great job guys.

sre_clean_repeat_data.patch looks good to me.

@Serhiy: Can you try the example to ensure that it fixes the issue? If yes, go 
ahead!

--

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



[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

 While we are here, it is possible to add the support of general byte-like 
 objects.

With and without the patch, write() accepts bytes, bytearray and memoryview. 
Which other byte-like types do you know?

writeframesraw() method of aifc, sunau and wave modules use this pattern:

if not isinstance(data, (bytes, bytearray)):
data = memoryview(data).cast('B')

We can maybe reuse it in gzip module?

--

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



[issue6422] timeit called from within Python should allow autoranging

2015-03-17 Thread Robert Collins

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


--
nosy: +rbcollins
stage: needs patch - patch review

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



[issue23552] Have timeit warn about runs that are not independent of each other

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

Reviewed on rietvald.

--
stage:  - patch review

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



[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cb05b6d7aacd by Victor Stinner in branch 'default':
Issue #23644: Fix issues with C++ when compiling Python extensions
https://hg.python.org/cpython/rev/cb05b6d7aacd

--

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



[issue23606] ctypes.util.find_library(c) no longer makes sense

2015-03-17 Thread eryksun

eryksun added the comment:

Say I need to use ctypes to call _wsopen_s to open a file without write 
sharing. If I read you correctly, you're saying I'll need to know it's exported 
by api-ms-win-crt-stdio-l1-1-0.dll? Does the 'l1-1-0' suffix reflect a version 
number that will be incremented over time? If so, how about adding an API that 
maps 'stdio' to the version that Python is linked against?

--

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



[issue23690] re functions never release GIL

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

 Aren't Python strings immutable?

Yes. But the re module supports more types than just str and bytes. For 
example, bytearray is also accepted:

 re.match(b'^abc', b'abc')
_sre.SRE_Match object; span=(0, 3), match=b'abc'
 re.match(b'^abc', bytearray(b'abc'))
_sre.SRE_Match object; span=(0, 3), match=b'abc'

 Also, match functions still permit execution of signal handlers, which can 
 execute any Python code.

Correct, signal handlers are called. If you mutate the string currently used in 
the pattern matching, you can probably crash Python. I hope that nobody does 
such ugly things in Python signal handlers :-)

 If GIL is needed during matching, can it be released temporarily to permit 
 thread switching?

It's possible to modify the _sre module to release the GIL in some cases. It's 
possible to release the GIL for immutables string, and keep the GIL for mutable 
strings. To do this, you have to audit the source code. First, ensure that no 
global variable is used. For example, the state must not be shared (it's ok, 
it's allocated on the stack, thread stacks are not shared).

If you start to release the GIL, you have to search for all functions which 
must be called with the GIL hold. For example, memory allocators, but also all 
functions manipulating Python objects. Hint: seach PyObject*. For example, 
getslice() must be called with the GIL hold.

Since the GIL is a lock, you should benchmark to ensure that sequences of 
acquire/release the GIL doesn't kill performances with a single thread, and 
with multiple threads. Anyway, a benchmark will be needed.

To be clear: I'm *not* interested to optimize the _sre module to release the 
GIL (to support parallel executions).

--

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



[issue22038] Implement atomic operations on non-x86 platforms

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

stdatomic.h is not compatible with C++: I disabled completly pyatomic.h on 
C++. pyatomic.h is only needed by Python core, not to compile Python 
extensions, so it's not an issue.

--

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



[issue23679] SSL Ciphers RC4

2015-03-17 Thread mogli

mogli added the comment:

That was fast, great job!

For the record: The SSLv3 issue I also wrote about was a false positive because 
the test only works with Javascript. Python 2.7.9 has SSLv3 disabled by default 
as it should.

urllib2.urlopen(https://sslv3.dshield.org;)  # fails as it should

--

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



[issue23685] Fix usage of PyMODINIT_FUNC

2015-03-17 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch fixes the usage of the PyMODINIT_FUNC macro.

My patch is based on Thomas Wouters's patch of the issue #11410.

I don't understand why Modules/pyexpat.c redefined PyMODINIT_FUNC if not 
defined. In which case PyMODINIT_FUNC was not defined?

I'm not sure that PC/config.c should use PyMODINIT_FUNC instead of use 
PyObject*.

@Steve.Dower: Does my change to PC/config.c look correct or not?

--
components: Build, Windows
files: PyMODINIT_FUNC.patch
keywords: patch
messages: 238272
nosy: haypo, loewis, pitrou, steve.dower, tim.golden, twouters, zach.ware
priority: normal
severity: normal
status: open
title: Fix usage of PyMODINIT_FUNC
versions: Python 3.5
Added file: http://bugs.python.org/file38517/PyMODINIT_FUNC.patch

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



[issue23646] PEP 475: handle EINTR in the time module, retry sleep()

2015-03-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4accc35cbfcf by Victor Stinner in branch 'default':
Revert changeset d927047b1d8eb87738676980a24930d053ba2150
https://hg.python.org/cpython/rev/4accc35cbfcf

--
nosy: +python-dev

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



[issue23625] load_module() docs: zipped eggs are not loaded.

2015-03-17 Thread Paul Moore

Paul Moore added the comment:

Egg files are a format defined by setuptools. If you look in the setuptools 
documentation it notes that egg files are simply zipfiles with a particular 
structure and naming convention. So from a core Python perspective, you can use 
eggs just like any other zipfile. See the zipimport documentation for further 
details if you need them.

To further confuse the issue, setuptools includes some pretty complex 
mechanisms for adding eggs to syst.path so that their contents can be imported 
(there are .pth files and multi-version support, for example). Those mechanisms 
are part of setuptools, not of core Python. From a core Python perspective, the 
path handling is something you do manually.

So while I understand your confusion, I think you should understand that it is 
a confusion over the setuptools implementation, and how it interacts with the 
mechanisms defined by core Python (which are defined in terms of zipfiles). So 
if you feel there are any documentation issues, they should probably be 
addressed by setuptools rather than in the core docs.

On a peripherally related point, your comment zipped egg files in sys.path are 
not found doesn't really explain your problem very well. When reporting to 
setuptools, I'd suggest that you need to clarify your problem a bit better - 
what steps did you take, did they match the steps that the setuptools docs tell 
you to use, and how did the failure show itself? But as I say, that's for a 
setuptools bug report.

--
nosy: +paul.moore

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



[issue11410] Use GCC visibility attrs in PyAPI_*

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

I extracted the changes on the PyMODINIT_FUNC macro and I opened the issue 
#23685.

--

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



[issue23625] load_module() docs: zipped eggs are not loaded.

2015-03-17 Thread Thomas Guettler

Thomas Guettler added the comment:

The docs should be where new users look.

I don't speak about several hundret words 

Where do you think new users look for documentation if they want a method which 
does find a module?

--

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

Ned Deily added the comment:
 FD_CLOEXEC is first support on OS X 10.5.  Here's a patch to skip the test on 
 earlier systems: tested on 10.4, 10.5, and 10.10.

What do you mean by first support? Does it mean that fcntl(fd, F_SETFD, 
FD_CLOEXEC) is simply a no-op?

Does Python 3.4 with the PEP 446 works on OS X 10.4? Can you test the following 
example?

Python 3.4.1 (default, Nov  3 2014, 14:38:10)
[GCC 4.9.1 20140930 (Red Hat 4.9.1-11)] on linux
Type help, copyright, credits or license for more information.
 import os
 fd=os.open('.', os.O_RDONLY)
 os.get_inheritable(fd)
False
 os.set_inheritable(fd, True)
 os.get_inheritable(fd)
True

--

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



[issue23646] PEP 475: handle EINTR in the time module, retry sleep()

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

I commited sleep_eintr.patch by mistake. After this change, test_socket started 
to fail on Windows. I don't understand why.

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/5836/steps/test/logs/stdio

==
ERROR: testClose (test.test_socket.TCPCloserTest)
--
Traceback (most recent call last):
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_socket.py, 
line 3723, in testClose
read, write, err = select.select([sd], [], [], 1.0)
TypeError: argument must be an int, or have a fileno() method.

==
FAIL: testRecv (test.test_socket.NonBlockingTCPTests)
--
Traceback (most recent call last):
  File C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_socket.py, 
line 3883, in testRecv
self.fail(Error trying to do non-blocking recv.)
AssertionError: Error trying to do non-blocking recv.

--

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



[issue11410] Use GCC visibility attrs in PyAPI_*

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

+#if defined(__GNUC__)  __GNUC__ = 4
+#   define HAVE_ATTRIBUTE_VISIBILITY
+#endif

Clang now also supports __attribute__((visibility(...))). I don't know since 
which version.

I'm not sure because I don't see it:
http://clang.llvm.org/docs/AttributeReference.html

I see it there:
http://llvm.org/docs/LangRef.html#visibility-styles

--

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



[issue23625] load_module() docs: zipped eggs are not loaded.

2015-03-17 Thread Thomas Guettler

Thomas Guettler added the comment:

In this case I am wearing newbee user glasses.

And with this glasses on my nose, I don't care for implementation.

I am confused that imp module does not work like import foo.

--

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



[issue11410] Use GCC visibility attrs in PyAPI_*

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

 The getargs.c change *is* necessary, although it doesn't have to be that 
 exact change.

Why not moving these declarations to Include/modsupport.h where 
_PyArg_Parse...() are already used?

--

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



[issue11410] Use GCC visibility attrs in PyAPI_*

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

In the issue #23685, I proposed a patch to add _PyBUILTIN_MODINIT_FUNC for 
builtin modules. It makes possible to hide PyInit_xxx symbols of builtin 
symbols with __attribute__((visibility(hidden))). It also avoids to export 
these privates symbols on Windows in the Python DLL (and on Linux in the Python 
.so library).

--

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



[issue23689] Memory leak in Modules/sre_lib.h

2015-03-17 Thread Evgeny Kapun

Evgeny Kapun added the comment:

Memory leak only happens if match operation terminates abruptly, e.g. because 
of SIGINT. In this case, DO_JUMP doesn't come back.

--

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



[issue23689] Memory leak in Modules/sre_lib.h

2015-03-17 Thread Evgeny Kapun

Evgeny Kapun added the comment:

Tracemalloc code:

import re
import signal
import tracemalloc

class AlarmError(Exception):
pass
def handle_alarm(signal, frame):
raise AlarmError
signal.signal(signal.SIGALRM, handle_alarm)

s1 = tracemalloc.take_snapshot()
for _ in range(20):
try:
signal.alarm(1)
re.match('(?:a|a|(?=b)){1000}', 'a'*999)
raise RuntimeError
except AlarmError:
pass
s2 = tracemalloc.take_snapshot()
res = s2.compare_to(s1, 'lineno')
for e in res[:10]:
print(e)

For me, it shows almost 3 MiB allocated in re.py.

--

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



[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

2015-03-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

You patch is correct Wolfgang, but with cast('B') the patch would be smaller 
(no need to replace len(data) to nbytes).

While we are here, it is possible to add the support of general byte-like 
objects.

if not isinstance(data, bytes):
data = memoryview(data).cast('B')

isinstance() check is just for optimization, it can be omitted if doesn't 
affect a performance.

--

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



[issue23691] re.finditer iterator is not reentrant, but doesn't protect against nested calls to __next__

2015-03-17 Thread Evgeny Kapun

New submission from Evgeny Kapun:

Iterator returned by re.finditer includes a SRE_STATE value, which is not 
designed to be used concurrently. However, it is possible to call __next__ on 
such iterator while another such call is in progress, e.g. from a signal 
handler. This may result in corruption of SRE_STATE structure.

--
components: Regular Expressions
messages: 238323
nosy: abacabadabacaba, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.finditer iterator is not reentrant, but doesn't protect against 
nested calls to __next__
type: crash
versions: Python 3.4

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



[issue9134] sre bug: lastmark_save/restore

2015-03-17 Thread Evgeny Kapun

Changes by Evgeny Kapun abacabadabac...@gmail.com:


--
nosy: +abacabadabacaba

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



[issue23690] re functions never release GIL

2015-03-17 Thread Evgeny Kapun

Evgeny Kapun added the comment:

Aren't Python strings immutable?

Also, match functions still permit execution of signal handlers, which can 
execute any Python code.

If GIL is needed during matching, can it be released temporarily to permit 
thread switching?

--

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



[issue23325] Turn SIG_DFL and SIG_IGN into functions

2015-03-17 Thread Ethan Furman

Ethan Furman added the comment:

A private method is being added to Enum to better support Enum replacement of 
constants, part of which includes changing __reduce_ex__ to return the string 
of the name.

These changes answer points 1 and 4.

Point 2 would be nice, but seems somewhat less important if Enums are being 
used.

Point 3 -- I don't see how 'Signal(xxx, yyy)' is more complicated than 
'Signal(xxx, zzz)'?

--
nosy: +barry, eli.bendersky

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



[issue433030] SRE: Atomic Grouping (?...) is not supported

2015-03-17 Thread Evgeny Kapun

Changes by Evgeny Kapun abacabadabac...@gmail.com:


--
nosy: +abacabadabacaba

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



[issue23692] Undocumented feature prevents re module from finding certain matches

2015-03-17 Thread Evgeny Kapun

New submission from Evgeny Kapun:

This pattern matches:

re.match('(?:()|(?(1)()|z)){2}(?(2)a|z)', 'a')

But this doesn't:

re.match('(?:()|(?(1)()|z)){0,2}(?(2)a|z)', 'a')

The difference is that {2} is replaced by {0,2}. This shouldn't prevent the 
pattern from matching anywhere where it matched before.

The reason for this misbehavior is a feature which is designed to protect re 
engine from infinite loops, but in fact it sometimes prevents patterns from 
matching where they should. I think that this feature should be at least 
properly documented, by properly I mean that it should be possible to 
reconstruct the exact behavior from documentation, as the implementation is not 
particularly easy to understand.

--
components: Regular Expressions
messages: 238330
nosy: abacabadabacaba, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Undocumented feature prevents re module from finding certain matches
type: behavior
versions: Python 3.4

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



[issue9782] _multiprocessing.c warnings under 64-bit Windows

2015-03-17 Thread Mark Lawrence

Mark Lawrence added the comment:

Where do we currently stand with all compiler warnings, I'm still seeing some 
but I recall that we've other open issues about this problem?

--
nosy: +serhiy.storchaka, steve.dower, zach.ware
versions: +Python 3.4, Python 3.5 -Python 3.2

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



[issue23695] idiom for clustering a data series into n-length groups

2015-03-17 Thread Ethan Furman

Ethan Furman added the comment:

I think an example should suffice:

 s = [1, 2, 3, 4, 5, 6, 7, 8, 9]
 n = 3
 zip(*[iter(s)]*n)
[(1, 2, 3), (4, 5, 6), (7, 8, 9)]

--
nosy: +ethan.furman
versions:  -Python 3.2, Python 3.3

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-03-17 Thread Ned Deily

Ned Deily added the comment:

The buildbot is now green - closed.

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

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



[issue23694] PEP 475: handle EINTR in fileutils.c

2015-03-17 Thread STINNER Victor

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


--
nosy: +neologix

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



[issue23694] PEP 475: handle EINTR in fileutils.c

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

fileutils_eintr.patch: handle EINTR for open, fopen and dup (only on Linux for 
dup in _Py_dup).

_Py_wfopen() and _Py_fopen() are not modified because callers are not really 
prepared to handle exceptions. These functions are mostly used during early 
steps of Python initializations. If someone is motived, you can propose a patch 
for these functions.

For other functions (cwd, readlink, etc.), it's not clear to me if we can get 
EINTR or not.

--
keywords: +patch
Added file: http://bugs.python.org/file38535/fileutils_eintr.patch

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



[issue23696] zipimport: chain ImportError to OSError

2015-03-17 Thread STINNER Victor

New submission from STINNER Victor:

To work on the issue #23694, I refactored the C function _Py_fopen_obj() to 
raise an exception on error. I noticed the that zipimport replaces the current 
exception with ZipImportError.

Attached patch chains the ZipImportError to the OSError to provide more context 
on error. For example, you can see in the unit test that ZipImportError was 
caused by a permission error.

Is it ok to require ZipImport.__context__ to be an OSError in the unit test? 
Can it be added to zipimport spec? If not, the test may be splitted to only 
check __context__ in a test decorated with @cpython_only.

--
files: zipimporterror_oserror.patch
keywords: patch
messages: 238368
nosy: brett.cannon, haypo, ncoghlan
priority: normal
severity: normal
status: open
title: zipimport: chain ImportError to OSError
versions: Python 3.5
Added file: http://bugs.python.org/file38536/zipimporterror_oserror.patch

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



[issue23529] Limit decompressed data when reading from LZMAFile and BZ2File

2015-03-17 Thread Nikolaus Rath

Nikolaus Rath added the comment:

If you want to add support for buffer_size=0 in a separate patch/issue I think 
that's fine. But in that case I would not add a buffer_size parameter now at 
all. IMO, not having it is better as having it but not supporting zero (even if 
it's documented that's pretty surprising).

--

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



[issue23697] Module level map submit for concurrent.futures

2015-03-17 Thread Nick Coghlan

New submission from Nick Coghlan:

Currently, concurrent.futures requires you to explicitly create and manage the 
lifecycle of a dedicated executor to handle multithreaded and multiprocess 
dispatch of concurrent activities.

It may be beneficial to provide module level tmap(), pmap(), tsubmit() and 
psubmit() APIs that use a default ThreadExecutor and/or ProcessExecutor 
instance to provide concurrent execution, with reasonable default settings for 
the underlying thread  process pools.

(Longer names like map_thread, and map_process would also be possible, but tmap 
 pmap are much easier to type and seem sufficient for mnemonic purposes)

This would allow usage like:

  done, not_done = wait(tmap(func, data))

and:

  for f in as_completed(tmap(func, data)):
result = f.result()

Ways to explicitly set and get the default thread and process pools would also 
need to be provided, perhaps based on the design of the event loop management 
interface in the asyncio module.

--
messages: 238373
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Module level map  submit for concurrent.futures

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-03-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 730bbd1499ba by Ned Deily in branch '2.7':
Issue #23458: Skip test_urandom_fd_non_inheritable on OS X 10.4 since
https://hg.python.org/cpython/rev/730bbd1499ba

--

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



[issue6422] timeit called from within Python should allow autoranging

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

I'm confused by the feedback on the patch. It adds a single new function, 
doesn't alter the public interface for any existing functions, and seems fit 
for purpose. Could someone help me understand how its deficient?

--

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



[issue19495] context manager for measuring duration of blocks of code

2015-03-17 Thread Robert Collins

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


--
nosy: +rbcollins
title: Enhancement for timeit: measure time to run blocks of code using 'with' 
- context manager for measuring duration of blocks of code

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



[issue23648] PEP 475 meta issue

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

In msg196555, Charles-François Natali wrote:


From a cursory look, the main files affected would be:
Modules/fcntlmodule.c
Modules/ossaudiodev.c
Modules/posixmodule.c
Modules/selectmodule.c
Modules/selectmodule.c
Modules/signalmodule.c
Modules/socketmodule.c
Modules/syslogmodule.c


For syslog, I tested the following code and I don't get any InterruptedError. 
The return type of the C functions openlog(), syslog() and closelog() is void: 
no result. So I don't see how they could fail because of a signal. Code of my 
test:
---
import syslog
import signal

hit = 0

def noop(*args):
global hit
hit += 1

signal.signal(signal.SIGALRM, noop)
t = 1e-6
nlog = 10**2
signal.setitimer(signal.ITIMER_REAL, t, t)
for i in range(nlog):
syslog.openlog()
syslog.syslog(test %s)
syslog.closelog()
signal.signal(signal.SIGALRM, signal.SIG_IGN)

print(nlog, logs)
print(hit, signals)
---

--

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



[issue23694] PEP 475: handle EINTR in fileutils.c

2015-03-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cfe541c694f3 by Victor Stinner in branch 'default':
Issue #23694: Enhance _Py_fopen(), it now raises an exception on error
https://hg.python.org/cpython/rev/cfe541c694f3

--

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



[issue23552] Have timeit warn about runs that are not independent of each other

2015-03-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch that emits a warning using the warnings module. The warning is 
output to stderr and can be suppressed with the -Wignore option, as all other 
warnings.

$ ./python -m timeit -n1 -r 10 -s import time, random -- 
time.sleep(random.random())
1 loops, best of 10: 79.6 msec per loop
:0: UserWarning: These test results likely aren't reliable.  The worst
time was more than four times slower than the best time.
$ ./python -Wignore -m timeit -n1 -r 10 -s import time, random -- 
time.sleep(random.random())
1 loops, best of 10: 16.2 msec per loop

--
Added file: http://bugs.python.org/file38532/timeit_python_warning.diff

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



[issue23552] Have timeit warn about runs that are not independent of each other

2015-03-17 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file38532/timeit_python_warning.diff

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



[issue23552] Have timeit warn about runs that are not independent of each other

2015-03-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Implemented Robert's suggestion.

$ ./python -m timeit -n1 -r 10 -s import time, random -- 
time.sleep(random.random())
1 loops, best of 10: 30.2 msec per loop
:0: UserWarning: The test results are likely unreliable. The worst
time (946 msec) was more than four times slower than the best time.

--
Added file: http://bugs.python.org/file38533/timeit_python_warning_2.diff

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



[issue23683] allow timeit to run expensive reset code per repeats

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

bah, nevermind - I failed to get that setup is called once per loop regardless 
- I might consider this a doc issue, or perhaps I was just fuzzy brained.

--
resolution:  - not a bug
status: open - closed

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



[issue23694] PEP 475: handle EINTR in fileutils.c

2015-03-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0b99d7043a99 by Victor Stinner in branch 'default':
Issue #23694: Enhance _Py_open(), it now raises exceptions
https://hg.python.org/cpython/rev/0b99d7043a99

--
nosy: +python-dev

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



[issue18828] urljoin behaves differently with custom and standard schemas

2015-03-17 Thread Demian Brecht

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


--
stage:  - patch review
versions: +Python 3.5

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



[issue6422] timeit called from within Python should allow autoranging

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

Filed #23693 for the accuracy thing.

--

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



[issue23693] timeit accuracy could be better

2015-03-17 Thread Robert Collins

New submission from Robert Collins:

In #6422 Haypo suggested making the timeit reports much better. This is a new 
ticket just for that. See 
https://bitbucket.org/haypo/misc/src/tip/python/benchmark.py and 
http://bugs.python.org/issue6422?@ok_message=issue%206422%20nosy%2C%20nosy_count%2C%20stage%20edited%20ok@template=item#msg164216

--
components: Library (Lib)
messages: 238353
nosy: haypo, rbcollins
priority: normal
severity: normal
stage: needs patch
status: open
title: timeit accuracy could be better
type: enhancement
versions: Python 3.6

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



[issue23694] PEP 475: handle EINTR in fileutils.c

2015-03-17 Thread STINNER Victor

New submission from STINNER Victor:

fileutils.c must be modified to retry when a function fails with EINTR: see the 
PEP 475.

I'm working on a patch.

--
messages: 238358
nosy: haypo
priority: normal
severity: normal
status: open
title: PEP 475: handle EINTR in fileutils.c
versions: Python 3.5

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



[issue23677] Mention dict and set comps in library reference

2015-03-17 Thread Mark Lawrence

Mark Lawrence added the comment:

That was embarrassing, hopefully this is rather better.

--
nosy: +BreamoreBoy
Added file: http://bugs.python.org/file38534/issue23677_v2.diff

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



[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write?

2015-03-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 With and without the patch, write() accepts bytes, bytearray and memoryview.
 Which other byte-like types do you know?

The bytes-like object term is used as an alias of an instance of type that 
supports buffer protocol. Besides bytes, bytearray and memoryview, this is 
array.array and NumPy arrays. file.write() supports arbitrary bytes-like 
objects, including array.array and NumPy arrays.

 writeframesraw() method of aifc, sunau and wave modules use this pattern:

Yes, I wrote this code, if I remember correct.

--
title: unnecessary copying of memoryview in gzip.GzipFile.write ? - 
unnecessary copying of memoryview in gzip.GzipFile.write?

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



[issue23693] timeit accuracy could be better

2015-03-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue21988.

--
nosy: +serhiy.storchaka

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



[issue18828] urljoin behaves differently with custom and standard schemas

2015-03-17 Thread Demian Brecht

Demian Brecht added the comment:

 I haven’t heard any arguments against this option yet, and it didn’t break 
 any tests.

Pre patch:

 urljoin('mailto:foo@', 'bar.com')
'bar.com'

Post patch:

 urljoin('mailto:foo@', 'bar.com')
'mailto:bar.com/bar.com'

I'm taking an educated guess here based on a marginal amount of research (there 
are just a few registered schemes at 
http://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml that should be 
understood), but it /seems/ like perhaps the current behaviour is intended to 
safeguard against joining non-hierarchical schemes in which case you'd get 
nonsensical values. It does seem a little odd to me, but I definitely prefer 
the former behaviour to the latter.

I think that short term, Madison's suggestion about documenting uses_relative 
would be an easy win and can be applied to all branches. Long term though, I 
think it would be nice to have a generalized urljoin() method that accounts for 
most (if not all) classifications of url schemes.

Thoughts?

--
nosy: +demian.brecht

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



[issue23693] timeit accuracy could be better

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

Not only I'm too lazy to compute manually the number of loops and repeat, but 
also I don't trust myself. It's even worse when someone publishs results of a 
micro-benchmark. I don't trust how the benchmark was calibrated. In my 
experience, micro-benchmark are polluted by noise in timings, so results are 
not reliable. 

benchmarks.py calibration is based on time, whereas timeit uses hardcoded 
constants (loops=100, repeat=3) which can be modified on the command line.

benchmarks.py has 3 main parameters:

- minimum duration of a single run (--min-time): 100 ms by default
- maximum total duration of the benchmark: benchmark.py does its best to 
respect this duration, but it can be longer: 1 second by default
- minimum repeat: 5 by default

The minimum duration is increased if the clock resolution is bad (1 ms or 
more). It's the case on Windows for time.clock() on Python 2 for example. 
Extract of benchmark.py:

min_time = max(self.config.min_time, timer_precision * 100)

The estimation of the number of loops is not reliable, but it's written to be 
fast. Since I run a micro-benchmark many times, I don't want to wait too 
long. It's not a power of 10, but an arbitrary integer number. Usually, when 
running benchmark.py multiple times, the number of loops is different each 
time. It's not really a big issue, but it probably makes results more difficult 
to compare.

My constrain is max_time. The tested function may not have a linear duration 
(time = time_one_iteration * loops).

https://bitbucket.org/haypo/misc/src/348bfd6108e9985b3c2298d2745eb5ddfe7042e6/python/benchmark.py?at=default#cl-416

Repeat a test at least 5 times is a compromise between the stability of the 
result and the total duration of the benchmark.

Feel free to reuse my code to enhance time.py.

--

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



[issue23695] idiom for clustering a data series into n-length groups

2015-03-17 Thread Paddy McCarthy

New submission from Paddy McCarthy:

In the zip section of the documentation, e.g. 
https://docs.python.org/3/library/functions.html#zip There is mention of an 
idiom for clustering a data series into n-length groups that I seem to only 
come across when people are explaining how it works on blog entries such as the 
three mentioned here: 
http://www.reddit.com/r/programming/comments/2z4rv4/a_function_for_partitioning_python_arrays/cpfvwun?context=3

It is not a straight-forward bit of code and so I think it should either be 
explained in more detail in the documentation or removed as an idiom, or I 
guess it could be encapsulated in a function and added to the stdlib.

--
assignee: docs@python
components: Documentation
messages: 238365
nosy: Paddy McCarthy, docs@python
priority: normal
severity: normal
status: open
title: idiom for clustering a data series into n-length groups
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue23689] Memory leak in Modules/sre_lib.h

2015-03-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be this patch helps.

--
keywords: +patch
stage:  - patch review
versions: +Python 2.7, Python 3.5
Added file: http://bugs.python.org/file38529/sre_clean_repeat_data.patch

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



[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-17 Thread Joshua J Cogliati

Joshua J Cogliati added the comment:

Once this is fixed, maybe issue 8027 can be fixed as well in 3.5.0.

--

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



[issue23631] 3.5 (a2) traceback regression snarls Idle

2015-03-17 Thread Robert Collins

Robert Collins added the comment:

Closing, though ideally Terry can confirm it is fully fixed for him.

--
resolution:  - fixed
status: open - closed

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



[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-17 Thread Joshua J Cogliati

Joshua J Cogliati added the comment:

 @Joshua: Can you please try to compile your extension with  Py_LIMITED_API 
 defined? Ex: #define Py_LIMITED_API 0x0303 at the top of your C file, 
 or g++ -DPy_LIMITED_API=0x0303.

It fails in that case, because SWIG is using functions that are not part of the 
Py_LIMITED_API.  

 And can you also please try to patch Python with pystate_cplusplus.patch?

With the pystate_cplusplus.patch I was able to compile both min_example.tar.gz 
and my actual extension.  So I with your patch, it does work.  Thank you.

--

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



[issue8027] distutils fail to determine c++ linker with unixcompiler if using ccache

2015-03-17 Thread Joshua J Cogliati

Joshua J Cogliati added the comment:

This bug is still in Python 3.5.0a2 (but first issue 23644 needs to be fixed 
before g++ can be used at all)

Attached is a patch for Python 3.5.0.

--
versions: +Python 3.5
Added file: http://bugs.python.org/file38530/fix-distutils-350.patch

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



[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

 For third-party code, pyatomic.h is only needed by PyThreadState_GET() in 
 pystate.h. Maybe we should hide completly pyatomic.h. Currently, pyatomic.h 
 is not really used if Py_LIMITED_API is defined.

pystate_cplusplus.patch: disable completly pyatomic.h on C++, and modify 
pystate.h: PyThreadState_GET() is just an alias to PyThreadState_Get() with 
compiled with C++.

IMO pystate_cplusplus.patch makes more sense.

I don't understand the purpose of atomicfix.patch or pyatomic_cpp.patch, 
PyThreadState_GET() will not work with these patches.

--
Added file: http://bugs.python.org/file38519/pystate_cplusplus.patch

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



[issue23686] Upgrade copy of OpenSSL bundled with Python

2015-03-17 Thread Alex Gaynor

New submission from Alex Gaynor:

On Thursday OpenSSL will disclose some security issues and issue new releases: 
https://mta.openssl.org/pipermail/openssl-announce/2015-March/20.html

When that happens, Python's that bundle an OpenSSL should be upgraded.

--
keywords: security_issue
messages: 238280
nosy: alex
priority: normal
severity: normal
status: open
title: Upgrade copy of OpenSSL bundled with Python

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



[issue23458] [2.7] random: make the file descriptor non-inheritable (on POSIX)

2015-03-17 Thread Ned Deily

Ned Deily added the comment:

$ sw_vers
ProductName:Mac OS X
ProductVersion: 10.4.11
BuildVersion:   8S165
$ ./python
Python 3.4.3+ (3.4:910a7a540a31, Mar 17 2015, 03:33:01)
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type help, copyright, credits or license for more information.
 import os
 fd=os.open('.', os.O_RDONLY)
 os.get_inheritable(fd)
False
 os.set_inheritable(fd, True)
 os.get_inheritable(fd)
True

But if I port test_urandom_fd_non_inheritable from 2.7, it fails on 3.4 as well.

--

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



[issue23686] Update Windows and OS X installer OpenSSL to 1.0.2a

2015-03-17 Thread Ned Deily

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


--
title: Upgrade copy of OpenSSL bundled with Python - Update Windows and OS X 
installer OpenSSL to 1.0.2a

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



[issue1553375] Add traceback.print_full_exception()

2015-03-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Adding Robert Collins to the nosy list to see if the recent traceback changes 
make it easier to implement this one correctly.

Robert, for context, the general idea here is to be able to stitch the 
traceback for a caught exception together with the stack trace for the current 
frame in order to give a full stack trace for the caught exception, rather than 
just the stack trace up to the frame where it was caught.

--
nosy: +rbcollins

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



[issue23644] g++ module compile fails with ‘_Atomic’ does not name a type

2015-03-17 Thread STINNER Victor

STINNER Victor added the comment:

Hum, I'm lost with the problem with C++ :-( What is your use case? Do you want 
to compile CPython with C++? Or compile a third-party extension with C++ and 
this extension includes Python.h which includes pyatomic.h.

For third-party code, pyatomic.h is only needed by PyThreadState_GET() in 
pystate.h. Maybe we should hide completly pyatomic.h. Currently, pyatomic.h is 
not really used if Py_LIMITED_API is defined.

By the way, can you try to compile the extension with Py_LIMITED_API? It should 
just work.


C++ 11 atomic:
---
#include atomic

int main()
{
std::atomic_uintptr_t current;
current.store(0, std::memory_order_relaxed);
return 0;
}
---


C++ 11 atomic used with C functions:
---
#include atomic

int main()
{
std::atomicuintptr_t current(0);
std::atomic_store_explicit(current, (uintptr_t)0, 
std::memory_order_relaxed);
return 0;
}
---

I didn't find how to use std::atomic_store_explicit with std::atomic_uintptr_t, 
so I used std::atomicuintptr_t instead.

std::atomic_store_explicit(current, 0, std::memory_order_relaxed); doesn't 
work: 0 must be explicitly cast to uintptr_t :-(

I tried to hack pyatomic.h to use std::atomic template: see attached 
pyatomic_cpp.patch.

But I don't understand: when PyThreadState_GET() is compiled in C++, should it 
use exactly the same functions of CPython (compiled with C)? It should be 
strange to to use a std::atomic C++ template to access an atomic C variable.

--
Added file: http://bugs.python.org/file38518/pyatomic_cpp.patch

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



[issue18814] Add codecs.convert_surrogateescape to clean surrogate escaped strings

2015-03-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Oh, and yes, I agree a python-dev discussion would be a good idea.

From my perspective, rehandle_surrogateescape is the key function for making 
it easier to check for malformed input data from operating system interfaces.

The other items I don't personally have a use case for, but they seem 
potentially valuable in make some key Unicode concepts a bit more discoverable.

--

___
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



  1   2   >