[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-20 Thread Nick Coghlan

Nick Coghlan added the comment:

For CPython, I was thinking of having it be "whatever gets passed to Py_Main", 
and that accepts wchar_t in Py3 [1], so on *Nix systems, the command line has 
already been decoded with [2] by the time it runs.

[1] https://docs.python.org/3/c-api/veryhigh.html#c.Py_Main
[2] https://docs.python.org/3/c-api/sys.html#c.Py_DecodeLocale

In the case of Windows, the wchar_t array is received straight from the OS as 
UTF-16-LE.

--

___
Python tracker 

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



[issue21895] signal.pause() and signal handlers don't react to SIGCHLD in non-main thread

2017-03-20 Thread Nathaniel Smith

Nathaniel Smith added the comment:

It turns out that this bug is more general than signal.pause, and has caused 
problems for a few different people:
  https://github.com/dabeaz/curio/issues/118#issuecomment-287735781
  https://github.com/dabeaz/curio/issues/118#issuecomment-287798241
  https://github.com/dabeaz/curio/issues/118#issuecomment-287887843

The basic problem is that CPython's signal handling strategy on Unix-likes 
assumes that if a signal is delivered to the process at a time when the main 
thread is blocked in a syscall, then that syscall will promptly exit with 
EINTR. So for example, time.sleep has some clever code on Windows to make it 
interruptible with control-C, but on Unix we assume that the kernel will break 
the sleep for us.

The problem with this is that POSIX only guarantees that *some* thread will 
receive the signal -- not necessarily the main thread. In practice it seems 
like most implementations do deliver most signals to the main thread or CPython 
wouldn't have gotten away with this for as long as it has, but in particular it 
seems like Linux is happy to deliver SIGCHLD to random other threads. So the 
C-level signal handler runs in whatever thread, it sets the flag for the main 
thread to run the Python-level signal handler... and then the main thread sits 
there blocked in sleep() or select() or pause() or whatever, and never checks 
the flag.

A simple solution would be to make sure signals are always delivered to the 
main thread, by adjusting the C-level signal handler to do something like:

if (current_thread != main_thread) {
pthread_kill(main_thread, sig_num);
return;
}

--
nosy: +njs
title: signal.pause() doesn't wake up on SIGCHLD in non-main thread -> 
signal.pause() and signal handlers don't react to SIGCHLD in non-main thread
versions: +Python 3.6, Python 3.7

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Actually, only put me down for -0.  This isn't a necessary change but it isn't 
egregious either.

--

___
Python tracker 

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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-20 Thread Ned Deily

Ned Deily added the comment:

Based on Brett's and Steve's feedback, I've pushed some tweaks to the captured 
git info.  With the changes, we now use --short form of git hash.  And we use 
output from "git describe --all --always --dirty" for the tag.  I added --all 
and --always for better results with development builds; the results should be 
the same for release (tagged) builds - I think.  I'm going to cherry pick this 
into 3.6.1 final and we can see how this works for development builds and 
further tweak as necessary.  Steve, note that I was brave and modified the 
Windows builds; yay, AppVeyor.  I'll also cherrypick these to 2.7 soon.

Expected outputs:
1. previous hg
2. previous git
3. updated git

Release (tagged) build:
1. Python 3.7.0a0 (v3.7.0a0:4def2a2901a5, ...
2. Python 3.7.0a0 (v3.7.0a0^0:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (v3.7.0a0:05f53735c8, ...

Development build:
1. Python 3.7.0a0 (default:41df79263a11, ...
2. Python 3.7.0a0 (master:05f53735c8912f8df1077e897f052571e13c3496, ...
3. Python 3.7.0a0 (heads/master-dirty:05f53735c8, ...

"dirty" means the working tree has uncommitted changes.
See "git help describe" for more info.

--

___
Python tracker 

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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-20 Thread Ned Deily

Changes by Ned Deily :


--
pull_requests: +660

___
Python tracker 

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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-20 Thread Ned Deily

Changes by Ned Deily :


--
pull_requests: +659

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Raymond Hettinger

Raymond Hettinger added the comment:

-1 We already have a way to do it.  I teach this way in my Python courses and 
there is a zero learning curve. It isn't difficult at all.

--
assignee:  -> bob.ippolito
nosy: +bob.ippolito

___
Python tracker 

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



[issue26418] multiprocessing.pool.ThreadPool eats up memories

2017-03-20 Thread renlifeng

renlifeng added the comment:

I confirm that 3.5.3 and 2.7.13 have fixed this problem. Now the memory usage 
will stop growing after using 28% of physical memory.

In other words, this problem can not be reproduced with the latest version of 
python, Thanks.

It's OK for me to set it to any of out of date, fixed, or closed.

--

___
Python tracker 

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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-03-20 Thread Ned Deily

Changes by Ned Deily :


--
pull_requests: +658

___
Python tracker 

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



[issue29849] fix memory leak in import_from

2017-03-20 Thread Xiang Zhang

Changes by Xiang Zhang :


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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-20 Thread INADA Naoki

INADA Naoki added the comment:

I don't know your patch is worth enough or not. (I dislike fprintf(stderr, ...) 
at least).

But my advice is stop mixing multithreading and fork (except fork+exec).
It's almost impossible.

While Python has GIL, some extension can release GIL and run any C code.
But very vary functions are not fork-safe.  Even malloc and printf are unsafe.

For more information, see "rational" section in 
http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_atfork.html

--

___
Python tracker 

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Is EHLO the only command sent in lower case?  I think it might not be.

I suppose I'm a solid ±0 on changing this (how's that for a completely neutral 
endorsement?).  I won't do the change myself, but I'd review a pull request.

--

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Eric V. Smith

Eric V. Smith added the comment:

+1: gets the job done without complicating the API.

--
nosy: +eric.smith

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Andrew Nester

Changes by Andrew Nester :


--
pull_requests: +657

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +benhoyt, r.david.murray

___
Python tracker 

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



[issue29863] Add a COMPACT constant to the json module

2017-03-20 Thread Brett Cannon

New submission from Brett Cannon:

In issue #29540 there was a suggestion to add a `compact` argument to 
json.dump() and json.dumps(). That was eventually rejected as adding complexity 
to an API that's already messy.

But in GH-72 someone created a COMPACT constant to the json module which gets a 
similar effect as a `compact` argument but without expanding any APIs. 
Unfortunately I think the constant proposal got lost in discussion of adding 
the `compact` argument, so I'm opening a new issue to make a final decision as 
to whether we should accept/reject the COMPACT constant idea.

--
components: Library (Lib)
messages: 289905
nosy: brett.cannon, ezio.melotti, rhettinger
priority: normal
severity: normal
status: open
title: Add a COMPACT constant to the json module
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-20 Thread Daniel Birnstiel

Daniel Birnstiel added the comment:

While you might scold me for the following code, it is just some fiddling with 
the cpython functions from python side.

Backstory is issue 6721 or related to it. I am working on a multi-process 
service which uses multiprocessing (or rather the billiard fork). While forking 
I run into deadlocks as described in the issue when I fork while the io lock is 
acquired.

In order to find a solution I experimented with the cpython module and tried to 
release the lock manually after a fork. The code can be found attached (tested 
with python 3.6/3.7 on OSX Sierra). While it does not really do what it is 
supposed to do, it shows the problem described in this issue (#29859):

If the internal calls to the pthread_* functions fail, I will only get a 
generic error message:

pthread_mutex_lock[3]: Undefined error: 0
pthread_cond_signal: Undefined error: 0
pthread_mutex_unlock[3]: Undefined error: 0

In reality the produced error messages should be:

pthread_mutex_lock[3]: Invalid argument
pthread_cond_signal: Invalid argument
pthread_mutex_unlock[3]: Invalid argument

This happens because the pthread_* functions do not set the erno variable as 
described in the issue description.

Please note that the issue is not only related to my code, but might affect all 
code using locks. While I suppose there shouldn't be any errors when calling 
the low level functions, the attached patch/pr will make debugging a lot easier 
when it actually happens by displaying the correct error message.

--
Added file: http://bugs.python.org/file46749/test.py

___
Python tracker 

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



[issue29851] Have importlib.reload() raise ImportError when a spec can't be found

2017-03-20 Thread Brett Cannon

Brett Cannon added the comment:

First, I don't know what version you're testing against because 3.0.6.1 isn't 
an actual release of Python and 3.6.1 isn't released yet (unless you know 
something I don't know :) ).

Second, the issue is that you're trying to import a module under a name which 
doesn't match the file specified. That's causing reload() to not be able to 
find the original source file to reload against, leading to the None being 
returned by importlib._bootstrap._find_spec() which is leading to the error 
you're seeing. (Remember, reload() basically runs like an import statement for 
the module you're reloading but recycles the module object.)

Third, while an exception is reasonable in this case, it is misleading and 
reload() should be updated to raise an ImportError if _bootstrap._find_spec() 
returns None.

I'm marking this issue as an easy fix since you just need to add an `is None` 
check on a return value and then raise ImportError if necessary in case someone 
wants to propose a PR to improve the error. It will require a doc update to 
document the change in the exception raised.

--
keywords: +easy
nosy: +brett.cannon, eric.snow, ncoghlan
priority: normal -> low
title: importlib.reload references None object -> Have importlib.reload() raise 
ImportError when a spec can't be found
type: crash -> enhancement
versions: +Python 3.7

___
Python tracker 

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



[issue29847] Path takes and ignores **kwargs

2017-03-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The support of **kwargs in Path.__new__ is needed if you want to implement a 
subclass of Path with __init__ accepting keyword arguments (and since Path 
constructor takes variable number of positional arguments, new arguments should 
be keyword-only).

>>> import pathlib
>>> class MyPath(pathlib.PosixPath):
... def __init__(self, *args, spam=False):
... self.spam = spam
... 
>>> p = MyPath('/', spam=True)
>>> p
MyPath('/')
>>> p.spam
True

Removing **kwargs from Path.__new__ will break the above example.

>>> MyPath('/', spam=True)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: __new__() got an unexpected keyword argument 'spam'

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29846] ImportError: Symbol not found: __PyCodecInfo_GetIncrementalDecoder when building 2.7.x on macOS

2017-03-20 Thread Ned Deily

Ned Deily added the comment:

Thanks, Adam!  Note to self: see Makefile changes in PR 737 for Issue15590.

--

___
Python tracker 

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



[issue29862] Fix grammar in importlib.reload() exception

2017-03-20 Thread Brett Cannon

New submission from Brett Cannon:

https://github.com/python/cpython/blob/05f53735c8912f8df1077e897f052571e13c3496/Lib/importlib/__init__.py#L140

"reload() argument must be a module" (missing the "a").

--
assignee: brett.cannon
components: Library (Lib)
messages: 289901
nosy: brett.cannon
priority: normal
severity: normal
status: open
title: Fix grammar in importlib.reload() exception
versions: Python 3.7

___
Python tracker 

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



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file46747/long-shift-overflow-long-long.diff

___
Python tracker 

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



[issue29846] ImportError: Symbol not found: __PyCodecInfo_GetIncrementalDecoder when building 2.7.x on macOS

2017-03-20 Thread Ned Deily

Changes by Ned Deily :


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

___
Python tracker 

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



[issue29846] ImportError: Symbol not found: __PyCodecInfo_GetIncrementalDecoder when building 2.7.x on macOS

2017-03-20 Thread Ned Deily

Ned Deily added the comment:

Thanks, Adam!  Note to self: see Makefile changes in GH-737 for Issue15590.

--

___
Python tracker 

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



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file46748/long-shift-overflow-divrem1.diff

___
Python tracker 

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



[issue29816] Get rid of C limitation for shift count in right shift

2017-03-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are two patches. The first uses C long long arithmetic (it corresponds 
current PR 680), the second uses PyLong arithmetic. What is easier to read and 
verify?

--

___
Python tracker 

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



[issue29847] Path takes and ignores **kwargs

2017-03-20 Thread Jelle Zijlstra

Jelle Zijlstra added the comment:

Thanks, I'll add a PR. This doesn't need to be documented, right?

--

___
Python tracker 

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



[issue29861] multiprocessing Pool keeps objects (tasks, args, results) alive too long

2017-03-20 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
pull_requests: +656

___
Python tracker 

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



[issue22708] httplib/http.client in method _tunnel used HTTP/1.0 CONNECT method

2017-03-20 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +655

___
Python tracker 

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



[issue29847] Path takes and ignores **kwargs

2017-03-20 Thread Brett Cannon

Brett Cannon added the comment:

Yep, kwargs should be dropped since it isn't used or documented: 
https://docs.python.org/3/library/pathlib.html#pathlib.PurePath (probably just 
a hold-over from when it did in some earlier version of the code).

--
components: +Library (Lib)
nosy: +brett.cannon
type:  -> behavior
versions: +Python 3.7

___
Python tracker 

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



[issue29861] multiprocessing Pool keeps objects (tasks, args, results) alive too long

2017-03-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Quick patch below.  I'll make a PR once I have time to :-)

diff --git a/Lib/multiprocessing/pool.py b/Lib/multiprocessing/pool.py
index ffdf426..945afa2 100644
--- a/Lib/multiprocessing/pool.py
+++ b/Lib/multiprocessing/pool.py
@@ -128,6 +128,8 @@ def worker(inqueue, outqueue, initializer=None, 
initargs=(), maxtasks=None,
 util.debug("Possible encoding error while sending result: %s" % (
 wrapped))
 put((job, i, (False, wrapped)))
+
+task = job = result = func = args = kwds = None
 completed += 1
 util.debug('worker exiting after %d tasks' % completed)
 
@@ -402,6 +404,8 @@ class Pool(object):
 if set_length:
 util.debug('doing set_length()')
 set_length(i+1)
+finally:
+task = taskseq = job = None
 else:
 util.debug('task handler got sentinel')
 
@@ -445,6 +449,7 @@ class Pool(object):
 cache[job]._set(i, obj)
 except KeyError:
 pass
+task = job = obj = None
 
 while cache and thread._state != TERMINATE:
 try:
@@ -461,6 +466,7 @@ class Pool(object):
 cache[job]._set(i, obj)
 except KeyError:
 pass
+task = job = obj = None
 
 if hasattr(outqueue, '_reader'):
 util.debug('ensuring that outqueue is not full')

--

___
Python tracker 

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



[issue29861] multiprocessing Pool keeps objects (tasks, args, results) alive too long

2017-03-20 Thread Antoine Pitrou

New submission from Antoine Pitrou:

The various workers in multiprocessing.Pool keep a reference to the last 
encountered task or task result.  This means some data may be kept alive even 
after the caller is done with them, as long as some other task doesn't clobber 
the relevant variables.

Specifically, Pool._handle_tasks(), Pool._handle_results() and the toplevel 
worker() function fail to clear references at the end of each loop.

Originally reported at https://github.com/dask/distributed/issues/956

--
components: Library (Lib)
messages: 289894
nosy: davin, pitrou, sbt
priority: normal
severity: normal
stage: needs patch
status: open
title: multiprocessing Pool keeps objects (tasks, args, results) alive too long
type: resource usage
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue26418] multiprocessing.pool.ThreadPool eats up memories

2017-03-20 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Your script works fine here.  I see:
iter 30, 30040
iter 29, 269848
iter 28, 269848
iter 27, 271996
[...]

--
nosy: +davin, pitrou

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-20 Thread INADA Naoki

INADA Naoki added the comment:

Could you give us minimum sample Python code to reproduce the error?

--
nosy: +inada.naoki

___
Python tracker 

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



[issue14003] __self__ on built-in functions is not as documented

2017-03-20 Thread Jim Fasarakis-Hilliard

Changes by Jim Fasarakis-Hilliard :


--
nosy: +Jim Fasarakis-Hilliard

___
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

2017-03-20 Thread Ken Odegard

Changes by Ken Odegard :


--
nosy: +njalerikson

___
Python tracker 

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread R. David Murray

R. David Murray added the comment:

On the other hand, the current mixed case sending found a bug in your code, so 
it has some value.  I'm neither in favor nor in objection to the change, at 
this point.

--

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-20 Thread Daniel Birnstiel

Changes by Daniel Birnstiel :


--
pull_requests: +654

___
Python tracker 

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



[issue29734] nt._getfinalpathname handle leak

2017-03-20 Thread Mark Becwar

Changes by Mark Becwar :


--
pull_requests: +653

___
Python tracker 

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

Seeing as I'm the one who built the server, it sure is out of spec :)

I could also quickly correct for this "issue" server-side.
So this is more of a "style guideline" change client-side - If no one opposes 
of keeping commands stylistically the same.

--

___
Python tracker 

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread R. David Murray

R. David Murray added the comment:

It is interesting that in all the years smtplib has been in use, this is the 
first time (as far as I know) this has been reported as a problem.  I don't see 
any reason to object to changing it to send the commands in upper case, but the 
server you are talking to is definitely out of spec with the RFC :)

--
components: +email
nosy: +barry, r.david.murray

___
Python tracker 

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread Lord Anton Hvornum

Lord Anton Hvornum added the comment:

Turns out, this goes for a lot more commands, such as:

```
Traceback (most recent call last):
  File "mail.py", line 12, in 
smtp_server.sendmail(fromaddr, toaddrs, msg)
  File "/usr/lib/python3.6/smtplib.py", line 866, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
```

The command that the server refused was:

mail FROM: size=11

Again, this is mostly because traditionally server commands are upper case 
(even tho RFC 821 defines that they can be any syntax, such as `mAiL FroM`).

But it would be nice if Python could keep consistency in it's syntax IMHO.

--

___
Python tracker 

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



[issue24796] Deleting names referencing from enclosed and enclosing scopes

2017-03-20 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
keywords: +easy
stage:  -> needs patch
versions: +Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-20 Thread Daniel Birnstiel

Daniel Birnstiel added the comment:

I have attached a diff adding a new macro for handling pthread_* status codes. 
Will submit PR as soon as my CLA is approved.

--
keywords: +patch
versions: +Python 3.7
Added file: http://bugs.python.org/file46746/patch.diff

___
Python tracker 

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



[issue29860] smtplib.py doesn't capitalize EHLO.

2017-03-20 Thread Lord Anton Hvornum

New submission from Lord Anton Hvornum:

```
  File "mail.py", line 9, in 
smtp_server.starttls(context)
  File "/usr/lib/python3.6/smtplib.py", line 748, in starttls
self.ehlo_or_helo_if_needed()
  File "/usr/lib/python3.6/smtplib.py", line 600, in ehlo_or_helo_if_needed
(code, resp) = self.helo()
  File "/usr/lib/python3.6/smtplib.py", line 429, in helo
(code, msg) = self.getreply()
  File "/usr/lib/python3.6/smtplib.py", line 393, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
```

This happens due to the server expecting commands (like EHLO, STARTTLS) being 
strict upper-case. And when the SMTP command isn't, it drops us.

This is a rare edge case since most mail servers handles shady client data in 
numerous different ways (such as gmail never sending QUIT for instance).

I don't know of a work-around for this and the documentation states `EHLO` is 
being sent (https://docs.python.org/3/library/smtplib.html), so I guess the lib 
assumes that's the case as well.

--
components: Library (Lib)
messages: 289886
nosy: Lord Anton Hvornum
priority: normal
severity: normal
status: open
title: smtplib.py doesn't capitalize EHLO.
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-20 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

As bytes?

--

___
Python tracker 

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



[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-20 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue29859] Return code of pthread_* in thread_pthread.h is not used for perror

2017-03-20 Thread Daniel Birnstiel

New submission from Daniel Birnstiel:

Python/thread_pthread.h:145 defines the CHECK_STATUS macro used for printing 
error messages in case any of the calls fail.

CHECK_STATUS uses perror for formatting an error message, which relies on the 
global erno being set (see man perror). Since the pthread functions return 
their status code instead of setting erno (which might not even work in 
threaded environments), no additional information is displayed. See for example 
produced by PyThread_release_lock:

pthread_mutex_lock[3]: Undefined error: 0
pthread_cond_signal: Undefined error: 0
pthread_mutex_unlock[3]: Undefined error: 0

The correct solution would be to use strerror(status) in order to show the 
proper message.

--
components: Interpreter Core
messages: 289884
nosy: Birne94
priority: normal
severity: normal
status: open
title: Return code of pthread_* in thread_pthread.h is not used for perror
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



[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-20 Thread Jakub Wilk

Changes by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue29854] Segfault when readline history is more then 2 * history size

2017-03-20 Thread Nir Soffer

Nir Soffer added the comment:

Sure, I'll add news entry and tests.

--

___
Python tracker 

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



[issue29844] Windows Python installers not installing DLL to System32/SysWOW64

2017-03-20 Thread Eryk Sun

Eryk Sun added the comment:

> It's inconsistent with the Linux experience of an all-users 
> installation

Yes, if you build with --enable-shared on Linux, then the shared libraries 
libpython3.X.so.1.0 and libpython3.so are installed in /usr/local/lib. 

Currently there's no direct equivalent for 3.5+ on Windows. However, 
delay-loading the DLL is an alternative to a static import. At program startup, 
get the install path from the registry and load python3x.dll manually via 
LoadLibraryEx with the flag LOAD_WITH_ALTERED_SEARCH_PATH. Delayed loading 
automates calling GetProcAddress, so you get the flexibility of a dynamic 
import without losing the convenience of a static import.

> add all the Python install directories to my path to ensure the DLLs 
> are visible to applications that link against them

If the 32-bit DLL were distributed as, for example, python36-32.dll, then this 
would at least be reliable, albeit tedious. Using System32 and SysWOW64 handles 
this problem reliably via file-system redirection.

> all users to go in ``%SystemDrive%\Python{major}{minor}``

The change to use %ProgramFiles% for a machine installation and %LocalAppData% 
for a user installation locks down the discretionary file security. In 
contrast, the file security inherited from C:\ is permissive. It allows any 
authenticated user the right to modify the directory, subdirectories, and 
files. The only rights not granted are delete-child (meaningless since the user 
has delete access for all files) and the right to modify the file security.

--

___
Python tracker 

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



[issue15590] --libs is inconsistent for python-config --libs and pkgconfig python --libs

2017-03-20 Thread Michael Haubenwallner

Changes by Michael Haubenwallner :


--
pull_requests: +652

___
Python tracker 

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



[issue28522] can't make IDLEX work with python._pth and python-3.6.0b2

2017-03-20 Thread illagrenan

Changes by illagrenan :


--
nosy: +illagrenan

___
Python tracker 

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



[issue29858] inspect.signature includes bound argument for wrappers around decorated bound methods

2017-03-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +yselivanov
stage:  -> patch review
type:  -> behavior
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



[issue29854] Segfault when readline history is more then 2 * history size

2017-03-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The fix LGTM. Any chance to write a test? And please add an entry in Misc/NEWS.

--
nosy: +serhiy.storchaka, twouters
stage:  -> patch review
type:  -> crash
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



[issue29858] inspect.signature includes bound argument for wrappers around decorated bound methods

2017-03-20 Thread anton-ryzhov

Changes by anton-ryzhov :


--
pull_requests: +650

___
Python tracker 

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



[issue29858] inspect.signature includes bound argument for wrappers around decorated bound methods

2017-03-20 Thread anton-ryzhov

anton-ryzhov added the comment:

Related to http://bugs.python.org/issue24298

--

___
Python tracker 

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



[issue29858] inspect.signature includes bound argument for wrappers around decorated bound methods

2017-03-20 Thread anton-ryzhov

New submission from anton-ryzhov:

If we wrap function with bound method, which is also a wrapper around function, 
`inspect.signature` will not do `skip_bound_arg`.
It will use `inspect.unwrap` and pass by bound method from outer function to 
inner one.

Reproduce:
```
import functools, inspect


def decorator(func):
@functools.wraps(func)
def inner(*args):
return func(*args)
return inner


class Foo(object):
@decorator
def bar(self, testarg):
pass


f = Foo()
baz = decorator(f.bar)
assert inspect.signature(baz) == inspect.signature(f.bar)
```

--
components: Library (Lib)
messages: 289879
nosy: anton-ryzhov
priority: normal
severity: normal
status: open
title: inspect.signature includes bound argument for wrappers around decorated 
bound methods
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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




[issue29816] Get rid of C limitation for shift count in right shift

2017-03-20 Thread Mark Dickinson

Mark Dickinson added the comment:

> Mark, could you please make a review?

I'll try to find time this week. At least in principle, the change sounds good 
to me.

--

___
Python tracker 

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



[issue25455] Some repr implementations don't check for self-referential structures

2017-03-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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



[issue29116] Make str and bytes error messages on concatenation conform with other sequences

2017-03-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't know why statuses was not updated automatically. Updated them manually.

Ivan in the comment on GitHub suggested to use "concatenate" instead of 
"concat" in "can't concat  to bytes". Maybe make it more similar to 
messages for list, tuple, deque, array? "can only concatenate objects 
supporting the buffer protocol (not "") to bytes"?

--

___
Python tracker 

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



[issue28876] bool of large range raises OverflowError

2017-03-20 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Akira for your patch.

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



[issue28876] bool of large range raises OverflowError

2017-03-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +649

___
Python tracker 

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



[issue28876] bool of large range raises OverflowError

2017-03-20 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +648

___
Python tracker 

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



[issue29855] The traceback compounding of RecursionError fails to work with __get__

2017-03-20 Thread Nick Coghlan

Nick Coghlan added the comment:

Indeed, the traceback abbreviation doesn't try to detect recursive loops, only 
exactly duplicated lines.

The problem is that the more state management we do in the traceback printing, 
the higher the chance there is of getting an error while attempt to display the 
previous errors.

Keeping the immediately preceding entry and doing an exact comparison is 
straightforward, but pattern matching on up-to-N entries is something we'll 
leave to external traceback pretty printers.

--
resolution:  -> not a bug
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



[issue14208] No way to recover original argv with python -m

2017-03-20 Thread Nick Coghlan

Nick Coghlan added the comment:

A few updates here:

* For the specific case of `python -m`, the original argument has been 
available as `__main__.__spec__.name` since Python 3.4

* Also since Python 3.4, the `multiprocessing` module has correctly handled the 
-m switch. For more details, see 
https://docs.python.org/3/whatsnew/3.4.html#multiprocessing and the linked 
issues.

* However, there are still some cases where it is potentially useful to have 
access to the full details of how the host Python runtime was invoked, rather 
than just the arguments that were left after CPython's runtime processing was 
completed. I filed issue 29857 as a new RFE specifically suggesting a 
`sys._raw_argv` attribute addressing that question.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue29857] Provide `sys._raw_argv` for host application's command line arguments

2017-03-20 Thread Nick Coghlan

New submission from Nick Coghlan:

Issue 14208 was ultimately resolved through an import system specific solution, 
with PEP 451 making the module name passed to `python -m` available as 
`__main__.__spec__.name`.

However, there are other situations where it may be useful to offer an 
implementation-dependent attribute in the `sys` module that provides access to 
a copy of the host application's raw `argv` details, rather than the filtered 
`sys.argv` details that are left after the host application's command line 
processing has been completed.

In the case of CPython, where `sys.argv` represents the arguments to the Python 
level __main__ function, `sys._raw_argv` would be a copy of the argv argument 
to the C level main() or wmain() function (as appropriate for the platform).

--
messages: 289873
nosy: ncoghlan
priority: normal
severity: normal
status: open
title: Provide `sys._raw_argv` for host application's command line arguments
type: enhancement

___
Python tracker 

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