[issue13769] json.dump(ensure_ascii=False) return str instead of unicode

2012-08-31 Thread Petri Lehtinen

Petri Lehtinen added the comment:

Fixed, thanks.

--
keywords:  -needs review
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue13769] json.dump(ensure_ascii=False) return str instead of unicode

2012-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a1884b3027c5 by Petri Lehtinen in branch '2.7':
#13769: Enhance docs for ensure_ascii semantics in JSON decoding functions
http://hg.python.org/cpython/rev/a1884b3027c5

--
nosy: +python-dev

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2012-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1b614921aefa by R David Murray in branch '3.2':
#12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/1b614921aefa

New changeset 74f6d87cd471 by R David Murray in branch 'default':
Merge #12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/74f6d87cd471

New changeset 62b5667ef2f4 by R David Murray in branch '2.7':
#12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/62b5667ef2f4

--
nosy: +python-dev

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

Thanks, Arnaud and Mike.  (And Steven, of course :)

--
nosy: +r.david.murray
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue11839] argparse: unexpected behavior of default for FileType('w')

2012-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1b614921aefa by R David Murray in branch '3.2':
#12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/1b614921aefa

New changeset 74f6d87cd471 by R David Murray in branch 'default':
Merge #12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/74f6d87cd471

New changeset 62b5667ef2f4 by R David Murray in branch '2.7':
#12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/62b5667ef2f4

--
nosy: +python-dev

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

You are welcome, and thanks for your contribution.

--
components: +Library (Lib) -Tests

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread Daniel Wagner-Hall

Daniel Wagner-Hall added the comment:

Added patch for 2.7.

I'll sign the contributor form just as soon as I can get to a printer.

Thanks for taking me through my first contribution.

--
versions: +Python 2.7
Added file: http://bugs.python.org/file27081/issue15836-2.7.patch

___
Python tracker 

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



[issue15837] Added test to test_random.py testing Random.shuffle

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

The patch seems to be missing.

The int=int is probably some sort of micro-optimization and perhaps should be 
removed.

--
nosy: +r.david.murray, rhettinger

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +michael.foord

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

Uploading the new patch here is the correct procedure.  It will automatically 
be uploaded to rietveld as well.

If by "how" you mean how to submit a backport, just create a patch against 2.7 
tip and upload it separately.

Revised patch looks good.

--

___
Python tracker 

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



[issue15837] Added test to test_random.py testing Random.shuffle

2012-08-31 Thread Alessandro Moura

New submission from Alessandro Moura:

Random.shuffle does not have a test in test_random.py; the attached patch adds 
this test. In addition, I rewrote the documentation string for Random.shuffle, 
which apparently did not reflect recent changes in the code and was 
inconsistent with the definition of the method. This change is also part of 
this patch; I was not sure if this merited a separate issue, so I just included 
this here.

On a related matter: in Random.shuffle there is a third optional argument which 
looks very odd to me:

def shuffle(self, x, random=None, int=int):


Besides being confusing to a user typing help(shuffle), what the "int" argument 
does in shuffle is to convert a float to an integer. But one could pass any 
one-argument function in principle, and it would be then very hard to predict 
what shuffle would do... it would not "shuffle" any more in the traditional 
sense - not with a uniform probability distribution. In summary, I don't see 
how that argument could be useful, although the people who wrote the library 
must have had something in mind... if so it would be a good idea to document it.

--
components: Tests
messages: 169603
nosy: eng793
priority: normal
severity: normal
status: open
title: Added test to test_random.py testing Random.shuffle
type: enhancement
versions: Python 3.3

___
Python tracker 

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



[issue15826] Increased test coverage of test_glob.py

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

Is test_bytes_glob_directory_with_trailing_slash unique to bytes, or should it 
be added to the base class instead?

What would be useful as bytes-only tests, I think, would be tests of non-ascii 
stuff.

Although that makes me wonder, do we test non-ascii unicode in the string 
tests?  I presume that ought to be tested, too, though I suppose that could be 
tricky if the default encoding of the system the tests are running on can't 
handle the selected characters (such as, if it is ASCII).

Both of those are extras, though, the main question before committing this 
patch is the first one.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread Daniel Wagner-Hall

Daniel Wagner-Hall added the comment:

I seem to be getting exceptions why trying to upload a new patch to rietveld, 
either by the web interface (in several browsers), or by upload.py - attaching 
new patchset here

Also, if I wanted to backport to 2.7 including an isinstance(e, 
types.ClassType) check, how would I go about doing so?

Thanks for the quick review!

--
Added file: http://bugs.python.org/file27080/assertRaises.patch

___
Python tracker 

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



[issue15809] IDLE console uses incorrect encoding.

2012-08-31 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue15820] Add additional info to Resources area on Dev Guide

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

Is the :exc:`KeyboardInterrupt` line supposed to be in there?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

I put some review comments in rietveld (you should have gotten an email).

--

___
Python tracker 

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



[issue15786] IDLE code completion window does not scoll/select with mouse

2012-08-31 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +serwy, terry.reedy

___
Python tracker 

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



[issue15780] IDLE (windows) with PYTHONPATH and multiple python versions

2012-08-31 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

Sounds like a reasonable suggestion.  However, the patch is not valid for 2.7, 
since there exceptions can be old style classes.

--
nosy: +r.david.murray
stage:  -> patch review
versions:  -Python 2.6, Python 2.7, Python 3.1

___
Python tracker 

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



[issue15535] Fix pickling efficiency of named tuples in 2.7.3

2012-08-31 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FWIW, all pickle protocol levels are affected:

Point = colletions.namedtuple('Point', ['x', 'y', 'z'])
for proto in range(3):
pickletools.dis(dumps(Point(10, 20, 30), proto))

I'll look at the proposed fix in more detail when I get a chance -- we want to 
make sure that subclasses aren't adversely affected and that there aren't any 
other unintended side-effects.

--
title: Fix pickling of named tuples in 2.7.3 (BUG) -> Fix pickling  efficiency 
of named tuples in 2.7.3

___
Python tracker 

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



[issue15836] unittest assertRaises should verify excClass is actually a BaseException class

2012-08-31 Thread Daniel Wagner-Hall

New submission from Daniel Wagner-Hall:

The following code in a unittest test is a no-op:

self.assertRaises(lambda: 1)

I would expect this to fail the test, because I naively assumed omitting the 
exception class would act as:

self.assertRaises(BaseException, lambda: 1)

verifying that *any* Exception is raised.



I believe the correct behaviour is to raise a TypeError if excClass is not a 
BaseException-derived type, similar to if a non-type is passed as the first arg 
to issubclass.

Attached is a patch to do so.  It also removes a no-op self.assertRaises from 
libimport's tests (because it started failing when I ran the tests with the 
patch).  That assertion is redundant, because the two lines above perform the 
assertion being attempted.

--
components: Tests
files: assertRaises.patch
keywords: patch
messages: 169596
nosy: illicitonion
priority: normal
severity: normal
status: open
title: unittest assertRaises should verify excClass is actually a BaseException 
class
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file27079/assertRaises.patch

___
Python tracker 

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



[issue15535] Fix pickling of named tuples in 2.7.3 (BUG)

2012-08-31 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Trent Nelson

Trent Nelson added the comment:

> Since the committed patch is already a step in that direction,
> I think it now needs to be completed. It's mandatory (IMO)
> that the generated files are actually used; that the generators
> are not run if not needed is optional and can be fixed later.

Martin: I'll work on another patch over the next few days and post it here for 
review.  It seems like your comments regarding our options are still valid 
(despite this thread getting sidetracked): continue with the premise that all 
generated files get generated in the build directory, and make sure that build 
directory gets used during the build (i.e. -I./Include).

I'll start with that and see how I get on.

--

___
Python tracker 

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



[issue15833] most failures to write byte-compiled file no longer suppressed

2012-08-31 Thread Eric Snow

Eric Snow added the comment:

I was thinking along the same lines, though it might make sense for EROFS and a 
few others.  (http://aplawrence.com/Unixart/errors.html)

--
nosy: +eric.snow

___
Python tracker 

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



[issue15835] HP-UX build needs to be tweaked to pick up PATH_MAX

2012-08-31 Thread Trent Nelson

New submission from Trent Nelson:

Building on HP-UX with the HP ANSI C compiler:


% make 
cc -Ae -c  -O  -O  -I. -I./Include-DPy_BUILD_CORE -o 
Python/pythonrun.o Python/pythonrun.c
"Python/pythonrun.c", line 805: error #2020: identifier "PATH_MAX" is undefined
  static wchar_t env_home[PATH_MAX+1];
  ^

1 error detected in the compilation of "Python/pythonrun.c".
*** Error exit code 2

Stop.

Placeholder bug whilst I do some more digging.

--
assignee: trent
messages: 169593
nosy: trent
priority: normal
severity: normal
status: open
title: HP-UX build needs to be tweaked to pick up PATH_MAX
type: compile error
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue15748] Various symlink test failures in test_shutil on FreeBSD

2012-08-31 Thread Larry Hastings

Larry Hastings added the comment:

Could we work around it?  Ignore the length we get back from readlink() and 
just measure the buffer ourselves?  Or, if we wanted to be *really* paranoid, 
write a \0 at the length they give us back and *then* strlen it.

--

___
Python tracker 

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



[issue15834] 2to3 benchmark not working under Python 3

2012-08-31 Thread Brett Cannon

Brett Cannon added the comment:

On Fri, Aug 31, 2012 at 6:42 PM, Antoine Pitrou wrote:

>
> Antoine Pitrou added the comment:
>
> > Might need to let Python 3 use its stdlib copy of lib2to3. Otherwise
> > will need to come up with a way to have two copies of a library, one
> > for Python 2 and another for Python 3, and then copy the right thing.
> > Maybe a lib3 directory that is only copied over by make_perf3.sh?
>
> Sounds like a good idea.
> Even better if you can find a 3.x copy of lib2to3 which is close the 2.x
> one :-)
>

I think short of copying the stdlib versions from Python 2.7 and 3.2 I
don't think there is much choice short of doing a 2to3+fixes translation
ourselves just to have a version that is as close to the same as possible.
But looking at the stdlib versions they are practically the same already
except that one uses StringIO and the other uses io.StringIO (and Python 3
doesn't need the encode() call that triggered this whole discussion). I
don't remember if StringIO or io.StringIO is faster in Python 2.6 and 2.7,
but based on that we can either leave it as-is or tweak it to use the other
just for benchmarking to make it even.

--

___
Python tracker 

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



[issue15748] Various symlink test failures in test_shutil on FreeBSD

2012-08-31 Thread Trent Nelson

Trent Nelson added the comment:

Turns out our unit test uncovered a very subtle corner-case bug in ZFS, 
requiring the following patch to FreeBSD:

a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
index 69374fb..7f61517 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
@@ -1695,6 +1695,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
ASSERT(action == SA_REPLACE);
SA_ADD_BULK_ATTR(attr_desc, j, attr,
locator, datastart, buflen);
+   length_idx++;
} else {
length = SA_REGISTERED_LEN(sa, attr);
if (length == 0) {


I guess the unit test should probably be patched to to skip the test IFF the 
underlying filesystem is ZFS and it exhibits the "length 24" problem.  
(Actually, detecting if the underlying filesystem is ZFS is non-trivial -- just 
testing for the "length 24" bug is probably sufficient.)  I'll look into this 
later.

(According to Andriy Gapon (FreeBSD developer that came up with the patch), the 
bug is likely to affect all ZFS implementations since the beginning of time.)

--
resolution:  -> postponed
stage:  -> needs patch

___
Python tracker 

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



[issue15834] 2to3 benchmark not working under Python 3

2012-08-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Might need to let Python 3 use its stdlib copy of lib2to3. Otherwise
> will need to come up with a way to have two copies of a library, one
> for Python 2 and another for Python 3, and then copy the right thing.
> Maybe a lib3 directory that is only copied over by make_perf3.sh?

Sounds like a good idea.
Even better if you can find a 3.x copy of lib2to3 which is close the 2.x
one :-)

--

___
Python tracker 

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



[issue15833] most failures to write byte-compiled file no longer suppressed

2012-08-31 Thread Brett Cannon

Brett Cannon added the comment:

So it might be a change, but I don't know if I would claim it is a regression 
that needs changing. If you can't write bytecode files for some reason other 
than permissions or the file already exists then there is something wrong with 
your setup that you might not be expecting.

I don't know what this EIO error code is, but it sounds non-standard for the 
situation and thus not something we should blindly be ignoring.

--

___
Python tracker 

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



[issue15834] 2to3 benchmark not working under Python 3

2012-08-31 Thread Brett Cannon

New submission from Brett Cannon:

2to3 isn't (ironically) translating lib2to3 so that it can run under Python 3:

File 
"/Users/bcannon/Developer/repo/benchmarks_py3k/lib/2to3/lib2to3/fixes/fix_operator.py",
 line 89, in _check_method
method = getattr(self, "_" + results["method"][0].value.encode("ascii"))

Might need to let Python 3 use its stdlib copy of lib2to3. Otherwise will need 
to come up with a way to have two copies of a library, one for Python 2 and 
another for Python 3, and then copy the right thing. Maybe a lib3 directory 
that is only copied over by make_perf3.sh?

--
assignee: collinwinter
components: Benchmarks
messages: 169587
nosy: brett.cannon, collinwinter, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: 2to3 benchmark not working under Python 3

___
Python tracker 

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



[issue15826] Increased test coverage of test_glob.py

2012-08-31 Thread Alessandro Moura

Alessandro Moura added the comment:

Agreed, here is the patch where this is done.

--
Added file: http://bugs.python.org/file27078/test_glob.patch

___
Python tracker 

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



[issue15775] Add StopParser() to expat

2012-08-31 Thread Berker Peksag

Changes by Berker Peksag :


--
versions: +Python 3.4

___
Python tracker 

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



[issue8912] `make patchcheck` should check the whitespace of .c/.h files

2012-08-31 Thread Chris Jerdonek

Chris Jerdonek added the comment:

The following commit from today is related to this issue: 815b88454e3e

"Remove trailing whitespace in order to silence warnings on HP-UX."

--
nosy: +cjerdonek

___
Python tracker 

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



[issue15833] most failures to write byte-compiled file no longer suppressed

2012-08-31 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Raising EIO in a read-only dir sounds weird.

--
nosy: +pitrou

___
Python tracker 

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



[issue15830] make -s no longer silences output from setup.py

2012-08-31 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +doko

___
Python tracker 

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



[issue15821] PyMemoryView_FromBuffer() behavior change (possible regression)

2012-08-31 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Here is what I think the test case should look like (untested):


static PyObject *
memoryview_from_buffer_cleanup(PyObject *self, PyObject *noargs)
{
PyObject *b, *view = NULL;
Py_buffer info;
Py_ssize_t shape[3] = {2, 2, 3};
Py_ssize_t strides[3] = {6, 3, 1};
const char *cp = "abcdefghijkl";

b = PyBytes_FromString(cp);
if (b == NULL)
return NULL;

if (PyObject_GetBuffer(b, &info, PyBUF_FULL_RO) < 0)
goto done;
/* reshape */
info.ndim = 3;
info.shape = shape;
info.strides = strides;

view = PyMemoryView_FromBuffer(&info);
/* release resources allocated for Py_buffer struct 
   before it goes out of scope */
PyBuffer_Release(&info);
 done:
Py_DECREF(b);
return view;
}

--

___
Python tracker 

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



[issue15821] PyMemoryView_FromBuffer() behavior change (possible regression)

2012-08-31 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

On Fri, Aug 31, 2012 at 3:12 PM, Stefan Krah  wrote:
> Now I'm puzzled: I thought your goal was to preserve the implicit cleanup
> from 3.2, i.e. PyBuffer_Release() is called when the managed buffer is
> deallocated.
>

The issue that I raised in msg169472 above was that
PyMemoryView_FromBuffer() would not copy .obj from Py_buffer structure
to the memoryview.  A related issue is that it looks like
PyObject_GetBuffer() often does not fill .obj either.   I would expect
that PyObject_GetBuffer() would always store a new reference in .obj
to assure that the .buf pointer remains valid until PyBuffer_Release()
is called explicitly.  (I am ignoring the issue of mutable objects
such as lists for the moment.)   PyMemoryView_FromBuffer() in turn
should store an additional reference in its own private copy of
Py_buffer structure.  After PyMemoryView_FromBuffer() returns a
well-behaved program should call PyBuffer_Release() releasing the
first reference and the second reference should be released in
memoryview destructor.  Am I missing something?

--

___
Python tracker 

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



[issue15756] subprocess.poll() does not handle errno.ECHILD "No child processes"

2012-08-31 Thread Gregory P. Smith

Gregory P. Smith added the comment:

thanks!  I'll take care of getting this fix in.

--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue14223] curses addch broken on Python3.3a1

2012-08-31 Thread Nicholas Cole

Nicholas Cole added the comment:

import curses

def test_screen(screen):
screen.addch(5,5, curses.ACS_HLINE)
screen.addch(5,6, curses.ACS_HLINE)
screen.refresh()
curses.napms(2000)

curses.wrapper(test_screen)

--

___
Python tracker 

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



[issue14223] curses addch broken on Python3.3a1

2012-08-31 Thread Nicholas Cole

Nicholas Cole added the comment:

I'm reopening this bug because I've noticed that in Python3.3rc1, although 
trying to print curses.ACS_HLINE and other such characters no long cause an 
Exception, only blank characters are printed to the screen.

Tested with both Terminal.App and xterm running under XQuartz.

Here is some minimal test code, that will print a line on Python2.x but a blank 
screen on Python3.3rc1.

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

___
Python tracker 

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



[issue15535] Fix pickling of named tuples in 2.7.3 (BUG)

2012-08-31 Thread Thomas Miedema

Changes by Thomas Miedema :


Removed file: http://bugs.python.org/file26662/namedtuple_pickle_fix.patch

___
Python tracker 

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



[issue15535] Fix pickling of named tuples in 2.7.3 (BUG)

2012-08-31 Thread Thomas Miedema

Thomas Miedema added the comment:

Added a better testcase.

--
title: Fix pickling of named tuples in 2.7.3 -> Fix pickling of named tuples in 
2.7.3 (BUG)
Added file: http://bugs.python.org/file27077/namedtuple_pickle_fix.patch

___
Python tracker 

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



[issue14783] Make int() and str() docstrings correct

2012-08-31 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The large issue is documenting complex signatures that do not really fit in any 
of the standard one-line patterns.

I was initially puzzled by Raymond describing the 3.3 line as 'confusing', but 
putting on 'newbie glasses' I see now that correctly parsing
int([number | string[, base]])
requires knowing that '[, option]' binds tighter than '|'. Since ',' normally 
has the lowest binding priority, someone who does not know the signature 
already (ie, a target audience member) could parse it as
int([ (number | string) [, base]])
rather than as intended:
int([number | (string[, base]) ])
So I agree that the two stacked lines in the doc patch are clearer.

However, this issue is about the docstring. Leave it incorrect? Change it to 
the hard-to-parse one liner? Change it to a two-line signature also? I noticed 
this issue while working on IDLE tooltips, using int as a test case. They 
currently use only the first line of the docstring, but I have decided that 
they should get more when needed for C functions. (For Python functions, 
tooltips use inspect for the actual signature and the first docstring line only 
for a description.) 

The first line of the str docstring is also incorrect in that the optional 
parameters are only valid for first arguments that are strings.
str(string[, encoding[, errors]]) -> str
It needs either a '|' construction like int or another line:
str(object)
I prefer the latter. I revised the title to add str.__doc__ to the issue.

While we are at it, how about
range(stop)
range(start, stop, [step])
instead of the current doc and docstring signature
range([start,] stop[, step])
? The current docstring is inaccurate and confusing to some. (How can there be 
an optional first arg and required second ? -- Answer: there can't.) The 
technically accurate signature is
range(start_or_stop[, stop[, step]])
but that has been rejected as confusing.

The bytes and bytearrays docstrings have 5 signature lines!. (The manual gives 
just one which does not quite cover all cases.) So (a) there is precedent for 
multiple signatures in docstrings and (b) tooltips already need to grab 
multiple signature lines. So I think int and str (and maybe range) should use a 
couple of clear lines.

If the new inspect.signature function were to give signatures for C functions, 
there would be no problem for tooltips, but it does not. (Can signature objects 
even handle multiple (or type-dependent) signatures?)

--
nosy: +georg.brandl
title: Update int() docstring from manual -> Make int() and str() docstrings 
correct

___
Python tracker 

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



[issue15756] subprocess.poll() does not handle errno.ECHILD "No child processes"

2012-08-31 Thread Berker Peksag

Changes by Berker Peksag :


--
versions:  -Python 2.6, Python 3.1

___
Python tracker 

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



[issue15821] PyMemoryView_FromBuffer() behavior change (possible regression)

2012-08-31 Thread Stefan Krah

Stefan Krah added the comment:

Alexander Belopolsky  wrote:
> I am still getting up to speed with all the changes that went in since
> 3.2.  I'll review your patch over the weekend.  Meanwhile, I think the
> goal should be that after PyMemoryview_FromBuffer(info) is called, it
> should be OK to discard info by calling PyBuffer_Release()

Now I'm puzzled: I thought your goal was to preserve the implicit cleanup
from 3.2, i.e. PyBuffer_Release() is called when the managed buffer is
deallocated.

Without the patch it's OK to call PyBuffer_Release(info) after
PyMemoryview_FromBuffer(info). With the patch you can't call
PyBuffer_Release(info), since it's done automatically already.

--

___
Python tracker 

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



[issue15821] PyMemoryView_FromBuffer() behavior change (possible regression)

2012-08-31 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

On Fri, Aug 31, 2012 at 2:34 PM, Stefan Krah  wrote:
> With the ManagedBuffer, we could now write a new function that returns
> a memoryview with much nicer cleanup facilities. But that doesn't help
> here since we're stuck with this function for 3.3.0.
>
>
> What do you think? Should this go into 3.3.0?

I am still getting up to speed with all the changes that went in since
3.2.  I'll review your patch over the weekend.  Meanwhile, I think the
goal should be that after PyMemoryview_FromBuffer(info) is called, it
should be OK to discard info by calling PyBuffer_Release() and if info
is not allocated on the stack, Py_DECREF(info).  I think we are almost
there achieving that goal with possible exception of dynamically or
stack-allocated fmt strings.

--

___
Python tracker 

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



[issue15821] PyMemoryView_FromBuffer() behavior change (possible regression)

2012-08-31 Thread Stefan Krah

Stefan Krah added the comment:

Alexander, your test case is brilliant and could eventually go into
_testbuffer.c, but I'd prefer a simpler test case for now. :)

Here's a patch that restores the info.obj cleanup facility.

I intentionally did not add copying the format in order to keep the
diff small (in case this can go into rc2). Crashing on stack addresses
for format is not a regression.


Apparently PyMemoryView_FromBuffer() is used for low level tinkering and
automatic cleanup, so I now think that it's better not to break backwards
compatibility, i.e. leave the value of info.obj untouched.

Otherwise people using the cleanup facility will have reference leaks.


However, I don't like the interface at all: Passing a pointer to a struct
and then relying on the fact that *some* values are copied (shape, strides
and suboffsets) but not others (format, buf) is counterintuitive.


With the ManagedBuffer, we could now write a new function that returns
a memoryview with much nicer cleanup facilities. But that doesn't help
here since we're stuck with this function for 3.3.0.


What do you think? Should this go into 3.3.0? The changes to memoryobject.c
are minimal, the rest are tests and docs.

--
assignee: docs@python -> skrah
components: +Interpreter Core -Documentation
stage:  -> patch review
title: Improve docs for PyMemoryView_FromBuffer() -> PyMemoryView_FromBuffer() 
behavior change (possible regression)
type: enhancement -> behavior
Added file: http://bugs.python.org/file27076/issue15821.diff

___
Python tracker 

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



[issue14783] Update int() docstring from manual

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

Here's a patch for the signature.

--
assignee:  -> ezio.melotti
keywords: +patch
stage: needs patch -> commit review
Added file: http://bugs.python.org/file27075/issue14783.diff

___
Python tracker 

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



[issue15810] assertSequenceEqual should be fired when comparing sequence subclasses

2012-08-31 Thread Gregory P. Smith

Gregory P. Smith added the comment:

When we added this functionality to assertEqual we were *intentionally* 
conservative on when it would auto-promote to nicer equality comparison 
functions.  It needs to behave exactly as == would in all situations.

>>> (1,2,3) == [1,2,3]
False

We must maintain that behavior in assertEqual.

Tests should use assertSequenceEqual when they want to compare sequences 
regardless of type because they are testing for something less than strict 
equality.

--
nosy: +gregory.p.smith
resolution:  -> rejected
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue15830] make -s no longer silences output from setup.py

2012-08-31 Thread Ned Deily

Ned Deily added the comment:

Issue15591 perhaps?

--
nosy: +ned.deily

___
Python tracker 

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



[issue15832] argparse: typechecks default value too early

2012-08-31 Thread Steven Bethard

Steven Bethard added the comment:

It's a bug, but it's already been reported in Issue 12776. There's a patch 
there, but someone needs to commit it.

--
superseder:  -> argparse: type conversion function should be called only once

___
Python tracker 

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



[issue15832] argparse: typechecks default value too early

2012-08-31 Thread Steven Bethard

Changes by Steven Bethard :


--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Richard Oudkerk

Richard Oudkerk added the comment:

I have opened a new issue:

http://bugs.python.org/issue15833

It is a regression because in Python 3.2 all failures to open the file for 
writing were supressed.

> But as I said: I'd also be fine with declaring this VM software
> unsupported. If this work-around is added, we should record the
> exact software for which it is a work-around, so we can remove
> it in the future.

It is VMware Player 4.0.0.

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

I think/hope that all the APIs we have in the stdlib are sane enough to have no 
more than 2-3 signatures (I'm not counting optional args (at the end) here).  
If that's not the case we should still be able to add as many signature as we 
need (I don't know if Sphinx has some limit about it though).

--

___
Python tracker 

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



[issue14783] Update int() docstring from manual

2012-08-31 Thread Éric Araujo

Éric Araujo added the comment:

+1!  This notation helps clearing up how int, str and other constructors work.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> What's this even supposed to mean?

I started wondering the same thing after I posted. :)

I guess my point/question is: are there any cases where more than two 
signatures would be needed to account for all of the possibilities?

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

> 766:.. method:: window.chgat([y, x, ] [num,] attr)

What's this even supposed to mean?

See also #14783.

--

___
Python tracker 

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



[issue15833] most failures to write byte-compiled file no longer suppressed

2012-08-31 Thread Richard Oudkerk

New submission from Richard Oudkerk:

As discussed in

http://bugs.python.org/issue15819

trying to run python built outside a read-only source directory fails for me 
because OSError(EIO, ...) is raised when importlib tries to write the byte 
compiled file.  (I built python in a Linux VM using VMware Player which only 
had read-only access to the source directory.)

Currently importlib only ignores PermissionError (EACCES, EPERM) and 
FileExistsError (EEXIST):


http://hg.python.org/cpython/file/d54f047312a8/Lib/importlib/_bootstrap.py#l1080

Under Python 3.2 all failures are ignored:

http://hg.python.org/cpython/file/69952b5599b5/Python/import.c#l905

so this seems to be a regression.

--
components: Interpreter Core
keywords: 3.3regression
messages: 169564
nosy: brett.cannon, sbt
priority: normal
severity: normal
status: open
title: most failures to write byte-compiled file no longer suppressed
type: behavior
versions: Python 3.3, Python 3.4

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> It would be fine with me to use a double signature for these.

Just an FYI that more than two signatures would be needed for cases like this:

766:.. method:: window.chgat([y, x, ] [num,] attr)

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

> No, methods for *curses* are also corrupted.

I meant the double signature support.

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

> This is what my search for ",] " gave me

It would be fine with me to use a double signature for these.

Georg, do you have any opinion?

(The double signature might be easier to understand, but the original issue 
should probably be fixed in Sphinx, even if we decide to stop using this kind 
of signature.)

--
nosy: +eric.araujo, georg.brandl

___
Python tracker 

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



[issue15701] AttributeError from HTTPError when using digest auth

2012-08-31 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Okay, this is funny. first info is invoking addinfourl of urllib, which would 
return headers. But in urllib2, the headers are self.hdrs

I would side with the documentation that info is advertised method for 
HTTPError object. In 2.7,  I guess just docs could be improved. This problem 
would be the present in 3.x.

--
assignee:  -> orsenthil
nosy: +orsenthil

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 31.08.12 18:18, schrieb Eric Snow:
> Doesn't EIO cover pathologies which we don't want to silence?  I could see 
> adding EROFS though.

[This should *really* be its own issue]
Sure, EIO indicates normally something pathological, such as a broken
cable to the disk. I'm not sure it needs to be reported, though, at
least not when coming out of open(): we are trying to write to the 
cache, and that failed really bad. However, this is not bad for Python:
if we don't have a cache file, we can still continue executing.

If we get EIO in the middle of writing, this would be worse.
So as a work-around, I could propose to map OSError(EIO) coming
out of open into PermissionError(EIO) (inside _bootstrap).
But as I said: I'd also be fine with declaring this VM software
unsupported. If this work-around is added, we should record the
exact software for which it is a work-around, so we can remove
it in the future.

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

> Does Sphinx support it for *.. function::*?

I'm pretty sure it does for methods, so I don't see why it shouldn't work for 
functions.

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Andrew Svetlov

Andrew Svetlov added the comment:

No, methods for *curses* are also corrupted.

--

___
Python tracker 

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



[issue15815] Add numerator to ZeroDivisionError messages

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

I'm not sure this is really useful.  Once I know that I divided by zero and I 
know where the division is, I don't really care what the numerator is.  Knowing 
the exact type of the denominator (0, 0.0, 0j) doesn't sound too useful as well 
-- unless you somehow manage to get the wrong type and a 0-value at the same 
time.

On a side note, I don't like
ZeroDivisionError: integer division or modulo of 3 by 0
too much, but I would prefer
ZeroDivisionError: integer division (or modulo) by zero
over
ZeroDivisionError: integer division or modulo by zero

IIRC the reason why both "division" and "modulo" are included in the message is 
because the error is created in a piece of code that is shared by both 
operations.

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Yes, it looks like Sphinx problem.

About having tho signatures for single function/method.
Does Sphinx support it for *.. function::*?
Pointing to anchor for first signature with adding second one somewhere in 
paragraph text doesn't look good.

--

___
Python tracker 

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



[issue15826] Increased test coverage of test_glob.py

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

I think it would be easier to subclass GlobTests and override norm and glob 
there (assuming that doesn't create problems with some of the tests).

--
nosy: +ezio.melotti
stage:  -> patch review
versions: +Python 3.2, Python 3.4

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Chris Jerdonek

Chris Jerdonek added the comment:

This is what my search for ",] " gave me (though the OP's print and random.seed 
do not show up in this list):

library/curses.rst
380:.. function:: newwin([nlines, ncols,] begin_y, begin_x)
659:.. method:: window.addch([y, x,] ch[, attr])
673:.. method:: window.addnstr([y, x,] str, n[, attr])
679:.. method:: window.addstr([y, x,] str[, attr])
766:.. method:: window.chgat([y, x, ] [num,] attr)
815:.. method:: window.derwin([nlines, ncols,] begin_y, begin_x)
909:.. method:: window.hline([y, x,] ch, n)
943:.. method:: window.insch([y, x,] ch[, attr])
964:.. method:: window.insnstr([y, x,] str, n [, attr])
1156:.. method:: window.subpad([nlines, ncols,] begin_y, begin_x)
1162:.. method:: window.subwin([nlines, ncols,] begin_y, begin_x)
1219:.. method:: window.vline([y, x,] ch, n)

library/functions.rst
1064:.. function:: range([start,] stop[, step])
1129:.. function:: slice([start,] stop[, step])

library/itertools.rst
55::func:`islice`  seq, [start,] stop [, step] elements from 
seq[start:stop:step]  ``islice('ABCDEFG', 2, None) --> C D E F 
G``
404:.. function:: islice(iterable, [start,] stop [, step])

library/random.rst
96:.. function:: randrange([start,] stop[, step])

library/syslog.rst
20:.. function:: syslog([priority,] message)

library/tkinter.tix.rst
507:.. method:: tixCommand.tix_configure([cnf,] **kw)

--

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Eric Snow

Eric Snow added the comment:

Doesn't EIO cover pathologies which we don't want to silence?  I could see 
adding EROFS though.

--
nosy: +eric.snow

___
Python tracker 

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



[issue15832] argparse: typechecks default value too early

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

It is possible this could be considered a feature rather than a bug :)  

Let's see what Steven thinks.

--
nosy: +bethard, r.david.murray
versions: +Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Ezio Melotti

Ezio Melotti added the comment:

I thought that was just a matter of finding the wrong commas and fixing them, 
but if they are correct in the source, then the situation might be a bit more 
complicated.

Does this happen only with "unusual" signatures like range([start], stop [, 
step])?

FWIW this could be replaced with:
range(stop)
range(start, stop [, step])

--

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Do we know that this is easy?  It might be a Sphinx issue, in which case it 
might not be as trivial as fixing typos.

I ask because the reST file looks correct (for range() for example):

.. function:: range([start,] stop[, step])

--

___
Python tracker 

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



[issue15832] argparse: typechecks default value too early

2012-08-31 Thread Riccardo Murri

New submission from Riccardo Murri:

The `argparse` module (tested with 2.7, but other versions might be
affected) checks the `default` value of an option too early: if the
default value raises an exception, then command-line parsing stops.

Consider for example the following code:

### begin sample #
import os
import argparse

def existing_filename(path):
if not os.access(path, os.F_OK | os.R_OK):
raise argparse.ArgumentTypeError("File '%s' does not exist or cannot be 
read." % path)
return path

parser = argparse.ArgumentParser(description='Process a file.')
parser.add_argument('file', type=existing_filename, 
default='/some/weird/default',
help='A file to process.')

args = parser.parse_args()
print ("Will process file '%s' ..." % args.file)
### end sample #

The intention here is that the default value should be used *if and
only if* the script users do not provide their own file to process.
It may happen that the default is invalid, but that should be reported
as an error only if the default is used, i.e., users did not provide
any file name to the script.

What happens instead is that the argparse errors out in any case, even
when `--help` is requested or when a valid file name is passed, as the
following two examples show:

rmurri@xenia:/tmp$ ./argparse-processes-defaults-too-early.py --help
Traceback (most recent call last):
  File "./argparse-processes-defaults-too-early.py", line 18, in 
args = parser.parse_args()
  File "/usr/lib/python2.7/argparse.py", line 1688, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python2.7/argparse.py", line 1710, in parse_known_args
default = self._get_value(action, default)
  File "/usr/lib/python2.7/argparse.py", line 2239, in _get_value
raise ArgumentError(action, msg)
argparse.ArgumentError: argument file: File '/some/weird/default' does not 
exist or cannot be read.

rmurri@xenia:/tmp$ ./argparse-processes-defaults-too-early.py /tmp/xxx.py 
Traceback (most recent call last):
  File "./argparse-processes-defaults-too-early.py", line 18, in 
args = parser.parse_args()
  File "/usr/lib/python2.7/argparse.py", line 1688, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python2.7/argparse.py", line 1710, in parse_known_args
default = self._get_value(action, default)
  File "/usr/lib/python2.7/argparse.py", line 2239, in _get_value
raise ArgumentError(action, msg)
argparse.ArgumentError: argument file: File '/some/weird/default' does not 
exist or cannot be read.

Thanks!

--
components: Library (Lib)
messages: 169548
nosy: riccardomurri
priority: normal
severity: normal
status: open
title: argparse: typechecks default value too early
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Ezio Melotti

Changes by Ezio Melotti :


--
keywords: +easy
nosy: +ezio.melotti
stage:  -> needs patch
versions: +Python 3.4

___
Python tracker 

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



[issue15831] comma after leading optional argument is after bracket in docs

2012-08-31 Thread Chris Jerdonek

New submission from Chris Jerdonek:

>From d...@python.org:

"""
In a number of places we find documentation with optional leading arguments 
where the meta-notation (square brackets) are in the wrong place.   For 
example, for range, the standard doc heading says

   range([start], stop [, step])   # The comma after start should be inside 
the square bracket, not outside.

The same error occurs with docs for print, and for slice, for random.randrange 
and for random.seed, etc, etc.   This seems a consistent bug whenever a 
function or method takes an optional first argument, and it looks like it might 
have been put there by some tool that generates the docs.

I use Python 3 - perhaps there was once a time when one had to supply the comma 
if one omitted the first argument?   In Python 3 it gives errors if one follows 
the documentation carefully and uses the comma.


(or see http://mail.python.org/pipermail/docs/2012-August/010051.html )

--
assignee: docs@python
components: Documentation
messages: 169547
nosy: cjerdonek, docs@python
priority: normal
severity: normal
status: open
title: comma after leading optional argument is after bracket in docs
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 31.08.12 17:32, schrieb Richard Oudkerk:
>File "", line 128, in _write_atomic
> OSError: [Errno 5] Input/output error: 
> '/mnt/hgfs/Repos/cpython-dirty/Lib/__pycache__/codecs.cpython-33.pyc.3076609376'
> Aborted
>
> I took this to be a failure to write the bytecompiled file.  (A regression?)

Sounds like a regression to me. However, errno 5 is EIO.
Normally, you should get PermissionError(errno=13, EACCES).
I could understand EROFS as well. This sounds like a bug in
the VM software, which really should report EROFS if the volume is
read-only, not EIO.

You might want to check whether this really is a regression;
in any case, I consider Python's reaction reasonable and then
your setup as just not supported. However, I could also accept
that a work-around is added for treating EIO also as an ignorable
error. In any case, this is a separate issue.

--

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Richard Oudkerk

Richard Oudkerk added the comment:

It looks like the code which writes the byte-compiled codes checks for and 
ignores PermissionError (EACCES, EPERM) and FileExistsError (EEXIST).

However, for me it is EIO which is raised.

--

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Richard Oudkerk

Richard Oudkerk added the comment:

> Why is that? python will work just fine if it can't write pyc files.

When I hacked around the _sysconfigdata.py issue, running the created python 
produced

Fatal Python error: Py_Initialize: Unable to get the locale encoding
Traceback (most recent call last):
  File "/mnt/hgfs/Repos/cpython-dirty/Lib/encodings/__init__.py", line 31, in 

  File "", line 1562, in _find_and_load
  File "", line 1529, in _find_and_load_unlocked
  File "", line 590, in _check_name_wrapper
  File "", line 1027, in load_module
  File "", line 1008, in load_module
  File "", line 566, in module_for_loader_wrapper
  File "", line 858, in _load_module
  File "", line 994, in get_code
  File "", line 1055, in _cache_bytecode
  File "", line 1078, in set_data
  File "", line 128, in _write_atomic
OSError: [Errno 5] Input/output error: 
'/mnt/hgfs/Repos/cpython-dirty/Lib/__pycache__/codecs.cpython-33.pyc.3076609376'
Aborted

I took this to be a failure to write the bytecompiled file.  (A regression?)  
Running "./python -B" does work correctly for me.

--

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d54f047312a8 by Brett Cannon in branch 'default':
Issue #15828: Don't try to close a file if imp.find_module() doesn't
http://hg.python.org/cpython/rev/d54f047312a8

--

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 31.08.12 16:40, schrieb Richard Oudkerk:
> I suspect a bigger issue is the fact that *.pyc files cannot be
> written to $(srcdir)/Lib/__pycache__.  This means that to complete
> the build, $(PYTHON_FOR_BUILD) should probably include the -B flag to
> prevent it from trying to write *.pyc files to a read-only location.

Why is that? python will work just fine if it can't write pyc files.

> But that still leaves you with a python which only works with the -B
> flag. Maybe library files could be linked/copied to some writable
> directory early in sys.path.

Just for running setup.py? I don't see the need for that.

--

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Richard Oudkerk

Richard Oudkerk added the comment:

> Richard: what was your use case?

Building on the main host and a VM without having to commit and synchronize 
temporary changes.  (The VM has read-only access to the host's repositories).

> What steps did you take that resulted in getting typeslots.inc and 
> _sysconfigdata.py written to?

As Martin says it is probably just the timestamps which caused typeslots.inc to 
be rebuilt.  In 3.3 _sysconfigdata.py is rebuilt whenever the python binary is.

I suspect a bigger issue is the fact that *.pyc files cannot be written to 
$(srcdir)/Lib/__pycache__.  This means that to complete the build, 
$(PYTHON_FOR_BUILD) should probably include the -B flag to prevent it from 
trying to write *.pyc files to a read-only location.

But that still leaves you with a python which only works with the -B flag. 
Maybe library files could be linked/copied to some writable directory early in 
sys.path.

--

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9ba57938f54d by Nick Coghlan in branch 'default':
Issue #15828: Restore support for C extension modules in imp.load_module()
http://hg.python.org/cpython/rev/9ba57938f54d

--
nosy: +python-dev

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Nick Coghlan added the comment:

Over to Georg to cherry pick this one into rc2

--
assignee:  -> georg.brandl

___
Python tracker 

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



[issue13992] Segfault in PyTrash_destroy_chain

2012-08-31 Thread Manu Cupcic

Manu Cupcic added the comment:

I am testing this patch right now. Will report back.

--

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Nick Coghlan added the comment:

Since I'm still up, I guess I'll check it in, then :)

--

___
Python tracker 

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



[issue15830] make -s no longer silences output from setup.py

2012-08-31 Thread Brett Cannon

New submission from Brett Cannon:

Sometime in the last month (probably) I change has been made in either 
configure(.ac), Makefile.pre.in, or setup.py that is causing the -s option 
passed to make to not also make its way into setup.py when extensions are built.

--
components: Build
keywords: 3.2regression
messages: 169536
nosy: brett.cannon
priority: normal
severity: normal
status: open
title: make -s no longer silences output from setup.py
versions: Python 3.3

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Am 31.08.12 15:19, schrieb Trent Nelson:
> I think I should clarify my use case that resulted in raising this
> bug.
>
> 1. Create a fresh hg clone, say, ~/hg/cpython-3.2.
> 2. Make it readonly

The use case is really uncontended, and long-standing. People want
to build from CD-ROM sources, from sources mounted via NFS,
from sources owned by some other user - there are really many
reasons why you want to build in a separate directory, and why
you then do not want the original source be clobbered.

> Richard: what was your use case?

I guess pretty much the same (though perhaps not ZFS).

> What steps did you take that
> resulted in getting typeslots.inc and _sysconfigdata.py written to?

Touch Include/typeslots.h (before making the checkout readonly)
to see this problem. On a hg checkout, it really depends on the order
in which Mercurial creates the files to either run or not run into one
of these issues.

You were lucky that the timestamps happened to be in an order were
in an order that caused typeslots.inc to be newer than its sources.
AFAIK, hg uses alphapbetical order when updating files, so this may
have helped.

> I think I'm +1 on reverting and trying the '-' approach originally
> used by Neil.

Please don't. I think Victor dropped the - because it would mask
errors from running pgen. pgen might fail, but pgen.stamp is still
generated. Then, on a subsequent run, pgen would not run again.
Of course, pgen.stamp is a later addition (by me), so this wasn't
originally a problem.

I think the regular case should be that the time stamps are in
the right order in the source tree, so none of the generators
should run. But if they happen to be in the wrong order (either
because of Mercurial, or because one of the sources was actually
modified), then the generators should run and output into the
build directory.

Since the committed patch is already a step in that direction,
I think it now needs to be completed. It's mandatory (IMO)
that the generated files are actually used; that the generators
are not run if not needed is optional and can be fixed later.

--

___
Python tracker 

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



[issue14502] Document better what happens on releasing an unacquired lock

2012-08-31 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue15819] Unable to build Python out-of-tree when source tree is readonly.

2012-08-31 Thread Trent Nelson

Trent Nelson added the comment:

Well, that escalated quickly :-)

I think I should clarify my use case that resulted in raising this bug.

1. Create a fresh hg clone, say, ~/hg/cpython-3.2.
2. Make it readonly: `zfs set readonly=on tank/home/cpython/hg/cpython-3.2`
3. cd /tmp/cpython-3.2-build
4. /home/cpython/hg/cpython-3.2/configure 
--srcdir=/home/cpython/hg/cpython-3.2/configure

So, my patches address that use case.  The thing I like about the approach 
above is that I can set the source directory to readonly immediately -- I don't 
have to do an intermediate ./configure in that directory in order to generate a 
Makefile so I can `make touch`.  (Side note: I'm almost certain `make touch` 
wouldn't work for my use case.)

Richard: what was your use case?  What steps did you take that resulted in 
getting typeslots.inc and _sysconfigdata.py written to?

although I just tried an out-of-tree build with 'default' using the exact 
steps above and got the same error with _sysconfigdata.py.

Martin: I think I understand your arguments, and I (think) I agree with them.  
Especially your last point with regards to always running ASDLGEN.

I think I'm +1 on reverting and trying the '-' approach originally used by Neil.

--

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Brett Cannon

Brett Cannon added the comment:

LGTM

--

___
Python tracker 

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



[issue15829] Threading Lock - Wrong Exception Name

2012-08-31 Thread R. David Murray

R. David Murray added the comment:

Please see Issue 14502.  The docs probably do need clarification, but it must 
be done carefully.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Nick Coghlan added the comment:

I'm heading to bed, so whoever reviews this one, please feel free to add a NEWS 
entry and check it in :)

--

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Changes by Nick Coghlan :


Removed file: 
http://bugs.python.org/file27073/issue15828_handle_extension_modules.diff

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Nick Coghlan added the comment:

Tweaked patch to also fix the typo in the error message

--
Added file: 
http://bugs.python.org/file27074/issue15828_handle_extension_modules.diff

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Changes by Nick Coghlan :


--
nosy: +georg.brandl
stage:  -> commit review

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Nick Coghlan added the comment:

Patch adds test case and fix (there was simply a missing entry for 
C_EXTENSION/load_dynamic in the load_module if-elif chain).

Also moves an imp module test from test_import to test_imp (it's the test I 
used as a guide to check I wasn't missing anything obvious when writing the new 
one).

--
keywords: +patch
Added file: 
http://bugs.python.org/file27073/issue15828_handle_extension_modules.diff

___
Python tracker 

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



[issue15828] imp.load_module doesn't support C_EXTENSION type

2012-08-31 Thread Nick Coghlan

Nick Coghlan added the comment:

An even easier reproducer:

>>> import imp
[93559 refs]
>>> details = imp.find_module("_elementtree")
[93572 refs]
>>> mod = imp.load_module('_elementtree', *details)
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/ncoghlan/devel/py3k/Lib/imp.py", line 171, in load_module
raise ImportError(msg, name=name)
ImportError: Don't know how to import _elementtree (type code 3
[93572 refs]

--
keywords: +3.3regression

___
Python tracker 

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



  1   2   >