[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Max

Max added the comment:

I agree about reflected operation, although the wording could be clearer (will 
try reflected operation is better worded as will return the result of the 
reflected operation called on the swapped arguments.)

But what does it mean or some other fallback? And what if the reflected 
operation or the fallback again return NotImplemented or is actually not 
implemented. Is it somewhere else in the docs?

--

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



[issue15490] Correct __sizeof__ support for StringIO

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patches updated. Now the computations done in size_t.

Note that the patches for the different versions differ.

--
Added file: http://bugs.python.org/file27240/stringio_sizeof-3.3_3.patch

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



[issue15490] Correct __sizeof__ support for StringIO

2012-09-21 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file27241/stringio_sizeof-3.2_3.patch

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



[issue15490] Correct __sizeof__ support for StringIO

2012-09-21 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file27242/stringio_sizeof-2.7_3.patch

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



[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 But please add regression tests checking
 that the error message is what we want.

Immediately as soon as I find a suitable place for this test. Should be 
somewhere tests for bytes/unicode filenames.

 I'd personally prefer the Oxford Comma there (string, bytes, or integer).
  But I don't know if there is a style preference one way or the other in
 Python error messages.

Invalid whence (%i, should be 0, 1 or 2)
expect bytes or str of length 1, or int, 
argument should be bytes, buffer or ASCII string, 
coercing to str: need bytes, bytearray or buffer-like object, %.80s found
character mapping must return integer, bytes or None, not %.400s

--

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Larry Hastings

Larry Hastings added the comment:

Ah!  It seems Python is anti-Oxford Comma.  Carry on!  ;-)

Wouldn't test_os be the natural place?  I don't understand why you're having 
difficulty finding a suitable place.

--

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



[issue15996] pow() for complex numbers is rough around the edges

2012-09-21 Thread Serhiy Storchaka

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


--
nosy: +storchaka

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



[issue15996] pow() for complex numbers is rough around the edges

2012-09-21 Thread Mark Dickinson

Mark Dickinson added the comment:

Well, C99 covers pow for *real* numbers just fine;  it's complex numbers where 
no-one wants to pin down what the behaviour should be.  So I don't think we 
need the man page reference.

If we're writing tests for complex pow, we might also want to consider adding 
tests for multiplication and division;  those aren't entirely trivial either 
for special cases.

I do agree that (for the most part), complex pow applied to arguments with zero 
imaginary part should behave like regular float pow.  There are some cases 
where it's clear what the behaviour should be, and others that are murkier.

E.g., for a positive real z and arbitrary complex w, the special cases for z**w 
should behave in the same way as for exp for z  0, and with some reflection of 
that behaviour for 0  z  1;  1**w should always be 1.

For nonzero finite values it's straightforward:  we just want to compute the 
best approximation to exp(w * log(z)), with the branch cut for the log along 
the negative real axis as usual.

But there are a *lot* of special cases to think about.  Consider that each real 
or imaginary part of the input is either:

(1) -infinity,
(2) -finite,
(3) -0.0
(4) +0.0
(5) +finite
(6) +infinity
(7) nan

and that we've got 2 complex inputs, or in effect 4 real inputs.  This divides 
our argument space into 7**4 = 2401 pieces.  With luck we can find rules that 
cover lots of those pieces at once, but it's still going to be a long job.

It doesn't help that it isn't particularly clear what the underlying 
mathematical model should be.  For floats, we can think about the two-point 
compactification of the real line (okay, with a doubled zero, which messes 
things up a little bit), which is a fairly sane space to work in.

--

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



[issue11715] Building Python on multiarch Debian and Ubuntu

2012-09-21 Thread Ezio Melotti

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


--
Removed message: http://bugs.python.org/msg169954

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



[issue11715] Building Python on multiarch Debian and Ubuntu

2012-09-21 Thread Ezio Melotti

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


--
Removed message: http://bugs.python.org/msg169959

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



[issue11715] Building Python on multiarch Debian and Ubuntu

2012-09-21 Thread Ezio Melotti

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


--
Removed message: http://bugs.python.org/msg169961

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2012-09-21 Thread Ezio Melotti

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


--
type:  - enhancement

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patch updated. Added tests.

--
Added file: http://bugs.python.org/file27243/posix_path_converter_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15972
___diff -r 24136a775943 Lib/test/test_posix.py
--- a/Lib/test/test_posix.pyThu Sep 20 23:49:33 2012 -0400
+++ b/Lib/test/test_posix.pyFri Sep 21 11:47:25 2012 +0300
@@ -358,12 +358,24 @@
 try:
 self.assertTrue(posix.fstat(fp.fileno()))
 self.assertTrue(posix.stat(fp.fileno()))
+
+self.assertRaisesRegex(TypeError, 'should be string, bytes or 
integer, not',
+posix.stat, float(fp.fileno()))
 finally:
 fp.close()
 
 def test_stat(self):
 if hasattr(posix, 'stat'):
 self.assertTrue(posix.stat(support.TESTFN))
+self.assertTrue(posix.stat(os.fsencode(support.TESTFN)))
+self.assertTrue(posix.stat(bytearray(os.fsencode(support.TESTFN
+
+self.assertRaisesRegex(TypeError, 'can\'t specify None for path 
argument',
+posix.stat, None)
+self.assertRaisesRegex(TypeError, 'should be string, bytes or 
integer, not',
+posix.stat, list(support.TESTFN))
+self.assertRaisesRegex(TypeError, 'should be string, bytes or 
integer, not',
+posix.stat, list(os.fsencode(support.TESTFN)))
 
 @unittest.skipUnless(hasattr(posix, 'mkfifo'), don't have mkfifo())
 def test_mkfifo(self):
@@ -721,6 +733,13 @@
 s1 = posix.stat(support.TESTFN)
 s2 = posix.stat(support.TESTFN, dir_fd=f)
 self.assertEqual(s1, s2)
+s2 = posix.stat(support.TESTFN, dir_fd=None)
+self.assertEqual(s1, s2)
+self.assertRaisesRegex(TypeError, 'should be integer, not',
+posix.stat, support.TESTFN, dir_fd=posix.getcwd())
+self.assertRaisesRegex(TypeError, 'should be integer, not',
+posix.stat, support.TESTFN, dir_fd=float(f))
+self.assertRaises(OverflowError, posix.stat, support.TESTFN, 
dir_fd=10**20)
 finally:
 posix.close(f)
 
diff -r 24136a775943 Modules/posixmodule.c
--- a/Modules/posixmodule.c Thu Sep 20 23:49:33 2012 -0400
+++ b/Modules/posixmodule.c Fri Sep 21 11:47:25 2012 +0300
@@ -427,26 +427,24 @@
 #endif
 
 static int
-_fd_converter(PyObject *o, int *p, int default_value) {
-long long_value;
-if (o == Py_None) {
-*p = default_value;
-return 1;
-}
-if (PyFloat_Check(o)) {
-PyErr_SetString(PyExc_TypeError,
-integer argument expected, got float );
+_fd_converter(PyObject *o, int *p, const char *allowed)
+{
+int overflow;
+long long_value = PyLong_AsLongAndOverflow(o, overflow);
+if (PyFloat_Check(o) ||
+(long_value == -1  !overflow  PyErr_Occurred())) {
+PyErr_Clear();
+PyErr_Format(PyExc_TypeError,
+argument should be %s, not %.200s,
+allowed, Py_TYPE(o)-tp_name);
 return 0;
 }
-long_value = PyLong_AsLong(o);
-if (long_value == -1  PyErr_Occurred())
-return 0;
-if (long_value  INT_MAX) {
+if (overflow  0 || long_value  INT_MAX) {
 PyErr_SetString(PyExc_OverflowError,
 signed integer is greater than maximum);
 return 0;
 }
-if (long_value  INT_MIN) {
+if (overflow  0 || long_value  INT_MIN) {
 PyErr_SetString(PyExc_OverflowError,
 signed integer is less than minimum);
 return 0;
@@ -456,8 +454,13 @@
 }
 
 static int
-dir_fd_converter(PyObject *o, void *p) {
-return _fd_converter(o, (int *)p, DEFAULT_DIR_FD);
+dir_fd_converter(PyObject *o, void *p)
+{
+if (o == Py_None) {
+*(int *)p = DEFAULT_DIR_FD;
+return 1;
+}
+return _fd_converter(o, (int *)p, integer);
 }
 
 
@@ -634,17 +637,16 @@
 }
 else {
 PyErr_Clear();
-bytes = PyBytes_FromObject(o);
+if (PyObject_CheckBuffer(o))
+bytes = PyBytes_FromObject(o);
+else
+bytes = NULL;
 if (!bytes) {
 PyErr_Clear();
 if (path-allow_fd) {
 int fd;
-/*
- * note: _fd_converter always permits None.
- * but we've already done our None check.
- * so o cannot be None at this point.
- */
-int result = _fd_converter(o, fd, -1);
+int result = _fd_converter(o, fd,
+string, bytes or integer);
 if (result) {
 path-wide = NULL;
 path-narrow = NULL;
@@ -705,15 +707,17 @@
 }
 
 static int

[issue15845] Fixing some byte-to-string conversion warnings

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

-if basename == '':
+if len(basename) == 0:

This should be if not basename:


-if tail == curdir:
+cdir = curdir
+if isinstance(tail, bytes):
+cdir = bytes(curdir, 'ASCII')
+if tail == cdir:

This will raise an error if curdir is a non-ascii str, so, unless the same 
error was already raised later in the code, this is backward incompatible.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15845
___
___
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-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

FTR this is addressed in #15845.

--

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



[issue15996] pow() for complex numbers is rough around the edges

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Well, C99 covers pow for *real* numbers just fine;  it's complex numbers
 where no-one wants to pin down what the behaviour should be. 

C99 contains cpow. Perhaps we should use conditional compilation?

--

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



[issue15852] typos in curses argument error messages

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

Can't you use assertRaisesRegex?

--

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



[issue15844] weird import errors

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

Closing for lack of reproducible test case.

--
resolution:  - invalid
stage:  - committed/rejected
status: pending - closed

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Stefan Krah

Stefan Krah added the comment:

The high and low words of the 64-bit value are switched:

 a = array.array('Q', [1])
 m = memoryview(a)
 m[0]= 2**32+5
 m[0]
21474836481
 struct.unpack_from('8s', m, 0)
(b'\x01\x00\x00\x00\x05\x00\x00\x00',)


Can anyone reproduce this in a source build? I think this should
be a blocker.

--
priority: critical - release blocker

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



[issue15995] Windows: 3.3.0-rc2.msi: test_lzma fails

2012-09-21 Thread Stefan Krah

Stefan Krah added the comment:

This should be the same as #15993. Closing.

--
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - Windows: 3.3.0-rc2.msi: test_buffer fails

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Stefan Krah

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


--
nosy: +nadeem.vawda

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



[issue15545] sqlite3.Connection.iterdump() does not work with row_factory = sqlite3.Row

2012-09-21 Thread Pierre Le Marre

Pierre Le Marre added the comment:

Thanks for the patch. In which version will be your patch integrated?

--

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



[issue15990] solidify argument/parameter terminology

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

 between arguments (what you pass, call syntax) and parameters
 (what the function receives, function definition syntax)

Note that there's a subtle difference to make here.  IMHO as soon as you use 
terms like receives or accepts, you are still talking about arguments.  
What you pass from one side is received by the other, and it's called an 
argument.

Given def f(x, y): pass you can say that x and y are parameter of the f 
function, or that the function accepts 2 arguments -- x and y.  The latter is 
far more common IME, and I rarely talk about parameters myself.

In f() missing 1 required positional argument: 'x', the usage of argument 
is correct, because what's missing is the argument in the function call, not 
the parameter in the function definition.  However the error points to the 
corresponding parameter 'x' -- because clearly it can't point to the argument 
you forgot to pass -- and this fact might led to some confusion.  IMHO though, 
the error is clear as is (at least regarding argument/parameter), so I wouldn't 
change it.

--
nosy: +gvanrossum

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



[issue15998] Python GUI idle not working

2012-09-21 Thread Sreenivas

New submission from Sreenivas:

Hi Everybody,

I have a problem where Python GUI IDLE is not working.I did go through the 
issues 15658,9925,4625.I did follow the steps given in these issues.I did unset 
the tcl and tk_library.I was able to open the python idle temporarily.But once 
i closed it I had to follow the same commands to open it again.instead of just 
clicking the application.I also tried this command - 
c:\Python32\Lib\idlelib\idle.py

This command gave the following error message

This probably means Tcl wasn#t properly installed

I tried to uninstall and reinstall and Python32 but still unsuccessful.I have 
installed few libs such as cx_Freeze and serial.I do not want to lose them as 
serial lib was itself painstaking process for installation.Can you tell me 
stepwise as to what should I do to get the IDLE working.

regards,
Sreeni

--
components: IDLE
messages: 170877
nosy: sreeni
priority: normal
severity: normal
status: open
title: Python GUI idle not working
type: crash
versions: Python 3.2

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



[issue15990] solidify argument/parameter terminology

2012-09-21 Thread Mark Dickinson

Mark Dickinson added the comment:

Nick Coghlan pointed out that a lot of this discussion has already happened for 
the function signature object PEP [1].  That PEP defines constants

Parameter.POSITIONAL_ONLY
Parameter.POSITIONAL_OR_KEYWORD
Parameter.KEYWORD_ONLY
Parameter.VAR_POSITIONAL
Parameter.VAR_KEYWORD

So the 'positional' in the TypeError messages corresponds to 
POSITIONAL_OR_KEYWORD.


[1] http://www.python.org/dev/peps/pep-0362/

--

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



[issue14900] cProfile does not take its result headers as sort arguments

2012-09-21 Thread Arne Babenhauserheide

Arne Babenhauserheide added the comment:

Did you get to taking a look?

Is there anything I should change?

--

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



[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Martin v . Löwis

Martin v. Löwis added the comment:

The main point is: it depends on the operation. NotImplemented is a way to 
signal that an operation is not implemented. It can be used for whatever you 
want to use it for. You can design to call an operation foo, and, if 
NotImplemented is returned, call bar instead.

If you want to know how a specific operation performs its fallback, you have to 
look in the documentation of the specific operation.

As an example for a method where some other fallback is used, see

http://docs.python.org/py3k/library/abc.html#abc.ABCMeta.__subclasshook__

--

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



[issue11715] Building Python on multiarch Debian and Ubuntu

2012-09-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 53fa224b95f4 by doko in branch '2.7':
- Issue #11715: Fix multiarch detection without having Debian development
http://hg.python.org/cpython/rev/53fa224b95f4

New changeset 78aba41a8105 by doko in branch '3.2':
- Issue #11715: Fix multiarch detection without having Debian development
http://hg.python.org/cpython/rev/78aba41a8105

--

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



[issue11715] Building Python on multiarch Debian and Ubuntu

2012-09-21 Thread Matthias Klose

Matthias Klose added the comment:

fixed for 2.7 and 3.2 as well.

--
status: open - closed

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



[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-21 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy: +brett.cannon

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



[issue15997] NotImplemented needs to be documented

2012-09-21 Thread R. David Murray

R. David Murray added the comment:

The mention of NotImplemented in library/stdtypes cross references to the 
'comparisions' section of the reference guide chapter on expressions.  That 
might be a useful cross link in the datamodel section as well.

--
nosy: +r.david.murray

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



[issue15882] _decimal.Decimal constructed from tuple

2012-09-21 Thread Stefan Krah

Stefan Krah added the comment:

Georg, *if* there is an rc3, could you add 97e53273f423 to it?

The commit is a backwards compatibility fix for constructing
infinities from tuples with arbitrary coefficients.


If there's no rc3, the issue can just be closed as fixed.

--
assignee: skrah - georg.brandl
nosy: +georg.brandl

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



[issue15980] Non-escaped '\n' in docstrings

2012-09-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7a125913a375 by Ezio Melotti in branch '2.7':
#15980: properly escape newlines in docstrings.  Patch by Serhiy Storchaka.
http://hg.python.org/cpython/rev/7a125913a375

New changeset e582ad1aee62 by Ezio Melotti in branch '3.2':
#15980: properly escape newlines in docstrings.  Patch by Serhiy Storchaka.
http://hg.python.org/cpython/rev/e582ad1aee62

New changeset 1830426da082 by Ezio Melotti in branch 'default':
#15980: merge with 3.2.
http://hg.python.org/cpython/rev/1830426da082

--
nosy: +python-dev

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



[issue15980] Non-escaped '\n' in docstrings

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
assignee: docs@python - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2012-09-21 Thread Mike Hoy

Mike Hoy added the comment:

http://bugs.python.org/issue15997 is this issue related to what Terry has 
mentioned:

Does 'not supported' mean 'raises TypeError', 'returns NotImplemented', or 
both? If the last, I don't really understand the reason for NotImplemented 
versus TypeError. That point should be clarified in 3.3 also. And 3.3 should be 
referenced in the comparisons section.

I am working on this patch and need confirmation as to whether or not this has 
to be included in my patch. I'm not clear on it so I may just pass on making a 
patch if it is required for this issue.

--

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



[issue15304] Wrong path in test.support.temp_cwd() error message

2012-09-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0b60dcabf7e6 by Ezio Melotti in branch '3.2':
#15304: fix wrong warning message in test.support.temp_cwd().
http://hg.python.org/cpython/rev/0b60dcabf7e6

New changeset b1d6daface10 by Ezio Melotti in branch 'default':
#15304: merge with 3.2.
http://hg.python.org/cpython/rev/b1d6daface10

--
nosy: +python-dev

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



[issue15304] Wrong path in test.support.temp_cwd() error message

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions:  -Python 2.7

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



[issue15998] Python GUI idle not working

2012-09-21 Thread Ezio Melotti

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


--
nosy: +ned.deily, serwy, terry.reedy

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread John Taylor

John Taylor added the comment:

OP here.  These error messages are much better.  Thanks!

--

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



[issue15996] pow() for complex numbers is rough around the edges

2012-09-21 Thread Mark Dickinson

Mark Dickinson added the comment:

 C99 contains cpow. Perhaps we should use conditional compilation?

I dread to think what horrors lurk in OS math library implementations of cpow;  
I suspect we'd soon find out, if we had used cpow and have any tests at all for 
special cases.

OS math libraries are bad enough at *float* math, let alone complex;  I'd 
rather not depend on them unless we have to.  And given that at least on 
Windows we need our own complex pow implementation anyway, I'd prefer to use 
the same code on all platforms, so that we have at least some degree of 
consistency from platform to platform.

--

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



[issue15983] multiprocessing JoinableQueue's join function with timeout

2012-09-21 Thread Richard Oudkerk

Richard Oudkerk added the comment:

I notice that queue.Queue.join() does not have a timeout parameter either.

Have you hit a particular problem that would be substantially easier with the 
patch?

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

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bfdf366a779a by Ezio Melotti in branch '2.7':
#15421: fix an OverflowError in Calendar.itermonthdates() after 
datetime.MAXYEAR.  Patch by Cédric Krier.
http://hg.python.org/cpython/rev/bfdf366a779a

New changeset aa73e60f65e9 by Ezio Melotti in branch '3.2':
#15421: fix an OverflowError in Calendar.itermonthdates() after 
datetime.MAXYEAR.  Patch by Cédric Krier.
http://hg.python.org/cpython/rev/aa73e60f65e9

New changeset 59a2807872d5 by Ezio Melotti in branch 'default':
#15421: merge with 3.2.
http://hg.python.org/cpython/rev/59a2807872d5

--
nosy: +python-dev

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



[issue15421] Calendar.itermonthdates OverflowError

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch and the report!

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

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



[issue15983] multiprocessing JoinableQueue's join function with timeout

2012-09-21 Thread Karl Bicker

Karl Bicker added the comment:

Actually, I would like to check if the threads working on the queue are still 
alive. 

However, it occurs to me now that I would need a facility to distinguish 
between a timeout and an actual join. Unfortunately, my original patch does not 
provide this, one would have to implement an additional check and think about 
the correct way to signal a timeout.

Also, there seem to be other people looking for this feature: 
http://stackoverflow.com/questions/1564501/add-timeout-argument-to-pythons-queue-join

--

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



[issue15998] Python GUI idle not working

2012-09-21 Thread Roger Serwy

Roger Serwy added the comment:

Hi Sreeni, 

Can you launch a Python interpreter from C:\python32\python.exe and report the 
output to import tkinter ?

--
status: open - pending
type: crash - behavior

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



[issue15999] Using new 'bool' format character

2012-09-21 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Issue14705 added 'bool' format character to PyArg_ParseTuple for using it for 
parsing multiple boolean arguments in os module. The proposed patch uses this 
format character for other boolean arguments. This makes the sources simpler, 
clearer and more reliable, improves error messages, gets rid of a few rare 
errors.

--
components: Extension Modules, Interpreter Core
files: use_bool_parsing.diff
keywords: patch
messages: 170897
nosy: larry, storchaka
priority: normal
severity: normal
status: open
title: Using new 'bool' format character
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file27244/use_bool_parsing.diff

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



[issue15999] Using new 'bool' format character

2012-09-21 Thread Larry Hastings

Larry Hastings added the comment:

Patch looks fine in principle, though I'd want someone to go over the 
individual cases to make sure they make sense.

Also, I have something up my sleeve regarding argument parsing for 3.4, and if 
it gets accepted we might be touching all this code anyway.  I mention this 
just to say--you may want to hold off on more patches like this for now.

--

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



[issue1602] windows console doesn't print or input Unicode

2012-09-21 Thread Drekin

Drekin added the comment:

Hello, I'm trying to handle Unicode input and output in Windows console and 
found this issue. Will this be solved in 3.3 final? I tried to write a solution 
(file attached) based on solution here – rewriting sys.stdin and sys.stdout so 
it uses ReadConsoleW and WriteConsoleW.

Output works well, but there are few problems with input. First, the Python 
interactive interpreter actually doesn't use sys.stdin but standard C stdin. 
It's implemented over file pointer (PyRun_InteractiveLoopFlags, 
PyRun_InteractiveOneFlags in pythonrun). But still the interpreter uses 
sys.stdin.encoding (assigning sys.stdin something, that doesn't have 
encoding==None freezes the interpreter). Wouldn't it make more sense if it used 
sys.__stdin__.encoding?

However, input() (which uses stdin.readline) works as expected. There's a small 
problem with KeyboardInterrupt. Since signals are processed asynchronously, 
it's raised at random place and it behaves wierdly. time.sleep(0.01) after the 
C call works well, but it's an ugly solution.

When code.interact() is used instead of standard interpreter, it works as 
expected. Is there a way of changing the intepreter loop? Some hook which calls 
code.interact() at the right place? The patch can be applied in site or 
sitecustomized, but calling code.iteract() there obviously doesn't work.

Some other remarks:
- When sys.stdin or sys.stdout doesn't define encoding and errors, input() 
raises TypeError: bad argument type for built-in operation.
- input() raises KeyboardInterrupt on Ctrl-C in Python 3.2 but not in Python 
3.3rc2.

--
nosy: +Drekin
Added file: http://bugs.python.org/file27245/win_unicode_console.py

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



[issue15852] typos in curses argument error messages

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks for taking a look at this, and good question.

Without restructuring how the tests are done, I believe the short answer is no. 
 The funny thing about this test module is that it does not actually have any 
unittest test cases.  It just calls some functions.  Failure happens if an 
exception is raised in any one of those functions.

See here, for example:

http://hg.python.org/cpython/file/59a2807872d5/Lib/test/test_curses.py#l35

--

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



[issue15304] Wrong path in test.support.temp_cwd() error message

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks, Ezio!

--

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Larry Hastings

Larry Hastings added the comment:

Patch looks fine, except please fix 80 columns.

--

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



[issue15989] Possible integer overflow of PyLong_AsLong() results

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch (for 3.3). I added private _PyLong_AsInt and where possible I 
have tried to use the appropriate function.

--
keywords: +patch
Added file: http://bugs.python.org/file27246/long_aslong_overflow.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15989
___diff -r 59a2807872d5 Include/longobject.h
--- a/Include/longobject.h  Fri Sep 21 17:29:20 2012 +0300
+++ b/Include/longobject.h  Fri Sep 21 19:21:25 2012 +0300
@@ -26,6 +26,9 @@
 PyAPI_FUNC(size_t) PyLong_AsSize_t(PyObject *);
 PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *);
 PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *);
+#ifndef Py_LIMITED_API
+PyAPI_FUNC(int) _PyLong_AsInt(PyObject *);
+#endif
 PyAPI_FUNC(PyObject *) PyLong_GetInfo(void);
 
 /* It may be useful in the future. I've added it in the PyInt - PyLong
diff -r 59a2807872d5 Modules/_ctypes/stgdict.c
--- a/Modules/_ctypes/stgdict.c Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/_ctypes/stgdict.c Fri Sep 21 19:21:25 2012 +0300
@@ -335,7 +335,7 @@
 
 isPacked = PyObject_GetAttrString(type, _pack_);
 if (isPacked) {
-pack = PyLong_AsLong(isPacked);
+pack = _PyLong_AsInt(isPacked);
 if (pack  0 || PyErr_Occurred()) {
 Py_XDECREF(isPacked);
 PyErr_SetString(PyExc_ValueError,
diff -r 59a2807872d5 Modules/_datetimemodule.c
--- a/Modules/_datetimemodule.c Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/_datetimemodule.c Fri Sep 21 19:21:25 2012 +0300
@@ -4717,7 +4717,7 @@
 if (seconds == NULL)
 goto error;
 Py_DECREF(delta);
-timestamp = PyLong_AsLong(seconds);
+timestamp = _PyLong_AsTime_t(seconds);
 Py_DECREF(seconds);
 if (timestamp == -1  PyErr_Occurred())
 return NULL;
diff -r 59a2807872d5 Modules/_io/_iomodule.c
--- a/Modules/_io/_iomodule.c   Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/_io/_iomodule.c   Fri Sep 21 19:21:25 2012 +0300
@@ -358,9 +358,9 @@
 PyObject *res = _PyObject_CallMethodId(raw, PyId_isatty, NULL);
 if (res == NULL)
 goto error;
-isatty = PyLong_AsLong(res);
+isatty = PyObject_IsTrue(res);
 Py_DECREF(res);
-if (isatty == -1  PyErr_Occurred())
+if (isatty  0)
 goto error;
 }
 
@@ -376,12 +376,12 @@
 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
 {
 struct stat st;
-long fileno;
+int fileno;
 PyObject *res = _PyObject_CallMethodId(raw, PyId_fileno, NULL);
 if (res == NULL)
 goto error;
 
-fileno = PyLong_AsLong(res);
+fileno = _PyLong_AsInt(res);
 Py_DECREF(res);
 if (fileno == -1  PyErr_Occurred())
 goto error;
diff -r 59a2807872d5 Modules/_io/fileio.c
--- a/Modules/_io/fileio.c  Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/_io/fileio.c  Fri Sep 21 19:21:25 2012 +0300
@@ -244,7 +244,7 @@
 return -1;
 }
 
-fd = PyLong_AsLong(nameobj);
+fd = _PyLong_AsInt(nameobj);
 if (fd  0) {
 if (!PyErr_Occurred()) {
 PyErr_SetString(PyExc_ValueError,
@@ -382,7 +382,7 @@
 goto error;
 }
 
-self-fd = PyLong_AsLong(fdobj);
+self-fd = _PyLong_AsInt(fdobj);
 Py_DECREF(fdobj);
 if (self-fd == -1) {
 goto error;
diff -r 59a2807872d5 Modules/_io/textio.c
--- a/Modules/_io/textio.c  Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/_io/textio.c  Fri Sep 21 19:21:25 2012 +0300
@@ -881,7 +881,7 @@
 }
 }
 else {
-int fd = (int) PyLong_AsLong(fileno);
+int fd = _PyLong_AsInt(fileno);
 Py_DECREF(fileno);
 if (fd == -1  PyErr_Occurred()) {
 goto error;
diff -r 59a2807872d5 Modules/_sqlite/connection.c
--- a/Modules/_sqlite/connection.c  Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/_sqlite/connection.c  Fri Sep 21 19:21:25 2012 +0300
@@ -859,7 +859,7 @@
 rc = SQLITE_DENY;
 } else {
 if (PyLong_Check(ret)) {
-rc = (int)PyLong_AsLong(ret);
+rc = _PyLong_AsInt(ret);
 } else {
 rc = SQLITE_DENY;
 }
@@ -1350,7 +1350,7 @@
 goto finally;
 }
 
-result = PyLong_AsLong(retval);
+result = _PyLong_AsInt(retval);
 if (PyErr_Occurred()) {
 result = 0;
 }
diff -r 59a2807872d5 Modules/grpmodule.c
--- a/Modules/grpmodule.c   Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/grpmodule.c   Fri Sep 21 19:21:25 2012 +0300
@@ -85,16 +85,23 @@
 grp_getgrgid(PyObject *self, PyObject *pyo_id)
 {
 PyObject *py_int_id;
-unsigned int gid;
+unsigned long gid;
 struct group *p;
 
 py_int_id = PyNumber_Long(pyo_id);
 if (!py_int_id)
 return NULL;
-

[issue15989] Possible integer overflow of PyLong_AsLong() results

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I was assigned this to itself to show that I working on the issue. Now I free 
up place for someone with committing privileges.

--
assignee: storchaka - 

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Patch looks fine, except please fix 80 columns.

Patch updated. Long lines in tests fixed.

--
Added file: http://bugs.python.org/file27247/posix_path_converter_3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15972
___diff -r 59a2807872d5 Lib/test/test_posix.py
--- a/Lib/test/test_posix.pyFri Sep 21 17:29:20 2012 +0300
+++ b/Lib/test/test_posix.pyFri Sep 21 20:07:09 2012 +0300
@@ -358,12 +358,28 @@
 try:
 self.assertTrue(posix.fstat(fp.fileno()))
 self.assertTrue(posix.stat(fp.fileno()))
+
+self.assertRaisesRegex(TypeError,
+'should be string, bytes or integer, not',
+posix.stat, float(fp.fileno()))
 finally:
 fp.close()
 
 def test_stat(self):
 if hasattr(posix, 'stat'):
 self.assertTrue(posix.stat(support.TESTFN))
+self.assertTrue(posix.stat(os.fsencode(support.TESTFN)))
+self.assertTrue(posix.stat(bytearray(os.fsencode(support.TESTFN
+
+self.assertRaisesRegex(TypeError,
+'can\'t specify None for path argument',
+posix.stat, None)
+self.assertRaisesRegex(TypeError,
+'should be string, bytes or integer, not',
+posix.stat, list(support.TESTFN))
+self.assertRaisesRegex(TypeError,
+'should be string, bytes or integer, not',
+posix.stat, list(os.fsencode(support.TESTFN)))
 
 @unittest.skipUnless(hasattr(posix, 'mkfifo'), don't have mkfifo())
 def test_mkfifo(self):
@@ -721,6 +737,14 @@
 s1 = posix.stat(support.TESTFN)
 s2 = posix.stat(support.TESTFN, dir_fd=f)
 self.assertEqual(s1, s2)
+s2 = posix.stat(support.TESTFN, dir_fd=None)
+self.assertEqual(s1, s2)
+self.assertRaisesRegex(TypeError, 'should be integer, not',
+posix.stat, support.TESTFN, dir_fd=posix.getcwd())
+self.assertRaisesRegex(TypeError, 'should be integer, not',
+posix.stat, support.TESTFN, dir_fd=float(f))
+self.assertRaises(OverflowError,
+posix.stat, support.TESTFN, dir_fd=10**20)
 finally:
 posix.close(f)
 
diff -r 59a2807872d5 Modules/posixmodule.c
--- a/Modules/posixmodule.c Fri Sep 21 17:29:20 2012 +0300
+++ b/Modules/posixmodule.c Fri Sep 21 20:07:09 2012 +0300
@@ -427,26 +427,24 @@
 #endif
 
 static int
-_fd_converter(PyObject *o, int *p, int default_value) {
-long long_value;
-if (o == Py_None) {
-*p = default_value;
-return 1;
-}
-if (PyFloat_Check(o)) {
-PyErr_SetString(PyExc_TypeError,
-integer argument expected, got float );
+_fd_converter(PyObject *o, int *p, const char *allowed)
+{
+int overflow;
+long long_value = PyLong_AsLongAndOverflow(o, overflow);
+if (PyFloat_Check(o) ||
+(long_value == -1  !overflow  PyErr_Occurred())) {
+PyErr_Clear();
+PyErr_Format(PyExc_TypeError,
+argument should be %s, not %.200s,
+allowed, Py_TYPE(o)-tp_name);
 return 0;
 }
-long_value = PyLong_AsLong(o);
-if (long_value == -1  PyErr_Occurred())
-return 0;
-if (long_value  INT_MAX) {
+if (overflow  0 || long_value  INT_MAX) {
 PyErr_SetString(PyExc_OverflowError,
 signed integer is greater than maximum);
 return 0;
 }
-if (long_value  INT_MIN) {
+if (overflow  0 || long_value  INT_MIN) {
 PyErr_SetString(PyExc_OverflowError,
 signed integer is less than minimum);
 return 0;
@@ -456,8 +454,13 @@
 }
 
 static int
-dir_fd_converter(PyObject *o, void *p) {
-return _fd_converter(o, (int *)p, DEFAULT_DIR_FD);
+dir_fd_converter(PyObject *o, void *p)
+{
+if (o == Py_None) {
+*(int *)p = DEFAULT_DIR_FD;
+return 1;
+}
+return _fd_converter(o, (int *)p, integer);
 }
 
 
@@ -634,17 +637,16 @@
 }
 else {
 PyErr_Clear();
-bytes = PyBytes_FromObject(o);
+if (PyObject_CheckBuffer(o))
+bytes = PyBytes_FromObject(o);
+else
+bytes = NULL;
 if (!bytes) {
 PyErr_Clear();
 if (path-allow_fd) {
 int fd;
-/*
- * note: _fd_converter always permits None.
- * but we've already done our None check.
- * so o cannot be None at this point.
- */
-int result = _fd_converter(o, fd, -1);
+int result = _fd_converter(o, fd,
+string, bytes or integer);
   

[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file27235/posix_path_converter.patch

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file27243/posix_path_converter_2.patch

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Larry Hastings

Larry Hastings added the comment:

LGTM.  Serhiy, you have the commit bit?

--

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



[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-21 Thread Benjamin Peterson

Benjamin Peterson added the comment:

This is a reasonable request. Should comparison include lineno/col_offset or 
not? If you implement, __eq__, you should also implement __hash__. Maybe, it 
would be best to start with a helper comparison function in the ast module.

--
nosy: +benjamin.peterson

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Serhiy, you have the commit bit?

It is zero.

--

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



[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-21 Thread Julian Berman

Julian Berman added the comment:

I'd say yes (to both lineno/col_offset). And yeah that sounds like what I had 
in mind (a helper function).

If I'm specific for a moment about implementation, perhaps something like 
`ast.diff`, which yielded tuples of differing nodes (in say, breadth first 
order down the tree) from two given nodes, and took args for configuration, 
compare_lineno and compare_col_offset (both defaulted to True), and then __eq__ 
was just `next(ast.diff(self, other, compare_lineno=True, 
compare_col_offset=True), None) is None`.

Sound good to you?

--

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



[issue15759] make suspicious doesn't display instructions in case of failure

2012-09-21 Thread Ezio Melotti

Ezio Melotti added the comment:

Apparently a '-' at the beginning of the command means run this thing and if 
it fails ignore the failure and keep going.  I tried to add an if/else in the 
build target to use the '-' with the selected builder was suspicious but I 
couldn't make it work, so I ended up adding a new build-and-continue that uses 
the '-'.

make linkcheck and make doctest had the same problem, so I fixed them too.

The output now looks like this:

$ make suspicious
mkdir -p build/suspicious build/doctrees
python tools/sphinx-build.py -b suspicious -d build/doctrees -D 
latex_paper_size=  . build/suspicious 
Running Sphinx v1.0.7
loading pickled environment... done
loading ignore rules... done, 359 rules loaded
building [suspicious]: targets for 428 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
preparing documents... done
writing output... [ 81%] library/unittest
WARNING: [library/unittest:19] :port found in host:port
writing output... [100%] whatsnew/index
build finished with problems, 1 warning.
make: [build-and-continue] Error 1 (ignored)

Suspicious check complete; look for any errors in the above output or in 
build/suspicious/suspicious.csv.  If all issues are false positives, append 
that file to tools/sphinxext/susp-ignored.csv.

--
stage: patch review - commit review
versions: +Python 2.7, Python 3.2
Added file: http://bugs.python.org/file27248/issue15759-2.diff

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



[issue15990] solidify argument/parameter terminology

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

We could start by establishing the argument/parameter distinction in the 
glossary.  Currently, the word parameter does not appear in the glossary, and 
the definition of argument blurs the distinction between the two:

For example, in the following definition of argument--

argument: A value passed to a function or method, assigned to a named local 
variable in the function body. A function or method may have both positional 
arguments and keyword arguments in its definition...

(from http://docs.python.org/dev/glossary.html#term-argument )

the second sentence is actually talking about parameters.

--

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



[issue15990] solidify argument/parameter terminology

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 IMHO as soon as you use terms like receives or accepts, you are still 
 talking about arguments.

Even PEP 362 is loose with its language in this regard.  For example, at the 
beginning of the Signature Object section:

For each parameter accepted by the function it stores a Parameter object in 
its parameters collection.

And at the beginning of the Parameter Object section:

Python's expressive syntax means functions can accept many different kinds of 
parameters with many subtle semantic differences.

--

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



[issue15379] Charmap decoding of no-BMP characters

2012-09-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patches updated. Added a few new tests, used MAX_UNICODE, a little changed 
extrachars grow step.

--
Added file: http://bugs.python.org/file27249/decode_charmap_maxchar-3.3_2.patch
Added file: http://bugs.python.org/file27250/decode_charmap_maxchar-3.2_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15379
___diff -r 3e677956eef4 Lib/test/test_codecs.py
--- a/Lib/test/test_codecs.py   Fri Sep 21 10:12:14 2012 -0700
+++ b/Lib/test/test_codecs.py   Fri Sep 21 23:08:31 2012 +0300
@@ -1693,6 +1693,15 @@
 )
 
 self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict, \U0010bc),
+(\U0010bc, 3)
+)
+
+self.assertRaises(UnicodeDecodeError,
+codecs.charmap_decode, b\x00\x01\x02, strict, ab
+)
+
+self.assertEqual(
 codecs.charmap_decode(b\x00\x01\x02, replace, ab),
 (ab\ufffd, 3)
 )
@@ -1718,6 +1727,113 @@
 (, len(allbytes))
 )
 
+def test_decode_with_int2str_map(self):
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict,
+  {0: 'a', 1: 'b', 2: 'c'}),
+(abc, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict,
+  {0: 'Aa', 1: 'Bb', 2: 'Cc'}),
+(AaBbCc, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict,
+  {0: '\U0010', 1: 'b', 2: 'c'}),
+(\U0010bc, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict,
+  {0: 'a', 1: 'b', 2: ''}),
+(ab, 3)
+)
+
+self.assertRaises(UnicodeDecodeError,
+codecs.charmap_decode, b\x00\x01\x02, strict,
+   {0: 'a', 1: 'b'}
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, replace,
+  {0: 'a', 1: 'b'}),
+(ab\ufffd, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, replace,
+  {0: 'a', 1: 'b', 2: None}),
+(ab\ufffd, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, ignore,
+  {0: 'a', 1: 'b'}),
+(ab, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, ignore,
+  {0: 'a', 1: 'b', 2: None}),
+(ab, 3)
+)
+
+allbytes = bytes(range(256))
+self.assertEqual(
+codecs.charmap_decode(allbytes, ignore, {}),
+(, len(allbytes))
+)
+
+def test_decode_with_int2int_map(self):
+a = ord('a')
+b = ord('b')
+c = ord('c')
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict,
+  {0: a, 1: b, 2: c}),
+(abc, 3)
+)
+
+# Issue #15379
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict,
+  {0: 0x10, 1: b, 2: c}),
+(\U0010bc, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, strict,
+  {0: sys.maxunicode, 1: b, 2: c}),
+(chr(sys.maxunicode) + bc, 3)
+)
+
+self.assertRaises(TypeError,
+codecs.charmap_decode, b\x00\x01\x02, strict,
+   {0: sys.maxunicode + 1, 1: b, 2: c}
+)
+
+self.assertRaises(UnicodeDecodeError,
+codecs.charmap_decode, b\x00\x01\x02, strict,
+   {0: a, 1: b},
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, replace,
+  {0: a, 1: b}),
+(ab\ufffd, 3)
+)
+
+self.assertEqual(
+codecs.charmap_decode(b\x00\x01\x02, ignore,
+  {0: a, 1: b}),
+(ab, 3)
+)
+
+
 class WithStmtTest(unittest.TestCase):
 def test_encodedfile(self):
 f = io.BytesIO(b\xc3\xbc)
diff -r 3e677956eef4 Objects/unicodeobject.c
--- a/Objects/unicodeobject.c   Fri Sep 21 10:12:14 2012 -0700
+++ b/Objects/unicodeobject.c   Fri Sep 21 23:08:31 2012 +0300
@@ -7525,9 +7525,10 @@
 /* Apply mapping */
 if (PyLong_Check(x)) {
 long value = PyLong_AS_LONG(x);
-if (value  0 || value  65535) {
-PyErr_SetString(PyExc_TypeError,
-character mapping must be in 

[issue15379] Charmap decoding of no-BMP characters

2012-09-21 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file26416/decode_charmap_tests.patch

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



[issue15379] Charmap decoding of no-BMP characters

2012-09-21 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file26412/decode_charmap_maxchar.patch

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



[issue15379] Charmap decoding of no-BMP characters

2012-09-21 Thread Serhiy Storchaka

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


Removed file: http://bugs.python.org/file26428/decode_charmap_maxchar-3.2.patch

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



[issue15991] BaseHTTPServer with ThreadingMixIn serving wrong data sometimes

2012-09-21 Thread Catalin Iacob

Catalin Iacob added the comment:

Can't reproduce this on openSUSE Factory (development version, what will become 
12.3).

I tried with openSUSE's Python 2 which is 2.7.3 and with self compiled up to 
date 2.7 branch from hg. For each of these I bumped the number of files to 3000 
instead of 300 and ran the script around 10 times, always got 3000 good 0 bad.

--
nosy: +catalin.iacob

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



[issue1602] windows console doesn't print or input Unicode

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

 Will this [issue] be solved in 3.3 final?

No. It would be an huge change and the RC2 was already released. No
new feature are accepted after the version 3.3.0 beta 1:
http://www.python.org/dev/peps/pep-0398/

I'm not really motivated to work on this issue, because it is really
hard to get something working in all cases. Using
ReadConsoleW/WriteConsoleW helps, but it doesn't solve all issues as
you said.

--

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Issue #15995 was marked as a duplicate of this issue. Copy of its initial 
message (msg170853):

This is similar to #15993: With the installed Python from the rc2-msi
test_lzma fails. I cannot reproduce the failure with python.exe (PGO)
compiled from source:


==  
 
ERROR: test__decode_filter_properties (test.test_lzma.MiscellaneousTestCase)
 
--  
 
Traceback (most recent call last):  
 
  File C:\Python33\lib\test\test_lzma.py, line 1105, in 
test__decode_filter_properties 
lzma.FILTER_LZMA1, b]\x00\x00\x80\x00)
 
ValueError: Invalid filter ID: 4611686018427387905  
 

 
==  
 
ERROR: test_filter_properties_roundtrip (test.test_lzma.MiscellaneousTestCase)  
 
--  
 
Traceback (most recent call last):  
 
  File C:\Python33\lib\test\test_lzma.py, line 1114, in 
test_filter_properties_roundtrip   
lzma.FILTER_LZMA1, b]\x00\x00\x80\x00)
 
ValueError: Invalid filter ID: 4611686018427387905  
 

 
--

--

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

I fail to reproduce the issue on Windows 7 (Version 6.0.1, number 7601, Service 
Pack 1):
---
Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tous droits réservés.

C:\Users\haypocd \python33

C:\Python33python.exe
Python 3.3.0rc2 (v3.3.0rc2:88a0792e8ba3, Sep  9 2012, 10:13:38) [MSC v.1600 64 b
it (AMD64)] on win32
Type help, copyright, credits or license for more information.
 exit()

C:\Python33python.exe -m test test_buffer test_lzma
[1/2] test_buffer
[2/2] test_lzma
All 2 tests OK.
---
I'm running Windows 7 in KVM, my host CPU is a Intel i7-2600.

 I'm getting these failures in test_buffer, 
 but I can *not* reproduce them when I build
 Win-32/pgo/python.exe from source:

The issue looks to be specific to 64 bits binaries. You need the professional 
version of Visual Studio 10. The express version doesn't support 64 bits. I 
only have the Express version.

--

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Declaring this a release blocker is technically difficult. If it is a release 
blocker, further releases cannot be done until it is resolved. Since it is an 
issue with the binary only, the only possible way to resolve this is with a 
release. So declaring this a release blocker essentially deadlocks the release.

--

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Martin v . Löwis

Martin v. Löwis added the comment:

For the record, the released binary is not just a PGO build, but has been 
trained with the attached training script.

--
Added file: http://bugs.python.org/file27251/profile.bat

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Martin v . Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


Added file: http://bugs.python.org/file27252/profiletests.txt

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

 You need the professional version of Visual Studio 10.
 The express version doesn't support 64 bits. I only have the
 Express version.

Ah yes, I now remember my issue with VS10 Express: when I set the project to 64 
bits, I get such error popup:
http://www.haypocalc.com/tmp/visual_studio_64bits.png

Which version should I try? Ultimate? Premium? Professional?

--

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



[issue14174] argparse.REMAINDER fails to parse remainder correctly

2012-09-21 Thread Idan Kamara

Idan Kamara added the comment:

I just ran into this issue myself and worked around it by using 
parse_known_args*.

* http://docs.python.org/library/argparse.html#partial-parsing

--
nosy: +idank

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



[issue15949] docs.python.org not getting updated

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

The 2.7 docs seem not to be affected by this issue (they are current) -- just 
the docs for 3.2 and the default branch.

--
versions: +Python 3.2, Python 3.3

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Stefan Krah

Stefan Krah added the comment:

STINNER Victor rep...@bugs.python.org wrote:
 Which version should I try? Ultimate? Premium? Professional?

Try Ultimate, it's AFAIK the only version these days that supports PGO.

--

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Stefan Krah

Stefan Krah added the comment:

Martin v. Löwis rep...@bugs.python.org wrote:
 For the record, the released binary is not just a PGO build, but has
 been trained with the attached training script.

Thanks. Now I can reproduce the issue with a source build.

--

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



[issue16000] test_curses should use unittest

2012-09-21 Thread Chris Jerdonek

New submission from Chris Jerdonek:

This issue is to switch test_curses to using unittest.TestCase classes.

Currently, test_curses does not use unittest.TestCase.  It just calls a series 
of functions that exercise curses functionality and aborts if an exception 
occurs:

http://hg.python.org/cpython/file/3e677956eef4/Lib/test/test_curses.py#l314

Some consequences of this are that a single failure will cause remaining tests 
not to execute, there is no fine-grained reporting, and TestCase assertion 
methods are not available (e.g. assertRaisesRegexp()).

--
components: Library (Lib)
messages: 170925
nosy: cjerdonek
priority: normal
severity: normal
status: open
title: test_curses should use unittest
type: enhancement
versions: Python 3.4

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



[issue16000] test_curses should use unittest

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

Would like to work on such patch?

--
nosy: +haypo

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



[issue15852] typos in curses argument error messages

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

FYI, I created issue 16000 :) to switch test_curses to using unittest.TestCase.

--

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



[issue15964] SyntaxError in asdl when building 2.7 with system Python 3

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Switching this to a devguide issue so the work-around can be documented, for 
example in this section:

http://docs.python.org/devguide/faq.html#how-do-i-switch-between-branches-inside-my-working-copy

--
assignee:  - docs@python
components: +Devguide, Documentation -Build
keywords: +easy
nosy: +docs@python, ezio.melotti
stage:  - needs patch
type: behavior - enhancement

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Martin v . Löwis

Martin v. Löwis added the comment:

I'm using Ultimate, but I think Professional should provide you with all 
required tools.

--

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



[issue15949] docs.python.org not getting updated

2012-09-21 Thread Ned Deily

Ned Deily added the comment:

I believe Georg maintains cronjobs for updating the docs.

--

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



[issue16000] test_curses should use unittest

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Sure, I could start work on such a patch.  I may start by switching just a 
couple of the functions to TestCase though (to establish a model and to make 
sure everything is wired up correctly), rather than attempting to switch the 
entire module all at once.

--

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



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

This issue is not a regression, I think that the fix can wait for Python 3.3.1.

--
nosy: +haypo

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



[issue15895] PyRun_SimpleFileExFlags() can leak a FILE pointer

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

 This issue is not a regression

My bad, Crys explained me on IRC that the leak does not exist in Python 3.2, it 
was introduced by the importlib. So it is a regression.

--

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



[issue15972] wrong error message for os.path.getsize

2012-09-21 Thread Larry Hastings

Larry Hastings added the comment:

Georg: this okay to check in?  It passes the regression test.

--
nosy: +georg.brandl

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



[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-21 Thread Stefan Krah

Stefan Krah added the comment:

It's a bit late here already, but unless I'm missing something I think
this is an optimizer bug. I'm attaching a workaround for memoryview.c
and _lzmamodule.c.

--
keywords: +patch
Added file: http://bugs.python.org/file27253/issue15993.diff

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



[issue12067] Doc: remove errors about mixed-type comparisons.

2012-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

After further thought: This section is about the syntax operators, not the 
special methods. The syntax operators never evaluate to NotImplemented as they 
(apparently) interpret its return from a special method the same as a raising 
of TypeError, and always raise TypeError when neither the op or its reflection 
is supported. So there should be no mention of NotImplemented here. Just a 
reference to 3.3. #15997 is related to my 'wonder' but not directly relevant to 
a patch for this. Please submit a draft patch when you have one.

I determined that 'raise TypeError' and 'return NotImplemented' both result in 
the call of the reflected method, at least for a couple of cases. (And same 
seems true for arithmetic ops too.)

class C():
def __ge__(self, other):
# print(in C.__ge__, end='')
return True
def __add__(self, other):
return 44
__radd__ = __add__

class O():
def __le__(self, other):
# print (in O.__le__)
return NotImplemented
def __add__(self, other):
return NotImplemented

c = C()
o = O()
ob = object() 
print(c = o, o = c, ob = c)
# True True True
# print(ob = ob) # raises TypeError
print(c + o, o + c, ob + c)
# 44 44 44
# print(ob + ob)  # raises TypeError
# print(ob = o)  # with O.__le__ print uncommented
# in O.__le__  # so non-implemented reflected o = ob *is* called
# TypeError: unorderable types: object() = O()

--

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



[issue15997] NotImplemented needs to be documented

2012-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The first three sentences are fine. The problem I have is with the 4th: 'may 
return' is rather vague. Such methods may raise TypeError instead (the old 
way), seemingly to the same effect. (See msg170936 in issue #12067, which is 
about clarifying the comparisons section of the expression chapter.). So the 
5th sentence could be misinterpreted wrongly to mean that NotImplemented is 
needed to get the alternate method try. (Since it is not, I wonder why it was 
added, since it complicates the internal logic of arithmetic and comparison 
ops.)

Perhaps a better place for any clarification on this point would be in 3.3 in 
the entry for __le__, etc.

--
nosy: +terry.reedy

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



[issue16001] small ints: cache string representation

2012-09-21 Thread STINNER Victor

New submission from STINNER Victor:

Integers in range [-5; 256] are singleton. It is possible to cache their string 
representation (in base 10) to make str(int) faster, but also to reduce memory 
consumption (and memory fragmentation, Unicode strings don't use free list).

Attached patch implements this micro-optimization. It reuses singleton for 
latin1 characters (so digits 0..9): str(0) is chr(48).

-/* Special-case boolean: we want 0/1 */
-if (PyBool_Check(val))
-result = PyNumber_ToBase(val, 10);
-else
-result = Py_TYPE(val)-tp_str(val);
+result = PyNumber_ToBase(val, 10);

This change is required because Py_TYPE(val)-tp_str(val); may return a 
singleton, whereas formatlong() requires a mutable string (string not used 
yet).

See also issue #10044.

--
components: Unicode
files: small_ints_cache_str.patch
keywords: patch
messages: 170938
nosy: ezio.melotti, haypo, pitrou
priority: normal
severity: normal
status: open
title: small ints: cache string representation
type: performance
versions: Python 3.4
Added file: http://bugs.python.org/file27254/small_ints_cache_str.patch

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



[issue16001] small ints: cache string representation

2012-09-21 Thread STINNER Victor

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


--
nosy: +storchaka

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



[issue16001] small ints: cache string representation

2012-09-21 Thread STINNER Victor

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


--
nosy:  -ezio.melotti

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



[issue15998] Python GUI idle not working

2012-09-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The following might also be helpful: which version of Windows? 32 or 64 bit? is 
python the 32 or 64 bit build? Or just copy the header line from the 
interactive interpreter. For me:

Python 3.3.0rc2 (v3.3.0rc2:88a0792e8ba3, Sep  9 2012, 10:13:38) [MSC v.1600 64 
bit (AMD64)] on win32

(although the win32 part seems wrong as this is 64 bit windows and amd64 build 
would not run on 32 bit windows)

Another suggestion: get 3.3.0, install in /python33, and try that (you should 
be able to select an option to have it not be the default install). This should 
not affect your 3.2 installation, and it will install its own copy of tcl/tk. 
In fact, if you do not have 3.2.3, you should be able to install that without 
disturbing your installed libraries.

--
status: pending - open

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



[issue10044] small int optimization

2012-09-21 Thread STINNER Victor

STINNER Victor added the comment:

If I understood correctly, the optimization proposed by Antoine was somehow 
rejected because _PyLong_IS_SMALL_INT() may be optimized incorrectly.

If a compiler miscompiles this macro, can't we disable this optimization on 
this specific compiler, instead of missing an interesting optimization on all 
compilers? I bet that no compiler will do insane optimization on such test.

Where in CPython source code do we use directly references to small_ints? The 
common case is to write PyLong_FromLong(0). Can compiler call PyLong_FromLong() 
to detect that the result is part of the small_ints array? Or that it is not 
part of small_ints?

The corner case is very unlikely to me.

--

I tested Antoine's patch with GCC 4.6 and CFLAGS=-O3 -flto (-flto: standard 
link-time optimizer): the test suite pass. I don't see any magic optimization 
here, sorry.

--

fwiw I've always found this helpful for undefined behavior: 
http://blog.regehr.org/archives/213 and, just as it says x+1  x will be 
optimized to a nop, by the same logic v = array[0]  v  array[array_len] 
will also be optimized to a nop.

x+1  x and v = array[0] are not the same checks. In the first test, x is 
used in both parts. I don't understand.

--

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



[issue10044] small int optimization

2012-09-21 Thread STINNER Victor

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


--
nosy: +loewis

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



[issue16000] test_curses should use unittest

2012-09-21 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Here is an initial patch for discussion.  As I started to say in my previous 
comment, I think it would be worth settling on the wiring (e.g. 
setUp/tearDown/etc) before trying to do more.

Some comments on the current patch:

(1) Of the following methods, it's not clear to me which should go in 
setUpModule(), setUpClass(), and setUp(): curses.setupterm(), curses.initscr(), 
and curses.savetty().

(2) When running the tests using __main__ or from regrtest in verbose mode, 
there is a slight rendering glitch in that the ok prints over the beginning 
of the output line instead of appending to the end:

$ ./python.exe Lib/test/test_curses.py
okst_issue10570 (__main__.CursesTestCase) ...
okst_issue6243 (__main__.CursesTestCase) ...

--
Ran 2 tests in 0.005s

OK

I'm not sure how important it is to make that work perfectly.  Using regrtest 
in normal mode, there are no rendering defects that I see.

--
keywords: +needs review, patch
stage:  - patch review
Added file: http://bugs.python.org/file27255/issue-16000-1.patch

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



  1   2   >