[issue18516] Typos in Lib/email/generator.py and Lib/email/architecture.rst

2013-07-21 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Sorry, my bad. The tuple pluralization is correct. I read it wrongly.

--

___
Python tracker 

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



[issue18517] "xxlimited" extension declared incorrectly in setup.py

2013-07-21 Thread Ned Deily

New submission from Ned Deily:

In the top-level setup.py, the code to define the Extension instance for the 
"xxlimited" extension is currently incorrectly located near the end of 
detect_tkinter() rather than in its parent detect_modules(). This has the 
effect of skipping the build of "xxlimited" on OS X since detect_tkinter() 
shortcuts to detect_tkinter_darwin() there.  The attached patch corrects that.

However, it does raise the question of why "xxlimited" is built at all for 
normal installable builds, since "xxlimited" is a dummy template module.  The 
definition for the somewhat similar "xx" is commented out by default.  Perhaps 
"xxlimited" should be as well.  Or perhaps both should only be built for 
--with-pydebug configs.  Opinions?

--
components: Build
messages: 193428
nosy: loewis, ned.deily
priority: low
severity: normal
stage: patch review
status: open
title: "xxlimited" extension declared incorrectly in setup.py
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



[issue18517] "xxlimited" extension declared incorrectly in setup.py

2013-07-21 Thread Ned Deily

Changes by Ned Deily :


--
keywords: +patch
Added file: http://bugs.python.org/file30993/issue_X_setup_xxlimited.patch

___
Python tracker 

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



[issue18518] timeit bug?

2013-07-21 Thread icedream91

New submission from icedream91:

When I ran code below, it printed -1. The question is, the code in variable 
snippet, has wrong syntax, it can't be run. I think timeit should return only 
non-negative float type.


from timeit import timeit

snippet="""
for i in range(10):
return -1
"""

print(timeit(snippet))


Thanks.

--
components: Library (Lib)
messages: 193429
nosy: icedream91
priority: normal
severity: normal
status: open
title: timeit bug?
type: behavior
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



[issue18438] Obsolete url in comment inside decimal module

2013-07-21 Thread Mark Dickinson

Mark Dickinson added the comment:

Searching around a bit, I did find a link to what looks like the actual version 
of IEEE 854 online.  I don't think it would be appropriate to add such a link 
to the docs, though.  It looks as though we'll have to settle for a reasonably 
persistent link that goes to a page *about* IEEE 854, rather than a link to a 
draft.  The wikipedia page would seem reasonable:

http://en.wikipedia.org/wiki/IEEE_854-1987

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread Ned Deily

New submission from Ned Deily:

See for instance:
http://buildbot.python.org/all/builders/x86%20Tiger%203.x/builds/6626

I was also able to reproduce and bisect on an OS X 10.5 (Leopard) PPC system:

$ hg bisec -b
The first bad revision is:
changeset:   84704:48a869a39e2d
user:Victor Stinner 
date:Thu Jul 18 01:41:08 2013 +0200
summary: Issue #18408: PyEval_EvalFrameEx() and 
PyEval_CallObjectWithKeywords() now fail

Crash and gdb "where" with current tip:

$ hg log -r tip
changeset:   84749:5643e873f06e
tag: tip
parent:  84746:c5d128b201af
parent:  84748:db6a22943a3f
user:Ned Deily 
date:Sat Jul 20 15:08:22 2013 -0700
summary: Issue #17532: merge from 3.3
$ ./python -m test  test_sqlite
[1/1] test_sqlite
Assertion failed: (!PyErr_Occurred()), function PyEval_EvalFrameEx, file 
Python/ceval.c, line 1210.
Fatal Python error: Aborted

Current thread 0xa0343820:
  File "/Volumes/cache/py/3x/unix/source/Lib/sqlite3/test/userfunctions.py", 
line 441 in authorizer_cb
  File "/Volumes/cache/py/3x/unix/source/Lib/sqlite3/test/userfunctions.py", 
line 406 in test_table_access
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/case.py", line 496 in run
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/case.py", line 535 in 
__call__
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 105 in run
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 67 in 
__call__
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 105 in run
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 67 in 
__call__
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 105 in run
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 67 in 
__call__
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 105 in run
  File "/Volumes/cache/py/3x/unix/source/Lib/unittest/suite.py", line 67 in 
__call__
  File "/Volumes/cache/py/3x/unix/source/Lib/test/support.py", line 1480 in run
  File "/Volumes/cache/py/3x/unix/source/Lib/test/support.py", line 1581 in 
_run_suite
  File "/Volumes/cache/py/3x/unix/source/Lib/test/support.py", line 1615 in 
run_unittest
  File "/Volumes/cache/py/3x/unix/source/Lib/test/regrtest.py", line 1304 in 

  File "/Volumes/cache/py/3x/unix/source/Lib/test/regrtest.py", line 1305 in 
runtest_inner
  File "/Volumes/cache/py/3x/unix/source/Lib/test/regrtest.py", line 1009 in 
runtest
  File "/Volumes/cache/py/3x/unix/source/Lib/test/regrtest.py", line 796 in main
  File "/Volumes/cache/py/3x/unix/source/Lib/test/regrtest.py", line 1590 in 
main_in_temp_cwd
  File "/Volumes/cache/py/3x/unix/source/Lib/test/__main__.py", line 3 in 

  File "/Volumes/cache/py/3x/unix/source/Lib/runpy.py", line 73 in _run_code
  File "/Volumes/cache/py/3x/unix/source/Lib/runpy.py", line 160 in 
_run_module_as_main
Abort trap
$ gdb ./python
GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:15:14 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...Reading symbols for shared 
libraries  done

(gdb) -m test -w -uall,-largefile test_sqlite
Undefined command: "-m".  Try "help".
(gdb) r -m test -w -uall,-largefile test_sqlite
Starting program: /Volumes/cache/py/3x/unix/source/python -m test -w 
-uall,-largefile test_sqlite
Reading symbols for shared libraries +++. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries ... done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
[1/1] test_sqlite
Reading symbols for shared libraries .. done
Reading symbols for shared libraries . done
Assertion failed: (!PyErr_Occurred()), function PyEval_EvalFrameEx, file 
Python/ceval.c, line 1210.

Program received signal SIGABRT, Aborted.
0x918089f0 in __

[issue18518] timeit bug?

2013-07-21 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Well, not sure if this is worth fixing, I think this is because timeit runs a 
modified version of the code using exec(), with the actual code to be timed 
within a function. (timeit runs something like this with exec():

def actual_code():
   #The real code
   for i in range(10): return -1

actual_code()

--
nosy: +Ramchandra Apte

___
Python tracker 

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2013-07-21 Thread Ramchandra Apte

Changes by Ramchandra Apte :


--
title: return-ing within timeit.timeit causes wrong return value of 
timeit.timeit -> return-ing within code timed with timeit.timeit causes wrong 
return value of timeit.timeit

___
Python tracker 

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



[issue18518] return-ing within timeit.timeit causes wrong return value of timeit.timeit

2013-07-21 Thread Ramchandra Apte

Changes by Ramchandra Apte :


--
title: timeit bug? -> return-ing within timeit.timeit causes wrong return value 
of timeit.timeit

___
Python tracker 

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



[issue18466] Spelling mistakes in various code comments.

2013-07-21 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Hmm... once I actually created a short (<50 lines) script which spell-checked 
the comments. Problem is that many technical words (GCC, for example) were 
marked incorrect by the spell-checker (Enchant), resulting in about 1000+ 
"incorrectly" spelled words.

--
nosy: +Ramchandra Apte

___
Python tracker 

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



[issue18491] Add "exe wrapper" functionality to Windows launcher

2013-07-21 Thread Paul Moore

Paul Moore added the comment:

Updated patch, as per discussion.

--
Added file: http://bugs.python.org/file30994/launcher_wrapper.patch

___
Python tracker 

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



[issue18491] Add "exe wrapper" functionality to Windows launcher

2013-07-21 Thread Paul Moore

Changes by Paul Moore :


Removed file: http://bugs.python.org/file30966/launcher_wrapper.patch

___
Python tracker 

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 026593cbc006 by Victor Stinner in branch 'default':
Issue #18519, #18408: Fix sqlite authorizer callback
http://hg.python.org/cpython/rev/026593cbc006

--

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 026593cbc006 by Victor Stinner in branch 'default':
Issue #18519, #18408: Fix sqlite authorizer callback
http://hg.python.org/cpython/rev/026593cbc006

--
nosy: +python-dev

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

It's not a crash, but an assertion that I added recently: it means that a 
previous Python exception is not handled correctly.

The problem is that a first call to _authorizer_callback() raised a Python 
exception and returned SQLITE_DENY, but sqlite called _authorizer_callback() 
again (with the Python exception set).

According to the doc: "SQLITE_DENY to cause the entire SQL statement to be 
rejected with an error":
http://www.sqlite.org/c3ref/set_authorizer.html

So I don't expect _authorizer_callback() to be called again if the previous 
call returned SQLITE_DENY. Whatever, this issue should be fixed by the 
changeset 026593cbc006.

--

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue18408] Fixes crashes found by pyfailmalloc

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

"""
python: Python/ceval.c:1210: PyEval_EvalFrameEx: Assertion `!PyErr_Occurred()' 
failed.
Fatal Python error: Aborted

Current thread 0x404df8c0:
  File 
"/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/sqlite3/test/userfunctions.py",
 line 441 in authorizer_cb
"""

Ned Deily created the issue #18519 for that. It should be fixed by the 
changeset 026593cbc006.

--

___
Python tracker 

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



[issue18520] Fixes bugs found by pyfailmalloc during Python initialization

2013-07-21 Thread STINNER Victor

New submission from STINNER Victor:

I'm working on a version of pyfailmalloc integrated into CPython to inject 
memory allocation failures duging Python startup. As expected, I found new bugs.

I create this issue to track these bugs and their fix, as I did with the issue 
#18408.

Home page of the project:
https://pypi.python.org/pypi/pyfailmalloc

--
messages: 193439
nosy: haypo
priority: normal
severity: normal
status: open
title: Fixes bugs found by pyfailmalloc during Python initialization
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



[issue18520] Fixes bugs found by pyfailmalloc during Python initialization

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 276477d5a548 by Victor Stinner in branch 'default':
Issue #18520: Fix initsigs(), handle PyOS_InitInterrupts() error
http://hg.python.org/cpython/rev/276477d5a548

--
nosy: +python-dev

___
Python tracker 

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



[issue18520] Fixes bugs found by pyfailmalloc during Python initialization

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

PyStructSequence_InitTypeWithError() return type is void, whereas it can fail 
and raise an exception. Can I change the return type, or should I create a new 
function?

--

___
Python tracker 

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



[issue18521] [cppcheck] Full report

2013-07-21 Thread Julien Nabet

New submission from Julien Nabet:

Hello,

I retrieved Cpython sources today and runned cppcheck ("git updated" today) on 
the whole sources with enable=all
I attached the full report.
There are certainly false positive but some reports may help, eg:
[Python/getargs.c:379]: (style) Array index 'i' is used before limits check.
Indeed, here is the code:
379 while (levels[i] > 0 && i < 32 && (int)(p-buf) < 220) {

[Modules/md5module.c:345] -> [Modules/md5module.c:342]: (style) Found duplicate 
branches for 'if' and 'else'
342 if (Py_TYPE(self) == &MD5type) {
343 if ( (newobj = newMD5object())==NULL)
344 return NULL;
345 } else {
346 if ( (newobj = newMD5object())==NULL)
347 return NULL;
348 }

[Objects/iterobject.c:87]: (error) Uninitialized variable: seqsize
[Objects/setobject.c:549]: (error) Address of local auto-variable assigned to a 
function parameter
etc.

Hope it helps.

Julien

--
files: cppcheck_reports.txt
messages: 193442
nosy: serval2412
priority: normal
severity: normal
status: open
title: [cppcheck] Full report
versions: Python 3.5
Added file: http://bugs.python.org/file30995/cppcheck_reports.txt

___
Python tracker 

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



[issue15905] Copy to fixed size buffer w/o check in sys_update_path

2013-07-21 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> -wcscpy(q+1, link);
> +wcsncpy(q+1, link, MAXPATHLEN);
> +argv0copy[2*MAXPATHLEN] = L'\0';

Should be `q[MAXPATHLEN] = L'\0';`. Otherwise there will be a bug when a length 
of link is MAXPATHLEN.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18521] [cppcheck] Full report

2013-07-21 Thread Christian Heimes

Christian Heimes added the comment:

The report contains too much noise to be useful. I suggest that you remove some 
of the noise.

* get rid of "The scope of the variable 'foo' can be reduced.". It's 
nit-picking.

* ignore 3rd party code: Modules/_ctypes/libffi*, Modules/_sha3/keccak, 
Modules/expat, Modules/_decimal/libmpdec

* ignore Windows stuff on non-Windows platforms: PC, PCbuild, Tools/msi

--
nosy: +christian.heimes

___
Python tracker 

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



[issue18514] Unreachable Py_DECREF() in ctypes's PyCData_FromBaseObj()

2013-07-21 Thread Eric V. Smith

Eric V. Smith added the comment:

Your patch looks like the output of "hg help", or similar.

--
nosy: +eric.smith

___
Python tracker 

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



[issue18521] [cppcheck] Full report

2013-07-21 Thread Julien Nabet

Julien Nabet added the comment:

Here's a new version of the file after some filtering
(for the record, I used this command line:
grep -v 'The scope' cppcheck_reports.txt |grep -v 'Modules/_ctypes/libffi' 
|grep -v Modules/_sha3/keccak| grep -v Modules/expat | grep -v 
Modules/_decimal/libmpdec |grep -v PC | grep -v msi | grep -v 'Skipping config' 
|grep -v 'Too many')

Is it ok for you?

Julien

--
Added file: http://bugs.python.org/file30996/cppcheck_reports_filtered.txt

___
Python tracker 

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



[issue18514] Unreachable Py_DECREF() in ctypes's PyCData_FromBaseObj()

2013-07-21 Thread Christian Heimes

Changes by Christian Heimes :


Removed file: http://bugs.python.org/file30989/frombaseobj.patch

___
Python tracker 

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



[issue18514] Unreachable Py_DECREF() in ctypes's PyCData_FromBaseObj()

2013-07-21 Thread Christian Heimes

Christian Heimes added the comment:

Oh, you are right ...

The patch is trivial: I switched the Py_DECREF() and return NULL lines.

--

___
Python tracker 

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



[issue18514] Unreachable Py_DECREF() in ctypes's PyCData_FromBaseObj()

2013-07-21 Thread Eric V. Smith

Eric V. Smith added the comment:

For some reason the blank link in the Coverity report confused me. Yes, 
swapping the lines looks right.

--

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread R. David Murray

R. David Murray added the comment:

Do you understand why it was called again with the exception set?  I'm worried 
that there might be a change in behavior here that the tests aren't catching.

--
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



[issue18517] "xxlimited" extension declared incorrectly in setup.py

2013-07-21 Thread R. David Murray

R. David Murray added the comment:

My expectation would be that we want the tests to be runnable (and be run, not 
skipped) with Python installed, and thus we build the test module.  (Whether or 
not our tests actually *can* be run with Python installed is an open question, 
though.)  And skipping some tests when installed is probably OK, too, so if I'm 
right about the rationale we could still change our minds.

--
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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2013-07-21 Thread R. David Murray

R. David Murray added the comment:

I'm inclined to agree with Ramchandra.  It might be worth a doc footnote, 
though.

--
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



[issue18514] Unreachable Py_DECREF() in ctypes's PyCData_FromBaseObj()

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 25ffad2e12d6 by Christian Heimes in branch '3.3':
Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
http://hg.python.org/cpython/rev/25ffad2e12d6

New changeset afe119a3619f by Christian Heimes in branch 'default':
Issue #18514: Fix unreachable Py_DECREF() call in PyCData_FromBaseObj()
http://hg.python.org/cpython/rev/afe119a3619f

--
nosy: +python-dev

___
Python tracker 

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



[issue18514] Unreachable Py_DECREF() in ctypes's PyCData_FromBaseObj()

2013-07-21 Thread Christian Heimes

Christian Heimes added the comment:

Thanks for the review

--
resolution:  -> fixed
stage: needs patch -> 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



[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Here is the patch for this ticket.

David Murray, am I on the right path? If yes, I'll put more robust tests, such 
as the ones with Asian encodings and unusual encodings.

--
Added file: http://bugs.python.org/file30997/set_payload_binary.txt

___
Python tracker 

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



[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok

Changes by Vajrasky Kok :


Removed file: http://bugs.python.org/file30997/set_payload_binary.txt

___
Python tracker 

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



[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Sorry, got typo for the last patch.

--
Added file: http://bugs.python.org/file30998/set_payload_binary.txt

___
Python tracker 

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



[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread R. David Murray

R. David Murray added the comment:

It looks like you are still patching get_payload.  This should be a really 
simple patch against set_payload.

It occurs to me that there could be a backward compatibility concern if passing 
binary to set_payload currently actually works in some cases, so we definitely 
needs a bunch of test that do that to make sure they all fail before we fix the 
bug :)

--

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

Before my change, the authorizer callback was called even if an exception
was raised. This is wrong, it is not how python works.

You can try with python 3.3 and an authorizer raising an exception and then
increment an attribute. If I understood correctly, the attribute will be
incremented but you will get the exception in the caller.

--

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread R. David Murray

R. David Murray added the comment:

Raised by what?  I thought the callback *was* the thing raising the
exception?  Are you sure you don't just need to clear the exception
if the callback function raises one?

--

___
Python tracker 

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2013-07-21 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
type: behavior -> enhancement
versions: +Python 2.7, Python 3.4

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

I agree also that io is a good place for the basic version that doesn't do file 
descriptor stuff and maybe the fancy file descriptor stuff should be a separate 
issue and should go in subprocess.

To move this along and generate more discussion, I took code from Nick earlier 
in the thread and made a little patch and a test program and put it in a gist:

https://gist.github.com/msabramo/6049140

If folks like that, I can convert the test program into an automated test. 

What do you guys think?

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Oops, Nick => Brett.

--

___
Python tracker 

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



[issue17128] OS X system openssl deprecated - installer should build local libssl

2013-07-21 Thread Mateusz Lenik

Mateusz Lenik added the comment:

I finally managed to find some time to clean up the script I used to compile 
multiarch openssl.

The diff is available at 
https://bitbucket.org/_mlen/cpython/commits/319f10362eb4b947b12750a6eb66fb622bbb0079

For 10.8 I had to comment out Tk related part and use the command below to 
build:
./build-installer.py 
--sdk-path=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/
 --third-party=/Users/m/Documents/Code/sources --universal-archs=intel 
--dep-target=10.8

The test results are below:
test-osx ➤ arch -i386 python3 -m test -unetwork test_ssl
[1/1] test_ssl
Resource 'ipv6.google.com' is not available
1 test OK.
test-osx ➤ arch -x86_64 python3 -m test -unetwork test_ssl
[1/1] test_ssl
Resource 'ipv6.google.com' is not available
1 test OK.

--
hgrepos: +204

___
Python tracker 

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



[issue18522] Error creating a raw string of r'\\?\'

2013-07-21 Thread John Jefferies

New submission from John Jefferies:

I'm having trouble with a raw string of r'\\?\' as in the following session:

>>> a = r'\\?\'
  File "", line 1
a = r'\\?\'
  ^
SyntaxError: EOL while scanning string literal


which seems like a bug to me. I see the same behaviour in v3.3, v3.2, and v2.6. 
I have tried searching for such a bug but search engines don't work well with a 
string of non-alphanumerics.

Why is this string important? It's because the Win32 API functions throw an 
error with path names longer than 260 chars unless the path names are prefixed 
with this string, e.g:
shutil.copy2(r'\\?\C:\some\quite\long\path\name', dstname)
shutil.copy2(r'\\?\' + r'C:\some\quite\long\path\name', dstname)

where the first example throws an exception without the path name prefix; while 
the second example fails to compile.

FTR. I can create the desired string in various other ways:

>>> a = '?\\'
>>> a
'?\\'
>>> a = r'\\?\ '[0:4]
>>> a
'?\\'
>>>


Thanks

John

--
components: Interpreter Core
messages: 193462
nosy: John.Jefferies
priority: normal
severity: normal
status: open
title: Error creating a raw string of r'\\?\'
type: compile error
versions: Python 2.6, 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



[issue18522] Error creating a raw string of r'\\?\'

2013-07-21 Thread Tim Peters

Tim Peters added the comment:

As section 2.4.1. (String literals) of the Python reference manual says, 

"... (even a raw string cannot end in an odd number of backslashes). 
Specifically, a raw string cannot end in a single backslash (since the 
backslash would escape the following quote character)."

--
nosy: +tim_one

___
Python tracker 

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



[issue18523] test_signal failure under Windows

2013-07-21 Thread Antoine Pitrou

New submission from Antoine Pitrou:

c31bec42e4112a49c192a16f271faffd5a44b83d (by Victor) seems to be the culprit.

See 
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/2188



==
ERROR: test_issue9324 (test.test_signal.WindowsSignalTests)
--
Traceback (most recent call last):
  File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_signal.py", 
line 213, in test_issue9324
signal.signal(sig, signal.signal(sig, handler))
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable 
object

--
assignee: haypo
components: Tests, Windows
messages: 193464
nosy: brian.curtin, haypo, larry, pitrou
priority: release blocker
severity: normal
stage: needs patch
status: open
title: test_signal failure under Windows
type: behavior
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



[issue18522] Error creating a raw string of r'\\?\'

2013-07-21 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Indeed, you'll have to use a regular (non-raw) string literal for everything 
ending up with a backslash. This part of Python's syntax probably won't be 
changed.

--
nosy: +pitrou
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue18522] Error creating a raw string of r'\\?\'

2013-07-21 Thread John Jefferies

John Jefferies added the comment:

Yes, thankyou; I missed that. Another search reveals the issue has come up 
under 11451 and 1271 at least.

John

--

___
Python tracker 

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



[issue18425] IDLE Unit test for IdleHistory.py

2013-07-21 Thread R. Jayakrishnan

Changes by R. Jayakrishnan :


--
resolution:  -> works for me

___
Python tracker 

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



[issue18458] libedit history offset workaround

2013-07-21 Thread Michael Kleehammer

Michael Kleehammer added the comment:

Just wanted to chime in that I reported this to Apple and their response was 
exactly this.  (Perhaps Ronald works for Apple?)

Is there a temporary work around in the meantime other than rebuilding 
everything?

--
nosy: +mkleehammer

___
Python tracker 

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



[issue18425] IDLE Unit test for IdleHistory.py

2013-07-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Resolution is for when the issue is closed, and I expect this to be closed as 
'fixed'.

--
assignee:  -> terry.reedy
resolution: works for me -> 
stage:  -> patch review

___
Python tracker 

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



[issue18523] test_signal failure under Windows

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

This issue is a duplicate of #18396.
Le 21 juil. 2013 21:35, "Antoine Pitrou"  a écrit :

>
> New submission from Antoine Pitrou:
>
> c31bec42e4112a49c192a16f271faffd5a44b83d (by Victor) seems to be the
> culprit.
>
> See
> http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/2188
>
>
>
> ==
> ERROR: test_issue9324 (test.test_signal.WindowsSignalTests)
> --
> Traceback (most recent call last):
>   File "C:\buildbot.python.org\3.x.kloth-win64\build\lib\test\test_signal.py",
> line 213, in test_issue9324
> signal.signal(sig, signal.signal(sig, handler))
> TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a
> callable object
>
> --
> assignee: haypo
> components: Tests, Windows
> messages: 193464
> nosy: brian.curtin, haypo, larry, pitrou
> priority: release blocker
> severity: normal
> stage: needs patch
> status: open
> title: test_signal failure under Windows
> type: behavior
> versions: Python 3.4
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue18458] libedit history offset workaround

2013-07-21 Thread Ned Deily

Ned Deily added the comment:

If you are using an existing binary installation, you could disable readline 
processing altogether by simply renaming the readline extension module, for 
example:

  cd /Library/Frameworks/Python.framework/Versions/3.3
  cd ./lib/python3.3/lib-dynload
  sudo mv readline.so readline.so.disabled

Of course, then you will not have interactive command line history and much of 
the editing features.  But it shouldn't crash.

If you don't mind using GNU readline (which is GPL licensed), you *might* be 
able to install the third-party readline module from PyPI:
   https://pypi.python.org/pypi/readline
But extension module building on unreleased systems may be problematic.  It may 
be easier to build on a currently supported system and move it.

As necessary, we will likely need to provide updates for the OS X installers in 
conjunction with the official release of 10.9.

--

___
Python tracker 

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



[issue18439] Patchcheck for ACKS, NEWS does not work on Windows.

2013-07-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Ronald or Ned, is the attached patch OK for Macs?

--
assignee:  -> terry.reedy
keywords: +patch
nosy: +ned.deily, ronaldoussoren
stage: needs patch -> commit review
Added file: http://bugs.python.org/file30999/patchcheck.diff

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Nick Coghlan

Nick Coghlan added the comment:

A good start, but:

1. io is too low level to depend on unittest (or even contextlib), as
anything it imports will be imported automatically at interpreter startup.
The context manager will need to be written out directly as a class with
the appropriate methods.

2. The name based API should accept the unqualified name and throw a value
error if an unexpected name is passed in.

3. The stdin replacement should have a separate optional keyword-only
"data" argument to request wrapping with StringIO, rather than duck typing
the replacement value.

--

___
Python tracker 

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2013-07-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Agreed this should be closed as "won't fix".

--
nosy: +rhettinger
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue18439] Patchcheck for ACKS, NEWS does not work on Windows.

2013-07-21 Thread Ned Deily

Ned Deily added the comment:

Re the patch: it looks like there's a debugging print left in it.  (Also, FYI, 
the patch did not apply cleanly using normal Unix patch; I had to strip the \r 
characters with (tr -d '\r' 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

Thanks Nick! I'll work on applying your suggestions a little later. And I'll 
add a note about it not working with subprocesses because I realized that I 
forgot to do that. 

Regarding redirect_stdfile, which is presumably what you meant by "name-based 
API", I started out with unqualified names like 'stdout', etc. I went with the 
qualified name as an attempt at making it more general (i.e.: if folks perhaps 
wanted to use this for something other than sys files) - I don't know whether 
or not this is useful - I don't have a use case in mind (anyone else got one?) 
- so I don't know if qualified names brings anything useful or not but that was 
the thinking. Thoughts on this are welcome.

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I'm thinking that PrintRedirect is a better name because it coincides with the 
intent of the primary use case.  The more computer-sciency you make the name, 
the more it becomes opaque to everyday users.

--

___
Python tracker 

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 23b0164b9c82 by Terry Jan Reedy in branch '2.7':
Issue #18441: Make test.support.requires('gui') skip when it should.
http://hg.python.org/cpython/rev/23b0164b9c82

--
nosy: +python-dev

___
Python tracker 

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I took a look. Not fun ;-).

Pending a more permanent fix, I am applying a revised patch, first to 2.7 to 
make sure it works.

--

___
Python tracker 

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



[issue18439] Patchcheck for ACKS, NEWS does not work on Windows.

2013-07-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Sorry, I forgot to paste the patch diff into Notepad++ rather than Idle in 
order to save it without \r. (That would be a useful option for Idle too.) Good 
to know that I can forget about Classic Mac. I deleted the debug print.

--

___
Python tracker 

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



[issue18439] Patchcheck for ACKS, NEWS does not work on Windows.

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 26686d227e41 by Terry Jan Reedy in branch '3.3':
Issue #18439: Make patchcheck work on Windows for ACKS, NEWS.
http://hg.python.org/cpython/rev/26686d227e41

New changeset 13950a33f889 by Terry Jan Reedy in branch '2.7':
Issue #18439: Make patchcheck work on Windows for ACKS, NEWS.
http://hg.python.org/cpython/rev/13950a33f889

New changeset f737673e909b by Terry Jan Reedy in branch '2.7':
Issue #18439: Move news entry misplaced by graft merge.
http://hg.python.org/cpython/rev/f737673e909b

--
nosy: +python-dev

___
Python tracker 

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



[issue18439] Patchcheck for ACKS, NEWS does not work on Windows.

2013-07-21 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> fixed
stage: commit 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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9f922270a929 by Terry Jan Reedy in branch '2.7':
Issue #18441: fix buildbot name-error for TclError.
http://hg.python.org/cpython/rev/9f922270a929

--

___
Python tracker 

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e8b8279ca118 by Terry Jan Reedy in branch '2.7':
Backed out changeset: 23b0164b9c82 #18441 not working
http://hg.python.org/cpython/rev/e8b8279ca118

--

___
Python tracker 

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2013-07-21 Thread R. David Murray

R. David Murray added the comment:

Rather than closing it, we converted it to a documentation issue.  I think it 
is worth a footnote in the docs, since it is not obvious (without reading the 
source code) that a return statement will cause timeit to return an invalid 
result instead of raising a syntax error.

--
resolution: wont fix -> 
status: closed -> open

___
Python tracker 

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

(The fix was incomplete because 'delete' in the except clause should be 
'remove'.) I finally realized that I could test the except clause by raising 
TclError explicitly just before it.

I reverted both changes because they do not seem to work, even with the 
additional fix (not committed). With or without patches,
python_d -m test -v test_idle  # runs 30 tests, as expected
python_d -m test -v -ugui test_idle  # run 40 tests, as expected
After raising TclError, the latter still runs 40 tests, which I did not expect.

It seems that 'gui' is not being removed from use_resources. Since debug 
print()s in test_idle do not show up on the console, I cannot easily see what 
is going on.

--

___
Python tracker 

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



[issue18453] There are unused variables inside DateTimeTestCase class in test_xmlrpc.py

2013-07-21 Thread Alexander Belopolsky

Alexander Belopolsky 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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

More noise. Much of what I said above was incorrect due to version mixup. The 
one extra fix I did not commit might have been enough, but I will wait until I 
have tested it.

--
stage: commit review -> patch review

___
Python tracker 

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



[issue18518] return-ing within code timed with timeit.timeit causes wrong return value of timeit.timeit

2013-07-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Go ahead and add a footnote, but do consider that such footnotes are mostly 
just clutter.  It doesn't help someone at the moment there is an invalid return 
value -- instead it just makes it so that afterward someone can say that it is 
documented.

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Nick Coghlan

Nick Coghlan added the comment:

As Raymond noted, we should resist the temptation to generalise this too much - 
generalisation almost always comes at the cost of making any *specific* case 
harder (consider the difference between the complexity of the "support any URL 
scheme" model in urllib and urllib2 and the relatively API simplicity of the 
higher level HTTP/HTTPS focused requests module).

I'm wary of calling it "PrintRedirect" though, as I believe that's actively 
misleading: swapping sys.stdout for something else affects more than just the 
print builtin, and if a particular print call uses the "file" parameter, then 
the redirection of sys.stdout will have no effect.

"Redirection" in general is a bit of a misnomer for what the context manager is 
doing.

So, here's a concrete API suggestion and implementation:

def replace_stdin(stream=None, *, data=None):
if data is not None:
if stream is not None:
raise ValueError("Cannot specify both stream & data")
stream = StringIO(data)
return ReplaceStandardStream('stdin', stream)

def replace_stdout(stream=None):
return ReplaceStandardStream('stdout', stream)

def replace_stderr(stream=None):
return ReplaceStandardStream('stderr', stream)

class ReplaceStandardStream:
"""Context manager to temporarily replace a standard stream

On entry, replaces the specified sys module stream attribute
('stdin', 'stdout' or 'stderr') with the supplied IO stream
object.

On exit, restores the previous value of the sys module
attribute.

Note: as this context manager modifies sys module attributes
directly, it is NOT thread-safe.
"""
def __init__(self, attr, stream):
if attr not in ('stdin', 'stdout', 'stderr'):
raise ValueError("{.200!r} is not a standard stream name 
(expected one of: 'stdin', 'stdout', or 'stderr'".format(attr))
self._attr_to_replace = attr
self._old_stream = None
if stream is None:
self._replacement_stream = StringIO()
else:
self._replacement_stream = stream

def __enter__(self):
if self._old_stream is not None:
raise RuntimeError("Cannot reenter {!r}".format(self))
self._old_stream = getattr(sys, self._attr_to_replace)
stream = self._replacement_stream
setattr(sys, self._attr_to_replace, stream)
return stream

def __exit__(self):
stream = self._old_stream
if stream is None:
raise RuntimeError("Never entered {!r}".format(self))
self._old_stream = None
setattr(sys, self._attr_to_replace, stream)

Cross linking from the print documentation to io.replace_stdout and from the 
input documentation to io.replace_stdin may also be a good idea.

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Nick Coghlan

Nick Coghlan added the comment:

And reviewing my own draft - the convenience functions would need docstrings 
too, and the docstrings should mention that a new StringIO instance is created 
by default and that "as name" can be used to get access to that object.

--

___
Python tracker 

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



[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread Vajrasky Kok

Vajrasky Kok added the comment:

"It looks like you are still patching get_payload.  This should be a really 
simple patch against set_payload."

Okay, do I get it right at this time?

About your second point, I need more time to think about it.

--
Added file: http://bugs.python.org/file31000/set_payload_binary_v2.txt

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Nick, it seems to me that you're going way over-board with an otherwise simple 
idea.  I'm aiming for something that looks much like my original posting.  That 
has been tried out on my students with great success.

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Marc Abramowitz

Marc Abramowitz added the comment:

I like Nick's version. I don't know if __exit__ really needs error checking, 
but I like the API. For me, it strikes a good balance between being intuitive 
and being general enough to do all the stuff I'd like to do. 

Should the docstrings mention that it only works within the process and doesn't 
affect subprocesses?

I also am having second thoughts about putting it in the io module. Now I'm 
thinking that sys makes more sense because that's where stdin, stdout, and 
stderr live.

--

___
Python tracker 

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



[issue18324] set_payload does not handle binary payloads correctly

2013-07-21 Thread R. David Murray

R. David Murray added the comment:

Yes, that's what I had in mind.

--

___
Python tracker 

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



[issue18492] Add test.support.regrtest_run flag, simplify support.requires

2013-07-21 Thread Zachary Ware

Zachary Ware added the comment:

Terry J. Reedy added the comment:
> The problem is that this permissiveness does not apply to subsidiary files 
> discovered from and run by a main file, even though it should. The current 
> workaround is to explicitly set use_resources for the benefit of subsidiary 
> files, as in test_idle.py.

This is exactly what inspired this issue, though with
test_codecmaps_*.py rather than test_idle.

> As I see it, the main point of this patch, somewhat obscured by the title, is 
> to extend the current resource permissiveness from tests *in* main files run 
> as main to tests in other files discovered and run from a main file. It also 
> extends the permisiveness to any test not run by regrtest (ie, by unittest).

I did choose the title rather poorly, but yes, this is the real point.

> The key change is
> -if sys._getframe(1).f_globals.get("__name__") == "__main__":
> +if not regrtest_run:
>
> 'regrtest_run == True' is currently spelled 'use_resources is not None', so 
> the latter could be used instead to replace the frame-check without otherwise 
> adding new code.

I think using the 'regrtest_run' flag is more explicit about why we're
just letting anything go, and could potentially be useful in other
situations as well (though I'm coming up blank on what any of those
might be right now).



> Serhiy is concerned about the possible booby-trap for users that run slow 
> resource intensive tests. Some thoughts:


I agree with your thoughts here, which if I'm not mistaken basically
boil down to "Yes, it's a booby-trap, but it's not a lethal one and we
can document around most of it."

> *If -u is added to unittest (and 'use=' to .main), a default of all would be 
> the right thing for subfile targets, even if not for file and multi-file 
> targets.

I'm not sure I understand this line.  But I do have an initial patch
adding -u to unittest which I will be posting shortly which, if
accepted, should render this issue moot.

--

___
Python tracker 

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



[issue18441] Idle: Make test.support.requires('gui') skip when it should.

2013-07-21 Thread Zachary Ware

Changes by Zachary Ware :


--
nosy: +zach.ware

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Nick Coghlan

Nick Coghlan added the comment:

OK, Raymond and I had a chat on IRC about this, and I've come back around to 
the idea that the simple "contextlib.redirect_stdout" model as Raymond 
originally proposed is the way to go. There are a few pieces to that rationale:

1. Why in contextlib?

The io module isn't something people normally need to think about - we mostly 
hide it from them since they can just call the open builtin. Similarly, most 
new users don't need to touch the sys module - it's all hidden behind higher 
level abstractions (like input, print and argparse).

However, contextlib is something everyone will be exposed to, both to turn 
generators into context managers, but also for the utility context managers 
closing() and ignored().

It also comes down to trusting Raymond's opinion as an experienced Python 
teacher that contextlib is a more discoverable location than io for this 
particular piece of functionality.

2. Why only stdout? Why not stdin and stderr?

Raymond pointed out that the case for this kind of redirection helper is much 
weaker for stdin and stderr. Wanting to control where "print" and similar 
operations write to is quite common, but writing to stderr is often 
specifically about bypassing typical redirections and faking input through 
stdin is typically only done for testing purposes.

Adding stdlib APIs without compelling use cases isn't a good idea, even when 
they seem like an "obvious" generalisation.

In this case, outside the CPython test suite, I couldn't think of any situation 
where the limited versions of these helpers would have actually been useful to 
me, and in the test suite case, the typical answer would be "use a mock" (that 
just wasn't an option for CPython until recently when unittest.mock was added 
to the standard library).

Instead, I now think both of those cases would be better handled by the more 
sophisticated API discussed above that would deal with these things at the file 
descriptor level. So I suggest we split that API out as a new issue targetting 
the subprocess API.

3. Why not include automatic creation of StringIO objects?

Including such a default actually makes the API harder to document and explain. 
Composing a "you must supply a stream object" API with io.StringIO is easy to 
get local redirection is easy. If we support implicit creation, then we need to 
explain that it happens, and that the "as" clause can be used to retrieve the 
implicitly created object.

Raymond plans to work on a patch for this simple version of the API.

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue18524] BufferedReader.read1() documentation/implementation difference

2013-07-21 Thread Nikolaus Rath

New submission from Nikolaus Rath:

The read1() docstring says: "Reads up to n bytes, with at most one read() 
system call."

However, in the implementation read1() calls peek() to refill the buffer if 
necessary, and then returns whatever is available in the buffer.

This means that read1() will only return up to n bytes if n is smaller than the 
buffer size, otherwise it will return at most  bytes.


With the current implementation, running a loop that calls obj.read1(n) for 
large n is therefore much less performant than a loop that calls 
obj.raw.read(n). 

I think a call to read1(n) with empty buffer should always attempt to read n 
bytes from the raw stream, i.e. the implementation should be changed to match 
the documentation.

--
components: IO
messages: 193496
nosy: Nikratio
priority: normal
severity: normal
status: open
title: BufferedReader.read1() documentation/implementation difference
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



[issue18525] Shutil cannot import WindowsError on windows

2013-07-21 Thread Saurabh Gupta

New submission from Saurabh Gupta:

I've observed that shutil fails to import WindowsError on our windows 7 systems:

from shutil import WindowsError

File , line , in 
from shutil import WindowsError
ImportError: cannot import name WindowsError

The same statement works absolutely fine on linux. Has anyone else come across 
it too? Do you know how I could fix it?

Python version: 2.6.7
Linux OS: Centos 6.3
Windows OS: Windows 7 Professional x64

--
components: Extension Modules, Library (Lib), Windows
messages: 193497
nosy: saurabhgupta2u
priority: normal
severity: normal
status: open
title: Shutil cannot import WindowsError on windows
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Nikolaus Rath

Nikolaus Rath added the comment:

I think stdout redirection is very useful, and I'm actually have a very similar 
context manager in my own code.

However, I'd like to raise the question if using a context manager for this 
purpose should really be "officially blessed" in this way.

To me, the with statement signals that effects are constrained to the managed 
block. But redirecting sys.stdout is a change with global scope - the 
redirection is not restricted to execution of the with block, it affects every 
other thread that's running at the same time. This effect is obvious if you 
wrote the redirection context manager yourself, but if you're using code from 
the standard library, this may be surprising.

I don't have a better proposal, but I just wanted to mention this...

--
nosy: +Nikratio

___
Python tracker 

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



[issue18526] Add resource management/guarding to unittest

2013-07-21 Thread Zachary Ware

New submission from Zachary Ware:

Here is an initial attempt at adding resource management/guarding to unittest, 
a la test.support.requires.

The patch adds 6 new names to unittest.__all__; one function called 
'registerResource' which explains itself, one function and one decorator 
(require and requires, respectively--I'm open to better, more differentiable 
names) for requiring a resource, and three exceptions (ResourceError for an 
error and ResourceUnavailable and ResourceDenied for skipping for different 
reasons).  All of these are implemented in a new unittest.resources module.

Existing modules are changed as follows:

- util.py defines class _BaseSkip(Exception), which ResourceUnavailable 
inherits from.  ResourceDenied subclasses ResourceUnavailable.
- case.py: SkipTest inherits from _BaseSkip, and _BaseSkip is checked for to 
mark a test as skipped in _Outcome.testPartExecutor.  Also, TestCase.run is 
patched to do resource checking for test classes and methods that use the 
requires decorator.
- loader.py checks for util._BaseSkip instead of case.SkipTest
- main.py adds -u and --use command line options, and use= TestProgram 
constructor arg.

Tests are added to test_program and a new test_resources.  The doc page is 
updated appropriately.

The idea behind the departures from the way test.support.requires works is that 
since this will be used by far more than just the stdlib tests, there will be 
more than just the resources we use that unittest will need to know about, so 
there has to be some way to tell it about them--hence 'registerResource'.  
Also, to alleviate issues like #18441, I have implemented an easy way to test 
whether the resource is usable, via the 'checker' argument to registerResource. 
 Lastly, 'requires' is provided as a decorator for ease of use, though it does 
add the most complication to the implementation.

I look forward to reviews :)

Thanks,

Zach

--
components: Library (Lib)
files: unittest_resources.diff
keywords: patch
messages: 193499
nosy: ezio.melotti, michael.foord, pitrou, r.david.murray, serhiy.storchaka, 
terry.reedy, zach.ware
priority: normal
severity: normal
status: open
title: Add resource management/guarding to unittest
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31001/unittest_resources.diff

___
Python tracker 

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



[issue18458] libedit history offset workaround

2013-07-21 Thread Ronald Oussoren

Ronald Oussoren added the comment:

Building just the readline extension shouldn't be that hard, using a small 
custom setup.py script. Then install by manually copying it to the right 
location.

And no, I don't work for Apple.

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread Nick Coghlan

Nick Coghlan added the comment:

Yeah, the docs will need to note that it isn't thread safe. However, non 
thread-safe constructs are often still incredibly useful for scripting use 
cases.

--

___
Python tracker 

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



[issue15805] Add stdout redirection tool to contextlib

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

Can someone propose a patch instead of inline code?

--

___
Python tracker 

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



[issue18519] test_sqlite crashes on OS X tiger 3.x buildbot

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

> Raised by what?

The test raising the assertion error is a Python authorizer callback which 
returns a Python int (2**32) larger than a C int (> INT_MAX) and so an 
OverflowError is raised in the C authorizer callback.

> Are you sure you don't just need to clear the exception
> if the callback function raises one?

I read the code one more time, and I saw this:

if (_enable_callback_tracebacks) {
PyErr_Print();
} else {
PyErr_Clear();
}

So it is expected that the C authorizer callback clears the error.

Here is a new patch which implement the same behaviour on _PyLong_AsInt() 
failure.

--
keywords: +patch
resolution: fixed -> 
status: closed -> open
Added file: http://bugs.python.org/file31002/sqlite_authorizer_err.patch

___
Python tracker 

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



[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed

2013-07-21 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 020dbfdf9517 by Victor Stinner in branch 'default':
Issue #18488: Fix _pysqlite_final_callback()
http://hg.python.org/cpython/rev/020dbfdf9517

--

___
Python tracker 

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



[issue18488] sqlite: finalize() method of user function may be called with an exception set if a call to step() method failed

2013-07-21 Thread STINNER Victor

STINNER Victor added the comment:

"+1 for PyException_SetContext or similar. The C code should behave like a 
"finally: x.finalize()"."

If the Python callback failed in _pysqlite_step_callback() or 
_pysqlite_final_callback(): the exception is printed if 
sqlite3.enable_callback_tracebacks() has been called, or cleared otherwise.

Only one kind of exception is expected to be passed to be caller (according to 
sqlite unit tests): AttributeError. The changeset 020dbfdf9517 restores the 
behaviour of Python 3.3 for best backward compatibility.

If you want better reporting, please open a new issue.

My only concern was just to not call a Python function while an exception is 
set: I fixed this issue using PyErr_Fetch/PyErr_Restore. So I'm closing the 
issue.

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

___
Python tracker 

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



[issue18510] dict.__contains__ and dict.keys().__contains__ raises exception instead of returning False

2013-07-21 Thread Ronald Oussoren

Ronald Oussoren added the comment:

As mentioned on python-dev the current behavior seems sane.

1) Just like __getitem__ and __setitem__, __contains__ raises an 
   exception when the key value cannot be used as a key (which normally
   is a programming error)

2) There are values that compare equal and where one of them is 
   hashable and the other is not, such a set() and frozenset() with
   the same contents. If would be strange if
 
  set([1,2]) in { frozenset([1,2]): 'a' }

   returned False, even though the value is equal to a key in the 
   dictionary.


BTW. I've always interpreted "key in a_dict" as 

   try:
   a_dict[key]
   return True
   except KeyError:
   return False

(and not as equivalent to "key in a_dict.keys()").

(Also, if this behavior were to be changed this would be a new feature and as 
such could only be added to 3.4 and would IMHO require a PEP)

--
nosy: +ronaldoussoren

___
Python tracker 

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