[issue25833] pyvenv: venvs cannot be moved because activate scripts hard-code paths

2016-02-12 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue25829] Mixing multiprocessing pool and subprocess may create zombie process, and cause program to hang.

2016-02-12 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +davin

___
Python tracker 

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



[issue26182] Deprecation warnings for the future async and await keywords in Python 3.6

2016-02-12 Thread Brett Cannon

Brett Cannon added the comment:

Because parsing is done before execution you can't flip on warnings during 
runtime in the file you to be affected.

As for the line number, that's because it's raise in C code that doesn't have a 
trigger in Python code. Try importing the code and you should get the line 
number of the import. Otherwise you will have to check if there is some 
function to specify a syntax warning that lets you set the line number 
explicitly (I don't think there is).

--

___
Python tracker 

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



[issue25796] Running test_multiprocessing_spawn is slow (more than 8 minutes)

2016-02-12 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +davin, sbt

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-02-12 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



[issue25726] sys.setprofile / sys.getprofile asymetry

2016-02-12 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +georg.brandl

___
Python tracker 

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



[issue25713] Setuptools included with 64-bit Windows installer is outdated

2016-02-12 Thread Ned Deily

Ned Deily added the comment:

Thanks for the report but, since 3.5.1 has subsequently been released, I don't 
think there is any reason to keep this open.  The distributions vendored with 
ensurepip - like pip, setuptools, and their dependencies - will typically 
become out-of-date after any Python release, since they are all on independent 
release cycles.  The main function of ensurepip is to ensure that you have a 
known working environment to install distributions from PyPI and elsewhere, 
including updates to pip and setuptools themselves.  FWIW, the bundled versions 
of pip and setuptools have already been updated in the 3.5 branch for the next 
maintenance release of 3.5.

--
nosy: +ned.deily
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
type: performance -> 

___
Python tracker 

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



[issue25179] PEP 498 f-strings need to be documented

2016-02-12 Thread Martin Panter

Martin Panter added the comment:

Hopefully that did it. Let me know if I missed anything.

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



[issue25709] Problem with string concatenation and utf-8 cache.

2016-02-12 Thread Ned Deily

Changes by Ned Deily :


--
stage: patch review -> resolved

___
Python tracker 

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



[issue26145] PEP 511: Add sys.set_code_transformers()

2016-02-12 Thread STINNER Victor

STINNER Victor added the comment:

TODO: implement a fast-path for PyCode_Optimize() avoiding completly the 
"expensive" code transformer API, before the first call to 
sys.set_code_transformer().

It would avoid list <=> tuple conversions for code constants, and the need of 
creating two code objects.

In practice, this fast-path should be taken in most cases.

--

___
Python tracker 

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



[issue25179] PEP 498 f-strings need to be documented

2016-02-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f4d7de7d18c0 by Martin Panter in branch 'default':
Issue #25179: Documentation for formatted string literals aka f-strings
https://hg.python.org/cpython/rev/f4d7de7d18c0

--

___
Python tracker 

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



[issue26354] re.I does not work as expected

2016-02-12 Thread Ezio Melotti

Ezio Melotti added the comment:

See #11957

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
superseder:  -> re.sub confusion between count and flags args

___
Python tracker 

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



[issue26354] re.I does not work as expected

2016-02-12 Thread Matthew Barnett

Matthew Barnett added the comment:

The 4th argument of re.sub is the count, not the flags.

Not a bug.

--

___
Python tracker 

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



[issue26155] 3.5.1 installer issue on Win 7 32 bit

2016-02-12 Thread TarotRedhand

TarotRedhand added the comment:

The precise location it was installed to was C:\Users\Nigel\Python35-32. It was 
supposed to install to my F:\ (labelled DATA) drive. After all this time I 
don't remember the actual folder it was supposed to use. Incidentally, I have 3 
physical HDs. F:\ is a 2tb drive whereas C & D are both 500gb.

--

___
Python tracker 

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



[issue26145] PEP 511: Add sys.set_code_transformers()

2016-02-12 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 6: updated to the new code_transformer() API, it now takes a code 
object as input and must return a new code object.

Sadly, it looks like there are reference leaks (try: ./python -m test -R 3:3 
test_import).

--
Added file: http://bugs.python.org/file41912/transformers-6.patch

___
Python tracker 

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



[issue26354] re.I does not work as expected

2016-02-12 Thread Magesh Kumar

New submission from Magesh Kumar:

I am in the process of re.sub the tag   with empty 
string from a xml output line.

If "re.I" is used, I am not able to remove the complete tag. 


>>> a
'ype="str">falseDefaultMulticastClient>> b = re.sub('\<\/?item(\s+type="dict")?\>', '', a, re.I)
>>> b
'ype="str">falseDefaultMulticastClient>> b = re.sub('\<\/?item(\s+type="dict")?\>', '', a)
>>> b
'ype="str">falseDefaultMulticastClient

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



[issue26317] Build Problem with GCC + Macintosh OS X 10.11 El Capitain

2016-02-12 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy:  -terry.reedy

___
Python tracker 

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



[issue26317] Build Problem with GCC + Macintosh OS X 10.11 El Capitain

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

When you reply by email to an email, please snip off the quote, except for 
possible a line that you are responding to.  The disposition of this issue for 
3.5+ is up to Ned or Ronald.

--

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-12 Thread Nicholas Chammas

Nicholas Chammas added the comment:

Yep, you're right. I'm just understanding now that we have lots of methods 
defined in C which have signatures like this.

Is there an umbrella issue, perhaps, that covers adding support for 
keyword-based arguments to functions defined in C, like `translate()`?

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

___
Python tracker 

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



[issue26349] Ship python35.lib with the embedded distribution, please

2016-02-12 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +steve.dower
versions: +Python 3.6

___
Python tracker 

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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-02-12 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +vinay.sajip
stage:  -> patch review
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue26340] modal dialog with transient method; parent window fails to iconify

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I changed 'Tkinter' to 'tkinter' and added 'root' to the Toplevel call and got 
the same behavior running from IDLE on Win10.  I am not sure this is a python 
bug, as opposed to a change in behavior.  Modal dialogs tend to disable 
everything else and tk and or Windows might have changed from 2.7.3.

--
nosy: +serhiy.storchaka, terry.reedy
versions: +Python 3.6

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2016-02-12 Thread Martin Panter

Martin Panter added the comment:

Thanks for the review Ned. I haven’t looked too closely but your comments sound 
reasonable in general. I don’t have a personal need to update this patch 
(Editline doesn’t work well for me on Linux), but I can try to update it if 
there is demand for this.

Regarding the leftover #ifdef __APPLE__ bits, I would have to double-check, but 
I presume I didn’t need to enable those for my version of Editline, so I 
presumed they were Apple-specific bugs.

--

___
Python tracker 

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



[issue26335] Make mmap.write return the number of bytes written like other write methods

2016-02-12 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +twouters

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is a known, generic issue with c-coded functions.  Some C functions have 
been converted, especially those with boolean parameters, and especially those 
with multiple boolean parameters.

I think, but an not sure, that / is sometimes used to signal that the preceding 
are position only, and that this may have something to do with ArgumentClinic.  
I also would like a consistent indication.  But this may be a duplicate issue.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue26333] Multiprocessing imap hangs when generator input errors

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

If you add the "if __name__ == '__main__':" guard after defining the target 
function, as specified in the multiprocessing doc, you will get a traceback 
much as you expect:

Traceback (most recent call last):
  File "F:\Python\mypy\tem.py", line 12, in 
for new_val in pool.imap(add_one, value_iter):
  File "C:\Programs\Python35\lib\multiprocessing\pool.py", line 695, in next
raise value
  File "C:\Programs\Python35\lib\multiprocessing\pool.py", line 380, in 
_handle_tasks
for i, task in enumerate(taskseq):
  File "C:\Programs\Python35\lib\multiprocessing\pool.py", line 286, in 

self._taskqueue.putresult._job, i, func, (x,), {})
  File "F:\Python\mypy\tem.py", line 10, in 
value_iter = (int(v) for v in values)
ValueError: invalid literal for int() with base 10: 'foo'

I have seem this bug of omission multiple times on Stackoverflow.

--
nosy: +terry.reedy
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions: +Python 3.6

___
Python tracker 

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



[issue23430] socketserver.BaseServer.handle_error() should not catch exiting exceptions

2016-02-12 Thread Martin Panter

Martin Panter added the comment:

Here is an updated version for 3.6. I also wrote an entry for What’s New. It 
seems my change could help people trying to make a single-threaded server quit 
the server loop (Issue 13749).

--
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file41911/socketserver-exit.v5.patch

___
Python tracker 

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



[issue23992] multiprocessing: MapResult shouldn't fail fast upon exception

2016-02-12 Thread Charles-François Natali

Changes by Charles-François Natali :


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



[issue24303] OSError 17 due to _multiprocessing/semaphore.c assuming a one-to-one Pid -> process mapping.

2016-02-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d3662c088db8 by Charles-François Natali in branch '2.7':
Issue #24303: Fix random EEXIST upon multiprocessing semaphores creation with
https://hg.python.org/cpython/rev/d3662c088db8

--
nosy: +python-dev

___
Python tracker 

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



[issue21140] Idle: saving Shell or an OutputWindow should default to .txt

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In #11830 I suggested that Shell should be added to this issue. #26327 does the 
same, as the prompt and output are not code.

At least in 3.x, these mixed code and text files should be encoded utf-8 (which 
is the same as ascii for all ascii files), as code files are (at least by 
default).  The encoding search and determination in IDBinding.py is a bit 
baroque.  The local encoding should not ever be used for 3.x code.

If we do something with #11838 (save runnable code from Shell), the default 
should then revert to .py.  I don't want a patch here to make this excessively 
difficult.

--
title: Idle: saving an OutputWindow should default to .txt -> Idle: saving 
Shell or an OutputWindow should default to .txt

___
Python tracker 

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



[issue26327] IDLE: File > Save in 2.7 Shell with non-ascii fails

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

You raised three issues.

1. If you run IDLE from a console (Command Prompt or Powershell) you will see 
the no-save cause.

C:\Users\Terry>py -m idlelib.idle
Exception in Tkinter callback
...
  File "C:\Programs\Python27\lib\idlelib\IOBinding.py", line 433, in encode
config_encoding = idleConf.GetOption("main","EditorWindow",
NameError: global name 'idleConf' is not defined

This a bug I introduced into 2.7.11 and have already fixed in the repository 
(hence 'out of date').  The line above is only executed when there are 
non-ascii chars, which is why saving worked before you added the non-ascii char.

To get the fix now, in your copy of IOBinding.py, move the line

from idlelib.configHandler import idleConf

in "def _io_binding" near the bottom of the file to the end of the imports near 
the top.  Remove the indent before saving.


2. #21140 is about making the default for mixed code and text files .txt 
instead of .py.


3. The insertion of /n into the Shell text widget when saving it seems like a 
bug.  I opened #26353 for this.

--
nosy: +terry.reedy
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
title: File > Save in IDLE shell window not working -> IDLE: File > Save in 2.7 
Shell with non-ascii fails

___
Python tracker 

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



[issue26353] IDLE: Saving Shell should not add \n

2016-02-12 Thread Terry J. Reedy

New submission from Terry J. Reedy:

When one saves the IDLE Shell window, at least when the cursor is at the 
prompt, \n is added, so that

>>> |

changes to

>>>
|

This seems wrong.  It does not happen in editor windows.  I should check Output 
Windows.

--
messages: 260205
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE: Saving Shell should not add \n
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue26350] Windows: signal doc should state certains signals can't be registered

2016-02-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
title: Windoes: signal doc should state certains signals can't be registered -> 
Windows: signal doc should state certains signals can't be registered

___
Python tracker 

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



[issue26352] getpass incorrectly displays password prompt on stderr on fallback

2016-02-12 Thread Matt Hooks

Matt Hooks added the comment:

Patch attached.

I'm unsure whether forcing the warning message to stderr is the right choice 
here, but it seems unlikely that users would want their warning and password 
prompt on the same stream.  The alternative here would be a second kwarg, but 
that seems overkill.

--
keywords: +patch
Added file: http://bugs.python.org/file41910/26352_avoid_prompt_on_stderr.patch

___
Python tracker 

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



[issue26352] getpass incorrectly displays password prompt on stderr on fallback

2016-02-12 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue25887] awaiting on coroutine more than once should be an error

2016-02-12 Thread Yury Selivanov

Yury Selivanov added the comment:

> I haven't looked at the patch, but the intent to make the 2nd 
> await raise a RuntimeError seems strange for several reasons:
> - it's inconsistent with the Future/Task interface;

Well, coroutines are much more lower level than Future/Tasks.


> - it's quite common to await a 2nd time to get the coroutine 
> result after calling asyncio.wait(...) using ALL_COMPLETED or 
> FIRST_EXCEPTION;

I believe you're not using the asyncio.task() function correctly.  
>From the docs:

"""Wait for the Futures and coroutine objects given by the sequence 
futures to complete. Coroutines will be wrapped in Tasks. Returns 
two sets of Future: (done, pending)."""


> - as mentioned in the mailing list the await keyword in 
> C#/Hack/JS which inspired the await keyword (as per PEP492) 
> returns the result/exception multiple times.

Yes, this was discussed at length on the mailing list.  There are
many reasons as to why we don't want coroutines to be awaitable
many times.  One of them is that we don't want low-level coroutine
objects to hold references to return values.  Coroutines in Python
are exhaustible resources (like generators).

--

___
Python tracker 

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



[issue26352] getpass incorrectly displays password prompt on stderr on fallback

2016-02-12 Thread Matt Hooks

New submission from Matt Hooks:

When calling getpass.getpass(), certain circumstances cause it to fallback to 
getpass.fallback_getpass, such as when swapping out sys.stdin for another 
object in a unit test.

In such a circumstance, fallback_getpass may be called with stream=None when 
getpass itself was called without a stream.  fallback_getpass needs a stream to 
write the "Warning: Password input may be echoed" warning to, and reasonably 
chooses stderr.  However, this choice persists down into getpass._raw_input, 
where the user is then shown the password prompt on stderr as well.  Instead of 
on stderr, the user should get the password prompt on stdout.

tl;dr: Some calls to getpass.getpass result in a password prompt on stderr.

Bad behavior: password prompt displayed over stderr.
Expected behavior: password prompt should be on stdout.

Found in 3.4, looks like it's the same in 3.5.

I will attach a patch in a few moments, after I get my dev environment sorted 
out.

--
components: Library (Lib)
messages: 260202
nosy: Matt Hooks
priority: normal
severity: normal
status: open
title: getpass incorrectly displays password prompt on stderr on fallback
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



[issue26350] Windoes: signal doc should state certains signals can't be registered

2016-02-12 Thread Eryk Sun

Eryk Sun added the comment:

All of the implemented signals can be registered, and the associated handler 
can at least be executed by calling the C raise() function. However, for 
pure-Python code only SIGINT and SIGBREAK are really useful.

FYI, Windows doesn't implement POSIX signals at the system level. The closest 
analog is an asynchronous procedure call (APC). You can queue a user-mode APC 
to a thread via QueueUserAPC. It executes when the thread enters an alertable 
wait (e.g. WaitForSingleObjectEx or SleepEx with bAlertable as TRUE). 
Kernel-mode APCs get dispatched immediately (when the IRQL is below APC_LEVEL). 
They're typically used by the I/O manager to complete asynchronous I/O Request 
Packets (e.g. copying data to a user-mode buffer). 

In principle, NT could implement POSIX-like signals using APCs, but in practice 
Windows uses other means for the same ends, such as exceptions and structured 
exception handling (e.g. __try, __except, __finally, __leave, RaiseException, 
AddVectoredExceptionHandler), dispatch objects (e.g. SetEvent and 
SetWaitableTimer, which queues an APC), and window messages (e.g. WM_QUIT, 
WM_TIMER). 

On Windows, the C runtime implements the six signals that are required by 
standard C: SIGINT, SIGABRT, SIGTERM, SIGSEGV, SIGILL, and SIGFPE. 

SIGABRT and SIGTERM are implemented just for the current process. You can call 
the handler via C raise(). 

>>> import signal, ctypes
>>> ucrtbase = ctypes.CDLL('ucrtbase')
>>> c_raise = ucrtbase['raise']
>>> foo = lambda *a: print('foo')
>>> signal.signal(signal.SIGTERM, foo)

>>> c_raise(signal.SIGTERM)
foo
0

SIGTERM is useless. 

You also can't do much with SIGABRT using the signal module because the abort() 
function kills the process once the handler returns, which happens immediately 
when using the signal module's internal handler (it trips a flag for the Python 
callable to be called later). Instead use the faulthandler module. Or call the 
CRT's signal() function via ctypes to set a ctypes callback as the handler.

The CRT implements SIGSEGV, SIGILL, and SIGFPE by setting a Windows structured 
exception handler (SEH) for the corresponding Windows exceptions:

STATUS_ACCESS_VIOLATION  SIGSEGV
STATUS_ILLEGAL_INSTRUCTION   SIGILL
STATUS_PRIVILEGED_INSTRUCTIONSIGILL
STATUS_FLOAT_DENORMAL_OPERANDSIGFPE
STATUS_FLOAT_DIVIDE_BY_ZERO  SIGFPE
STATUS_FLOAT_INEXACT_RESULT  SIGFPE
STATUS_FLOAT_INVALID_OPERATION   SIGFPE
STATUS_FLOAT_OVERFLOWSIGFPE
STATUS_FLOAT_STACK_CHECK SIGFPE
STATUS_FLOAT_UNDERFLOW   SIGFPE
STATUS_FLOAT_MULTIPLE_FAULTS SIGFPE
STATUS_FLOAT_MULTIPLE_TRAPS  SIGFPE

Use the faulthandler module for these exception-based signals. The way they're 
implemented is incompatible with Python's signal handler. The exception filter 
calls the registered handler and then returns EXCEPTION_CONTINUE_EXECUTION. 
Python's handler only trips a flag for the interpreter to call the registered 
Python callable at a later time. So the code that triggered the exception will 
trigger again, and so on in an endless loop. 

That leaves SIGINT, to which Windows adds the non-standard SIGBREAK. Both 
console and non-console processes can raise() one of these signals, but only a 
console process can receive them from another process. 

The CRT sets a console control event handler via SetConsoleCtrlHandler. When 
the console sends the process a CTRL_C_EVENT or CTRL_BREAK_EVENT, the CRT's 
handler calls the associated SIGINT or SIGBREAK handler. 

Note that this is implemented by creating a new thread in the process that 
begins executing at kernel32!CtrlRoutine. Unlike SIGINT on POSIX, the handler 
does not execute on the main thread (hijacking a thread is taboo in Windows). 
This can lead to synchronization problems that Python 3 attempts to work around 
by using a Windows event object.

You can send a control event to all processes attached to the current console 
via GenerateConsoleCtrlEvent. You can target a subset of processes that belong 
to a process group, or send the event to all processes by targeting process 
group 0. 

What the console does when the target ID isn't a process group ID is undefined. 
It basically acts like the target is group 0, but that shouldn't be relied on. 
(It's most likely a bug.) It can also mess up the console's list of attached 
processes (i.e. GetConsoleProcessList) by adding non-console processes. 

The docs for os.kill clearly state that you can only send signal.CTRL_C_EVENT 
and signal.CTRL_BREAK_EVENT on Windows. Any other value is passed to 
TerminateProcess as the exit code, which kills the process without notice (like 
POSIX SIGKILL). 

It also states that "[t]he Windows version of kill() additionally takes process 
handles to be killed", which I don't think was ever true. That line needs to be 
removed.

It also fails to clarify that the target has to

[issue25887] awaiting on coroutine more than once should be an error

2016-02-12 Thread André Caron

André Caron added the comment:

Hi there!

I've just stumbled upon this behavior and I was also surprised by the fact that 
the second await simply returns None.

After fiddling around for a while, I noticed that if I wrap the coroutine 
object using asyncio.ensure_future() or asyncio.get_event_loop().create_task(), 
the same result/exception is returned by multiple await expressions.

I haven't looked at the patch, but the intent to make the 2nd await raise a 
RuntimeError seems strange for several reasons:
- it's inconsistent with the Future/Task interface;
- it's quite common to await a 2nd time to get the coroutine result after 
calling asyncio.wait(...) using ALL_COMPLETED or FIRST_EXCEPTION;
- as mentioned in the mailing list the await keyword in C#/Hack/JS which 
inspired the await keyword (as per PEP492) returns the result/exception 
multiple times.

I put up a Gist that shows the inconsistency: 
https://gist.github.com/AndreLouisCaron/db2965aae095f5c85dd5

Here's an example of asyncio.wait() I was referencing:

async def main()
f1 = foo()
f2 = bar()
asyncio.wait([f1, f2], return_when=asyncio.FIRST_EXCEPTION)
print('1:', await f1)
print('2:', await f2)

I also noticed that there seems to be some intent to avoid making a distinction 
between a normal function returning a future and a coroutine function from the 
point of view of the caller.

If the patch is merged as is, I will always need to use asyncio.ensure_future() 
on all coroutine calls before asyncio.wait() because the result is inconsistent 
depending on the implementation of foo() and bar(): if they return futures, I'm 
OK, but if any of them is a proper coroutine function, I might get RuntimeError 
exceptions.

Any chance you can consider changing the patch to make awaiting a coroutine's 
result multiple times a valid pattern?

--
nosy: +André Caron

___
Python tracker 

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



[issue26326] Named entity "vertical line" missed in 2.7 htmlentitydefs.py

2016-02-12 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +ezio.melotti
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue26319] Check recData size before unpack in zipfile

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The bug was not noticing the length mismatch caused by a corrupt zip file.  It 
is already fixed.  The last link in your message opens 
https://hg.python.org/cpython/file/2.7/Lib/zipfile.py#l238.  A few lines 
further, the code now has an added guard.

recData = data[start:start+sizeEndCentDir]
if len(recData) != sizeEndCentDir:
# Zip file is corrupted.
return None
endrec = list(struct.unpack(structEndArchive, recData))

When reporting a bug, please test on the currect release (ie, 2.7.11).  If this 
is not possible, and you have the specific traceback as here, one could look at 
the current code online.  Go to hg.python.org/cpython, select version in the 
sidebar, select 'Browse' in the sidebar, and then, in this case, /Lib and 
zipfile.py.

--
nosy: +terry.reedy
resolution:  -> out of date
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



[issue26318] `io.open(fd, ...).name` returns numeric fd instead of None

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

3.4 only gets security fixes.  3.5 only gets bug fixes.  Feature changes 
('enhancements') are limited to future versions.

This is not a behavior issue because the code and doc match.  
https://docs.python.org/3/library/io.html#io.FileIO.name says (as Martin 
paraphrased) 

"name
The file name. This is the file descriptor of the file when no name is 
given in the constructor."

As I remember, this was discussed when io was designed.  The alternatives to 
name = fd: no name attribute, name = '', name = None.  All are about equally 
easy to test, as long as the decision is documented, which is clearly is, 
contrary to the claim otherwise.  I believe the deciding factor is that fd has 
more information than nothing, even if redundant or useless.

In the absence of sufficient reason to break existing code that follows the 
doc, which we are generally loathe to do, the design change should be rejected.

--
nosy: +terry.reedy
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
type: behavior -> enhancement
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue26342] Faster bit ops for single-digit positive longs

2016-02-12 Thread Yury Selivanov

Yury Selivanov added the comment:

> with patch: 0.404usec  without patch: 0.41

Sorry, I made a typo: these results should be flipped -- 0.41-0.404 is the 
overhead of the fastpath's 'if' check.  I'd say it's a pretty small overhead -- 
we already optimize all other long ops, including bit inversion.

--

___
Python tracker 

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



[issue26342] Faster bit ops for single-digit positive longs

2016-02-12 Thread Yury Selivanov

Yury Selivanov added the comment:

> Does this patch have effect with results over 8 bits? 

-m timeit -s "x=2**40" "x&2;x&2;x&2;x&333;x&3;x&3;x&;x&4"
with patch: 0.404usec  without patch: 0.41


> Does it have effect after applying patches from 24165?

I'm not sure how it's related, but let's modify the test to stress the mem 
allocation:

-m timeit -s "x=21827623" 
"(x+x)&2;(x+x)&2;(x+x)&2;(x+x)&333;(x+x)&3;x&3;(x+x)&;(x+x)&4"

this patch+freelist: 0.337usec   only freelist: 0.496

In any case, bit operations are often used for bit-flags logic, where numbers 
are usually aren't too big (it's rare to see more than 30 bit flags on one 
field).

--

___
Python tracker 

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



[issue26317] Build Problem with GCC + Macintosh OS X 10.11 El Capitain

2016-02-12 Thread Robert P Fischer

Robert P Fischer added the comment:

Could this be fixed on 3.5 and 3.6?

On Fri, Feb 12, 2016 at 2:34 PM, Terry J. Reedy 
wrote:

>
> Terry J. Reedy added the comment:
>
> 3.4 only gets security fixes
>
> --
> nosy: +terry.reedy
> stage:  -> needs patch
> type:  -> compile error
> versions: +Python 3.5, Python 3.6 -Python 3.4
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue24961] shell stdout broken after exiting interactive python prompt

2016-02-12 Thread Julian Mehnle

Changes by Julian Mehnle :


--
nosy: +jmehnle

___
Python tracker 

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



[issue26317] Build Problem with GCC + Macintosh OS X 10.11 El Capitain

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

3.4 only gets security fixes

--
nosy: +terry.reedy
stage:  -> needs patch
type:  -> compile error
versions: +Python 3.5, Python 3.6 -Python 3.4

___
Python tracker 

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



[issue26316] Probable typo in Arg Clinic's linear_format()

2016-02-12 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
title: Probable typo in Arg Clinic’s linear_format() -> Probable typo in Arg 
Clinic's linear_format()

___
Python tracker 

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



[issue26306] Can't create abstract tuple

2016-02-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

3.2 to 3.4 only get security fixes

--
components: +Library (Lib)
nosy: +terry.reedy
stage:  -> test needed
versions: +Python 3.6 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue26306] Can't create abstract tuple

2016-02-12 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy:  -terry.reedy

___
Python tracker 

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



[issue26209] TypeError in smtpd module with string arguments

2016-02-12 Thread Anish Shah

Changes by Anish Shah :


--
nosy: +anish.shah

___
Python tracker 

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



[issue26342] Faster bit ops for single-digit positive longs

2016-02-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Does this patch have effect with results over 8 bits? Does it have effect after 
applying patches from 24165?

--

___
Python tracker 

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



[issue26282] Add support for partial keyword arguments in extension functions

2016-02-12 Thread Anish Shah

Changes by Anish Shah :


--
nosy:  -anish.shah

___
Python tracker 

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



[issue26342] Faster bit ops for single-digit positive longs

2016-02-12 Thread Yury Selivanov

Yury Selivanov added the comment:

> You should add a tests. especially for edge cases, for negative values for 
> example.

There are many binop tests in test_long.py

--

___
Python tracker 

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



[issue26351] Occasionally check for Ctrl-C in long-running operations like sum

2016-02-12 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue26342] Faster bit ops for single-digit positive longs

2016-02-12 Thread Марк Коренберг

Марк Коренберг added the comment:

You should add a tests. especially for edge cases, for negative values for 
example.

--
nosy: +mmarkk

___
Python tracker 

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



[issue26351] Occasionally check for Ctrl-C in long-running operations like sum

2016-02-12 Thread Steven D'Aprano

New submission from Steven D'Aprano:

There are a few operations such as summing or unpacking infinite iterators 
where the interpreter can become unresponsive and ignore Ctrl-C 
KeyboardInterrupt. Guido suggests that such places should occasionally check 
for signals:

https://mail.python.org/pipermail/python-ideas/2016-February/038426.html

--
components: Interpreter Core
messages: 260189
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: Occasionally check for Ctrl-C in long-running operations like sum
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue26318] `io.open(fd, ...).name` returns numeric fd instead of None

2016-02-12 Thread Марк Коренберг

Марк Коренберг added the comment:

The main idea: if wile does not have a name, it should not have it!

--

___
Python tracker 

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



[issue26318] `io.open(fd, ...).name` returns numeric fd instead of None

2016-02-12 Thread Марк Коренберг

Марк Коренберг added the comment:

oops, issue22208 is not related issue

--

___
Python tracker 

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



[issue26318] `io.open(fd, ...).name` returns numeric fd instead of None

2016-02-12 Thread Марк Коренберг

Марк Коренберг added the comment:

1. nasty bugs not in my code!
2. It is not documented that name may be an int, so if applications rely on 
undocumented stuff are definitely broken, so if IMHO we CAN change that.
3. It will be much stricter to delattr('name') instead of setting as None. This 
will automatically cure issue21996 and issue22208.

--

___
Python tracker 

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



[issue26182] Deprecation warnings for the future async and await keywords in Python 3.6

2016-02-12 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue25931] os.fork() command distributed in windows Python27 (in SocketServer module)

2016-02-12 Thread Davin Potts

Changes by Davin Potts :


--
nosy: +davin

___
Python tracker 

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



[issue26333] Multiprocessing imap hangs when generator input errors

2016-02-12 Thread Davin Potts

Changes by Davin Potts :


--
nosy: +davin

___
Python tracker 

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



[issue8690] multiprocessing.dummy.Queue does not expose same interface as multiprocessing.Queue

2016-02-12 Thread Davin Potts

Changes by Davin Potts :


--
nosy: +davin

___
Python tracker 

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



[issue24303] OSError 17 due to _multiprocessing/semaphore.c assuming a one-to-one Pid -> process mapping.

2016-02-12 Thread Davin Potts

Davin Potts added the comment:

@neologix: I second your proposed patch -- looks like a winner to me.  
Apologies for not following up earlier.

--

___
Python tracker 

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



[issue21130] equivalent functools.partial instances should compare equal

2016-02-12 Thread shakur shams Mullick

shakur shams Mullick added the comment:

I have submitted a patch for the issue. Please review and give feedback.

--
nosy: +shakur shams Mullick

___
Python tracker 

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



[issue21130] equivalent functools.partial instances should compare equal

2016-02-12 Thread shakur shams Mullick

Changes by shakur shams Mullick :


--
keywords: +patch
Added file: http://bugs.python.org/file41909/issue21130.patch

___
Python tracker 

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



[issue23948] Deprecate os.kill() on Windows

2016-02-12 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

See also #26350.

--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue26344] `sys.meta_path` Skipped for Packages with Non-Standard Suffixed `__init__` Files

2016-02-12 Thread Wolfgang Richter

Wolfgang Richter added the comment:

Ah, sorry Brett!

Thanks for spotting this.

The import machinery is *really* awesome.

--

___
Python tracker 

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



[issue26347] BoundArguments.apply_defaults doesn't handle empty arguments

2016-02-12 Thread Yury Selivanov

Yury Selivanov added the comment:

Hi Frederick, the patch looks good.  Thanks for reporting this!  Could you 
please sign the contributor agreement so that I can commit your patch?

--
assignee:  -> yselivanov
nosy: +yselivanov

___
Python tracker 

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



[issue26350] Windoes: signal doc should state certains signals can't be registered

2016-02-12 Thread STINNER Victor

STINNER Victor added the comment:

See also issue #23948.

--

___
Python tracker 

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



[issue26350] Windoes: signal doc should state certains signals can't be registered

2016-02-12 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue26350] Windoes: signal doc should state certains signals can't be registered

2016-02-12 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

I'm not sure whether this is a bug with signal.signal doc or with the function 
itself, anyway, here goes. On UNIX I'm able to register a signal handler for 
SIGTERM which is executed when the signal is received. On Windows I'm able to 
register it but it will never be executed:


import os, signal

def foo(*args):
print("foo")  # this never gets printed on Windows

signal.signal(signal.SIGTERM, foo)
os.kill(os.getpid(), signal.SIGTERM)


I think signal module doc should be more clear about this. In details, if it is 
possible to execute a function on SIGTERM if should explain how. If not (and 
AFAIK it's not possible) it should state that "signal.signal(signal.SIGTERM, 
foo)" on Windows is a NOOP.

Note: I'm probably missing something but the same thing applies for SIGINT and 
possibly (all) other signals, so I'm not sure why Windows has signal.signal in 
the first place. What's its use case on Windows?

--
messages: 260179
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: Windoes: signal doc should state certains signals can't be registered

___
Python tracker 

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



[issue24165] Free list for single-digits ints

2016-02-12 Thread Yury Selivanov

Yury Selivanov added the comment:

> Did that comment come from a benchmark suite run? (i.e. actual applications 
> and not micro benchmarks?) And, does it show a difference between the single- 
> and multi-digit cases?

Yes, more details here: http://bugs.python.org/issue26341#msg260124

--

___
Python tracker 

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



[issue26182] Deprecation warnings for the future async and await keywords in Python 3.6

2016-02-12 Thread Marco Buttu

Marco Buttu added the comment:

Thank you Brett, the problem was the missed exec(). With the patch in 
attachment the tests pass, but it does not seem to me a good solution. Infact, 
changing the filter at runtime has no effect: 

$ cat foo.py 
import warnings

warnings.simplefilter("always")
async = 33
await = 33

$ ./python foo.py 
$

Does this happen because, putting the PyErr_WarnEx() in Python/ast.c, the 
warning is issued before the runtime?

Furthermore, if I set the filter from the CL, then the warning is properly 
triggered, but the file name and line number are wrong: 

$ ./python -Wd foo.py 
sys:1: DeprecationWarning: 'async' will become a reserved keyword in Python 3.7
sys:1: DeprecationWarning: 'await' will become a reserved keyword in Python 3.7

--
keywords: +patch
Added file: http://bugs.python.org/file41908/async_await.patch

___
Python tracker 

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



[issue26349] Ship python35.lib with the embedded distribution, please

2016-02-12 Thread Thomas Führinger

New submission from Thomas Führinger:

I would like to use the new embedded distribution and load-time link to 
python35.dll. It would make things a lot easier if you could also include 
python35.lib in the file python-3.5.1-embed-win32.zip.

--
components: Installation
messages: 260176
nosy: Thomas Führinger
priority: normal
severity: normal
status: open
title: Ship python35.lib with the embedded distribution, please
type: enhancement
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



[issue26348] activate.fish sets VENV prompt incorrectly

2016-02-12 Thread Dan McCombs

New submission from Dan McCombs:

Currently, the activate.fish VENV script sets fish's prompt to be prepended 
with a literal "__VENV_PROMPT__" rather than the contents of the 
$__VENV_PROMPT__ variable as intended.

The attached patch simply adds the missing "$" to the variable in the 
conditional test and it's usage, so it's only being set if the variable is 
non-zero, rather than testing if the string "__VENV_PROMPT__" is non-zero like 
it is doing right now.

The results in the prompt being correctly prepended by "(my_actual_venv_name)".

--
components: Library (Lib)
files: activate-fish.patch
keywords: patch
messages: 260175
nosy: Dan McCombs
priority: normal
severity: normal
status: open
title: activate.fish sets VENV prompt incorrectly
type: behavior
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41907/activate-fish.patch

___
Python tracker 

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



[issue25709] Problem with string concatenation and utf-8 cache.

2016-02-12 Thread Georg Brandl

Georg Brandl added the comment:

Don't bother. I can do that once 3.3.7 is released.

--

___
Python tracker 

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



[issue15873] datetime: add ability to parse RFC 3339 dates and times

2016-02-12 Thread Jakub Stasiak

Changes by Jakub Stasiak :


--
nosy: +jstasiak

___
Python tracker 

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



[issue26345] Extra newline appended to UTF-8 strings on Windows

2016-02-12 Thread Eryk Sun

Eryk Sun added the comment:

This a third-party problem due to bugs in the console's support for codepage 
65001. For the general problem of Unicode in the console, see issue 1602. The 
best way to resolve this problem is by using the wide-character APIs, 
WriteConsoleW and ReadConsoleW. I suggest that you try the win_unicode_console 
package.

> But if I try to print something a little less common
> (GREEK CAPITAL LETTER ALPHA), something weird happens:
>
>>python -c "print(chr(0x391))"
>Α
>
>
>>

In versions of Windows that use the legacy console, WriteFile to a console 
screen mistakenly returns the number of UTF-16 codes written instead of the 
number of bytes written. 

For example, '\u0391\r\n' gets encoded as a four-byte buffer, b'\xce\x91\r\n'. 
Here's the result of writing this buffer to the legacy console, using codepage 
65001:

>>> sys.stdout.buffer.raw.write(b'\xce\x91\r\n')
Α
3

Four bytes were written, but the console returns that it wrote three UTF-16 
codes. Python's BufferedWriter (i.e. sys.stdout.buffer) sees this as an 
incomplete write. So it writes the last byte again. That's why you see an extra 
newline. The problem can be far worse if the UTF-8 buffer contains many 
non-ASCII characters, especially if it includes codes greater than U+07FF that 
get encoded as three bytes. 

This particular problem is fixed in the new version of the console that comes 
with Windows 10. For the legacy console, you can work around the problem by 
hooking WriteConsoleA and WriteFile via DLL injection. For example, ANSICON and 
ConEmu do this.

That said, there's a far worse problem with using codepage 65001 in the 
console, which still exists in Windows 10. Due to this bug Python's interactive 
REPL will quit whenever you try to enter non-ASCII characters, and built-in 
input() will raise EOFError. For example:

>>> input()
Ü
Traceback (most recent call last):
  File "", line 1, in 
EOFError

To read the console's wide-character (UTF-16) input buffer via ReadFile, it has 
to first get encoded to the current codepage. The console does the conversion 
via WideCharToMultiByte with a buffer size that assumes each UTF-16 value will 
be encoded as a single byte. But that's wrong for UTF-8, in which one UTF-16 
code can map to as many as three bytes. So WideCharToMultiByte fails, but does 
the console try to increase the buffer size? No. Does it fail the call? No. It 
actually returns back that it 'successfully' read 0 bytes. To the REPL and 
built-in input() that signals EOF (end of file).

If you only need to input text in your system locale, you can try to have the 
best of both worlds. Use chcp.com to set the command prompt to the codepage you 
need for input. Then in your Python script (e.g. in sitecustomize.py) you can 
use ctypes to change just the output codepage and rebind sys.stdout. For 
example:

>>> import os, sys, ctypes
>>> ctypes.WinDLL('kernel32').SetConsoleOutputCP(65001)
1
>>> sys.stdout = open(os.dup(sys.__stdout__.fileno()), 'w', 
encoding='cp65001')

>>> sys.stdin.encoding
'cp1252'
>>> input()
Ü
'Ü'
>>> print('\u0391')
Α

Another minor bug is that the console doesn't keep an overlapping window in 
case a UTF-8 sequence gets split across multiple writes (typically due to 
buffering). For example:

>>> exec(r'''
... sys.stdout.buffer.raw.write(b'\xce')
... sys.stdout.buffer.raw.write(b'\x91')
... ''')
��>>>

Since UTF-8 uses up to four bytes per code, the console would have to keep a 
three-byte buffer to handle the case of a split write.

> Look, guys, I know what a mess Unicode handling on Windows is,
> and I'm not even sure it's Python's fault 

Unicode handling is only a mess in the Windows API if you think Unicode is 
synonymous with UTF-8. Windows NT is Unicode down to the lowest levels of the 
kernel, but it's UTF-16 using 16-bit wide characters. Part of the problem is 
that the C and POSIX APIs that are preferred by cross-platform applications are 
byte oriented (e.g. null-terminated char strings), so Unicode support becomes 
synonymous with UTF-8. On Windows this leaves you stuck using the ANSI 
codepage, which unfortunately cannot be set to codepage 65001. Microsoft would 
have to rewrite a lot of code to support UTF-8 in the ANSI API, and they have 
no incentive to pay for that given that they're heavily invested in UTF-16.

--
nosy: +eryksun
resolution:  -> third party
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



[issue25709] Problem with string concatenation and utf-8 cache.

2016-02-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

b9c8f1c80f47 added a new head. Should we merge 3.3 -> 3.4 -> 3.5 -> default?

--

___
Python tracker 

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



[issue24165] Free list for single-digits ints

2016-02-12 Thread Stefan Behnel

Stefan Behnel added the comment:

I like Serhiy's patch, too, but it feels like the single-digit case should be 
enough. I found this comment by Yury a good argument:

"""
I can see improvements in micro benchmarks, but even more importantly, Serhiy's 
patch reduces memory fragmentations.  99% of all long allocations are coming 
from freelist when it's there.
"""

Did that comment come from a benchmark suite run? (i.e. actual applications and 
not micro benchmarks?) And, does it show a difference between the single- and 
multi-digit cases?

--
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue26345] Extra newline appended to UTF-8 strings on Windows

2016-02-12 Thread STINNER Victor

STINNER Victor added the comment:

I guess that it's yet another example of the bug #1602: "windows console 
doesn't print or input Unicode".

Don't use the Windows console, but use a better console which has a better 
Unicode support. For example, you can play with IDLE :-) (Maybe PowerShell or 
ConEmu ?)
https://conemu.github.io/

--

___
Python tracker 

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



[issue26343] os.O_CLOEXEC not available on OS X

2016-02-12 Thread STINNER Victor

STINNER Victor added the comment:

> FYI Python creates non-inheritable file descriptors by default since Python 
> 3.4: PEP 446.

You didn't reply why you need O_CLOEXEC?

--

___
Python tracker 

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



[issue23718] strptime() can produce invalid date with negative year day

2016-02-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you please add tests?

--
stage:  -> test needed

___
Python tracker 

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



[issue24165] Free list for single-digits ints

2016-02-12 Thread STINNER Victor

STINNER Victor added the comment:

I ran again the benchmark on long_fl.patch of issue #26341 with -b all. The 
problem is that I don't know what to think about the benchmark, to me all these 
number only look like noise :-/ If we ignore changes smaller than 1.05 
(positive or negative), the patch has no impact on performance on such macro 
benchmark.

I didn't say that the patches are useless :-) We may focus on micro-benchmark?

$ ~/bin/taskset_isolated.py time python3 -u perf.py --rigorous 
../default/python.orig ../default/python_long_fl -b all

Report on Linux smithers 4.3.4-300.fc23.x86_64 #1 SMP Mon Jan 25 13:39:23 UTC 
2016 x86_64 x86_64
Total CPU cores: 8

### call_method ###
Min: 0.316851 -> 0.308606: 1.03x faster
Avg: 0.317870 -> 0.309778: 1.03x faster
Significant (t=480.37)
Stddev: 0.00014 -> 0.00026: 1.8165x larger

### etree_parse ###
Min: 0.266148 -> 0.255969: 1.04x faster
Avg: 0.267591 -> 0.257492: 1.04x faster
Significant (t=67.72)
Stddev: 0.00108 -> 0.00103: 1.0478x smaller

### etree_process ###
Min: 0.218512 -> 0.225462: 1.03x slower
Avg: 0.220441 -> 0.227143: 1.03x slower
Significant (t=-37.15)
Stddev: 0.00128 -> 0.00127: 1.0035x smaller

### fannkuch ###
Min: 0.962323 -> 0.984226: 1.02x slower
Avg: 0.965782 -> 0.985413: 1.02x slower
Significant (t=-73.63)
Stddev: 0.00213 -> 0.00160: 1.3276x smaller

### float ###
Min: 0.252470 -> 0.257536: 1.02x slower
Avg: 0.259895 -> 0.265731: 1.02x slower
Significant (t=-9.15)
Stddev: 0.00426 -> 0.00474: 1.1125x larger

### json_dump_v2 ###
Min: 2.717022 -> 2.814488: 1.04x slower
Avg: 2.743981 -> 2.835444: 1.03x slower
Significant (t=-46.41)
Stddev: 0.01375 -> 0.01411: 1.0264x larger

### mako_v2 ###
Min: 0.039410 -> 0.037304: 1.06x faster
Avg: 0.040038 -> 0.038094: 1.05x faster
Significant (t=138.56)
Stddev: 0.00024 -> 0.00037: 1.5234x larger

### meteor_contest ###
Min: 0.182787 -> 0.191944: 1.05x slower
Avg: 0.183526 -> 0.193532: 1.05x slower
Significant (t=-147.53)
Stddev: 0.00031 -> 0.00060: 1.9114x larger

### nbody ###
Min: 0.232746 -> 0.221279: 1.05x faster
Avg: 0.233580 -> 0.222623: 1.05x faster
Significant (t=67.66)
Stddev: 0.00052 -> 0.00153: 2.9467x larger

### nqueens ###
Min: 0.254579 -> 0.263282: 1.03x slower
Avg: 0.256874 -> 0.264082: 1.03x slower
Significant (t=-57.86)
Stddev: 0.00110 -> 0.00059: 1.8689x smaller

### pickle_dict ###
Min: 0.502160 -> 0.490473: 1.02x faster
Avg: 0.502456 -> 0.490759: 1.02x faster
Significant (t=654.42)
Stddev: 0.00014 -> 0.00011: 1.1950x smaller

### raytrace ###
Min: 1.271059 -> 1.309407: 1.03x slower
Avg: 1.274115 -> 1.313171: 1.03x slower
Significant (t=-206.50)
Stddev: 0.00123 -> 0.00144: 1.1698x larger

### richards ###
Min: 0.162761 -> 0.158441: 1.03x faster
Avg: 0.164611 -> 0.160229: 1.03x faster
Significant (t=30.03)
Stddev: 0.00107 -> 0.00099: 1.0761x smaller

### simple_logging ###
Min: 0.279392 -> 0.286003: 1.02x slower
Avg: 0.280746 -> 0.287228: 1.02x slower
Significant (t=-59.16)
Stddev: 0.00075 -> 0.00080: 1.0760x larger

### telco ###   
Min: 0.012419 -> 0.011853: 1.05x faster
Avg: 0.012500 -> 0.011968: 1.04x faster
Significant (t=93.79)
Stddev: 0.3 -> 0.5: 1.3307x larger

The following not significant results are hidden, use -v to show them:
2to3, call_method_slots, call_method_unknown, call_simple, chameleon_v2, chaos, 
django_v3, etree_generate, etree_iterparse, fastpickle, fastunpickle, 
formatted_logging, go, hexiom2, json_load, normal_startup, pathlib, 
pickle_list, pidigits, regex_compile, regex_effbot, regex_v8, silent_logging, 
spectral_norm, startup_nosite, tornado_http, unpack_sequence, unpickle_list.

--

___
Python tracker 

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