[issue23188] Exception chaining should trigger for non-normalised exceptions

2015-01-08 Thread Nick Coghlan

Nick Coghlan added the comment:

After looking into this further, PyErr_SetObject (and other APIs like 
PyErr_SetString which call that internally) aim to handle the chaining 
automatically, but they don't handle exceptions which haven't been normalized 
yet.

PyErr_SetObject should probably normalise the exception at the start of the 
call f ithe exception type is set on the thread state, but not the exception 
value.

--
title: Convert _PyErr_ChainExceptions to a public API -> Exception chaining 
should trigger for non-normalised exceptions
type: enhancement -> behavior

___
Python tracker 

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



[issue23188] Exception chaining should trigger for non-normalised exceptions

2015-01-08 Thread Nick Coghlan

Nick Coghlan added the comment:

The documentation of PyErr_SetObject, PyErr_SetString et al should also be 
updated to mention exception chaining.

--

___
Python tracker 

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



[issue13307] bdist_rpm: INSTALLED_FILES does not use __pycache__

2015-01-08 Thread Vjacheslav Fyodorov

Vjacheslav Fyodorov added the comment:

Now in 3.4 Fedora 21

--
nosy: +Vjacheslav.Fyodorov
versions: +Python 3.4 -3rd party, Python 3.2, Python 3.3

___
Python tracker 

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



[issue23188] Exception chaining should trigger for non-normalised exceptions

2015-01-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Thinking about it a bit further, I suspect implicit normalisation of chained 
exceptions could cause problems when we only want to set __cause__ without 
setting __context__ (e.g. codec exception chaining).

I'm going to ponder this one for a while, but happy to hear anyone else's 
feedback.

At the very least, I think the C API docs could use a bit more clarity on the 
intricacies of C level exception chaining.

--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2015-01-08 Thread Nick Coghlan

Nick Coghlan added the comment:

Looking more closely at the patch:

* for the missing tracebacks, you're probably hitting the note in 
https://docs.python.org/3/c-api/exceptions.html#c.PyErr_NormalizeException and 
need an explicit call to PyErr_SetTraceback (My recollection is that I made 
this same mistake when working on the codec chaining patch, so we may want to 
revisit the comment before PyErr_NormalizeException that suggests making 
setting the traceback attribute on the normalized value implicit)

* to trigger the implicit chaining in PyErr_String, try calling PyErr_Restore 
on the normalized exception before calling PyErr_SetString, rather than just 
dropping the references. That should let you drop the subsequent explicit 
PyErr_SetContext call.

--

___
Python tracker 

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



[issue23185] add inf and nan to math module

2015-01-08 Thread Mark Dickinson

Mark Dickinson added the comment:

I have an updated patch taking into account the most recent review comments 
(for which thanks!), but it's at home; I'll upload it this evening (UTC+00:00).

--

___
Python tracker 

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



[issue22560] Add loop-agnostic SSL implementation to asyncio

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I wrote the patch for Tulip. Patch regenerated to use Python paths.

--
Added file: http://bugs.python.org/file37638/sslproto-4.patch

___
Python tracker 

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



[issue22560] Add loop-agnostic SSL implementation to asyncio

2015-01-08 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file37637/sslproto-4.patch

___
Python tracker 

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



[issue23177] test_ssl: failures on OpenBSD with LibreSSL

2015-01-08 Thread Bernard Spil

Bernard Spil added the comment:

LibreSSL defines in opensslv.h
#define LIBRESSL_VERSION_NUMBER 0x2000L
#define OPENSSL_VERSION_NUMBER 0x2000L

And FreeBSD replaces
#define OPENSSL_VERSION_NUMBER 0x1000107fL

Proper way would be to check for LIBRESSL_VERSION_NUMBER string, FreeBSD 
modifies the OpenSSL version number to indicate its compatibility level (as 
stated in commit log)

--

___
Python tracker 

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



[issue23177] test_ssl: failures on OpenBSD with LibreSSL

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

> Proper way would be to check for LIBRESSL_VERSION_NUMBER string, FreeBSD 
> modifies the OpenSSL version number to indicate its compatibility level (as 
> stated in commit log)

Please see the unit test: it checks that the version number and version string 
are consistent. It's not the case on OpenBSD with LibreSSL (2.0 vs 2.1) nor on 
FreeBSD (1.0 vs 2.1).

--

___
Python tracker 

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



[issue23189] Set docstrings to empty string when optimizing with -OO.

2015-01-08 Thread Jarle Selvåg

New submission from Jarle Selvåg:

Python code byte-compiled with -OO has doc-strings stripped out. 

This creates problems when compiling different packages which changes the 
doc-strings by doing something like this:
 __doc__ += "additional text"
(when the docstring is 'None', this will fail).

The packages "lmfit 0.8.1" and "Patsy 0.3.0" have this problem, and must be 
patched before compilation.

See related discussion on Stackoverflow:
http://stackoverflow.com/questions/22299532/unsupported-operand-types-for-nonetype-and-str-winappdbg-error-after-c

Proposal: Set the doc-strings to empty string ("") instead of removing them 
completely during optimization with -OO. The memory footprint would anyway be 
the same.

--
components: Interpreter Core
messages: 233634
nosy: jvs
priority: normal
severity: normal
status: open
title: Set docstrings to empty string when optimizing with -OO.
type: enhancement
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method

2015-01-08 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Try something like this:

if start < 0:
start += len(self)
if stop is None:
stop = len(self)
elif stop < 0:
stop += len(self)
for i in range(max(start, 0), min(stop, len(self))):
if self[i] == value:
return i
raise ValueError

--

___
Python tracker 

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



[issue23189] Set docstrings to empty string when optimizing with -OO.

2015-01-08 Thread Jarle Selvåg

Jarle Selvåg added the comment:

This issue is only relevant for classes that have this construct:

class MyClass(object):
__doc__ += '''Some more text'''


--

___
Python tracker 

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



[issue22919] Update PCBuild for VS 2015

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

Hi, I'm no more able to compile Python 3.5 on Windows. I have Visual Studio 
2008 Express, Visual Studio 2010 Express. VS 2010 is unable to open 
PCbuild/pcbuild.sln: it says that the file was created on a more recent Visual 
Studio version and it is unable to open it.

I tried to install Visual Studio 2013 community but it told me that my Windows 
Seven is too old: it looks like Windows 8.1 or newer is required :-(

I found a Visual Studio 2015 Ultime preview, but I don't want to install an 
heavy "Ultime" IDE, I just want a simple C compiler...

> Though the title says VS 2015, builds will work fine with VS 2010 and VS 2013 
> (and probably VS 2012, but I didn't try it). Even so, I've copied the old 
> project files into PC/VS10.0, though I'd be happy to just forget them.

There is no PC/VS10.0 file or directory in the Python source code. I only found 
two .sln files: PCbuild/pcbuild.sln and PC/example_nt/example.sln.

The devguide looks outdated: it only mentions Visual Studio 2010 (and 2008 for 
Python 2.7). Can you please update it?
https://docs.python.org/devguide/setup.html#compiling

I am no more able to develop on Windows, the issue becomes very annoying for 
me. I hate having to install a huge IDE to compile Python.

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

___
Python tracker 

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



[issue23152] fstat64 required on Windows

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

Here is a patch adding a new _Py_fstat() function which uses signed 64-bit 
integer to store the file size and so is not limited to 2 GB files. I just 
moved the code from posixmodule.c to fileutils.c.

The patch replaces calls to fstat() with _Py_stat() (and also change the stat 
structure to _Py_stat_struct).

I didn't modified _Py_stat() which calls _wstat() on Windows and so also have 
this issue (limited to 2 GB files on Windows). _Py_stat() is called in 
zipimport.c, so zipped packages are limited to 2 GB on Windows. I don't know if 
it's a severe issue or not. os.stat() implementation is more complex than 
os.fstat() on Windows.

I'm unable to test my patch on Windows because Visual Studio 2010 is unable to 
open the new PCbuild/pcbuild.sln: see my comment on the issue #22919.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file37639/py_fstat.patch

___
Python tracker 

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



[issue23152] fstat64 required on Windows

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

> #define fstat _fstati64

This change (alone) is not safe because _fstati64() doesn't use "struct stat" 
but "struct __stat64".

I don't like such global define, I may have unexpected side effect. I prefer to 
modify directly calls to fstat() in .c files (like the change implemented in my 
patch).

--

___
Python tracker 

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2015-01-08 Thread Chris Angelico

Chris Angelico added the comment:

PyErr_Restore doesn't seem to trigger exception chaining. But thanks for the 
tip about explicitly setting the traceback; not sure how I missed that, but now 
the StopIteration traceback is visible.

Minor point: The previous patch was setting the __context__ of the 
RuntimeError, whereas it ought to have been setting __cause__. Have corrected 
that.

So here, before I move further forward, is a new POC patch; I've removed the 
patches that rhettinger applied already, and fixed up tracebacks. So now it's a 
better-behaved POC, at least.

--
Added file: http://bugs.python.org/file37640/pep0479.patch

___
Python tracker 

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2015-01-08 Thread Chris Angelico

Changes by Chris Angelico :


Added file: http://bugs.python.org/file37641/stopiter.py

___
Python tracker 

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



[issue22919] Update PCBuild for VS 2015

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

Oh by the way, 2 Windows buildbot slaves are no more able to compile Python. I 
don't know if it's related to this issue or not.


Builder "AMD64 Windows7 SP1 3.x", owned by Jeremy Kloth:
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x

2>LINK : fatal error LNK1104: cannot open file 
'C:\buildbot.python.org\3.x.kloth-win64\build\PCBuild\amd64\python35_d.dll' 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]


Builder "x86 Windows Server 2003 [SB] 3.x" managed by Snakebite.org (trent):
http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%203.x

E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\Tools\buildbot\..\..\build\TEEB4C~1
 - The process cannot access the file because it is being used by another 
process.
(...)
 
2>E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\PCbuild\pythoncore.vcxproj(415,5):
 warning : Toolset v100 is not used for official builds. Your build may have 
errors or incompatibilities.
(...)
 C:\Program 
Files\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\Microsoft.Cpp.Win32.Targets(147,5):
 error MSB6006: "CL.exe" exited with code 128. 
[E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\PCbuild\pythoncore.vcxproj]


Both slaves are part of the group of "3.x stable" buildbots :-(

--

___
Python tracker 

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



[issue19102] Add tests for CLI of the tabnanny module

2015-01-08 Thread Al Sweigart

Al Sweigart added the comment:

Since tabnanny is also a module in the standard library (it is imported by the 
idle code), wouldn't moving it to lib/test/test_tools make it un-importable? 
This would be a good case for leaving it where it is.

--
nosy: +Al.Sweigart

___
Python tracker 

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



[issue22919] Update PCBuild for VS 2015

2015-01-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Visual Studio 2013 Professional works fine under Windows 7 SP1 here.

--
nosy: +pitrou

___
Python tracker 

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



[issue22919] Update PCBuild for VS 2015

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

> Visual Studio 2013 Professional works fine under Windows 7 SP1 here.

Ok, good to know. But is it correct that the free version of VS 2013 
(community) requires Windows 8.1 or newer? It's not cool to require to upgrade 
Windows to being able to freely compile Python.

My MSDN account is probably outdated, I don't think that I have access to the 
Professional version.

Would it be possible to build Python with the light Windows SDK which basically 
only includes the C compiler and the CRT?

--

___
Python tracker 

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2015-01-08 Thread Chris Angelico

Chris Angelico added the comment:

Nick, any particular reason for pointing to 
https://hg.python.org/cpython/annotate/bbf16fd024df/Lib/__future__.py rather 
than https://hg.python.org/cpython/annotate/tip/Lib/__future__.py ? I'm looking 
at both, anyhow.

--

___
Python tracker 

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



[issue23190] OpenSSL fails building with build.bat

2015-01-08 Thread Antoine Pitrou

New submission from Antoine Pitrou:

With "PCbuild\build.bat -d -e", OpenSSL fails building:

  nasm: fatal: unable to open input file `Z:\cpython\default\externals\openssl-
  1.0.1j\tmp32\aes-586.asm'

Detailed build log is:

"Z:\cpython\default\PCbuild\libeay.vcxproj" (default target) (32:3) ->
(BuildNasmFiles target) -> 
  Z:\cpython\default\PCbuild\openssl.props(61,5): error MSB3073: The command 
"setlocal [Z:\cpython\default\PCbuild\libeay.vcxproj]
Z:\cpython\default\PCbuild\openssl.props(61,5): error MSB3073: set 
PATH=%PATH%;Z:\cpython\default\externals\\nasm-2.11.06\ 
[Z:\cpython\default\PCbuild\libeay.vcxproj]
Z:\cpython\default\PCbuild\openssl.props(61,5): error MSB3073: nasm.exe -f 
win32 -o "Z:\cpython\default\externals\openssl-1.0.1j\tmp32\libeay\aes-586.obj" 
"Z:\cpython\default\externals\openssl-1.0.1j\tmp32\aes-586.asm"" exited with 
code 1. [Z:\cpython\default\PCbuild\libeay.vcxproj]

"Z:\cpython\default\PCbuild\pcbuild.proj" (Rebuild target) (1) ->
"Z:\cpython\default\PCbuild\_ssl.vcxproj" (Build target) (31:2) ->
"Z:\cpython\default\PCbuild\ssleay.vcxproj" (default target) (33:3) ->
(ClCompile target) -> 
  c1 : fatal error C1083: Cannot open source file: 
'Z:\cpython\default\externals\openssl-1.0.1j\ssl\d1_both.c': No such file or 
directory [Z:\cpython\default\PCbuild\ssleay.vcxproj]

[etc.]


It seems there are problems with how the file paths are computed? Also, I have 
no file "aes-586.asm", how is it supposed to be generated?

--
components: Build, Windows
messages: 233646
nosy: pitrou, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: OpenSSL fails building with build.bat
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue23190] OpenSSL fails building with build.bat

2015-01-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Z:\cpython\default>dir Z:\cpython\default\externals\openssl-1.0.1j\
 Volume in drive Z is antoine
 Volume Serial Number is 2FA8-F31C

 Directory of Z:\cpython\default\externals\openssl-1.0.1j

01/08/2015  11:59 AM  .
01/08/2015  12:10 PM  ..
01/08/2015  11:59 AM  tmp32
   0 File(s)  0 bytes
   3 Dir(s)  49,764,913,152 bytes free

Z:\cpython\default>dir Z:\cpython\default\externals\openssl-1.0.1j\tmp32
 Volume in drive Z is antoine
 Volume Serial Number is 2FA8-F31C

 Directory of Z:\cpython\default\externals\openssl-1.0.1j\tmp32

01/08/2015  11:59 AM  .
01/08/2015  11:59 AM  ..
01/08/2015  11:59 AM  ssleay
01/08/2015  12:17 PM  libeay
   0 File(s)  0 bytes
   4 Dir(s)  49,764,913,152 bytes free

--

___
Python tracker 

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



[issue22919] Update PCBuild for VS 2015

2015-01-08 Thread Mark Lawrence

Mark Lawrence added the comment:

@Victor I don't know what version you need for Windows 7 or earlier but I can 
tell you that VS 2013 Community edition is *NOT* free, I fell into that trap 
myself, you need the Express edition.

--

___
Python tracker 

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



[issue23190] OpenSSL fails building with build.bat

2015-01-08 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hmm, probably the svn export had failed for some reason. I deleted the OpenSSL 
directory, re-ran get_externals.bat and then everything went fine.

--

___
Python tracker 

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



[issue23190] OpenSSL fails building with build.bat

2015-01-08 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue7676] IDLE shell shouldn't use TABs

2015-01-08 Thread Al Sweigart

Changes by Al Sweigart :


--
nosy: +Al.Sweigart

___
Python tracker 

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



[issue23191] fnmatch regex cache use is not threadsafe

2015-01-08 Thread M. Schmitzer

New submission from M. Schmitzer:

The way the fnmatch module uses its regex cache is not threadsafe. When 
multiple threads use the module in parallel, a race condition between 
retrieving a - presumed present - item from the cache and clearing the cache 
(because the maximum size has been reached) can lead to KeyError being raised.

The attached script demonstrates the problem. Running it will (eventually) 
yield errors like the following.

Exception in thread Thread-10:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
  File "fnmatch_thread.py", line 12, in run
fnmatch.fnmatchcase(name, pat)
  File "/home/marc/.venv/modern/lib/python2.7/fnmatch.py", line 79, in 
fnmatchcase
return _cache[pat].match(name) is not None
KeyError: 'lYwrOCJtLU'

--
components: Library (Lib)
files: fnmatch_thread.py
messages: 233650
nosy: mschmitzer
priority: normal
severity: normal
status: open
title: fnmatch regex cache use is not threadsafe
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file37642/fnmatch_thread.py

___
Python tracker 

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



[issue23191] fnmatch regex cache use is not threadsafe

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

I guess that a lot of stdlib modules are not thread safe :-/ A workaround is to 
protect calls to fnmatch with your own lock.

--
nosy: +haypo

___
Python tracker 

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



[issue22919] Update PCBuild for VS 2015

2015-01-08 Thread Steve Dower

Steve Dower added the comment:

You will need Windows 7 *SP1*, as I don't think VS will run without the 
updates. There is also a service pack for VS 2010 that may enable opening the 
newer solution - it certainly worked for me.

We decided not to keep the old project files as they weren't being maintained.

Community edition is free, but you need a Microsoft account (also free) to 
register it. I don't know why this is necessary, but that's the way they set it 
up.

I'll check out that buildbot when I get a chance (Trent's one is known to be 
busted). The stable buildbots and the one with VS 2015 were doing fine last 
time I looked.

I haven't tried with the SDK compilers, but it should be possible to build with 
them now. VS is no longer required to build from the command line.

--

___
Python tracker 

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



[issue23152] fstat64 required on Windows

2015-01-08 Thread Steve Dower

Steve Dower added the comment:

I prefer your patch too. (I've posted on the other thread about the build 
problems, and I'll test this when I get a chance.)

--

___
Python tracker 

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



[issue23191] fnmatch regex cache use is not threadsafe

2015-01-08 Thread M. Schmitzer

M. Schmitzer added the comment:

Ok, if that is the attitude in such cases, feel free to close this.

--

___
Python tracker 

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



[issue23191] fnmatch regex cache use is not threadsafe

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

It would be nice to fix the issue, but I don't know how it is handled in other 
stdlib modules.

--

___
Python tracker 

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



[issue23191] fnmatch regex cache use is not threadsafe

2015-01-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is easy to make fnmatch caching thread safe without locks. Here is a patch.

The problem with fnmatch is that the caching is implicit and a user don't know 
that any lock are needed. So either the need of the lock should be explicitly 
documented, or fnmatch should be made thread safe. The second option looks more 
preferable to me.

In 3.x fnmatch is thread safe because thread safe lru_cache is used.

--
keywords: +patch
nosy: +serhiy.storchaka
stage:  -> patch review
Added file: http://bugs.python.org/file37643/fnmatch_threadsafe.patch

___
Python tracker 

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



[issue23188] Exception chaining should trigger for non-normalised exceptions

2015-01-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

_PyErr_ChainExceptions() was added because exceptions raised in C code are not 
implicitly chained. The code for explicit chaining is error prone, so it was 
extracted in separate function. Even with _PyErr_ChainExceptions() chaining 
exceptions look complex. May be implicit chaining all exceptions would be 
better.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

+1 for removing unicode specialization. Dictionaries with string keys is a part 
of the language, but sets of strings are not special.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue23191] fnmatch regex cache use is not threadsafe

2015-01-08 Thread M. Schmitzer

M. Schmitzer added the comment:

@serhiy.storchaka: My thoughts exactly, especially regarding the caching being 
implicit. From the outside, fnmatch really doesn't look like it could have 
threading issues.
The patch also looks exactly like what I had in mind.

--

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-08 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

I'm not sure I follow:

Sets of strings are very common when trying to create a unique set of strings 
or optimizing "name in set_of_names" lookups.

Regarding your benchmark numbers: I have a hard time following how they work. A 
simply "word in set_of_one_word" certainly doesn't make a good benchmark for 
these sort of tests :-)

You should at least test with sets of various sizes and include the 
non-matching checks as well.

--
nosy: +lemburg

___
Python tracker 

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



[issue15955] gzip, bz2, lzma: add option to limit output size

2015-01-08 Thread Martin Panter

Martin Panter added the comment:

It turns out that GzipFile.read() etc is also susceptible to 
decompression bombing. Here is a patch to test and fix that, making use of the 
existing “max_length” parameter in the “zlib” module.

--
Added file: http://bugs.python.org/file37644/gzip-bomb.patch

___
Python tracker 

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



[issue23192] Generator return value ignored in lambda function

2015-01-08 Thread Chris Angelico

Changes by Chris Angelico :


--
type:  -> behavior

___
Python tracker 

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



[issue23192] Generator return value ignored in lambda function

2015-01-08 Thread Chris Angelico

New submission from Chris Angelico:

As yield is an expression, it's legal in a lambda function, which then
means you have a generator function. But it's not quite the same as
the equivalent function made with def:

$ python3
Python 3.5.0a0 (default:1c51f1650c42+, Dec 29 2014, 02:29:06)
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> f=lambda: (yield 5)
>>> x=f()
>>> next(x)
5
>>> x.send(123)
Traceback (most recent call last):
  File "", line 1, in 
StopIteration
>>> def f(): return (yield 5)
...
>>> x=f()
>>> next(x)
5
>>> x.send(123)
Traceback (most recent call last):
  File "", line 1, in 
StopIteration: 123
>>> x = (lambda: print((yield 1)) or 2)()
>>> next(x)
1
>>> x.send(3)
3
Traceback (most recent call last):
  File "", line 1, in 
StopIteration

The last example demonstrates that send() is working, but the return value is 
not getting propagated. Disassembly shows this:

>>> dis.dis(lambda: (yield 5))
  1   0 LOAD_CONST   1 (5)
  3 YIELD_VALUE
  4 POP_TOP
  5 LOAD_CONST   0 (None)
  8 RETURN_VALUE
>>> def f(): return (yield 5)
... 
>>> dis.dis(f)
  1   0 LOAD_CONST   1 (5)
  3 YIELD_VALUE
  4 RETURN_VALUE

I'm sure this is a bug that will affect very approximately zero people, but 
it's still a peculiar inconsistency!

Verified with 3.5 and 3.4.

--
components: Interpreter Core
messages: 233662
nosy: Rosuav
priority: normal
severity: normal
status: open
title: Generator return value ignored in lambda function
versions: Python 3.4, Python 3.5

___
Python tracker 

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



[issue23193] Please support "numeric_owner" in tarfile

2015-01-08 Thread Michael Vogt

New submission from Michael Vogt:

Please consider adding a option to extract a tarfile with the uid/gid instead 
of the lookup for uname/gname in the tarheader (i.e. what tar --numeric-owner 
provides).

One use-case is if you unpack a chroot tarfile that contains a 
/etc/{passwd,group} file with different uid/gid for user/groups like zope that 
may be present in both host and chroot but have different numbers. With the 
current approach files owned by this user will get the host uid/gid instead of 
the uid/gid of the chroot.

Attached is a patch to outline what I have in mind - if there is a chance that 
this patch goes in I'm happy to write the required test (mocking os.chown()) 
for this to go in.

Thanks for your consideration,
 Michael

--
components: Library (Lib)
files: tarfile-numeric-owner.diff
keywords: patch
messages: 233663
nosy: mvo
priority: normal
severity: normal
status: open
title: Please support "numeric_owner" in tarfile
type: enhancement
Added file: http://bugs.python.org/file37645/tarfile-numeric-owner.diff

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-08 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Sets of strings are very common when trying to create a unique set of strings 
> or optimizing "name in set_of_names" lookups.

This is not nearly so common as attributes or globals access, or passing 
keyword arguments.

--

___
Python tracker 

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



[issue23193] Please support "numeric_owner" in tarfile

2015-01-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +lars.gustaebel, serhiy.storchaka
stage:  -> patch review
versions: +Python 3.5

___
Python tracker 

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



[issue22906] PEP 479: Change StopIteration handling inside generators

2015-01-08 Thread Chris Angelico

Chris Angelico added the comment:

Okay! I think I have something here. DEFINITELY needs more eyeballs, but all 
tests pass, including a new one that tests StopIteration leakage both with and 
without the __future__ directive. Some docs changes have been made (I grepped 
for 'stopiteration' and 'generator' case insensitively, and changed anything 
that caught my eye). It'd be nice if the entire test suite and standard library 
could be guaranteed to work in a post-3.7 world, but I don't know of an easy 
way to do that, short of peppering the code with unnecessary __future__ 
directives.

--
Added file: http://bugs.python.org/file37646/pep0479.patch

___
Python tracker 

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



[issue23192] Generator return value ignored in lambda function

2015-01-08 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +benjamin.peterson, gvanrossum, serhiy.storchaka

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-08 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 08.01.2015 15:46, Serhiy Storchaka wrote:
> 
>> Sets of strings are very common when trying to create a unique set of 
>> strings or optimizing "name in set_of_names" lookups.
> 
> This is not nearly so common as attributes or globals access, or passing 
> keyword arguments.

Not at the interpreter level, but unlike dicts, sets are not used
much to implement interpreter logic. Their use cases are more based
in application code where you basically find two major use cases:

1. check for flag in set of numeric codes

2. check for string in unique set of strings

(and their associated set operations, i.e. checking for subsets,
superset, etc.)

This is why I don't follow Raymond's reasoning. Of course, if
he comes up with a patch that makes both cases faster, I'd be
+1 ;-)

--

___
Python tracker 

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



[issue23189] Set docstrings to empty string when optimizing with -OO.

2015-01-08 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

That's a backward compatibility break since existing code may be expecting 
None.  At least it needs to be carefully considered, and should have no 
possibility of be applied to anything before Python 3.5.

--
nosy: +barry
versions:  -Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.6

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-08 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue23192] Generator return value ignored in lambda function

2015-01-08 Thread Guido van Rossum

Guido van Rossum added the comment:

Hm, looks like nobody bothered to update the lambda code generation to use the 
value from yield. I almost feel like there is some unnecessary check "if we are 
in a lambda" in the code generation for yield. Have you looked through the code 
generation yet?

--

___
Python tracker 

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



[issue23192] Generator return value ignored in lambda function

2015-01-08 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

@Raymond: Please disable git format for patches, because Rietveld doesn't 
support such patch and so we don't get the "review" button.

--
nosy: +haypo

___
Python tracker 

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



[issue23119] Remove unicode specialization from set objects

2015-01-08 Thread Ezio Melotti

Ezio Melotti added the comment:

Without changesets information (not included in the git format) rietveld will 
try to apply the patch on default and if it applies clearly it will work, so 
creating the patch against an up to date py3 clone should work even with the 
git format.

--

___
Python tracker 

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



[issue22919] Update PCBuild for VS 2015

2015-01-08 Thread Steve Dower

Steve Dower added the comment:

Just emailed Jeremy about the buildbot. It looks like the last time tests were 
run something didn't clean up properly and left the build output locked. 
There's nothing wrong with the project files.

--

___
Python tracker 

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



[issue23193] Please support "numeric_owner" in tarfile

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

"(...) if there is a chance that this patch goes in I'm happy to write the 
required test (mocking os.chown()) for this to go in."

We don't accept changes without test. So you must write a test.

Implementing the feature in Python makes sense.

--
nosy: +haypo

___
Python tracker 

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



[issue23192] Generator return value ignored in lambda function

2015-01-08 Thread Chris Angelico

Chris Angelico added the comment:

I'm not sure what to look for in the code generation. In compile.c lines 3456 
and following, there's a LOAD_CONST None coming through, in the else branch of 
"if (e->v.Yield.value)", but nothing talking about lambda functions. There are 
constants COMPILER_SCOPE_LAMBDA and COMPILER_SCOPE_FUNCTION, but the only place 
where they're used is compiler_set_qualname() and I can't see anything obvious 
there. Hopefully someone more familiar with the code internals will be able to 
figure this out!

--

___
Python tracker 

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



[issue23185] add inf and nan to math module

2015-01-08 Thread Mark Dickinson

Mark Dickinson added the comment:

New patch, addressing review comments.

--
Added file: http://bugs.python.org/file37647/math_inf_nan4.patch

___
Python tracker 

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



[issue23187] Segmentation fault, possibly asyncio related

2015-01-08 Thread Rickard Englund

Changes by Rickard Englund :


--
nosy: +r-englund

___
Python tracker 

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



[issue22411] Embedding Python on Windows

2015-01-08 Thread Rickard Englund

Rickard Englund added the comment:

I have also had this problem. 
The way I solved it was to undef _DEBUG before including python and then 
redefine it again:

#undef _DEBUG //Prevent linking debug build of python
#include 
#define _DEBUG 1

This is just a hack though and it would be interesting to know if there is a 
correct way to do it.

--
nosy: +r-englund

___
Python tracker 

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



[issue22411] Embedding Python on Windows

2015-01-08 Thread Antoine Pitrou

Changes by Antoine Pitrou :


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

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Jim Kubicek

New submission from Jim Kubicek:

Python 3.4.2 (default, Dec 29 2014, 14:03:16) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import antigravity
2015-01-08 10:45:03.771 osascript[47250:12135049] Error loading 
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe Unit 
Types:  dlopen(/Library/ScriptingAdditions/Adobe Unit 
Types.osax/Contents/MacOS/Adobe Unit Types, 262): no suitable image found.  Did 
find:
/Library/ScriptingAdditions/Adobe Unit Types.osax/Contents/MacOS/Adobe 
Unit Types: no matching architecture in universal wrapper
osascript: OpenScripting.framework - scripting addition 
"/Library/ScriptingAdditions/Adobe Unit Types.osax" declares no loadable 
handlers.

The import command appears to work correctly (the proper XKCD opens), so I 
think this issue is just cosmetic.

--
components: Extension Modules
messages: 233676
nosy: jkubicek
priority: normal
severity: normal
status: open
title: Antigravity prints osascript errors in OS X Yosemite
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Ezio Melotti

Ezio Melotti added the comment:

Do you see the same messages if you use the webbrowser module directly?

--
components: +Library (Lib) -Extension Modules
nosy: +ezio.melotti

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Jim Kubicek

Jim Kubicek added the comment:

I do. I was just coming back here to post that very thing.

--

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Jim Kubicek

Jim Kubicek added the comment:

No, the behavior is the same in all cases

--

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Ezio Melotti

Ezio Melotti added the comment:

Does anything change if you use open/open_new/open_new_tab, and/or use 
different urls (http and https)?

--
nosy: +hynek, ned.deily, ronaldoussoren

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Ned Deily

Ned Deily added the comment:

My guess is that you have an older 32-bit-only Scripting Addition from Adobe 
installed.  This has nothing to do with Python.

--

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Ned Deily

Ned Deily added the comment:

The solution is to either remove or update /Library/ScriptingAdditions/Adobe 
Unit Types.osax/Contents/MacOS/Adobe Unit.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue23194] Antigravity prints osascript errors in OS X Yosemite

2015-01-08 Thread Ned Deily

Ned Deily added the comment:

P.S. See https://discussions.apple.com/thread/4355847?start=0&tstart=0

--

___
Python tracker 

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



[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method

2015-01-08 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

Are you sure? I noticed that __iter__ went out of its way to avoid calling 
len().

--

___
Python tracker 

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



[issue23195] Sorting with locale does not work properly with Python3 on Macos

2015-01-08 Thread Pierre Nugues

New submission from Pierre Nugues:

The sorted() function does not work properly with macosx.
Here is a script to reproduce the issue:

import locale
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
a = ["A", "E", "Z", "a", "e", "é", "z"]
sorted(a)
sorted(a, key=locale.strxfrm)


The execution on MacOsX produces:
pierre:Flaubert pierre$ sw_vers -productVersion
10.10.1
pierre:Flaubert pierre$ python3
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  5 2014, 20:42:22) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import locale
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
'fr_FR.UTF-8'
a = ["A", "E", "Z", "a", "e", "é", "z"]
sorted(a)
['A', 'E', 'Z', 'a', 'e', 'z', 'é']
sorted(a, key=locale.strxfrm)
['A', 'E', 'Z', 'a', 'e', 'z', 'é']


while it produces this on your interactive shell (python.org):
In [10]: import locale
In [11]: locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
Out[11]: 'fr_FR.UTF-8'
In [12]: a = ["A", "E", "Z", "a", "e", "é", "z"]
In [13]: sorted(a)
Out[13]: ['A', 'E', 'Z', 'a', 'e', 'z', 'é']
In [14]: sorted(a, key=locale.strxfrm)
Out[14]: ['a', 'A', 'e', 'E', 'é', 'z', 'Z']

which is correct.

--
components: Unicode
messages: 233685
nosy: ezio.melotti, haypo, pnugues
priority: normal
severity: normal
status: open
title: Sorting with locale does not work properly with Python3 on Macos
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue23195] Sorting with locale does not work properly with Python3 on Macos

2015-01-08 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +ned.deily

___
Python tracker 

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



[issue23196] Greek letters not sorted properly

2015-01-08 Thread Pierre Nugues

New submission from Pierre Nugues:

Greek letters are not properly sorted when a locale is set. I tested a French 
and a Greek locales. Here is an output obtained from the Python interactive 
shell available from the python.org home page:

In [22]: a
Out[22]: 
('Ά',
 'Γ',
 'Η',
 'Κ',
 'Ν',
 'Ο',
 'έ',
 'ί',
 'α',
 'β',
 'γ',
 'δ',
 'ε',
 'ζ',
 'ι',
 'κ',
 'λ',
 'μ',
 'ν',
 'ο',
 'ς',
 'τ',
 'φ',
 'χ',
 'ό',
 'ϐ',
 'Ἀ',
 'ῖ')
In [26]: sorted(a, key=locale.strxfrm)
Out[26]: 
['Ἀ',
 'ῖ',
 'α',
 'Ά',
 'β',
 'ϐ',
 'Γ',
 'γ',
 'δ',
 'ε',
 'έ',
 'ζ',
 'Η',
 'ι',
 'ί',
 'Κ',
 'κ',
 'λ',
 'μ',
 'Ν',
 'ν',
 'Ο',
 'ο',
 'ό',
 'ς',
 'τ',
 'φ',
 'χ']

The letter 'ῖ' is wrongly sorted. You can try to sort the same character list 
with the ICU demonstration to see the correct ordering here: 
http://demo.icu-project.org/icu-bin/locexp?_=el&d_=fr&x=col

--
components: Unicode
messages: 233686
nosy: ezio.melotti, haypo, pnugues
priority: normal
severity: normal
status: open
title: Greek letters not sorted properly
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue23195] Sorting with locale does not work properly with Python3 on Macos

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

locale.strxfrm() have a different implementation in Python 2 and in Python 3:
- Python 2 uses strxfrm(), so works on bytes strings
- Python 3 uses wcsxfrm(), so works on multibyte strings ("unicode" strings)

It looks like Python 2 and 3 have the same behaviour on Mac OS X: the list is 
not sorted as expected. Test on Mac OS X 10.9.2.

Imac-Photo:~ haypo$ cat collate2.py 
#coding:utf8
import locale, random
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
print("LC_COLLATE = %s" % locale.setlocale(locale.LC_COLLATE, None))
a = ["A", "E", "Z", "\xc9", "a", "e", "\xe9", "z"]
random.shuffle(a)
print(sorted(a))
print(sorted(a, key=locale.strxfrm))

Imac-Photo:~ haypo$ cat collate3.py 
#coding:utf8
import locale, random
locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
print("LC_COLLATE = %s" % locale.setlocale(locale.LC_COLLATE, None))
a = ["A", "E", "Z", "\xc9", "a", "e", "\xe9", "z"]
random.shuffle(a)
print(ascii(sorted(a)))
print(ascii(sorted(a, key=locale.strxfrm)))

Imac-Photo:~ haypo$ LC_ALL=fr_FR.utf8 python collate2.py 
LC_COLLATE = fr_FR.UTF-8
['A', 'E', 'Z', 'a', 'e', 'z', '\xc9', '\xe9']
['A', 'E', 'Z', 'a', 'e', 'z', '\xc9', '\xe9']

Imac-Photo:~ haypo$ LC_ALL=fr_FR.utf8 ~/prog/python/default/python.exe 
~/collate3.py 
LC_COLLATE = fr_FR.UTF-8
['A', 'E', 'Z', 'a', 'e', 'z', '\xc9', '\xe9']
['A', 'E', 'Z', 'a', 'e', 'z', '\xc9', '\xe9']

On Linux, I get the expected order with Python 3:

LC_COLLATE = fr_FR.UTF-8
['A', 'E', 'Z', 'a', 'e', 'z', '\xc9', '\xe9']
['a', 'A', 'e', 'E', '\xe9', '\xc9', 'z', 'Z']

On Linux, Python 2 gives me a strange order. It's maybe an issue in my program:

haypo@selma$ python x.py 
LC_COLLATE = fr_FR.UTF-8
['A', 'E', 'Z', 'a', 'e', 'z', '\xc9', '\xe9']
['\xe9', '\xc9', 'a', 'A', 'e', 'E', 'z', 'Z']

--

___
Python tracker 

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



[issue23195] Sorting with locale (strxfrm) does not work properly with Python3 on Macos

2015-01-08 Thread R. David Murray

Changes by R. David Murray :


--
title: Sorting with locale does not work properly with Python3 on Macos -> 
Sorting with locale (strxfrm) does not work properly with Python3 on Macos

___
Python tracker 

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



[issue23195] Sorting with locale (strxfrm) does not work properly with Python3 on Macos

2015-01-08 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +r.david.murray

___
Python tracker 

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



[issue23196] Greek letters not sorted properly

2015-01-08 Thread R. David Murray

R. David Murray added the comment:

This appears to be a duplicate of issue 23196 (the strxfrm issue).

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Greek letters not sorted properly

___
Python tracker 

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



[issue23196] Greek letters not sorted properly

2015-01-08 Thread R. David Murray

R. David Murray added the comment:

Oops, I meant issue 23195.

--
superseder: Greek letters not sorted properly -> Sorting with locale (strxfrm) 
does not work properly with Python3 on Macos

___
Python tracker 

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



[issue23195] Sorting with locale (strxfrm) does not work properly with Python3 on Macos

2015-01-08 Thread Ned Deily

Ned Deily added the comment:

The initial difference appears to be a long-standing BSD (including OS X) 
versus GNU/Linux platform difference.  See, for example:
http://www.postgresql.org/message-id/18c8a481-33a6-4483-8c24-b8ce70db7...@eggerapps.at

Why there is no difference between en and fr UTF-8 is obvious when you look 
under the covers at the system locale definitions.  This is on FreeBSD 10, OS X 
10.10 is the same:

$ cd /usr/share/locale/fr_FR.UTF-8/
$ ls -l
total 8
lrwxr-xr-x  1 root  wheel   28 Jan 16  2014 LC_COLLATE -> 
../la_LN.US-ASCII/LC_COLLATE
lrwxr-xr-x  1 root  wheel   17 Jan 16  2014 LC_CTYPE -> ../UTF-8/LC_CTYPE
lrwxr-xr-x  1 root  wheel   30 Jan 16  2014 LC_MESSAGES -> 
../fr_FR.ISO8859-1/LC_MESSAGES
-r--r--r--  1 root  wheel   36 Jan 16  2014 LC_MONETARY
lrwxr-xr-x  1 root  wheel   29 Jan 16  2014 LC_NUMERIC -> 
../fr_FR.ISO8859-1/LC_NUMERIC
-r--r--r--  1 root  wheel  364 Jan 16  2014 LC_TIME

For some reason US-ASCII is used for UTF-8 collation; this is also true for 
en_US.UTF-8 and de_DE.UTF-8, the only other ones I checked.

The postresq discussion and some earlier Python issues suggest using ICU to 
properly implement Unicode functions like collation across all platforms.  But 
that has never been implemented in Python.  Nosing Marc-Andre.

--
nosy: +lemburg

___
Python tracker 

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



[issue23195] Sorting with locale (strxfrm) does not work properly with Python3 on BSD or OS X

2015-01-08 Thread Ned Deily

Changes by Ned Deily :


--
title: Sorting with locale (strxfrm) does not work properly with Python3 on 
Macos -> Sorting with locale (strxfrm) does not work properly with Python3 on 
BSD or OS X

___
Python tracker 

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



[issue23195] Sorting with locale (strxfrm) does not work properly with Python3 on BSD or OS X

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

> The postresq discussion and some earlier Python issues suggest using ICU to 
> properly implement Unicode functions like collation across all platforms.

In my experience, the locale module is error-prone and not reliable, especially 
if you want portability. It just uses functions provided by the OS. And the 
locales (LC_CTYPE, LC_MESSAGE, etc.) are process-wide which become a major 
issue if you want to serve different clients using different locales... Windows 
supports a different locale per thread if I remember correctly.

It would be more reliable to use a good library like ICU. You may try:
https://pypi.python.org/pypi/PyICU

Link showing how to use PyICU to sort a Python sequence:
https://stackoverflow.com/questions/11121636/sorting-list-of-string-with-specific-locale-in-python
=> strings.sort(key=lambda x: collator[loc].getCollationKey(x).getByteArray())

--

___
Python tracker 

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



[issue23185] add inf and nan to math module

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

Except of my small suggestion on the doc (see the review), math_inf_nan4.patch 
looks good to me.

--

___
Python tracker 

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



[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method

2015-01-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

I think it avoids len because the length might change during iteration due to 
side-effects of other code. Since a shrinking sequence would raise an 
IndexError anyway when you overran the end, it may as well not assume the 
length is static and just keep indexing forward until it hits an IndexError. 
It's less of an issue (though not a non-issue) with index, because index 
actually performs all the indexing without returning to user code; __iter__ 
pauses to allow user code to execute between each yield, so the odds of a 
length mutation are much higher.

You might be able to use len (and just say that if a side-effect of an equality 
comparison causes the sequence to change length, or another thread messes with 
it, that's your own fault), but you'd probably want  to catch and convert 
IndexError to ValueError to consistently respond to "we didn't find it" with 
the same exception.

--
nosy: +josh.r

___
Python tracker 

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



[issue22970] Cancelling wait() after notification leaves Condition in an inconsistent state

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

I don't like the idea of ignoring exceptions (CancelledError). An option may be 
to store the latest exception and reraise it when the condition is acquired.

I'm not sure that it's safe or correct to "retry" to acquire the condition.

I don't know what I should think about this issue. I don't see any obvious and 
simple fix, but I agree that inconsistencies in lock primitives is a severe 
issue.

--

___
Python tracker 

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



[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method

2015-01-08 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Note: index returns without the caller having a chance to execute code that 
would change the sequence length directly. But other threads could change it, 
as could a custom __eq__ on an object stored in the sequence (or a poorly 
implemented __getitem__ or __len__ on the sequence itself, but that's getting 
even more pathological). Thread consistency is the code's responsibility though 
(we just need to make sure we behave the best we can, and hope they use locks 
correctly), and the odds of equality of __getitem__ altering the sequence are 
much lower than the odds of someone iterating the sequence and changing it as 
they go (which is what __iter__'s implementation allows, responding with 
potentially incomplete results since items might be skipped due to the 
mutation), but keeping the sequence in a consistent state.

--

___
Python tracker 

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



[issue22970] Cancelling wait() after notification leaves Condition in an inconsistent state

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

threading.Condition.wait() implementation is very similar to 
asyncio.Condition.wait(), and the threading code only call acquire() once, it 
doesn't loop or ignore exceptions.

Does it mean that threading.Condition.wait() has the same issue?

--

___
Python tracker 

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



[issue22560] Add loop-agnostic SSL implementation to asyncio

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

For STARTTLS, see also this issue:
https://code.google.com/p/tulip/issues/detail?id=79

--

___
Python tracker 

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



[issue23086] Add start and stop parameters to the Sequence.index() ABC mixin method

2015-01-08 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

I'm going to add a test case that changes the sequence length during .index(), 
and just do whatever list does in that case.

--

___
Python tracker 

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



[issue23197] asyncio: check if a future is cancelled before calling set_result/set_exception

2015-01-08 Thread STINNER Victor

New submission from STINNER Victor:

set_result/set_exception methods of an asyncio.Future raise an exception if the 
future is cancelled.

Attached patch adds the check in 3 remaining places.

--
components: asyncio
files: asyncio.patch
keywords: patch
messages: 233699
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: check if a future is cancelled before calling 
set_result/set_exception
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37648/asyncio.patch

___
Python tracker 

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



[issue23198] asyncio: refactor StreamReader

2015-01-08 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch refactors the asyncio.StreamReader class:

- use the value None instead of True or False to wake up the waiter
- add a new _wakeup_waiter() method
- replace _create_waiter() method with a _wait_for_data() coroutine function

The change adds a subgenerator (_wait_for_data), is it an issue in term of 
performances? (I don't think so.)

--
components: asyncio
files: refactor_streamreader.patch
keywords: patch
messages: 233700
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: refactor StreamReader
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37649/refactor_streamreader.patch

___
Python tracker 

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



[issue7676] IDLE shell shouldn't use TABs

2015-01-08 Thread Al Sweigart

Al Sweigart added the comment:

There are three pieces of user-specified configuration: (1) the number of 
spaces for a tab set in IDLE's config, (2) the sys.ps1 value, and (3) the 
sys.ps2 value.

Currently IDLE's shell is ignoring (1) while the editor is not. IDLE's shell is 
ignoring (3) while the python shell isn't. I think the obvious solution is to 
make IDLE's shell follow the same behavior as IDLE's editor and the python 
shell.

The draw back comes from variable-pitch fonts, but I think using variable-pitch 
fonts is a minority use case and will create spacing issues regardless 
(compared pasting 8 spaces and pasting 1 tab into the editor with Lucida Sans 
Unicode). Special cases aren't special enough to break the rules.

This issue is concerned with mixed tabs and spaces in the IDLE shell, which has 
a simple fix. Putting the >>> and ... prompts in a separate space so that they 
are not copied can be done in a separate issue.

--

___
Python tracker 

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



[issue23199] libpython27.a in amd64 release is 32-bit

2015-01-08 Thread Zach Welch

New submission from Zach Welch:

I tried to link a program against the libpython27.a provided by the latest 
2.7.9 amd64 installer, only to discover that the provided library is a 32-bit 
version.  I had to go through the gendef/dlltool dance in order to produce a 
useable 64-bit library from the DLL.

--
components: Library (Lib), Windows
messages: 233702
nosy: steve.dower, tim.golden, zach.ware, zwelch
priority: normal
severity: normal
status: open
title: libpython27.a in amd64 release is 32-bit
type: compile error
versions: Python 2.7

___
Python tracker 

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



[issue23197] asyncio: check if a future is cancelled before calling set_result/set_exception

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I forgot that the change in subprocess.py (check if waiter is cancelled 
before setting its result) is already part of the issue #23197 which comes with 
an unit test.

The changes on the SSL handshake are still needed.

--

___
Python tracker 

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



[issue22986] Improved handling of __class__ assignment

2015-01-08 Thread Nathaniel Smith

Nathaniel Smith added the comment:

I hereby invoke the one month ping rule! Patch, be pinged!

--

___
Python tracker 

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



[issue7676] IDLE shell shouldn't use TABs

2015-01-08 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I believe I explained above the logical and technical factors that make the 
Idle shell inherently different from the console shell in this regard.  As the 
title says, this issue is about not using tabs and not about mixing tabs and 
spaces.  As I already said, my intended fix is to put the prompt in a sidebar 
(adapting the proposed editor line number code), which will allow use of space 
indents in the entry area, as in the editor.

--

___
Python tracker 

___
___
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-01-08 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fbe87fb071a6 by Victor Stinner in branch 'default':
Issue #22038: pyatomic.h now uses stdatomic.h or GCC built-in functions for
https://hg.python.org/cpython/rev/fbe87fb071a6

--
nosy: +python-dev

___
Python tracker 

___
___
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-01-08 Thread STINNER Victor

STINNER Victor added the comment:

atomicv3.patch is wrong for GCC builtin atomic operations: the parenthesis is 
not closed. I fixed this typo in the commit.

Vitor & Gustavo: Thanks for the patch, it's now applied to Python 3.5.

I tested it on Fedora 21 (x86_64). I disabled manually HAVE_STD_ATOMIC in 
pyconfig.h to test the two new options (stdatomic header & GCC builtins).

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue23025] ssl.RAND_bytes docs should mention os.urandom

2015-01-08 Thread STINNER Victor

STINNER Victor added the comment:

To be clear: rand.diff looks good to me, go ahead.

--

___
Python tracker 

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



[issue23200] Clarify max_length and flush() for zlib decompression

2015-01-08 Thread Martin Panter

New submission from Martin Panter:

This simple patch documents that max_length has to be non-zero. The 
implementation actually uses zero as a special value to indicate max_length was 
not specified.

Also, I wonder what the point of the Decompressor.flush() method is. Reading 
the module code and zlib manual, it looks like it would return the same data as 
decompressor.decompress(decompressor.unconsumed_tail), except that it uses the 
Z_FINISH flag instead of Z_SYNC_FLUSH, so that zlib can optimize by assuming no 
more data is to be processed. Since unconsumed_tail is read-only and only 
relevant when using max_length, and flush does not support max_length, I wonder 
if the flush() method should be deprecated.

To further test this theory, I modified the test_zlib.py file so that all 
appropriate flush() calls are equivalent to this:

self.assertFalse(dco.flush())

and the tests all still pass.

BTW, it looks to me like zlib_Decompress_flush_impl() is setting avail_out too 
high (blessing unallocated memory) when the total length is more than half of 
UNIT_MAX, but I am not in a position to test this.

--
assignee: docs@python
components: Documentation
files: max_length.patch
keywords: patch
messages: 233709
nosy: docs@python, vadmium
priority: normal
severity: normal
status: open
title: Clarify max_length and flush() for zlib decompression
versions: Python 3.4
Added file: http://bugs.python.org/file37650/max_length.patch

___
Python tracker 

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



  1   2   >