[issue23383] Clean up bytes formatting

2015-02-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks to Martin's suggestions here is even more clean patch.

--
Added file: http://bugs.python.org/file38011/bytes_format_2.patch

___
Python tracker 

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




[issue23390] make profile-opt: test_distutils failure

2015-02-04 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue23390] make profile-opt: test_distutils failure

2015-02-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8957ff9776bd by Gregory P. Smith in branch '3.4':
Fixes issue23390: make profile-opt causes -fprofile-generate and related flags
https://hg.python.org/cpython/rev/8957ff9776bd

New changeset 9c46707e5526 by Gregory P. Smith in branch 'default':
Fixes issue23390: make profile-opt causes -fprofile-generate and related flags
https://hg.python.org/cpython/rev/9c46707e5526

--
nosy: +python-dev

___
Python tracker 

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



[issue23390] make profile-opt: test_distutils failure

2015-02-04 Thread Gregory P. Smith

Changes by Gregory P. Smith :


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

___
Python tracker 

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



[issue20416] Marshal: special case int and float, don't use references

2015-02-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch which adds separate dict for interned strings (otherwise they 
can be uninterned) and for bytes. It also slightly simplify the code.

--
Added file: http://bugs.python.org/file38012/marshal_refs_by_value_3.patch

___
Python tracker 

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



[issue20416] Marshal: special case int and float, don't use references

2015-02-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And here is alternative patch which uses a hashtable.

Both patches have about the same performance for *.pyc files, but 
marshal_hashtable.patch is much faster for duplicated values. Marshalling 
[1000]*10**6, [1000.0]*10**6 and [1000.0j]*10**6 with version 3 an 4 is so fast 
as marshalling [1000]*10**6 with version 2 (i.e. 5 times faster than current 
implementation).

data  ver.  dumps(ms)  loads(ms)  size(KiB)

genData2   99.9  188.9 4090.7
genData3  148.2  189.1 4090.7
genData4  121.4  177.4 3651.3

[1000]*10**6   2   97.7  131.6 4882.8
[1000]*10**6   3   95.1   63.1 4882.8
[1000]*10**6   4   95.1   64.4 4882.8

[1000.0]*10**6 2  172.9  153.5 8789.1
[1000.0]*10**6 3   97.4   61.9 4882.8
[1000.0]*10**6 4   95.7   61.6 4882.8

[1000.0j]*10**62  288.6  228.216601.6
[1000.0j]*10**63   94.9   61.6 4882.8
[1000.0j]*10**64   95.1   62.2 4882.8

20 pydecimals  2   88.0  111.4 3929.6
20 pydecimals  3   57.0   51.4 3368.5
20 pydecimals  4   46.6   39.9 3292.8

--
Added file: http://bugs.python.org/file38013/marshal_hashtable.patch

___
Python tracker 

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



[issue14203] PEP-3118: remove obsolete write-locks

2015-02-04 Thread Stefan Krah

Stefan Krah added the comment:

I think it's sufficient to test bytesiobuf_getbuffer() on
Linux and FreeBSD.  The test just checks that the exception
is raised.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue14965] super() and property inheritance behavior

2015-02-04 Thread Piotr Dobrogost

Changes by Piotr Dobrogost :


--
nosy: +piotr.dobrogost

___
Python tracker 

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



[issue23255] SimpleHTTPRequestHandler refactor for more extensible usage.

2015-02-04 Thread Ent

Ent added the comment:

No I think it's better if you put up a separate patch. That way any questions 
other reviewers will have, you will be better suited to answer them.

Cheers!

--

___
Python tracker 

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



[issue19017] selectors: towards uniform EBADF handling

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

> To find an invalid FD when select() fails with EBAD, we can use something 
> like:
> http://ufwi.org/projects/nufw/repository/revisions/b4f66edc5d4dc837f75857f8bffe9015454fdebc/entry/src/nuauth/tls_nufw.c#L408

Oh, the link is dead. Copy/paste of the code:
---
/* errno == EBADF */
int i;
/* A client disconnects between FD_SET and select.
 * Will try to find it */
for (i=0; imx; ++i){
struct stat s;
if (FD_ISSET(i, &context->tls_rx_set)){
if (fstat(i, &s)<0) {
log_message(CRITICAL, DEBUG_AREA_USER,
"Warning: %d is a bad file descriptor.", i);
FD_CLR(i, &context->tls_rx_set);
}
}
}
continue;   /* retry select */
---

In short: call fstat() if check if the FD is valid or not. O(n) complexity.

--

___
Python tracker 

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



[issue19017] selectors: towards uniform EBADF handling

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

Guido wrote:
"This still leaves case (1), where the FD is already bad when we register it.  
I am actually fine with sometimes raising and sometimes not; I don't want to 
pay the extra overhead of doing an fstat() or some other syscall just to verify 
that it is valid.  (Although this would make the argument about wanting to 
choose a selector class that doesn't make extra syscalls less compelling. :-)  
And neither do I want to ignore the error in register() and pretend success."

The asyncio has a debug mode which can execute expensive checks. These checks 
would not be acceptable in release mode since they are an impact on 
performances. In debug mode, asyncio can explicitly call fstat() before calling 
selector.register() or selector.modify().

This solution may be suggested in the documentation if someone wants a portable 
behaviour for all selector.

--

___
Python tracker 

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



[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

Here is a patch:

Issue #18932, selectors: Optimize the modify() method of selectors

Optimize also register() and unregister() methods of KqueueSelector: only call 
kqueue.control() once.

--
keywords: +patch
Added file: http://bugs.python.org/file38014/selectors_optimize_modify.patch

___
Python tracker 

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



[issue23389] pkgutil.find_loader raises an ImportError on PEP 420 implicit namespace packages

2015-02-04 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

I tested SelectSelector, PollSelector, EpollSelector on Linux. I ran tests on 
FreeBSD, so also tested KqueueSelector. I didn't test DevpollSelector, but the 
code should be identical to PollSelector (the API is the same).

--

___
Python tracker 

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



[issue17023] Subprocess does not find executable on Windows if it is PATH with quotes

2015-02-04 Thread Eli_B

Changes by Eli_B :


--
nosy: +Eli_B

___
Python tracker 

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



[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

_BaseSelectorImpl.modify() still calls unregister() and register(). To my 
understanding the whole point of this proposal was to avoid that in order to 
obtain the speedup and (possibly) avoid race conditions.

--

___
Python tracker 

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



[issue17023] Subprocess does not find executable on Windows if it is PATH with quotes

2015-02-04 Thread Tim Golden

Tim Golden added the comment:

Under the covers, subprocess is calling CreateProcess so there's really not 
very much we can do here, short of writing our own PATH-handling.

As a matter of fact, passing shell=True will produce the desired effect. Since 
the only thing this does is to run the process under cmd.exe I assume that 
cmd.exe itself adds some kind of PATH handling of its own.

I recommend closing as "won't fix".

--
assignee:  -> tim.golden
components: +Windows
nosy: +steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue22995] Restrict default pickleability

2015-02-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +nadeem.vawda

___
Python tracker 

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



[issue23264] Add pickle support of dict views

2015-02-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thanks Antoine. Do you have objections Raymond? I'm going to provide similar 
patch for MappingView.

More robust tests in updated patch.

--
assignee:  -> serhiy.storchaka
Added file: http://bugs.python.org/file38015/pickle_dictviews_2.patch

___
Python tracker 

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



[issue23376] getargs.c: redundant C-contiguity check

2015-02-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also contiguity tests in Modules/binascii.c and Modules/_ssl.c,

--

___
Python tracker 

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



[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread Charles-François Natali

Charles-François Natali added the comment:

Well, I'd like to see at least one benchmark.

--

___
Python tracker 

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



[issue23393] [Windows] Unable to link with Python in debug configuration

2015-02-04 Thread Sébastien Gallou

New submission from Sébastien Gallou:

Hi all,

I installed Python (2.7.9) as binaries under Windows. I have trouble trying to 
compile my application embedding Python, in debug configuration. I have exactly 
the same problem as described here :
http://www.cmake.org/pipermail/cmake/2013-January/053125.html

The include file python.h selects automaticaly the library file to link with, 
but python27_d.lib (needed in debug configuration) is not provided by the 
installer.

I don't find if this issue was already supported.

Thanks,
Sébastien Gallou

--
components: Build, Library (Lib), Windows
messages: 235397
nosy: sgallou, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [Windows] Unable to link with Python in debug configuration
type: compile error
versions: Python 2.7

___
Python tracker 

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



[issue23393] [Windows] Unable to link with Python in debug configuration

2015-02-04 Thread Steve Dower

Steve Dower added the comment:

It's not supported. You'll need to get the Python 2.7 source code and rebuild 
the binaries under Debug.

Python 3.5 will probably have the option to download and install debug versions 
of the binaries, but Python 2.7 won't be getting this.

--

___
Python tracker 

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



[issue23393] [Windows] Unable to link with Python in debug configuration

2015-02-04 Thread Sébastien Gallou

Sébastien Gallou added the comment:

Thanks Steve for your quick answer.
It's now clear for me.

I will then apply this workaround :

#ifdef PYTHON_USE_SOURCES
   #include 
#else
   #if defined WIN32 && defined _DEBUG
  #undef _DEBUG // Undef _DEBUG to use only release version of Python.lib. 
The debug version of Python.lib is not provided with the Windows installer 
version (https://www.python.org/downloads/windows/)
  #include 
  #define _DEBUG
   #else
  #include 
   #endif
#endif // PYTHON_USE_SOURCES

Sébastien Gallou

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue22963] broken link in PEP 102

2015-02-04 Thread Ezio Melotti

Ezio Melotti added the comment:

Ok, so I'm closing this again.
Berker, can you add a link to this issue too on the pydotorg tracker?

--
status: open -> closed

___
Python tracker 

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



[issue18932] Optimize selectors.EpollSelector.modify()

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

Benchmark on Fedora 21 (Linux 3.18.3, glibc 2.20, Python 3.5 rev 7494f3972726).

Original:

haypo@selma$ ./python -m timeit -s 'import os, selectors; 
s=selectors.SelectSelector(); r,w=os.pipe(); s.register(r, 
selectors.EVENT_READ)' 's.modify(r, selectors.EVENT_WRITE); s.modify(r, 
selectors.EVENT_READ)'
1 loops, best of 3: 43.7 usec per loop
haypo@selma$ ./python -m timeit -s 'import os, selectors; 
s=selectors.PollSelector(); r,w=os.pipe(); s.register(r, selectors.EVENT_READ)' 
's.modify(r, selectors.EVENT_WRITE); s.modify(r, selectors.EVENT_READ)'
1 loops, best of 3: 45.1 usec per loop
haypo@selma$ ./python -m timeit -s 'import os, selectors; 
s=selectors.EpollSelector(); r,w=os.pipe(); s.register(r, 
selectors.EVENT_READ)' 's.modify(r, selectors.EVENT_WRITE); s.modify(r, 
selectors.EVENT_READ)'
1 loops, best of 3: 48.4 usec per loop

Patched:

haypo@selma$ ./python -m timeit -s 'import os, selectors; 
s=selectors.SelectSelector(); r,w=os.pipe(); s.register(r, 
selectors.EVENT_READ)' 's.modify(r, selectors.EVENT_WRITE); s.modify(r, 
selectors.EVENT_READ)'
1 loops, best of 3: 37.2 usec per loop
haypo@selma$ ./python -m timeit -s 'import os, selectors; 
s=selectors.PollSelector(); r,w=os.pipe(); s.register(r, selectors.EVENT_READ)' 
's.modify(r, selectors.EVENT_WRITE); s.modify(r, selectors.EVENT_READ)'
1 loops, best of 3: 40.5 usec per loop
haypo@selma$ ./python -m timeit -s 'import os, selectors; 
s=selectors.EpollSelector(); r,w=os.pipe(); s.register(r, 
selectors.EVENT_READ)' 's.modify(r, selectors.EVENT_WRITE); s.modify(r, 
selectors.EVENT_READ)'
1 loops, best of 3: 39.9 usec per loop

* SelectSelector: 14% faster (-6.5 us)
* PollSelector: 10% faster (-4.6 us)
* EpollSelector: 18% faster (-8.5 us)

--

> _BaseSelectorImpl.modify() still calls unregister() and register().

I chose to factorize code in modify() and only put the specific code in 
_modify(). The advantage is to pass directly oldkey and key to _modify().

We may even try to keep the selector consistent if _modify() fails. For 
example, start with unregister, and only register if _modify() succeed.

--

In a previous (local) patch, the default implementation of _modify() was:

self.unregister(fileobj)
return self.register(fileobj, events, data)

And each specialized _modify() started with:

oldkey = self.unregister(fileobj)
key = self.register(fileobj, events, data)

Do you prefer this?

--

___
Python tracker 

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



[issue23393] [Windows] Unable to link with Python in debug configuration

2015-02-04 Thread Steve Dower

Steve Dower added the comment:

You'll also need to change your project to use the release version of the C 
Runtime library and undefine _DEBUG throughout, otherwise you'll get conflicts 
in things like memory allocators and alignment. It's not quite as simple as 
choosing another lib.

--

___
Python tracker 

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



[issue23393] [Windows] Unable to link with Python in debug configuration

2015-02-04 Thread Sébastien Gallou

Sébastien Gallou added the comment:

So there is no mean to build my application in debug mode without rebuilding 
all Python ?

--

___
Python tracker 

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



[issue22087] _UnixDefaultEventLoopPolicy should either create a new loop or explicilty fail when get_event_loop() is called from a multiprocessing child process

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

This issue looks to be a duplicate of #21998.

handle-mp_unix2.patch looks more to a workaround than a real issue. When I 
write asyncio code, I prefer to pass explicitly the loop, so get_event_loop() 
should never be called. IMO the methods of the event loop should detect the 
fork and handle the fork directly.

--

___
Python tracker 

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



[issue20289] Make cgi.FieldStorage a context manager

2015-02-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--

___
Python tracker 

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



[issue23394] No garbage collection at end of main thread

2015-02-04 Thread François Trahan

New submission from François Trahan:

When reaching the end of a script, there is no garbage collection done if 
another thread is running.

If you have cyclic references between objects that would be elligible for 
collection under one of which a __del__ would terminate that thread, execution 
will hang at the end of the "main thread".

We ended up in this situation; adding "gc.collect" at the end of our script 
solves the problem, but this is a library and it is not reasonnable to assume 
all our clients will properly ensure every execution path properly forces a 
garbage collection.

Suggestion: at the end of a thread, or at least main thread, force a collection.

--
components: Interpreter Core
messages: 235406
nosy: François.Trahan
priority: normal
severity: normal
status: open
title: No garbage collection at end of main thread
versions: Python 3.4

___
Python tracker 

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



[issue23393] [Windows] Unable to link with Python in debug configuration

2015-02-04 Thread Steve Dower

Steve Dower added the comment:

Afraid not. The closest you can get is building in Release with full debug 
symbols and no optimisations, which should al lest get you decent debugging. 
However, you won't get the extra memory check patterns or assertions throughout 
your code.

--

___
Python tracker 

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



[issue23393] [Windows] Unable to link with Python in debug configuration

2015-02-04 Thread Sébastien Gallou

Sébastien Gallou added the comment:

Thanks Steve,

I will try to build it (hope it will not be too difficult...). If I don't 
success, I will use your solution.

--

___
Python tracker 

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



[issue21998] asyncio: a new self-pipe should be created in the child process after fork

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

Attached at_fork.patch: detect fork and handle fork.

* Add _at_fork() method to asyncio.BaseEventLoop
* Add _detect_fork() method to asyncio.BaseEventLoop
* Add _at_fork() method to selectors.BaseSelector

I tried to minimize the number of calls to _detect_fork(): only when the 
self-pipe or the selector is used.

I only tried test2.py. More tests using two processes running two event loops 
should be done, and non-regression tests should be written.

The issue #22087 (multiprocessing) looks like a duplicate of this issue.

--
Added file: http://bugs.python.org/file38016/at_fork.patch

___
Python tracker 

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



[issue21998] asyncio: a new self-pipe should be created in the child process after fork

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

close_self_pipe_after_selector.patch only fixes test2.py, it doesn't fix the 
general case: run the "same" event loop in two different event loops.

--

___
Python tracker 

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



[issue22087] asyncio: support multiprocessing

2015-02-04 Thread STINNER Victor

Changes by STINNER Victor :


--
title: _UnixDefaultEventLoopPolicy should either create a new loop or 
explicilty fail when get_event_loop() is called from a multiprocessing child 
process -> asyncio: support multiprocessing

___
Python tracker 

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



[issue22087] asyncio: support multiprocessing

2015-02-04 Thread STINNER Victor

STINNER Victor added the comment:

See also the https://pypi.python.org/pypi/mpworker project

--

___
Python tracker 

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



[issue23264] Add pickle support of dict views

2015-02-04 Thread Josh Rosenberg

Changes by Josh Rosenberg :


--
nosy: +josh.r

___
Python tracker 

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



[issue23395] _thread.interrupt_main() errors if SIGINT handler in SIG_DFL, SIG_IGN

2015-02-04 Thread Thomas Kluyver

New submission from Thomas Kluyver:

In tracking down an obscure error we were seeing, we boiled it down to this 
test case for thread.interrupt_main():

import signal, threading, _thread, time
signal.signal(signal.SIGINT, signal.SIG_DFL) # or SIG_IGN

def thread_run():
_thread.interrupt_main()

t = threading.Thread(target=thread_run)
t.start()
time.sleep(10)

This fails with an error message "TypeError: 'int' object is not callable", and 
a traceback completely disconnected from the cause of the error, presumably 
because it's not coming from the usual Python stack.

The problem appears to be that interrupt_main sets (in the C code) 
Handlers[SIGINT].tripped, which is only expected to occur when the handler is a 
Python function. When PyErr_CheckSignals() runs, it tries to call 
Handlers[SIGINT].func as a Python function, but it's a Python integer, causing 
the error.

I think the fix for this is to check what Handlers[sig_num].func is, either in 
trip_signal() before setting Handlers[sig_num].tripped, or in 
PyErr_CheckSignals before calling it. I can work on a patch if desired, but I'm 
not brilliant at C.

--
components: Library (Lib)
messages: 235412
nosy: minrk, takluyver
priority: normal
severity: normal
status: open
title: _thread.interrupt_main() errors if SIGINT handler in SIG_DFL, SIG_IGN
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue23394] No garbage collection at end of main thread

2015-02-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Can you post a simple reproducer so that we can more easily see what you are 
talking about? Thank you.

--
nosy: +pitrou

___
Python tracker 

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



[issue23395] _thread.interrupt_main() errors if SIGINT handler in SIG_DFL, SIG_IGN

2015-02-04 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo, neologix

___
Python tracker 

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



[issue23396] Wrong print for 2.7.9

2015-02-04 Thread John Boersma

New submission from John Boersma:

In the tutorial for 2.7.9, in the section on quotes and the escape character, 
there is the following example text: 
>>> '"Isn\'t," she said.'
'"Isn\'t," she said.'
>>> print '"Isn\'t," she said.'
"Isn't," she said.
>>> s = 'First line.\nSecond line.'  # \n means newline
>>> s  # without print(), \n is included in the output
'First line.\nSecond line.'
>>> print s  # with print, \n produces a new line
First line.
Second line.

Note the print() in a comment. Isn't that Python 3 syntax? Should just be print 
for 2.7, I believe.

--
assignee: docs@python
components: Documentation
messages: 235414
nosy: docs@python, johnboersma
priority: normal
severity: normal
status: open
title: Wrong print for 2.7.9
type: enhancement
versions: Python 2.7

___
Python tracker 

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



[issue23396] Wrong print for 2.7.9

2015-02-04 Thread John Boersma

John Boersma added the comment:

To clarify - this is in tutorial section 3.1.2.

--

___
Python tracker 

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



[issue23351] socket.settimeout(5.0) does not have any effect

2015-02-04 Thread Piotr Jurkiewicz

Piotr Jurkiewicz added the comment:

Does not work on Debian 7 Wheezy, kernel 3.2.65.

$ python test.py
('sending ', 0)
took 0.000s
('sending ', 1)
took 0.000s
('sending ', 2)
took 0.000s
('sending ', 3)
took 0.000s
('sending ', 4)
took 0.000s
('sending ', 5)
took 0.000s
('sending ', 6)
took 0.000s
('sending ', 7)
took 0.000s
('sending ', 8)
took 0.000s
('sending ', 9)
took 0.000s
('sending ', 10)
took 0.000s
('sending ', 11)
took 0.000s
Traceback (most recent call last):
  File "test.py", line 17, in 
s.sendto("hello", SOCKNAME)
socket.error: [Errno 11] Resource temporarily unavailable

$ uname -a
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u1 x86_64 GNU/Linux

--
status: pending -> open

___
Python tracker 

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



[issue23396] Wrong print for 2.7.9

2015-02-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2bb5fa752bfc by Benjamin Peterson in branch '2.7':
remove parenthesis from print statement (closes #23396)
https://hg.python.org/cpython/rev/2bb5fa752bfc

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue20289] Make cgi.FieldStorage a context manager

2015-02-04 Thread Berker Peksag

Berker Peksag added the comment:

Here's an updated patch. Thank you Serhiy.

--
Added file: http://bugs.python.org/file38017/issue20289_v2.diff

___
Python tracker 

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



[issue23345] test_ssl fails on OS X 10.10.2 with latest patch level of OpenSSL libs

2015-02-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 49f07942fbd7 by Ned Deily in branch '2.7':
Issue #23345: Prevent test_ssl failures with large OpenSSL patch level
https://hg.python.org/cpython/rev/49f07942fbd7

New changeset 52932cd7f003 by Ned Deily in branch '3.4':
Issue #23345: Prevent test_ssl failures with large OpenSSL patch level
https://hg.python.org/cpython/rev/52932cd7f003

New changeset 62b322b82f00 by Ned Deily in branch 'default':
Issue #23345: merge from 3.4
https://hg.python.org/cpython/rev/62b322b82f00

--
nosy: +python-dev

___
Python tracker 

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



[issue23345] test_ssl fails on OS X 10.10.2 with latest patch level of OpenSSL libs

2015-02-04 Thread Ned Deily

Ned Deily added the comment:

Fixed for 2.7.10, 3.4.3, and 3.5.0.

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

___
Python tracker 

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



[issue14910] argparse: disable abbreviation

2015-02-04 Thread Berker Peksag

Berker Peksag added the comment:

The patch LGTM.

In Doc/library/argparse.rst:

-  add_help=True)
+  allow_abbrev=True, add_help=True)

should be

add_help=True, allow_abbrev=True)

I'll add a release note and commit it. Thanks!

--
assignee:  -> berker.peksag
nosy: +berker.peksag

___
Python tracker 

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



[issue23351] socket.settimeout(5.0) does not have any effect

2015-02-04 Thread Charles-François Natali

Charles-François Natali added the comment:

It's a kernel bug closing (working fine on my Debian wheezy with a more recent 
kernel BTW).

--
resolution:  -> third party
status: open -> closed

___
Python tracker 

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