[issue11994] [2.7/gcc-4.4.3] Segfault under valgrind in string.split()

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

> I can reproduce this only with gcc-4.4.3, so it could also be a compiler bug.

You should try to disable compiler optimization: pass -O0 to gcc. E.g. use 
./configure --with-pydebug CFLAGS="-O0".

--
nosy: +haypo

___
Python tracker 

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue11995] test_pydoc loads all Python modules

2011-05-04 Thread STINNER Victor

New submission from STINNER Victor :

PydocUrlHandlerTest.test_url_requests() of test_doc checks "search?key=pydoc" 
URL. This operation has to load all Python modules to get their documentation. 
The problem is that loading all modules can have border effects with other 
tests. The most recent example: test_signal fails if it runs after test_pydoc. 
test_pydoc imports _tkinter and _tkinter loads the Tcl library which creates a 
thread waiting events in select(). The problem is that test_signal supposes 
that there is only one running thread.

Can we run tests loading all modules in a subprocess?

I have a fix to test_signal, so this bug is not really blocker, but it's better 
if a test doesn't touch the environment too much.

---

To see which modules are imported by pydoc, you can use:
import pydoc; pydoc.ModuleScanner().run(lambda *args: 0, 'XXX')

Result on my host (using python -v):

__future__
_ast
_bz2
_compat_pickle
_ctypes
_curses
_datetime
_hashlib
_json
_multiprocessing
_pickle
_posixsubprocess
_random
_socket
_sqlite3
_struct
_symtable
_tkinter
array
atexit
bdb
binascii
bz2
cmd
code
codeop
concurrent
concurrent
concurrent.futures
concurrent.futures
concurrent.futures._base
concurrent.futures.process
concurrent.futures.thread
contextlib
copy
ctypes
ctypes
ctypes._endian
ctypes.macholib
ctypes.macholib
ctypes.test
ctypes.test
curses
curses
curses.wrapper
datetime
dbm
dbm
difflib
distutils
distutils
distutils.command
distutils.command
distutils.tests
distutils.tests
doctest
email
email
email.mime
email.mime
encodings.cp1252
encodings.idna
encodings.koi8_r
faulthandler
fcntl
fnmatch
gc
getopt
gettext
grp
hashlib
html
html
http
http
idlelib
idlelib
importlib
importlib
importlib._bootstrap
importlib.test
importlib.test
importlib.test.builtin
importlib.test.builtin
importlib.test.extension
importlib.test.extension
importlib.test.frozen
importlib.test.frozen
importlib.test.import_
importlib.test.import_
importlib.test.source
importlib.test.source
json
json
json.decoder
json.encoder
json.scanner
lib2to3
lib2to3
lib2to3.btm_matcher
lib2to3.btm_utils
lib2to3.fixer_base
lib2to3.fixer_util
lib2to3.fixes
lib2to3.fixes
lib2to3.fixes.fix_imports
lib2to3.fixes.fix_imports2
lib2to3.fixes.fix_urllib
lib2to3.main
lib2to3.patcomp
lib2to3.pgen2
lib2to3.pgen2
lib2to3.pgen2.driver
lib2to3.pgen2.grammar
lib2to3.pgen2.literals
lib2to3.pgen2.parse
lib2to3.pgen2.pgen
lib2to3.pgen2.token
lib2to3.pgen2.tokenize
lib2to3.pygram
lib2to3.pytree
lib2to3.refactor
lib2to3.tests
lib2to3.tests
lib2to3.tests.support
lib2to3.tests.test_all_fixers
lib2to3.tests.test_fixers
lib2to3.tests.test_main
lib2to3.tests.test_parser
lib2to3.tests.test_pytree
lib2to3.tests.test_refactor
lib2to3.tests.test_util
logging
logging
logging.handlers
marshal
math
msilib
msilib
multiprocessing
multiprocessing
multiprocessing.dummy
multiprocessing.dummy
multiprocessing.dummy.connection
multiprocessing.forking
multiprocessing.process
multiprocessing.queues
multiprocessing.synchronize
multiprocessing.util
myfixes
myfixes
optparse
pdb
pickle
pprint
pwd
pydoc_data
pydoc_data
queue
random
select
shutil
socket
sqlite3
sqlite3
sqlite3.dbapi2
sqlite3.test
sqlite3.test
stringprep
struct
subprocess
tarfile
tempfile
test
test
test.encoded_modules
test.encoded_modules
test.json_tests
test.json_tests
test.leakers
test.leakers
test.support
test.test_email
test.test_email
test.tracedmodules
test.tracedmodules
textwrap
threading
tkinter
tkinter
tkinter.constants
tkinter.test
tkinter.test
tkinter.test.test_tkinter
tkinter.test.test_tkinter
tkinter.test.test_ttk
tkinter.test.test_ttk
turtledemo
turtledemo
unicodedata
unittest
unittest
unittest.case
unittest.loader
unittest.main
unittest.result
unittest.runner
unittest.signals
unittest.suite
unittest.test
unittest.test
unittest.util
urllib
urllib
wsgiref
wsgiref
xml
xml
xml.dom
xml.dom
xml.dom.domreg
xml.dom.minicompat
xml.etree
xml.etree
xml.parsers
xml.parsers
xml.sax
xml.sax
xml.sax._exceptions
xml.sax.handler
xml.sax.xmlreader
xmlrpc
xmlrpc
xxsubtype

--
components: Tests
messages: 135100
nosy: haypo
priority: normal
severity: normal
status: open
title: test_pydoc loads all Python modules
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



[issue11995] test_pydoc loads all Python modules

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

By the way, it is NOT POSSIBLE TO UNLOAD modules implemented in C, even if 
there is no more Python reference to the module.

--

___
Python tracker 

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



[issue11996] libpython.py: nicer py-bt output

2011-05-04 Thread STINNER Victor

New submission from STINNER Victor :

py-bt is too much verbose, I'm unable to read it.

Example:

$ gdb -args ./python -c 'import time, threading; 
threading.Thread(target=lambda:time.sleep(3)).start()'
...
[New Thread 0x769d9700 (LWP 17193)]
^C
Program received signal SIGINT, Interrupt.
sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
86  ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S: Aucun fichier ou 
dossier de ce type.
in ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S
(gdb) py-bt
#6 Frame 0xc52620, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 
237, in wait (self=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xc1f1e0>, 
_waiters=[<_thread.lock at remote 0xafb590>], _verbose=False) at remote 
0xc1cbe0>, timeout=None, waiter=<_thread.lock at remote 0xafb590>, 
saved_state=None)
waiter.acquire()
#10 Frame 0xbbb580, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 
851, in join (self=, 
_block=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xc1f1e0>, 
_waiters=[<_thread.lock at remote 0xafb590>], _verbose=False) at remote 
0xc1cbe0>, _args=(), _initialized=True, _name='Thread-1', _daemonic=False, 
_kwargs={}, _stderr=<_io.TextIOWrapper at remote 0xac15a0>, 
_ident=140737330910976, _started=<_Event(_flag=True, 
_cond=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xad7e00>, _waiters=[], 
_verbose=False) at remote 0xc1ce40>, _verbose=False) at remote 0xaec980>, 
_stopped=False, _verbose=False) at remote 0xc2fb70>, timeout=None)
self._block.wait()
#14 Frame 0xc42eb0, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 
965, in _exitfunc (self=<_MainThread(_target=None, 
_block=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xc66290>, _waiters=[], 
_verbose=False) at remote 0xc66110>, _args=(), _initialized=True, 
_name='MainThread', _daemonic=False, _kwargs={}, _stderr=<_io.TextIOWrapper at 
remote 0xac15a0>, _ident=140737353987840, _started=<_Event(_flag=True, 
_cond=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xc62fe0>, _waiters=[], 
_verbose=False) at remote 0xc65d20>, _verbose=False) at remote 0xc65840>, 
_stopped=True, _verbose=False) at remote 0xc64c90>, t=, _block=<_Condit
 ion(release=", line 1, in 
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 690, in run
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 737, in 
_bootstrap_inner
  File "/home/haypo/prog/HG/cpython/Lib/threading.py", line 710, in _bootstrap


--
components: Demos and Tools
files: gdb.patch
keywords: patch
messages: 135102
nosy: dmalcolm, haypo
priority: normal
severity: normal
status: open
title: libpython.py: nicer py-bt output
versions: Python 3.3
Added file: http://bugs.python.org/file21878/gdb.patch

___
Python tracker 

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



[issue11996] libpython.py: nicer py-bt output

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

I would also like a less verbose output for where, especially be able to hidden 
the value of the globals argument of PyEval_EvalCodeEx.

Example of where output:
---
(gdb) where
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x004d5ff5 in PyThread_acquire_lock_timed (lock=0xc3bc50, 
microseconds=-1, intr_flag=1)
at Python/thread_pthread.h:333
#2  0x004db97e in acquire_timed (lock=0xc3bc50, microseconds=-1) at 
./Modules/_threadmodule.c:66
#3  0x004dbbc5 in lock_PyThread_acquire_lock (self=0xafb590, args=(), 
kwds=0x0) at ./Modules/_threadmodule.c:133
#4  0x005931d6 in PyCFunction_Call (func=, arg=(), 
kw=0x0) at Objects/methodobject.c:84
#5  0x00489c6d in call_function (pp_stack=0x7fffb738, oparg=0) at 
Python/ceval.c:3859
#6  0x00484791 in PyEval_EvalFrameEx (f=
Frame 0xc52620, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 
237, in wait (self=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xc1f1e0>, 
_waiters=[<_thread.lock at remote 0xafb590>], _verbose=False) at remote 
0xc1cbe0>, timeout=None, waiter=<_thread.lock at remote 0xafb590>, 
saved_state=None), throwflag=0) at Python/ceval.c:2657
#7  0x00487db4 in PyEval_EvalCodeEx (_co=, 
globals=
{'current_thread': , '_BoundedSemaphore': 
, '_Semaphore': , '_Timer': 
, '_format_exc': , 
'Semaphore': , 'activeCount': , '_profile_hook': None, '_sleep': , '_trace_hook': None, 'ThreadError': , '_enumerate': , '_start_new_thread': 
, 
'_CRLock': , 'BoundedSemaphore': , 'currentThread': , '__all__': 
['active_count', 'Condition', 'current_thread', 'enumerate', 'Event', 'Lock', 
'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Barrier', 'Timer', 
'setprofile', 'settrace', 'local', 'stack_size'], '_Event': , '_PyRLock': , 
pp_stack=0x7fffc418, n=1, na=1, nk=0)
at Python/ceval.c:3957
#9  0x00489e43 in call_function (pp_stack=0x7fffc418, oparg=0) at 
Python/ceval.c:3880
#10 0x00484791 in PyEval_EvalFrameEx (f=
Frame 0xbbb580, for file /home/haypo/prog/HG/cpython/Lib/threading.py, line 
851, in join (self=, 
_block=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xc1f1e0>, 
_waiters=[<_thread.lock at remote 0xafb590>], _verbose=False) at remote 
0xc1cbe0>, _args=(), _initialized=True, _name='Thread-1', _daemonic=False, 
_kwargs={}, _stderr=<_io.TextIOWrapper at remote 0xac15a0>, 
_ident=140737330910976, _started=<_Event(_flag=True, 
_cond=<_Condition(release=, acquire=, _lock=<_thread.lock at remote 0xad7e00>, _waiters=[], 
_verbose=False) at remote 0xc1ce40>, _verbose=False) at remote 0xaec980>, 
_stopped=False, _verbose=False) at remote 0xc2fb70>, timeout=None), th
 rowflag=0) at Python/ceval.c:2657
#11 0x00487db4 in PyEval_EvalCodeEx (_co=, 
globals=
{'current_thread': , '_BoundedSemaphore': 
, '_Semaphore': , '_Timer': 
, '_format_exc': , 
'Semaphore': , 'activeCount': , '_profile_hook': None, '_sleep': , '_trace_hook': None, 'ThreadError': , '_enumerate': , '_start_new_thread': 
, 
'_CRLock': , 'BoundedSemaphore': , 'currentThread': , '__all__': 
['active_count', 'Condition', 'current_thread', 'enumerate', 'Event', 'Lock', 
'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Barrier', 'Timer', 
'setprofile', 'settrace', 'local', 'stack_size'], '_Event': , '_PyRLock': , 
pp_stack=0x7fffd0f8, n=1, na=1, nk=0)
at Python/ceval.c:3957
---

Without python-gdb.py:
---
(gdb) where
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:86
#1  0x004d5ff5 in PyThread_acquire_lock_timed (lock=0xc3bc50, 
microseconds=-1, intr_flag=1)
at Python/thread_pthread.h:333
#2  0x004db97e in acquire_timed (lock=0xc3bc50, microseconds=-1) at 
./Modules/_threadmodule.c:66
#3  0x004dbbc5 in lock_PyThread_acquire_lock (self=0xafb590, 
args=0x8977a0, kwds=0x0) at ./Modules/_threadmodule.c:133
#4  0x005931d6 in PyCFunction_Call (func=0xc670d0, arg=0x8977a0, 
kw=0x0) at Objects/methodobject.c:84
#5  0x00489c6d in call_function (pp_stack=0x7fffb738, oparg=0) at 
Python/ceval.c:3859
#6  0x00484791 in PyEval_EvalFrameEx (f=0xc52620, throwflag=0) at 
Python/ceval.c:2657
#7  0x00487db4 in PyEval_EvalCodeEx (_co=0xc32cd0, globals=0xb86dd0, 
locals=0x0, args=0xbbb728, argcount=1, 
kws=0xbbb730, kwcount=0, defs=0xc4ec28, defcount=1, kwdefs=0x0, 
closure=0x0) at Python/ceval.c:3295
#8  0x0048a26b in fast_function (func=0xc4eb60, 
pp_stack=0x7fffc418, n=1, na=1, nk=0) at Python/ceval.c:3957
#9  0x00489e43 in call_function (pp_stack=0x7fffc418, oparg=0) at 
Python/ceval.c:3880
#10 0x00484791 in PyEval_EvalFrameEx (f=0xbbb580, throwflag=0) at 
Python/ceval.c:2657
#11 0x00487db4 in PyEval_EvalCodeEx (_co=0xc282d0, globals=0xb86dd0, 
locals=0x0, args=0xc43048, argcount=1, 
kws=0xc43050, kwcount=0,

[issue11990] redirected output - stdout writes newline as \n in windows

2011-05-04 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Do you have a test scipt for us to reproduce the issues?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue8498] Cannot use backlog = 0 for sockets

2011-05-04 Thread Daniel Evers

Daniel Evers  added the comment:

Thanks for the tip. I added the unit test and uploaded my final patch (which 
includes all changes).
Is it ok to remove the files I uploaded previously?

--
Added file: http://bugs.python.org/file21879/backlog0_complete.patch

___
Python tracker 

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



[issue4106] multiprocessing occasionally spits out exception during shutdown

2011-05-04 Thread Miquel Torres

Miquel Torres  added the comment:

I can confirm this but with Python 2.7.1 on Ubuntu 11.04 64bit

My code was working with a queue that was being fed a two-string tuple.
When i changed it to contain my custom Objects, it still worked correctly, but 
the main program doesn't end until it raises the exception in QueueFeederThread

--
nosy: +tobami
versions: +Python 2.7

___
Python tracker 

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



[issue11997] One typo in Doc/c-api/init.rst

2011-05-04 Thread Steffen Daode Nurpmeso

New submission from Steffen Daode Nurpmeso :

Yes, i really found a typo.
I'll send two patches, one with the typo fixed,
and one with the typo fixed and one for which
i've :setlocal tw=80:{gq}

--
assignee: docs@python
components: Documentation
messages: 135107
nosy: docs@python, sdaoden
priority: normal
severity: normal
status: open
title: One typo in Doc/c-api/init.rst
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue11997] One typo in Doc/c-api/init.rst

2011-05-04 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

11997.1.diff only corrects the typo, 11997.2.diff does also
reformat.  (Note that all of init.rst is hard to read on a 80
column terminal.)

--
keywords: +patch
Added file: http://bugs.python.org/file21880/11997.1.diff
Added file: http://bugs.python.org/file21881/11997.2.diff

___
Python tracker 

___diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -883,7 +883,7 @@
 modules.
 
 Also note that combining this functionality with :c:func:`PyGILState_\*` APIs
-is delicate, become these APIs assume a bijection between Python thread states
+is delicate, because these APIs assume a bijection between Python thread states
 and OS-level threads, an assumption broken by the presence of sub-interpreters.
 It is highly recommended that you don't switch sub-interpreters between a pair
 of matching :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` calls.
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -882,14 +882,14 @@
 by such objects may affect the wrong (sub-)interpreter's dictionary of loaded
 modules.
 
-Also note that combining this functionality with :c:func:`PyGILState_\*` APIs
-is delicate, become these APIs assume a bijection between Python thread states
-and OS-level threads, an assumption broken by the presence of sub-interpreters.
-It is highly recommended that you don't switch sub-interpreters between a pair
-of matching :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` calls.
-Furthermore, extensions (such as :mod:`ctypes`) using these APIs to allow 
calling
-of Python code from non-Python created threads will probably be broken when 
using
-sub-interpreters.
+Also note that combining this functionality with :c:func:`PyGILState_\*` APIs 
is
+delicate, because these APIs assume a bijection between Python thread states 
and
+OS-level threads, an assumption broken by the presence of sub-interpreters.  It
+is highly recommended that you don't switch sub-interpreters between a pair of
+matching :c:func:`PyGILState_Ensure` and :c:func:`PyGILState_Release` calls.
+Furthermore, extensions (such as :mod:`ctypes`) using these APIs to allow
+calling of Python code from non-Python created threads will probably be broken
+when using sub-interpreters.
 
 
 Asynchronous Notifications
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11998] test_signal cannot test blocked signals if _tkinter is loaded

2011-05-04 Thread STINNER Victor

New submission from STINNER Victor :

I'm working on signals, especially on pthread_sigmask(), and I'm trying to 
understand test_signal failures.

test_signal fails if the _tkinter module is loaded, because _tkinter loads the 
Tcl library which create a thread waiting events in select(). For example, 
"python -m test test_pydoc test_signal" fails, because test_pydoc loads ALL 
Python modules. I opened an issue for test_pydoc: 
http://bugs.python.org/issue11995

_tkinter.c contains the following code:
#if 0
/* This was not a good idea; through  bindings,
   Tcl_Finalize() may invoke Python code but at that point the
   interpreter and thread state have already been destroyed! */
Py_AtExit(Tcl_Finalize);
#endif

Tcl_Finalize() exits the thread, but this function is never called in Python. 
Anyway, it is not possible to unload a module implemented in C.

I would like to know if it would be possible to mask all signals in the Tcl 
thread, or if Tcl supports/uses signals.

It is possible to mask all signals in the Tcl thread using:
--
allsignals = range(1, signal.NSIG)
oldmask = signal.pthread_sigmask(signal.SIG_BLOCK, allsignals)
import _tkinter
signal.pthread_sigmask(signal.SIG_SETMASK, oldmask)
--

I'm not asking the question for test_signal: I have a patch fixing test_signal, 
even if the Tcl zombi thread is present (use pthread_kill() to send the signal 
directly to the main thread).

(I wrote "zombi" thread because I was not aware that Tcl uses a thread,
nor that test_pydoc loads all modules. The thread is valid, alive, and
it's just a joke. The threads is more hidden than zombi.)

(Message copied/pasted from python-dev)

--
components: Tests, Tkinter
messages: 135109
nosy: haypo
priority: normal
severity: normal
status: open
title: test_signal cannot test blocked signals if _tkinter is loaded
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



[issue11995] test_pydoc loads all Python modules

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

See also #11998 for test_signal and _tkinter issue (test_pydoc + test_signal).

--

___
Python tracker 

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



[issue11998] test_signal cannot test blocked signals if _tkinter is loaded

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 88dca05ed468 by Victor Stinner in branch 'default':
Issue #11998, issue #8407: workaround _tkinter issue in test_signal
http://hg.python.org/cpython/rev/88dca05ed468

--
nosy: +python-dev

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

> c) Skip the test if the _tkinter thread is present (...)

I opened issue #11998 for the problem with test_signal and the _tkinter module. 
To get back green buildbots, I commited a workaround:

New changeset 88dca05ed468 by Victor Stinner in branch 'default':
Issue #11998, issue #8407: workaround _tkinter issue in test_signal
http://hg.python.org/cpython/rev/88dca05ed468

> a) Use pthread_kill() to send the signal directly
> to the right thread (...)

I'm still working on this solution to test blocked signals even if _tkinter is 
loaded.

--

___
Python tracker 

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



[issue11998] test_signal cannot test blocked signals if _tkinter is loaded

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

As suggested by Antoine, here is a patch to call Tcl_Finalize() in test_signal.

You can call create a Tcl/Tk window, destroy it, call _tkinter._finalize(), and 
then create a new Tcl/Tk window. But call _tkinter._finalize() crashes if there 
is still a running Tcl/Tk window.

We should add a safety test checking that there is no more running widget. If 
it is not possible to implement this, the function should only be compiled in 
debug mode. If it is possible, it would be nice to call _tkinter._finalize() 
when the last widget is destroyed and/or at Python exit.

--
keywords: +patch
nosy: +gpolo
Added file: http://bugs.python.org/file21882/tkinter_finalize.patch

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-04 Thread Nick Coghlan

Nick Coghlan  added the comment:

A quick eyeball of the test doesn't reveal anything obvious:

- if the subprocess is failing, it is doing so in such a way that it is still 
returning a 0 error code and isn't writing anything to stdout (as those 
assertions are before the check that the expected compiled file exists)
- the invocation of script_helper looks sensible
- if the directory creation fails, it won't get as far as running the subprocess

To instrument this, I would suggest starting by adding an assertion message on 
the failing assertion that includes "fn". My guess is that with the random 
directory name in there, the regex is triggering on the directory name and 
hence excluding the __init__.py file as well.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue11834] wrong module installation dir on Windows

2011-05-04 Thread anatoly techtonik

anatoly techtonik  added the comment:

It's always a pleasure. ;)

--

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-04 Thread Nick Coghlan

Nick Coghlan  added the comment:

Hmm, I probably should have revised the first half of my comment after I had 
the thought about "simple regex" + "random directory name" being potentially 
problematic. I don't think that theory really counts as obvious, though...

--

___
Python tracker 

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



[issue11999] sporadic failure in test_mailbox on FreeBSD

2011-05-04 Thread STINNER Victor

New submission from STINNER Victor :

test_mailbox fails sometimes on FreeBSD. Recent example on AMD FreeBSD 8.2 3.x:
---
[200/354] test_mailbox
test test_mailbox failed -- Traceback (most recent call last):
  File 
"/usr/home/buildbot/buildarea/3.x.krah-freebsd/build/Lib/test/test_mailbox.py", 
line 905, in test_reread
assert refreshed()
AssertionError
---
http://www.python.org/dev/buildbot/all/builders/AMD64%20FreeBSD%208.2%203.x/builds/180/steps/test/logs/stdio

--
components: Library (Lib), Tests
messages: 135117
nosy: haypo
priority: normal
severity: normal
status: open
title: sporadic failure in test_mailbox on FreeBSD
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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset a5890ff5e3d5 by Victor Stinner in branch 'default':
Issue #8407: signal.pthread_sigmask() returns a set instead of a list
http://hg.python.org/cpython/rev/a5890ff5e3d5

--

___
Python tracker 

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



[issue12000] SSL certificate verification failed if no dNSName entry in subjectAltName

2011-05-04 Thread Nicolas Bareil

New submission from Nicolas Bareil :

When connecting to a SSL server, the certificate verification failed if
it has a subjectAltName extension without any dNSName entry inside: it
should fallback to the Common Name.

Example:

>>> cert = conn.getpeercert()
>>> cert
{'notAfter': 'May 15 14:31:42 2011 GMT',
 'subject': ((('countryName', u'FR'),),
 (('stateOrProvinceName', u'Ile-de-France'),),
 (('localityName', u'Paris'),),
 (('organizationName', 'xxx'),),
 (('organizationalUnitName', 'xxx'),),
 (('commonName', 'foobar.corp'),),
 (('emailAddress', u't...@test.net'),)),
 'subjectAltName': (('email', t...@test.net'),)}


This certificate is valid according to RFC 2818:

If a subjectAltName extension of type dNSName is present, that MUST
be used as the identity. Otherwise, the (most specific) Common Name
field in the Subject field of the certificate MUST be used. Although
the use of the Common Name is existing practice, it is deprecated and
Certification Authorities are encouraged to use the dNSName instead.

Even if the use of CommonName is deprecated, we should not break
existing systems.

Current revision of Lib/ssl.py :

108 def match_hostname(cert, hostname):
...
119 san = cert.get('subjectAltName', ())
120 for key, value in san:
121 if key == 'DNS':
122 if _dnsname_to_pat(value).match(hostname):
123 return
124 dnsnames.append(value)
125 if not san:
126 # The subject is only checked when subjectAltName is empty
127 for sub in cert.get('subject', ()):
128 for key, value in sub:
129 # XXX according to RFC 2818, the most specific Common 
Name
130 # must be used.
131 if key == 'commonName':
132 if _dnsname_to_pat(value).match(hostname):
133 return
134 dnsnames.append(value)
...

Proposed patch is:


diff -r 513f6dfd3173 Lib/ssl.py
--- a/Lib/ssl.pySun May 01 20:24:59 2011 -0500
+++ b/Lib/ssl.pyMon May 02 11:16:46 2011 +0200
@@ -122,8 +122,9 @@
 if _dnsname_to_pat(value).match(hostname):
 return
 dnsnames.append(value)
- if not san:
- # The subject is only checked when subjectAltName is empty
+ if not san and not dnsnames:
+ # The subject is only checked when there is no dNSName entry
+ # in subjectAltName
  for sub in cert.get('subject', ()):
  for key, value in sub:
  # XXX according to RFC 2818, the most specific Common Name

--
components: Library (Lib)
messages: 135119
nosy: nbareil
priority: normal
severity: normal
status: open
title: SSL certificate verification failed if no dNSName entry in subjectAltName
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue11982] json.loads() returns str instead of unicode for empty strings

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9d5a50e5d8a2 by Ezio Melotti in branch '2.7':
#11982: fix json.loads('""') to return u'' rather than ''.
http://hg.python.org/cpython/rev/9d5a50e5d8a2

--
nosy: +python-dev

___
Python tracker 

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



[issue11982] json.loads() returns str instead of unicode for empty strings

2011-05-04 Thread Ezio Melotti

Ezio Melotti  added the comment:

Fixed, thanks for the report!

--
resolution: accepted -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

pending_signals.patch: add pthread_kill(), sigpending() and sigwait() functions 
with doc and tests.

I added many "See also" in the doc, e.g. os.kill() gives a link to 
signal.pthread_kill().

Note: the patch renames also BasicSignalTests to PosixTests, it's not related 
to the other changes.

--
Added file: http://bugs.python.org/file21883/pending_signals.patch

___
Python tracker 

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



[issue11998] test_signal cannot test blocked signals if _tkinter is loaded; Tcl_Finalize()

2011-05-04 Thread STINNER Victor

Changes by STINNER Victor :


--
title: test_signal cannot test blocked signals if _tkinter is loaded -> 
test_signal cannot test blocked signals if _tkinter is loaded; Tcl_Finalize()

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

Reopen, test_zlib fails with Python 2.7 on Windows:

==
ERROR: test_big_buffer (test.test_zlib.ChecksumBigBufferTestCase)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_zlib.py", 
line 91, in test_big_buffer
m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
WindowsError: [Error 87] The parameter is incorrect

http://www.python.org/dev/buildbot/all/builders/x86%20XP-4%202.7/builds/854/steps/test/logs/stdio

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

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 1ef2a7319849 by Victor Stinner in branch '2.7':
Issue #11277: fix issue number in a test_zlib comment
http://hg.python.org/cpython/rev/1ef2a7319849

--

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

"x86 debian parallel 2.7", "x86 Ubuntu Shared 2.7" and "x86 Tiger 2.7" fail 
with mmap.error('[Errno 12] Cannot allocate memory').

http://www.python.org/dev/buildbot/all/builders/x86%20Ubuntu%20Shared%202.7/builds/866/steps/test/logs/stdio
http://www.python.org/dev/buildbot/all/builders/x86%20Tiger%202.7/builds/776/steps/test/logs/stdio
http://www.python.org/dev/buildbot/all/builders/x86%20debian%20parallel%202.7/builds/739/steps/test/logs/stdio
==
ERROR: test_big_buffer (test.test_zlib.ChecksumBigBufferTestCase)
--
Traceback (most recent call last):
  File "/srv/buildbot/buildarea/2.7.bolen-ubuntu/build/Lib/test/test_zlib.py", 
line 91, in test_big_buffer
m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
error: [Errno 12] Cannot allocate memory

--

___
Python tracker 

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



[issue11999] sporadic failure in test_mailbox on FreeBSD

2011-05-04 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

I think this relates #6896.
Maybe a two second resolution should be tried?

--
keywords: +patch
nosy: +sdaoden
Added file: http://bugs.python.org/file21884/11999.1.diff

___
Python tracker 

___diff --git a/Lib/mailbox.py b/Lib/mailbox.py
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -514,13 +514,11 @@
 else:
 return
 
-# We record the current time - 1sec so that, if _refresh() is called
-# again in the same second, we will always re-read the mailbox
-# just in case it's been modified.  (os.path.mtime() only has
-# 1sec resolution.)  This results in a few unnecessary re-reads
-# when _refresh() is called multiple times in the same second,
-# but once the clock ticks over, we will only re-read as needed.
-now = time.time() - 1
+# Try to be fancy by using a date in the past for our _last_read mtime
+# checks (see issues #6896, #11999)
+# Using a two second resolution should be enough to overcome all
+# fuzziness which may be introduced along the different filesystems.
+now = time.time() - 2
 
 self._toc = {}
 def update_dir (subdir):
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10946] bdist doesn’t pass --skip-build on to subcommands

2011-05-04 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
nosy: +orsenthil

___
Python tracker 

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



[issue11982] json.loads() returns str instead of unicode for empty strings

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d3bd384df8ca by Ezio Melotti in branch '2.7':
#11982: remove now unused function.
http://hg.python.org/cpython/rev/d3bd384df8ca

--

___
Python tracker 

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



[issue11999] sporadic failure in test_mailbox on FreeBSD

2011-05-04 Thread R. David Murray

Changes by R. David Murray :


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



[issue11834] wrong module installation dir on Windows

2011-05-04 Thread Brian Curtin

Changes by Brian Curtin :


--
status: open -> closed

___
Python tracker 

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



[issue5755] "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++"

2011-05-04 Thread Peter Le Bek

Peter Le Bek  added the comment:

distutils reuses whatever flags Python was built with, covered here: 
http://bugs.python.org/issue1222585 (and here http://bugs.python.org/issue9031).

--
nosy: +vokoda

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-04 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

> error: [Errno 12] Cannot allocate memory

@haypo: Well i told you i have no idea.  These bots are 32 bit?

I'll attach 11277-27.3.diff which does @skipUnless(not 32 bit).
Note i'll test against >_4G - does this work (on 32 bit and in
Python)?  A pity that Python does not offer a 'condition is
always true due to datatype storage restriction' check?!

And i don't think it makes sense to test a _1GB mmap on 32 bit at
all (but at least address space shouldn't exhaust for that).
So, sorry, also for the two bugs in that two-liner, but very
especially the 'm' case.

--
Added file: http://bugs.python.org/file21885/11277-27.3.diff

___
Python tracker 

___diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -2,7 +2,7 @@
 from test.test_support import TESTFN, run_unittest, import_module, unlink, 
requires
 import binascii
 import random
-from test.test_support import precisionbigmemtest, _1G
+from test.test_support import precisionbigmemtest, _1G, _2G, _4G
 import sys
 
 try:
@@ -75,17 +75,16 @@
 # Issue #11277 - check that inputs of 2 GB are handled correctly.
 # Be aware of issues #1202, #8650, #8651 and #10276
 class ChecksumBigBufferTestCase(unittest.TestCase):
-int_max = 0x7FFF
-
+@unittest.skipUnless(sys.maxsize > _4G, "Can't run on a 32-bit system.")
 @unittest.skipUnless(mmap, "mmap() is not available.")
 def test_big_buffer(self):
 if sys.platform[:3] == 'win' or sys.platform == 'darwin':
 requires('largefile',
  'test requires %s bytes and a long time to run' %
- str(self.int_max))
+ str(_2G -1))
 try:
 with open(TESTFN, "wb+") as f:
-f.seek(self.int_max-4)
+f.seek(_2G -1-4)
 f.write("asdf")
 f.flush()
 m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue3526] Customized malloc implementation on SunOS and AIX

2011-05-04 Thread Sébastien Sablé

Sébastien Sablé  added the comment:

Another reason why you should not force dlmalloc for all applications linked 
with libpython is because dlmalloc is (by default) not thread safe, while the 
system malloc is (generally) thread-safe. It is possible to define a constant 
in dlmalloc to make it thread-safe (using locks) but it will be slower and it 
is not needed in Python since the GIL must be held when using PyMem_ functions.

If a thread-safe implementation was needed, it would be better to switch to 
ptmalloc2.

Also that addresses the issue of "two threads inside different malloc 
implementations at the same time": it is currently not allowed with 
PyMem_Malloc.

> Most of the allocations come from the heap - through sbrk

Most python objects will be allocated in pymalloc arenas (if they are smaller 
than 256 bytes) which (if compiled with --with-pymalloc-mmap) will be directly 
allocated by calling mmap, or (without --with-pymalloc-mmap) will be allocated 
in dlmalloc by calling mmap (because arenas are 256KB).
So most of the python objects will end up in mmap segments separate from the 
heap.

The only allocations that will end up in the heap are for the medium python 
objects (>256 bytes and <256KB) or for allocations directly by calling  
PyMem_Malloc (and for a size <256KB). Also dlmalloc will not call sbrk for each 
of those allocations: dlmalloc allocates some large memory pools and manage the 
smaller allocations within those pools in a very efficient way. So the heap 
fragmentation should be indeed reduced by using dlmalloc.

Most modern malloc implementations are also using pools/arenas anyway, so the 
heap will mostly contain a mix of native malloc arenas and dlmalloc pools. So 
the fragmentation should not be too much of a concern if you mix 2 malloc 
implementations.
Here is OpenSolaris malloc implementation for example:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libmalloc/common/malloc.c#514

Concerning trimming: the reason why I am proposing to use dlmalloc on AIX and 
Solaris is that the native malloc/free do not correctly trim the heap in the 
first place on those platforms! If malloc/free correctly worked on those 
platforms and the heap was trimmed when possible, I would not have taken the 
trouble of proposing this patch and using dlmalloc, I would happily use the 
native malloc/free.

So mixing 2 malloc implementations should not be a problem as long as you keep 
track of the right 'free' implementation to use for each pointer (which should 
already be the case when you call PyMem_Malloc/PyMem_Free instead of 
malloc/free).

If you are really concerned about mixing 2 malloc implementations in the heap, 
you can define "HAVE_MORECORE 0" in dlmalloc and that way dlmalloc will always 
use mmap and not use the heap at all.

My application uses the provided patch so that dlmalloc is used for Python 
objects and the native malloc for all the rest (much less consuming than the 
Python part) on AIX and SunOS. It has been in production for years and we never 
experienced any crash related to memory problems.

--

___
Python tracker 

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



[issue12001] Extend json.dumps to handle N-triples strings

2011-05-04 Thread Glenn Ammons

New submission from Glenn Ammons :

The string format used in N-triples is very similar to that used in JSON (see 
http://www.w3.org/TR/rdf-testcases/#ntrip_strings).  It would be handy if 
json.dumps could (optionally) follow the N-triples format.  The differences are

1) In \u escapes, the hexadecimal digits must be capitalized.
2) N-triples uses \u escapes instead of \b and \f

--
components: Extension Modules
messages: 135131
nosy: Glenn.Ammons
priority: normal
severity: normal
status: open
title: Extend json.dumps to handle N-triples strings
type: feature request
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



[issue11949] Make float('nan') unorderable

2011-05-04 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

On Tue, May 3, 2011 at 12:05 PM, Mark Dickinson  wrote:
..
> I was thinking of something like the rAssertAlmostEqual method in test_cmath.

This one is good.  I wonder if it would be appropriate to move
rAssertAlmostEqual() up to unitetest.case possibly replacing
assertAlmostEqual()? If replacing assertAlmostEqual() is not an
option, I would call it assertFloatAlmostEqual().

--

___
Python tracker 

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



[issue12001] Extend json.dumps to handle N-triples strings

2011-05-04 Thread Ezio Melotti

Changes by Ezio Melotti :


--
components: +Library (Lib)
nosy: +ezio.melotti
versions: +Python 3.3 -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



[issue11985] Document that platform.python_implementation supports PyPy

2011-05-04 Thread Éric Araujo

Éric Araujo  added the comment:

Could you update the docstring as well?

--

___
Python tracker 

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



[issue11985] Document that platform.python_implementation supports PyPy

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset affec521b330 by Ezio Melotti in branch '2.7':
#11985: update docstring of platform.python_implementation.
http://hg.python.org/cpython/rev/affec521b330

New changeset 7bf9d7ae6c94 by Ezio Melotti in branch '3.1':
#11985: update docstring of platform.python_implementation.
http://hg.python.org/cpython/rev/7bf9d7ae6c94

New changeset cc7342b4e59d by Ezio Melotti in branch '3.2':
#11985: merge with 3.1.
http://hg.python.org/cpython/rev/cc7342b4e59d

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

--

___
Python tracker 

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



[issue11985] Document that platform.python_implementation supports PyPy

2011-05-04 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks!

--

___
Python tracker 

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



[issue11993] Use sub-second resolution to determine if a file is newer

2011-05-04 Thread Éric Araujo

Éric Araujo  added the comment:

To quote the initial message:

> If it were desired to determine which file was newer using sub-second
> values, perhaps that would make a reasonable change in distutils2,
> but files created with a few microseconds would have to be considered
> equivalent due to the reduced precision available in python floats
> (53 bits on my platform, if I understand correctly) as compared to
> the 64 bit precision used by some operating systems and file systems.

--
title: Is it desired to distinguish new files from old with sub-second 
resolution? -> Use sub-second resolution to determine if a file is newer
versions: +Python 3.3 -Python 2.7

___
Python tracker 

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



[issue11991] test_distutils fails because of bad filename match

2011-05-04 Thread Éric Araujo

Éric Araujo  added the comment:

Closing as duplicate.  Please join the discussion at #11340 if you have 
feedback or a patch :)

--
resolution:  -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> test_distutils fails because of borked compress program

___
Python tracker 

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



[issue11970] distutils command 'upload' crashes when --show-response is selected

2011-05-04 Thread Éric Araujo

Éric Araujo  added the comment:

Are you sure?  This looks like #10367 (unsolved yet), not #9199 (fixed).

--

___
Python tracker 

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



[issue11970] distutils command 'upload' crashes when --show-response is selected

2011-05-04 Thread Chris Rose

Chris Rose  added the comment:

No, not 100% sure, but my read of the 2.7 branch code certainly seemed to 
suggest that it was fixed.

in distutil/commands/upload.py:

Line 193 gets the response unconditionally as 'r' from the http object

Line 201 uses 'r' to show the response.

I might be missing a form that the 'r' object can take that isn't going to have 
a read() method, but I doubt it.

--

___
Python tracker 

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



[issue11970] distutils command 'upload' crashes when --show-response is selected

2011-05-04 Thread Chris Rose

Chris Rose  added the comment:

... oh, except I'm an idiot, and I think I'm reading tip code there. 

Yep, I'm an idiot.

Okay, but this is still a dupe of #10367

--
resolution: invalid -> duplicate

___
Python tracker 

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



[issue11970] distutils command 'upload' crashes when --show-response is selected

2011-05-04 Thread Éric Araujo

Changes by Éric Araujo :


--
stage:  -> committed/rejected
superseder:  -> "python setup.py sdist upload --show-response" can fail with 
"UnboundLocalError: local variable 'result' referenced before assignment"

___
Python tracker 

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



[issue11990] redirected output - stdout writes newline as \n in windows

2011-05-04 Thread James Hutchison

James Hutchison  added the comment:

Yes and no, I can give you a single process single child example that just 
shows that python 3.2 uses binary output while python 3.1 used system default 
when piping, but trying to reproduce the multiprocessing output inconsistencies 
would be... difficult. Unfortunately the software I used to spot the \n, \r\n 
inconsistency with is proprietary. After creating a sample case in only python 
I couldn't reproduce the inconsistent \r\n issue in python 3.2 so I cannot say 
for certain that it wasn't caused by my C# program. I wouldn't worry about the 
inconsistent endlines for now.

Note that I don't see in the "what's new" documentation it mentioning that 3.2 
changed the behavior of piped output. Kind of a big deal.

Sample code to compare 3.1 and 3.2 piped output:

import sys;
import os;
import subprocess;
from time import sleep;

python31loc = r"C:\python31\python.exe";
python32loc = r"C:\python32\python.exe";

myname = "IOPipetest.py";

def main(args):
if(len(args) == 1):
# main code
print("Testing python 3.1 endlines.", end='\r\n');
output = subprocess.check_output("%s %s -output" % (python31loc, 
myname));
print(output);
print("Testing python 3.2 endlines.", end='\r\n');
output = subprocess.check_output("%s %s -output" % (python32loc, 
myname));
print(output);
sleep(7);
else:
for i in range(4):
print("TESTING DEFAULT"); # endline is supposed to be automatic
print("TESTING SLASH-EN\n", end='');
print("TESTING WINDOW-RETURN\r\n", end='');


if __name__ == "__main__":
main(sys.argv);

--

sample output:

Testing python 3.1 endlines.

b'TESTING DEFAULT\r\nTESTING SLASH-EN\r\nTESTING WINDOW-RETURN\r\r\nTESTING 
DEFAULT\r\nTESTING SLASH-EN\r\nTESTING WINDOW-RETURN\r\r\nTESTING 
DEFAULT\r\nTESTING SLASH-EN\r\nTESTING WINDOW-RETURN\r\r\nTESTING 
DEFAULT\r\nTESTING SLASH-EN\r\nTESTING WINDOW-RETURN\r\r\n'
Testing python 3.2 endlines.

b'TESTING DEFAULT\nTESTING SLASH-EN\nTESTING WINDOW-RETURN\r\nTESTING 
DEFAULT\nTESTING SLASH-EN\nTESTING WINDOW-RETURN\r\nTESTING DEFAULT\nTESTING 
SLASH-EN\nTESTING WINDOW-RETURN\r\nTESTING DEFAULT\nTESTING SLASH-EN\nTESTING 
WINDOW-RETURN\r\n'

--

___
Python tracker 

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



[issue11994] [2.7/gcc-4.4.3] Segfault under valgrind in string.split()

2011-05-04 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


--
nosy: +stutzbach

___
Python tracker 

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



[issue11994] [2.7/gcc-4.4.3] Segfault under valgrind in string.split()

2011-05-04 Thread Stefan Krah

Stefan Krah  added the comment:

STINNER Victor  wrote:
> You should try to disable compiler optimization: pass -O0 to gcc. E.g. use 
> ./configure --with-pydebug CFLAGS="-O0".

I did, see "only occurs when python is compiled with optimizations". :)

--

___
Python tracker 

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



[issue11995] test_pydoc loads all Python modules

2011-05-04 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> - what's current_thread_id ? If it's thread_get_ident (pthread_self),
> since TID is not guaranteed to be inherited across fork, this won't
> work

Ouch, then the approach I'm proposing is probably doomed.

> And it's true with every lock in the library code: they're only held
> in short critical sections (typically acquired when entering a
> function and released when leaving), and since it's not the threads
> inside those libraries that fork, all those locks can simply be
> reinitialized on fork, without having the reacquire them.

Well, this means indeed that *some* locks can be handled, but not all of
them and not automatically, right?
Also, how would you propose they be dealt with in practice? How do they
get registered, and how does the reinitialization happen?

(do note that library code can call arbitrary third-party code, by the
way: for example through encodings in the text I/O layer)

--

___
Python tracker 

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



[issue1856] shutdown (exit) can hang or segfault with daemon threads running

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 2a19d09b08f8 by Antoine Pitrou in branch '3.2':
Issue #1856: Avoid crashes and lockups when daemon threads run while the
http://hg.python.org/cpython/rev/2a19d09b08f8

New changeset c892b0321d23 by Antoine Pitrou in branch 'default':
Issue #1856: Avoid crashes and lockups when daemon threads run while the
http://hg.python.org/cpython/rev/c892b0321d23

--
nosy: +python-dev

___
Python tracker 

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



[issue11072] Add MLSD command support to ftplib

2011-05-04 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Eric, any further comments about the patch?
Can we go on and commit it?

--

___
Python tracker 

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



[issue1856] shutdown (exit) can hang or segfault with daemon threads running

2011-05-04 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Should be fixed in 3.2 and 3.3 now. I don't really want to bother with 2.7 and 
3.1 (the GIL implementation is different), but someone can backport the patch 
if they want to :)

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

___
Python tracker 

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



[issue11995] test_pydoc loads all Python modules

2011-05-04 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

It might be possible to use a part of patch for issue #1674555.
A newer version of that patch can be found in:
http://overlays.gentoo.org/svn/proj/python/overlays/python/dev-lang/python/files/3.3-20110417/23_all_tests_environment.patch

--

___
Python tracker 

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



[issue3526] Customized malloc implementation on SunOS and AIX

2011-05-04 Thread Charles-François Natali

Charles-François Natali  added the comment:

> Also that addresses the issue of "two threads inside different malloc 
> implementations at the same time": it is currently not allowed with 
> PyMem_Malloc.
>

That's not true.
You can perfectly have one thread inside PyMem_Malloc while another
one is inside libc's malloc.
For example, posix_listdir does:

 Py_BEGIN_ALLOW_THREADS
 dirp = opendir(name);
 Py_END_ALLOW_THREADS

Where opendir calls malloc internally. Since the GIL is released, you
can have another thread inside PyMem_Malloc at the same time. This is
perfectly safe, as long as the libc's malloc version is thread-safe.

But with your patch, such code wouldn't be thread-safe anymore. This
patch implies that a thread can't call malloc directly or indirectly
(printf, opendir, and many others) while it doesn't hold the GIL. This
is going to break a lot of existing code.
This thread-safety issue is not theoretical: I wrote up a small
program with two threads, one allocating/freeing memory in loop with
glibc's malloc and the other one with dlmalloc: it crashes immediately
on a Linux box.

> Most python objects will be allocated in pymalloc arenas (if they are smaller 
> than 256 bytes) which (if compiled with --with-pymalloc-mmap) will be 
> directly allocated by calling mmap, or (without --with-pymalloc-mmap) will be 
> allocated in dlmalloc by calling mmap (because arenas are 256KB).
> So most of the python objects will end up in mmap segments separate from the 
> heap.
>
> The only allocations that will end up in the heap are for the medium python 
> objects (>256 bytes and <256KB) or for allocations directly by calling  
> PyMem_Malloc (and for a size <256KB).

Note that there are actually many objects falling into this category:
for example, on 64-bit, a dictionary exceeds 256B, and is thus
allocated directly from the heap (well, it changed really recently
actually), the same holds for medium-sized lists and strings. So,
depending on your workload, the heap can extend and shrink quite a
bit.

> If you are really concerned about mixing 2 malloc implementations in the 
> heap, you can define "HAVE_MORECORE 0" in dlmalloc and that way dlmalloc will 
> always use mmap and not use the heap at all.
>

It will also be slower, and consume more memory.

--

___
Python tracker 

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



[issue11954] 3.3 - 'make test' fails

2011-05-04 Thread Stefan Krah

Stefan Krah  added the comment:

I just ran into this with test_httpserver/Python2.7, which fails if run
as root. If I understand correctly this is the main problem here. Jason,
do you agree to change the issue title to reflect this?

--
nosy: +skrah
versions: +Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue11049] add tests for test.support

2011-05-04 Thread Sandro Tosi

Changes by Sandro Tosi :


--
nosy: +sandro.tosi

___
Python tracker 

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



[issue11015] Bring test.support docs up to date

2011-05-04 Thread Sandro Tosi

Changes by Sandro Tosi :


--
nosy: +sandro.tosi

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 7f3cab59ef3e by Victor Stinner in branch '2.7':
Issue #11277: test_zlib tests a buffer of 1 GB on 32 bits
http://hg.python.org/cpython/rev/7f3cab59ef3e

--

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e6a4deb84e47 by Victor Stinner in branch '2.7':
Issue #11277: oops, fix checksum values of test_zlib on 32 bits
http://hg.python.org/cpython/rev/e6a4deb84e47

--

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-04 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

@haypo: Oh. Not:

   if sys.maxsize > _4G:
# (64 bits system) crc32() and adler32() stores the buffer size into an
# int, the maximum filesize is INT_MAX (0x7FFF)
filesize = 0x7FFF
crc_res = 0x709418e7
adler_res = -2072837729
else:
# (32 bits system) On a 32 bits OS, a process cannot usually address
# more than 2 GB, so test only 1 GB
filesize = _1G
crc_res = 0x2b09ee11
adler_res = -1002962529

self.assertEqual(zlib.crc32(m), self.crc_res)
self.assertEqual(zlib.adler32(m), self.adler_res)

I'm not that fast.

--

___
Python tracker 

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



[issue1516897] Use dynload_shlib on newer HP-UX versions

2011-05-04 Thread Oren Held

Oren Held  added the comment:

ajaksu2: the ticket you referred to fixed it for Darwin only, afaik. HP-UX, 
regardless of versions, still use the old dynload_hpux.c.

--
nosy: +Oren_Held

___
Python tracker 

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



[issue1487481] Could BIND_FIRST be removed on HP-UX?

2011-05-04 Thread Oren Held

Changes by Oren Held :


--
nosy: +Oren_Held

___
Python tracker 

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



[issue665194] datetime-RFC2822 roundtripping

2011-05-04 Thread R. David Murray

R. David Murray  added the comment:

Here is a patch that adds datetime support to email.utils.formatdate.  
Ultimately the email package will give programs access to datetime+timezone 
representations of the dates in various headers, so this provides the output 
end of the round trip.

Alexander, if you could review this that would be great.  There may be bugs in 
the logic of formatdate, but my hope is that I haven't added any new ones.

--
nosy: +r.david.murray
stage: needs patch -> patch review
versions: +Python 3.3 -Python 3.2
Added file: http://bugs.python.org/file21886/formatdate_datetime_support.patch

___
Python tracker 

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



[issue11335] Memory leak after key function failure in sort

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 52fb7dc721ed by Daniel Stutzbach in branch '3.2':
#11335: Fix memory leak after key function failure in sort
http://hg.python.org/cpython/rev/52fb7dc721ed

New changeset 18e43c6acfff by Daniel Stutzbach in branch 'default':
#11335: Merge from 3.2: Fix memory leak after key function failure in sort
http://hg.python.org/cpython/rev/18e43c6acfff

--
nosy: +python-dev

___
Python tracker 

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



[issue11335] Memory leak after key function failure in sort

2011-05-04 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


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

___
Python tracker 

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



[issue11994] [2.7/gcc-4.4.3] Segfault under valgrind in string.split()

2011-05-04 Thread STINNER Victor

STINNER Victor  added the comment:

GCC 4.4.3 is not the last stable version of the 4.4 branch: try maybe GCC 
4.4.6...

Changes of GCC 4.4.4, 4.4.5 and 4.4.6:
http://gcc.gnu.org/gcc-4.4/changes.html#4.4.6

Or try maybe another major version.

--

___
Python tracker 

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-04 Thread Charles-François Natali

Charles-François Natali  added the comment:

>> - what's current_thread_id ? If it's thread_get_ident (pthread_self),
>> since TID is not guaranteed to be inherited across fork, this won't
>> work
>
> Ouch, then the approach I'm proposing is probably doomed.
>

Well, it works on Linux with NPTL, but I'm not sure at all it holds
for other implementations (pthread_t it's only meaningful within the
same process).
But I'm not sure it's really the "killer" point: PID with linuxthreads
and lock being acquired by a second thread before the main thread
releases it in the child process also look like serious problems.

> Well, this means indeed that *some* locks can be handled, but not all of
> them and not automatically, right?
> Also, how would you propose they be dealt with in practice? How do they
> get registered, and how does the reinitialization happen?

When a lock object is allocated in Modules/threadmodule.c
(PyThread_allocate_lock/newlockobject), add the underlying lock
(self->lock_lock) to a linked list (since it's called with the GIL
held, we don't need to protect the linked list from concurrent
access). Each thread implementation (thread_pthread.h, thread_nt.h)
would provide a new PyThread_reinit_lock function that would do the
right thing (pthread_mutex_destroy/init, sem_destroy/init, etc).
Modules/threadmodule.c would provide a new PyThread_ReInitLocks that
would walk through the linked list and call PyThread_reinit_lock for
each lock.
PyOS_AfterFork would call this PyThread_ReInitLocks right after fork.
This would have the advantage of being consistent with what's already
done to reinit the TLS key and the import lock. So, we guarantee to be
in a consistent and usable state when PyOS_AfterFork returns. Also,
it's somewhat simpler because we're sure that at that point only one
thread is running (once again, no need to protect the linked-list
walk).
I don't think that the performance impact would be noticable (I know
it's O(N) where N is the number of locks), and contrarily to the
automatic approach, this wouldn't penalize every acquire/release.
Of course, this would solve the problem of threading's module locks,
so PyEval_ReInitThreads could be removed, along with threading.py's
_after_fork and _reset_internal_locks.
In short, this would reset every lock held so that they're usable in
the child process, even locks allocated e.g. from
Modules/_io/bufferedio.c.
But this wouldn't allow a lock's state to be inherited across fork for
the main thread (but like I said, I don't think that this makes much
sense anyway, and to my knowledge no implementation makes such a
guarantee - and definitely not POSIX).

--

___
Python tracker 

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



[issue12002] ftplib.FTP.abort fails with TypeError on Python 3.x

2011-05-04 Thread Robert Xiao

New submission from Robert Xiao :

On Python 3.2, calling abort() on an ftplib.FTP object will cause an exception:

>>> ftp = ftplib.FTP('localhost')
>>> ftp.abort()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.2/ftplib.py", line 246, in abort
self.sock.sendall(line, MSG_OOB)
TypeError: 'str' does not support the buffer interface

The offending line, ftplib.py:246, should be replaced by
self.sock.sendall(line.encode(self.encoding), MSG_OOB)

--
components: Library (Lib)
messages: 135158
nosy: nneonneo
priority: normal
severity: normal
status: open
title: ftplib.FTP.abort fails with TypeError on Python 3.x
type: crash
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue12003] documentation: alternate version of xrange seems to fail.

2011-05-04 Thread alejandro david weil

New submission from alejandro david weil :

Python's documentation includes 2 source codes for alternate xrange 
implementations, which, at least in my tests, give unexpected results.

# from file:///usr/share/doc/python2.6-doc/html/library/functions.html#xrange
takewhile(lambda x:xhttp://docs.python.org/library/functions.html?highlight=xrange#xrange
islice(count(start, step), (stop-start+step-1)//step)


I'll attach a file with source code showing that, and propose 3 different 
versions which seems to work fine. (I've prefer the first one, but python lacks 
of sign() function).

--
assignee: docs@python
components: Documentation
files: test_xrange.py
messages: 135159
nosy: docs@python, tenuki
priority: normal
severity: normal
status: open
title: documentation: alternate version of xrange seems to fail.
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file21887/test_xrange.py

___
Python tracker 

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



[issue11015] Bring test.support docs up to date

2011-05-04 Thread Sandro Tosi

Sandro Tosi  added the comment:

Hi all,
IIUIC we are left with issue11015.py3k.testdoc.1.patch) since 
issue11015.py3k.remove_fcmp.{1,2}.patch has been already applied on default.

I just gave a look to the doc patch and it seems fine (it also applies without 
any warning on default).

Eli, do you want to expand this patch further (and how :) or do you think it's 
still the version you want to commit? Can a core devel, then, give this patch a 
deeper look?

--

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-04 Thread John O'Connor

John O'Connor  added the comment:

I am new to the community but hoping to start contributing or at least 
following issues and learning :) 

I'm looking at bufferediobase_readinto(). What I haven't yet figured out is why 
.readinto() is (currently) implemented at this layer of the hierarchy. You have 
to have a raw read buffer available to read from and I'm not sure how one would 
acquire that from here (without calling .read() or something that has been 
overridden and knows about the raw buffer).

I feel like bufferediobase_readinto() should return unsupported. Also 
readinto(), in theory, is lower level than read. if read isn't implemented at 
this layer why is readinto()?

With a little direction, I would be interested in helping w/a patch.

--
nosy: +jcon

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-04 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

2011/5/4 John O'Connor :
>
> John O'Connor  added the comment:
>
> I am new to the community but hoping to start contributing or at least 
> following issues and learning :)
>
> I'm looking at bufferediobase_readinto(). What I haven't yet figured out is 
> why .readinto() is (currently) implemented at this layer of the hierarchy. 
> You have to have a raw read buffer available to read from and I'm not sure 
> how one would acquire that from here (without calling .read() or something 
> that has been overridden and knows about the raw buffer).

Why is that? You can, as the BufferedIOBase implementation does, just
call read() and stick it into the buffer.

>
> I feel like bufferediobase_readinto() should return unsupported. Also 
> readinto(), in theory, is lower level than read. if read isn't implemented at 
> this layer why is readinto()?

To provide a simple implementation for unsophisticated subclasses.

--

___
Python tracker 

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



[issue8158] Docstring of optparse.OptionParser incomplete

2011-05-04 Thread Bryce Verdier

Bryce Verdier  added the comment:

Applied patch cleanly. Also the description reads clearly and makes sense.

--
nosy: +louiscipher

___
Python tracker 

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



[issue11943] Add TLS-SRP (RFC 5054) support to ssl, _ssl, http, and urllib

2011-05-04 Thread Quinn Slack

Quinn Slack  added the comment:

I have updated the patch in hg to address the sections marked "TODO" (after I 
submitted a patch to OpenSSL that they depended on). I'll resubmit a patch here 
in a ~week addressing that issue and those below, to continue pushing this 
issue along.

pitrou: Thanks for your feedback.

> - the OpenSSL functions you are using (SSL_get_srp_username etc.) don't seem 
> documented on openssl.org; this makes it harder to do a proper review

Yes...I'll submit some docs to OpenSSL on these functions.

> - what is an "SRP vbase"? is it something standardized, or OpenSSL-specific?
> - if server-side support needs a callback, I think it would be better to let 
> users write their callback in Python, rather than force a hardwired 
> implementation

An SRP "vbase" is OpenSSL's name for the SRP password (verifier) database. I 
will generalize this interface so that Python callbacks can be provided (in 
addition to using an OpenSSL verifier database).

> - no need to fill Misc/ACKS and Misc/NEWS by yourself, we can take care of 
> that
> - ssl.wrap_socket() is the legacy API, I would rather add new features only 
> to the SSLContext API

Got it.

--

___
Python tracker 

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



[issue11015] Bring test.support docs up to date

2011-05-04 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

This is an improvement that I think should be committed before 3.2.1.
Some comments:

+.. function:: run_doctest(module, verbosity=None)
+   Run :mod:`doctest` on the given *module*.
should be, I believe,
+   Run :func:`doctest.testmod` on the given *module*.
as that is what the function actually does (I check the code).

+   If *verbosity* is :const:`None`, :meth:`doctest` is run with verbosity set
+   to :data:`verbose`.  Otherwise, it is run with verbosity set to
+   :const:`None`.

Should :meth:`doctest` be :func:`testmod` ?
Otherwise the proposed text rewrites

"If optional argument verbosity is not specified (or is None), pass
support's belief about verbosity on to doctest.  Else doctest's
usual behavior is used (it searches sys.argv for -v)."

The problem with the rewrite is that the keyword param of testmod is 'verbose', 
not 'verbosity'. 'Verbosity' is a dummy name used to either pass 
support.verbose to verbose, or not. So testmod is, in net effect, run with 
verbose=verbose or verbose=None. My attempt to explain a bad design (with 
probable markup errors):

"If *verbosity* is :const:`None`, :func:`testmod` is run with verbose set to 
:data:`support.verbose`, which is set by :func:`regrtest`. Otherwise, it is run 
with verbose set to :const:`None` and subsequently replaced by :code:`'-v' in 
sys.argv`."


+.. function:: temp_umask(umask)
+
+   A context manager that temporarily sets the process umask to the
+   given value.

"sets the process umask to *umask*." ?


+.. function:: find_unused_port(family=socket.AF_INET, 
socktype=socket.SOCK_STREAM)

+   Either this method or :func:`bind_port` should be used for any tests
+   where a server socket needs to be bound to a particular port for the
+   duration of the test.
+   Which one to use depends on whether the calling code is creating a python
+   socket, or if an unused port needs to be provided in a constructor
+   or passed to an external program (i.e. the ``-accept`` argument to
+   openssl's s_server mode). 

This is copied from the doc string but does really tell me which to use in 
which of the two situations.

Other additions look OK to me. Some copied docstrings (or comments). Some are 
new. Support.py could also use a patch to add missing docstings (and turn a 
couple of comments into docstrings).

--

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-04 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Looking at this again, I agree with John.  For BufferedIOBase, read() is 
abstract while readinto() is concrete.  That seems backward, and, indeed, it's 
the opposite of RawIOBase, where readinto() is abstract and read() is concrete.

Unfortunately, this code has shipped, so changing which methods are abstract 
may not be practical.  On the other hand, the documentation doesn't mention 
which methods are abstract versus concrete.

All of that said, we can freely change the C implementation of BufferedReader 
which is a concrete class.  That would allow us to cut out the extra 
allocoations/deallocations, even if we can't clean up the abstract vs concrete 
method issue.  Basically, this would require greatly expanding 
buffered_readinto() in bufferedio.c to use _bufferedreader_raw_read() and 
related functions.

As I think about this more... I'm not sure how much performance there is to 
gain here in practice.  It seems like any time I'd want to use readinto(), it's 
because I want to do my own buffering, in which case why would I use a 
BufferedReader?  I'm thinking that BufferedIOBase only provides a readinto() 
method for completeness, so it can be used as a drop-in replacement for an 
unbuffered file object.

--

___
Python tracker 

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



[issue8158] Docstring of optparse.OptionParser incomplete

2011-05-04 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset c13d2552eb51 by R David Murray in branch '2.7':
#8158: add missing 'description' description to optparse docstring.
http://hg.python.org/cpython/rev/c13d2552eb51

New changeset f559b88bcaa0 by R David Murray in branch '3.1':
#8158: add missing 'description' description to optparse docstring.
http://hg.python.org/cpython/rev/f559b88bcaa0

New changeset b4b0a1458638 by R David Murray in branch '3.2':
Merge #8158: add missing 'description' description to optparse docstring.
http://hg.python.org/cpython/rev/b4b0a1458638

New changeset 2a403afc4a76 by R David Murray in branch 'default':
Merge #8158: add missing 'description' description to optparse docstring.
http://hg.python.org/cpython/rev/2a403afc4a76

--
nosy: +python-dev

___
Python tracker 

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



[issue8158] Docstring of optparse.OptionParser incomplete

2011-05-04 Thread R. David Murray

R. David Murray  added the comment:

Thanks everyone.

--
resolution:  -> fixed
stage: needs patch -> committed/rejected
status: open -> closed
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



[issue11935] MMDF/MBOX mailbox need utime

2011-05-04 Thread R. David Murray

R. David Murray  added the comment:

Not all system mail spools are mode 1777.  Mutt needs to be setgid mail on 
systems that aren't, if I understand correctly.  Making a python program setgid 
mail is a bit more of security issue than making a well-tested C program 
setgid, since it is easier to break out of the box in a python program.

I'm pretty sure that the shell does not parse the mbox when it produces its 
'you have new mail' message.  I believe it just looks at the mtime/atime.

mailbox is an mbox manipulation program, not a mail delivery agent.  If you are 
using it to write a mail delivery agent, I think perhaps the mtime setting code 
belongs in your application, not the mailbox module.

--

___
Python tracker 

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



[issue12004] PyZipFile.writepy gives internal error on syntax errors

2011-05-04 Thread Ben Morgan

New submission from Ben Morgan :

PyZipFile.writepy gives internal error on syntax errors in files it processes.

For example, in the attached test case:
Traceback (most recent call last):
  File "C:\tfs\SDKS\python\Python32\lib\py_compile.py", line 119, in compile
optimize=optimize)
  File "test_zipfile_error_bad_syntax.py", line 1
syntax error
   ^
SyntaxError: invalid syntax

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1393, in _compile
py_compile.compile(file, doraise=True, optimize=optimize)
  File "C:\tfs\SDKS\python\Python32\lib\py_compile.py", line 123, in compile
raise py_exc
py_compile.PyCompileError:   File "test_zipfile_error_bad_syntax.py", line 1
syntax error
   ^
SyntaxError: invalid syntax


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test_zipfile_error.py", line 7, in 
pzf.writepy(PYFILE)
  File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1376, in writepy
fname, arcname = self._get_codename(pathname[0:-3], basename)
  File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1428, in _get_codename

if _compile(file_py):
  File "C:\tfs\SDKS\python\Python32\lib\zipfile.py", line 1395, in _compile
print(err.msg)
NameError: global name 'err' is not defined

Around zipfile.py:1395 
in PyZipFile._get_codename _compile
try:
py_compile.compile(file, doraise=True, optimize=optimize)
except py_compile.PyCompileError as error:
print(err.msg)
return False

The print should be printing error.msg not err.msg

--
files: test_zipfile_error.py
messages: 135170
nosy: Ben.Morgan
priority: normal
severity: normal
status: open
title: PyZipFile.writepy gives internal error on syntax errors
type: behavior
Added file: http://bugs.python.org/file21888/test_zipfile_error.py

___
Python tracker 

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



[issue12004] PyZipFile.writepy gives internal error on syntax errors

2011-05-04 Thread Ben Morgan

Changes by Ben Morgan :


--
keywords: +patch
Added file: http://bugs.python.org/file21889/pyzipfile-error.patch

___
Python tracker 

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



[issue11015] Bring test.support docs up to date

2011-05-04 Thread Eli Bendersky

Eli Bendersky  added the comment:

> Eli, do you want to expand this patch further (and how :) or do you think
> it's still the version you want to commit? Can a core devel, then, give this
> patch a deeper look?
>

I will review this again in a couple of days and will commit.

--
Added file: http://bugs.python.org/file21890/unnamed

___
Python tracker 

___
Eli, do you want to expand this patch further (and how :) or do you think 
it's still the version you want to commit? Can a core devel, then, give 
this patch a deeper look?I will review this again in 
a couple of days and will commit.


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



[issue11015] Bring test.support docs up to date

2011-05-04 Thread Terry J. Reedy

Changes by Terry J. Reedy :


Removed file: http://bugs.python.org/file21890/unnamed

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-04 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I don't see the problem. You're free to override readinto() and read() in 
subclasses. readinto() is just implemented in BufferedIOBase as a convenience.

--

___
Python tracker 

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



[issue6721] Locks in python standard library should be sanitized on fork

2011-05-04 Thread Charles-François Natali

Charles-François Natali  added the comment:

Please disregard my comment on PyEval_ReInitThreads and _after_fork:
it will of course still be necessary, because it does much more than
just reinitializing locks (e.g. stop threads).
Also, note that both approaches don't handle synchronization
primitives other  than bare Lock and RLock. For example, Condition and
Event used in the threading module wouldn't be reset automatically:
that's maybe something that could be handled by Gregory's atfork
mechanism.

--

___
Python tracker 

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