[issue21514] update json module docs in light of RFC 7159 ECMA-404

2014-05-16 Thread Ezio Melotti

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


--
nosy: +ezio.melotti, pitrou, rhettinger
stage:  - needs patch
type:  - enhancement
versions: +Python 3.4

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



[issue634412] RFC 2387 in email package

2014-05-16 Thread Abhilash Raj

Abhilash Raj added the comment:

I would like to work on this issue, but I would need a little help to start 
working on this feature.

--
nosy: +abhilash.raj

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



[issue21046] Document formulas used in statistics

2014-05-16 Thread Ezio Melotti

Ezio Melotti added the comment:

Do you want to propose a patch?

--

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



[issue20177] Derby #8: Convert 28 sites to Argument Clinic across 2 files

2014-05-16 Thread Tal Einat

Tal Einat added the comment:

Regarding the handling of time_t arguments which can be None, I agree that the 
second version (without custom convertors) is simpler and clearer while having 
no disadvantage that I can see.

I'd like to review the rest of the patches, but you mention changes to the AC 
policy regarding 3.4 and 3.5 and I can't find a reference to these changes or 
to the new policy.

--
nosy: +taleinat

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



[issue20177] Derby #8: Convert 28 sites to Argument Clinic across 2 files

2014-05-16 Thread Stefan Krah

Changes by Stefan Krah stefan-use...@bytereef.org:


--
nosy:  -skrah

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread STINNER Victor

New submission from STINNER Victor:

Linux 3.11 introduced a new file flag O_TMPFILE. The flag is exposed in 
Python, see the issue #18673.

O_TMPFILE is a new open(2)/openat(2) flag that makes easier the creation of 
secure temporary files. Files opened with the O_TMPFILE flag are created but 
they are not visible in the filesystem. And as soon as they are closed, they 
get deleted - just as a file you would have opened and unlinked.
http://kernelnewbies.org/Linux_3.11#head-8be09d59438b31c2a724547838f234cb33c40357

Does it make sense to use this flag in tempfile.TemporaryFile?

Attached patch is a work-in-progress patch for tempfile.

 if hasattr(_os, 'O_TMPFILE'):
 _O_TMPFILE = _os.O_TMPFILE
 elif _sys.platform == 'linux':
 __O_TMPFILE = 0o2000
 _O_TMPFILE = (__O_TMPFILE | _os.O_DIRECTORY)

The second if should be removed. I used it because my Linux kernel (3.14) 
supports the flag, but the constant is not defined yet in C headers of my C 
library (glibc 2.18).

 flags = (flags | _O_TMPFILE)  ~_os.O_CREAT

O_CREAT is incompatible with O_TMPFILE.

Bonus point of the flag: no need to compute a random name! Just pass the 
temporary directory.

To do: test the patch on Linux  3.11 to see how the flag is interpreted. If 
the flag is ignored, we open the directory in write mode! That's insafe. If the 
flag raises an error, we should fallback to the current implementation and 
remember that the flag is not supported.

I implemented something similar for O_CLOEXEC and SOCK_CLOEXEC flags (PEP 433).

--
files: tempfile_o_tmpfile.patch
keywords: patch
messages: 218648
nosy: haypo, neologix
priority: normal
severity: normal
status: open
title: Use Linux O_TMPFILE flag in tempfile.TemporaryFile?
versions: Python 3.5
Added file: http://bugs.python.org/file35261/tempfile_o_tmpfile.patch

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't think we can use this by default, or it will break the expected 
semantics of temporary files under Unix (visible by other processes).

--
nosy: +georg.brandl, ncoghlan, pitrou

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread STINNER Victor

STINNER Victor added the comment:

I don't think we can use this by default, or it will break the expected 
semantics of temporary files under Unix (visible by other processes).

I proposed to change TemporaryFile, not NamedTemporaryFile. Do you mean that 
other processes are supposed to have access to the temporary file descriptor? 
Access through /proc/pid/fd/tmp_fd?

O_TMPFILE should increase the security because there is no more race condition 
between os.open() and os.unlink() (window where an attack can access the file).

My patch uses O_EXCL. It makes possible to use linkat() to create a path for 
the temporary file (I didn't try it, but I read that it's possible). I don't 
know if using O_EXCL should be the default.

--

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



[issue21046] Document formulas used in statistics

2014-05-16 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Fri, May 16, 2014 at 07:50:16AM +, Ezio Melotti wrote:

 Do you want to propose a patch?

I'm really not sure that I agree with this request. I'm currently 
sitting on the fence, undecided, about 60% against and 40% in favour of 
explicitly documenting the formulae. This is not Mathworld or Wikipedia, 
and it is easy to google for variance to find out what it means.

This request orginally came from somebody who claimed he didn't know 
what the functions were from the names (mean, median, variance) but 
would recognise them from the formulae. Given how hard it is to 
accurately portray mathematical formulae in plain text, and how many 
different versions of the mathematical formulae there are, I don't think 
that will apply to very many people.

There's no good way to write mathematical functions *accurately* in 
ASCII text. I can write mean(L) = sum(L)/len(L), for example, that's 
quite trivial. But it's not the usual mathematical formula. If the OP 
doesn't recognise the name mean, will he recognise that non-standard 
formula? Should the docs include μ = ∑x÷n? But even that's not quite 
accurate -- where's the subscript on the x? The reader needs to 
understand the formula, and they aren't going to get that here. They 
probably have to go read Mathworld or Wikipedia regardless.

The problem is compounded with variance. Which of these should we write?

σ² = ∑(x - μ)² ÷ n
s² = ∑x² ÷ n - μ²
s[n]² = ∑(x - a)² ÷ n
Var(X) = E[X-μ)²]
Var(X) = E[X²] - (E[X])²

or something else?

What do other statistics packages do? I wouldn't want to do *less* -- if 
it is common for other stats packages to show the formula, then I would 
agree we should do the same. R doesn't seem to do so:

http://stat.ethz.ch/R-manual/R-devel/library/base/html/mean.html

--

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



[issue21046] Document formulas used in statistics

2014-05-16 Thread Ezio Melotti

Ezio Melotti added the comment:

From msg214692 it seems to me that Alex wants Python-friendly formulas or 
examples, rather than mathematical formulas.  Most functions seems to already 
have them, so I was asking for a patch to get a better idea of which functions 
he thinks should be improved and how.

As an example, itertools docs have simple formulas explaining what the 
function does and an example in the table at the top, and (possibly 
approximate) Python equivalents for most of the functions: 
https://docs.python.org/dev/library/itertools.html
While the Python equivalent are probably not needed here, some simple 
formulas/examples might be OK, but I would have to see what exactly Alex is 
proposing.

--

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I proposed to change TemporaryFile, not NamedTemporaryFile.

Ah, sorry. Then it sounds ok.
(I couldn't find any documentation for O_TMPFILE, though)

--

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



[issue21507] set and frozenset constructor should use operator.length_hint to guess the size of the iterator

2014-05-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

AFAIU, Lev merely posted this because he feared it might be indicative of a 
bug. Since it isn't a bug but the by-product of a feature, I propose to close 
this issue as not a bug.

Regardless, thank you for posting this report! We appreciate the concern.

--
resolution:  - not a bug

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



[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which tests encoding name with cp65001 instead of CP_UTF8. 
I can't test on Windows and don't know which of two patches are correct.

--
Added file: http://bugs.python.org/file35262/surrogatepass_cp65001.patch

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



[issue21027] difflib new cli interface

2014-05-16 Thread Claudiu.Popa

Claudiu.Popa added the comment:

Attached the new version of the patch which removes the resource warnings. 
Raymond, I disagree on certain points. `difflib -m` does help the development, 
especially for platforms where there aren't many readily available alternatives 
(like Windows). I gave an example for this in my first message, where you can't 
modify the PATH, nor install additional software. Also, you say that this 
should remain in tools as a demo. Wouldn't be better to have that demo well 
tested in stdlib and in a place where you can easy access it? This way, the 
user doesn't have to reimplement the wheel everytime he needs the differences 
between two files. And we are not competing with well developed, tested tools. 
By this argument, having `-m zipfile` and `-m tarfile` is redundant, because we 
can always use zip and tar instead.

--
Added file: http://bugs.python.org/file35263/issue21027_2.patch

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



[issue13299] namedtuple row factory for sqlite3

2014-05-16 Thread Glenn Langford

Glenn Langford added the comment:

In abstract, I like the namedtuple interface for sqlite3 as well. One caution 
is that the approach suggested at

http://peter-hoffmann.com/2010/python-sqlite-namedtuple-factory.html 

can have a dramatic impact on performance. For one DB-intensive application, I 
experienced 20+ seconds run time with the row factory (under 3.4), versus sub 
second without (identified with cProfile). Many thousands of calls to 
namedtuple_factory were not good. :)

--
nosy: +glangford

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



[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8ee2b73cda7a by Victor Stinner in branch 'default':
Issue #13916: Fix surrogatepass error handler on Windows
http://hg.python.org/cpython/rev/8ee2b73cda7a

--

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



[issue13916] disallow the surrogatepass handler for non utf-* encodings

2014-05-16 Thread STINNER Victor

STINNER Victor added the comment:

 But an exception reports about CP_UTF8.

Oh, that's my fault! And it is a bug: CP_UTF8 is the Windows constant, but it 
is not a valid Python codec name.

Attached patch cp_encoding_name.patch fixes this issue.

I don't think that Py_LOWER() is needed because the encoding name of Unicode 
errors from the code page codec is cpXXX. It cannot be CPXXX, except if you 
pass create manually an Unicode error exception.

What do you think? Py_LOWER or not?

--
Added file: http://bugs.python.org/file35264/cp_encoding_name.patch

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread STINNER Victor

STINNER Victor added the comment:

It looks like O_TMPFILE is supported by tmpfs (3.11), ext3 (3.11), ext4 (3.11), 
XFS (3.15). It looks like BTRFS will also support the O_TMPFILE:
https://btrfs.wiki.kernel.org/index.php/Project_ideas#Implement_O_TMPFILE_support

--

It looks like os.open() fails with OSError(95, 'Operation not supported') if 
the filesystem of the directory doesn't support TMPFILE. In this case, a 
fallback to the current implementation should be enough. I don't think that we 
need to remember that the directory doesn't support TMPFILE. The directory may 
be on a different filesystem at the next call.

haypo@smithers$ ~/prog/python/default/python 
Python 3.5.0a0 (default:5e98a50e0f55, May 16 2014, 10:44:10) 
 import tempfile
 tempfile._O_TMPFILE
4259840
 f=tempfile.TemporaryFile(dir='.')
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/haypo/prog/python/default/Lib/tempfile.py, line 507, in 
TemporaryFile
fd = _os.open(dir, flags, 0o600)
OSError: [Errno 95] Operation not supported: '.'

haypo@smithers$ df .
Sys. de fichiers   Taille Utilisé Dispo Uti% Monté sur
192.168.0.42:/test96G9,1G   83G  10% /home/haypo/nfs

--

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread STINNER Victor

STINNER Victor added the comment:

It looks like open() ignores O_TMPFILE (0o2000) on old Linux kernels. Test 
on Linux 3.2:

 fd=os.open(/tmp, os.O_RDWR | O_TMPFILE, 0o600)
Traceback (most recent call last):
  File stdin, line 1, in module
OSError: [Errno 21] Is a directory: '/tmp'

 fd=os.open(/tmp, os.O_RDWR | os.O_DIRECTORY, 0o600)
Traceback (most recent call last):
  File stdin, line 1, in module
OSError: [Errno 21] Is a directory: '/tmp'

So we should catch OSError(21, Is a directory: '/tmp') and fallback to the 
current implementation (random name, unlink), and remember that the kernel 
version is too old.

--

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



[issue21047] html.parser.HTMLParser: convert_charrefs should become True by default

2014-05-16 Thread Berker Peksag

Berker Peksag added the comment:

Here's a patch to set the default convert_charrefs value to True (with 
documentation and whatsnew updates).

--
keywords: +patch
nosy: +berker.peksag
stage:  - patch review
Added file: http://bugs.python.org/file35265/issue21047.diff

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



[issue21047] html.parser.HTMLParser: convert_charrefs should become True by default

2014-05-16 Thread Ezio Melotti

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


--
assignee:  - ezio.melotti

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



[issue634412] RFC 2387 in email package

2014-05-16 Thread R. David Murray

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


--
versions: +Python 3.5 -Python 3.4

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



[issue634412] RFC 2387 in email package

2014-05-16 Thread R. David Murray

R. David Murray added the comment:

There is some support for this in the new email policies.  Take a look at the 
new examples in the 3.4 email documentation in particular.

The additional thing I would like to see is support in the content manager that 
recognizes multipart/related and makes it easy to manage one.  I have to find 
time to look at it again myself before I can provide my ideas of what the API 
should be.  Maybe you could take a look at the docs and examples and how the 
contentmanager works, and see if you have thoughts or questions.

--

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



[issue21516] pathlib.Path(...).is_dir() crashes on readonly directories (Windows)

2014-05-16 Thread Thomas Heller

New submission from Thomas Heller:

On Windows, pathlib.Path(...).is_dir() crashes on readonly directories while 
os.path.isdir(...) works fine.  Example on Windows7:

Python 3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:24:06) [MSC v.1600 32 bit 
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import os.path, pathlib
 os.path.isdir(c:\\Users\\admin)
True
 pathlib.Path(c:\\Users\\admin).is_dir()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python34\lib\pathlib.py, line 1197, in is_dir
return S_ISDIR(self.stat().st_mode)
  File C:\Python34\lib\pathlib.py, line 1045, in stat
return self._accessor.stat(self)
  File C:\Python34\lib\pathlib.py, line 323, in wrapped
return strfunc(str(pathobj), *args)
PermissionError: [WinError 5] Zugriff verweigert: 'c:\\Users\\admin'


This probably affects other methods that call stat() internally.

--
components: Library (Lib)
messages: 218664
nosy: theller
priority: normal
severity: normal
status: open
title: pathlib.Path(...).is_dir() crashes on readonly directories (Windows)
type: crash
versions: Python 3.4, Python 3.5

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



[issue21516] pathlib.Path(...).is_dir() crashes on some directories (Windows)

2014-05-16 Thread Thomas Heller

Thomas Heller added the comment:

Well, not 'readonly' directories but directories where the user has no access 
rights.  I corrected the title of this bug.

--
title: pathlib.Path(...).is_dir() crashes on readonly directories (Windows) - 
pathlib.Path(...).is_dir() crashes on some directories (Windows)

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



[issue21503] Use test_both() consistently throughout test_importlib

2014-05-16 Thread Brett Cannon

Brett Cannon added the comment:

I see you noticed my shift in strategy after I realized part way through a 
cleaner way of doing things. =)

LGTM

I don't love the formatting of the test_both() lines, but I think that one is 
just an aesthetic thing that will never make people happy -- weird line 
wrapping or really long lines -- so just leave it as-is in your patch.

--

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 So we should catch OSError(21, Is a directory: '/tmp') and fallback
 to the current implementation (random name, unlink), and remember that
 the kernel version is too old.

Just catch any OSError?

--

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



[issue13299] namedtuple row factory for sqlite3

2014-05-16 Thread Glenn Langford

Glenn Langford added the comment:

...if I understand the proposed caching scheme, then repeated executions of the 
query

SELECT a,b,c FROM table

would result in cache hits, since the column names remain the same. I'm 
guessing this would resolve the performance problem in the app I saw, but it 
would be good to verify that performance is broadly similar with/without named 
tuples.

--

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



[issue21503] Use test_both() consistently throughout test_importlib

2014-05-16 Thread Eric Snow

Eric Snow added the comment:

 I don't love the formatting of the test_both() lines, but I think that one is 
 just an aesthetic thing that will never make people happy -- weird line 
 wrapping or really long lines -- so just leave it as-is in your patch.

Yeah, I went with the formatting that I did because I found it a
little easier to follow (stronger separation between elements) and
visually distinguish in the code.  It was also a little easier to
grep/search for.

--

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread STINNER Victor

STINNER Victor added the comment:

 Just catch any OSError?

If possible, I would prefer to not retry O_TMPFILE each time if the kernel 
version does not support the flag.

Pseudo-code:
--
if o_tmpfile_supported:
   try:
  fd = os.open(dir, os.O_TMPFILE | ...)
   except IsADirectoryError:
  # Linux kernel older than 3.11 ignores O_TMPFILE flag
  o_tmpfile_supported = False
   except OSError:
  # the filesystem doesn't support O_TMPFILE
  pass
   else:
  return io.open(fd, ...)
   # fallback to unsafe but portable implementation

# current code generating a name and using unlink
---

--

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

  Just catch any OSError?
 
 If possible, I would prefer to not retry O_TMPFILE each time if the kernel 
 version does not support the flag.

How likely it is to have a glibc flag that's not supported by the kernel
(on a normal setup, not a self-compiled distro)?

--

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



[issue21503] Use test_both() consistently throughout test_importlib

2014-05-16 Thread Eric Snow

Eric Snow added the comment:

FWIW, this change was motivated by the importlib backport (I found some time to 
work on it).  The import_importlib()/test_both() approach definitely makes 
backporting the tests easier (thanks for that).

BTW, thanks for also consolidating the various test_importlib util modules.  
That also helped.

--

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



[issue19610] setup.py does not allow a tuple for classifiers

2014-05-16 Thread Berker Peksag

Berker Peksag added the comment:

 A patch to detect bad type for classifiers in the check command would
 also be acceptable for 3.5, or to catch it earlier, a check in the
 Distribution class.

Thanks for the idea, Éric. New patch attached.

--
stage: needs patch - patch review
versions:  -Python 2.7, Python 3.4
Added file: http://bugs.python.org/file35266/issue19610_catch_distribution.diff

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



[issue21516] pathlib.Path(...).is_dir() crashes on some directories (Windows)

2014-05-16 Thread Matthew Barnett

Matthew Barnett added the comment:

I wouldn't call it a crash. It's an exception.

--
nosy: +mrabarnett

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



[issue6445] Add check parameter to subprocess.Popen.communicate

2014-05-16 Thread akira

akira added the comment:

subprocess.check_output() could be used in communicate() + check process
exit status one-liners. It returns child process output (stdout)
and raises an exception if the returncode is not zero. It is available
since Python 2.7 (3.1)

If you don't want to raise an error for non-zero exit status; you
could define a helper function:

  def status_output(*args, **kwargs):
  try:
  return 0, check_output(*args, **kwargs)
  except CalledProcessError as e:
  return e.returncode, e.output


 The CalledProcessError requires a cmd argument, which means also adding
a cmd member to Popen objects.

Popen.args is available since Python 3.3, see issue #21353

--
nosy: +akira

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



[issue21503] Use test_both() consistently throughout test_importlib

2014-05-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 34d65746d5ca by Eric Snow in branch 'default':
Issue #21503: Use test_both() consistently in test_importlib.
http://hg.python.org/cpython/rev/34d65746d5ca

--
nosy: +python-dev

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



[issue21503] Use test_both() consistently throughout test_importlib

2014-05-16 Thread Eric Snow

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


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

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



[issue21516] pathlib.Path(...).is_dir() crashes on some directories (Windows)

2014-05-16 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
type: crash - behavior

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



[issue2506] Add mechanism to disable optimizations

2014-05-16 Thread Trip Volpe

Changes by Trip Volpe t...@flowroute.com:


--
nosy: +Trip.Volpe

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



[issue21468] NNTPLib connections become corrupt after long periods of activity

2014-05-16 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +pitrou

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



[issue21477] Idle: improve idle_test.htest

2014-05-16 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
title: Idle: improve idle_test,htest - Idle: improve idle_test.htest

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



[issue21484] More clarity needed about difference between x += e and x = x + e

2014-05-16 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
nosy: +terry.reedy

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



[issue21495] Sane default for logging config

2014-05-16 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
components: +Library (Lib)
stage:  - test needed
type:  - enhancement
versions: +Python 3.5

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



[issue21495] Sane default for logging config

2014-05-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Moving discussion to python-ideas was the right thing to do. I am closing this 
for the present as there is no concrete accepted idea to write a patch for. 
Thomas, if that changes, you can re-open.

--
nosy: +terry.reedy
resolution:  - later
stage: test needed - resolved
status: open - closed

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



[issue21511] Thinko in Lib/quopri.py

2014-05-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Senthil, David, I hope one of you understands this. I looks like a minor fix.

--
nosy: +orsenthil, r.david.murray, terry.reedy
stage:  - test needed
versions: +Python 3.4

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



[issue21511] Thinko in Lib/quopri.py

2014-05-16 Thread R. David Murray

R. David Murray added the comment:

We should resolve issue 18022 before we decide how to fix this.

--
dependencies: +Inconsistency between quopri.decodestring() and 
email.quoprimime.decode()

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



[issue2506] Add mechanism to disable optimizations

2014-05-16 Thread Jean-Paul Calderone

Changes by Jean-Paul Calderone jean-p...@hybridcluster.com:


--
nosy:  -exarkun

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



[issue21511] Thinko in Lib/quopri.py

2014-05-16 Thread Paul Sokolovsky

Paul Sokolovsky added the comment:

This is minor issue indeed, uncovered when trying to run quopri.py with 
MicroPython http://micropython.org . I now worked around this on MicroPython 
side, but otherwise I set to report any issues I've seen with MicroPython 
porting, in the hope that MicroPython effort is good member of Python 
community. If the original report is unclear, feel free to point to any vague 
spots, and I'll elaborate on it. Thanks.

--

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



[issue21511] Thinko in Lib/quopri.py

2014-05-16 Thread R. David Murray

R. David Murray added the comment:

Thanks.  It's very clear.  What isn't clear is if the line should be made to 
work as apparently intended, or removed :)  (My guess at this point without 
re-reading the RFCs is that it should be removed.)

--

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



[issue21112] 3.4 regression: unittest.expectedFailure no longer works on TestCase subclasses

2014-05-16 Thread Ned Deily

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


--
nosy: +larry

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



[issue21516] pathlib.Path(...).is_dir() crashes on some directories (Windows)

2014-05-16 Thread eryksun

eryksun added the comment:

nt._isdir calls GetFileAttributes. CPython's stat implementation calls 
CreateFile to get a handle to pass to GetFileInformationByHandle. If it can't 
get a valid handle, it falls back to calling FindFirstFileW to get the file 
information, but only for ERROR_SHARING_VIOLATION. Shouldn't this include 
ERROR_ACCESS_DENIED?

win32_xstat_impl_w
http://hg.python.org/cpython/file/04f714765c13/Modules/posixmodule.c#l1742

--
nosy: +eryksun
type: behavior - crash

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



[issue21112] 3.4 regression: unittest.expectedFailure no longer works on TestCase subclasses

2014-05-16 Thread Larry Hastings

Larry Hastings added the comment:

Berker: do you consider your diff ready to go in, or is it an early diff 
(like a work-in-progress)?

--

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



[issue21516] pathlib.Path(...).is_dir() crashes on some directories (Windows)

2014-05-16 Thread eryksun

eryksun added the comment:

 but only for ERROR_SHARING_VIOLATION. Shouldn't this 
 include ERROR_ACCESS_DENIED?

To clarify, I meant that I think it should fall back to using FindFirstFile for 
either error, not that ERROR_SHARING_VIOLATION somehow includes 
ERROR_ACCESS_DENIED. (Proofreading? What's that?)

--

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I am glad that issues with 3rdparty libs which dependent on the previous wrong 
behavior has been resolved.

As indicated previously, I think, it makes sense to have this in 2.7 as well. I 
created a patch and tested it 2.7 and it is all good. I plan to commit it 
before the next 2.7 update (which should be tomorrow).

--
priority: release blocker - high
Added file: http://bugs.python.org/file35267/7776-2.7.patch

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



[issue21516] pathlib.Path(...).is_dir() crashes on some directories (Windows)

2014-05-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

When you say os.path.isdir(...) works fine, you mean it's returning False?

--
nosy: +pitrou

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



[issue21516] pathlib.Path(...).is_dir() crashes on some directories (Windows)

2014-05-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Apparently os.path.isdir() has been special-cased under Windows to use other, 
native APIs (see #11583).

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

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 568041fd8090 by Senthil Kumaran in branch '2.7':
Backport Fix for Issue #7776: Fix ``Host:'' header and reconnection when using 
http.client.HTTPConnection.set_tunnel().
http://hg.python.org/cpython/rev/568041fd8090

--

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Senthil Kumaran

Senthil Kumaran added the comment:

This is fixed in 2.7 as well here (changeset 568041fd8090). 

We shall close this ticket after @dstufft pulls in the updated pip for 3.4

Thanks!

--
priority: high - release blocker
versions: +Python 2.7

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Reasonably common, I believe. For example, Red Hat ships a Developer
Toolset, so you may be building with an up to date gcc on RHEL 6 or 7, but
still support deploying against the older kernel in RHEL 5.

--

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Donald Stufft

Donald Stufft added the comment:

Requests has been released and I've pulled it into the pip tree. I'll be 
releasing tonight probably, or maybe tomorrow.

--

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



[issue21515] Use Linux O_TMPFILE flag in tempfile.TemporaryFile?

2014-05-16 Thread Josh Rosenberg

Changes by Josh Rosenberg shadowranger+pyt...@gmail.com:


--
nosy: +josh.rosenberg

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Larry Hastings

Larry Hastings added the comment:

I tag 3.4.1 final in less than 24 hours.  I really would prefer that the 
embedded pip not contain such, uh, fresh software.  But let's try it and hope 
for the best.

--

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Donald Stufft

Donald Stufft added the comment:

Well you're the RM Larry :) I'll do whatever you think is best. I would greatly 
prefer it if the pip shipped with CPython 3.4.1 wasn't broken with proxies. I 
think the choices are

1) Ship it with the new pip, I can give a delta of the differences if that is 
helpful.
2) Roll back the patch that broke the behavior
3) Ship with broken pip + proxy behavior

Whichever you think is the better option is fine with me.

--

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Larry Hastings

Larry Hastings added the comment:

Yeah, I'd like to see the diff.

--

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Donald Stufft

Donald Stufft added the comment:

I just released pip 1.5.6.

The ensurepip package currently has 1.5.4 inside of it. 1.5.5 has been out for 
2 weeks or so and there haven't been any reported regressions.

The only difference between 1.5.5 and 1.5.6 is that requests has been upgraded.

Here's the changelog items for 1.5.5 and 1.5.6: 
https://github.com/pypa/pip/blob/master/CHANGES.txt#L1-L20

Here's the diff from 1.5.5 to 1.5.6: 
https://github.com/pypa/pip/compare/1.5.5...1.5.6
Here's the diff from 1.5.4 to 1.5.6: 
https://github.com/pypa/pip/compare/1.5.4...1.5.6

If you want me to update the bundled ensurepip let me know what branch I should 
do it on. I'm going to go ahead and do it for 3.5 though.

--

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Donald Stufft

Donald Stufft added the comment:

Just FYI, I upgraded setuptools and pip in 3.5:

http://hg.python.org/cpython/rev/acb5cc616052
http://hg.python.org/cpython/rev/308ff6a5ce67

If you decide to go that way dunno if you can just cherry pick or not.

--

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



[issue21517] installer Python default setting fails with mac Python Launcher

2014-05-16 Thread Andrew Harrington

New submission from Andrew Harrington:

I installed Python 3.4 on my Mac (OSX 10.9.2), with the option to make python 
3.4 my default python3, so 
  
which python3

prints

/Library/Frameworks/Python.framework/Versions/3.4/bin/python3

which is fine.  A terminal then brings up python 3.4, fine.

However the Python Launcher uses /usr/bin/python3 and the Python 3,4 install 
script does not change that.  (I had it pointing to python 3.3 before, and it 
remained that way after installing Python 3.4.)

Since the Python Launcher is a pretty standard way to start Python, this would 
be nice to fix, or at least in the installer have a comment that the something 
more needs to be set!

--
assignee: ronaldoussoren
components: Macintosh
messages: 218697
nosy: Andrew.Harrington, ronaldoussoren
priority: normal
severity: normal
status: open
title: installer Python default setting fails with mac Python Launcher
type: behavior
versions: Python 3.4

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



[issue7776] http.client.HTTPConnection tunneling is broken

2014-05-16 Thread Senthil Kumaran

Senthil Kumaran added the comment:

I prefer we update the ensurepip in 3.4.1  
That will be helpful too since 3.5 has the fix.

--

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