[issue31706] urlencode should accept generator as values for mappings when doseq=True

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Extending urlencode() to accept iterables instead of just sequences of values 
makes sense to me. There is no principal reason of requiring sequences. But you 
need to update the documentation, docstrings and comments.

While we are here, we can generalize urlencode() in other aspect. Currently it 
accepts either mapping or a sequence of 2-tuples. It could be accept an 
iterable of 2-tuples (or even an iterable of 2-element sequences or 2-element 
iterables).

--
nosy: +serhiy.storchaka
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



[issue31707] Irrational fractions

2017-10-06 Thread Henk-Jaap Wagenaar

Henk-Jaap Wagenaar  added the comment:

I would like to provide some colour to this discussion. In a former life I have 
coded these during my studies. Ben is talking about implementing the Field of 
Fractions of an Integral Domain. See 
https://en.wikipedia.org/wiki/Field_of_fractions

The way Fraction is implemented it has a unique representation for each 
fraction in Q and uses GCD. This requires us to strengthen the condition of 
Integral Domain to a Euclidean Domain where the Euclidean Function fulfills the 
role of %. I.e. Serhiy: it would only support exactly those rings that support 
gcd! See https://en.wikipedia.org/wiki/Euclidean_domain

One could implement a base class called (Euclidean)FractionField that 
generalizes to Euclidean domains. For future reference, there are a few 
practical niggles I want to record:
- how to deal with basic numeric types?
- Euclidean Domain needs to implement __abs__ to get a canonical denominator, 
unless gcd works out magically like it does in Z?

The added advantage beside being able to use the FractionField class as Ben 
suggests is that it splits up the mechanics of parsing/creating/casting to/from 
various basic numeric types from the mathematical operations in a fraction 
field making the code clearer.

I am happy to assist Ben with the patch if he wants any help.

--
nosy: +Henk-Jaap Wagenaar

___
Python tracker 

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



[issue31707] Irrational fractions

2017-10-06 Thread Mark Dickinson

Mark Dickinson  added the comment:

I think this is way beyond the scope of the current fractions module. I'd 
suggest putting something on PyPI as a proof of concept.

Given the negative response from other core developers, I'm going to close here.

--
resolution:  -> rejected
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



[issue31596] expose pthread_getcpuclockid in time module

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

Thank you Benjamin, buildots are back to green :-)

I prefer the new unit test which only tests pthread_getcpuclockid() clock and 
not make any assumption on the link between this clock and 
CLOCK_THREAD_CPUTIME_ID.

--

___
Python tracker 

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



[issue31711] ssl.SSLSocket.send(b"") fails

2017-10-06 Thread Jörn Heissler

New submission from Jörn Heissler :

Traceback (most recent call last):
  File "client.py", line 10, in 
conn.send(b'')
  File "/usr/lib/python3.6/ssl.py", line 941, in send
return self._sslobj.write(data)
  File "/usr/lib/python3.6/ssl.py", line 642, in write
return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:2074)

This error is not what I expected. I expected a noop instead.

My guess is, that python calls SSL_write (3.6 branch, _ssl.c:2038) with that 
empty buffer.
The manpage states: "When calling SSL_write() with num=0 bytes to be sent the 
behaviour is undefined."

This undefined behaviour should either be documented in python, or defined to 
either raise an exception (ValueError?) or defined as a noop. I'd prefer the 
latter.

--
assignee: christian.heimes
components: SSL
files: client.py
messages: 303810
nosy: christian.heimes, joernheissler
priority: normal
severity: normal
status: open
title: ssl.SSLSocket.send(b"") fails
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47194/client.py

___
Python tracker 

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



[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread Oren Milman

Oren Milman  added the comment:

Here is some similar code that crashes for the same reasons:

# create a circular reference with a malicious __del__().
class A:
def __del__(*args):
del list1[0]
circ_ref_obj = A()
circ_ref_obj._self = circ_ref_obj

list1 = [None]
list2 = []
del circ_ref_obj
while len(list2) < 1:
list2.append(list1[:])

IIUC, list_slice() first finds the boundaries of the slice and its length, and
then calls PyList_New().
But PyList_New() might call PyObject_GC_New(), which eventually causes a call
to _PyObject_GC_Alloc(), which might call collect_generations(), which causes
the malicious __del__() to run.
After __del__() empties the list, list_slice() continues to run, but the list's
boundaries it found earlier are now invalid, and so it tries to read the first
element in the now empty list, and crashes.


Maybe we should prevent collection of garbage with circular references (that
has __del__() or weakref callbacks) from PyObject_GC_New()?

ISTM there might be a lot of places with similar issues. (e.g. if we replace
'list2.append(list1[:])' with 'list2.append(list1[::-1])', we get a crash in
list_subscript()).
So i think that fixing each of them would be harder and might even introduce a
regression in performance.

--
nosy: +Oren Milman

___
Python tracker 

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



[issue31092] multiprocessing.Manager() race condition

2017-10-06 Thread Oren Milman

Oren Milman  added the comment:

Davin and Antoine, i added you to the nosy list because you are listed
as multiprocessing experts :)

--
nosy: +davin, pitrou

___
Python tracker 

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



[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread Oren Milman

Oren Milman  added the comment:

Oh, and calls to PyObject_GC_NewVar() might also cause similar issues.

--

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2017-10-06 Thread Nick Coghlan

Nick Coghlan  added the comment:

This has been merged now: 
https://github.com/python/cpython/commit/731e18901484c75b60167a06a0ba0719a6d4827d

Thank you for the PEP & implementation! :)

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



[issue31712] subprocess with stderr=subprocess.STDOUT hang

2017-10-06 Thread l4mer

New submission from l4mer :

I am using ssh mux + authorized key. So can exectute commands without passwod.

1. disconnect mux by: ssh user@localhost -O exit
2. run simple script
import subprocess

if __name__ == '__main__':
cmd = ["ssh", "user@localhost", "id"]
try:
buf = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
buf = e.output
3. This always hang in read(3,
fcntl(3, F_GETFL)   = 0 (flags O_RDONLY)
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f036b5f1000
lseek(3, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
munmap(0x7f036b5f1000, 4096)= 0
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
lseek(3, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
read(3, "uid=0(", 6)= 6
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
lseek(3, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
read(3, "root) ", 6)= 6
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
lseek(3, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
read(3, "gid=0(r", 7)   = 7
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
lseek(3, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
read(3, "oot) gro", 8)  = 8
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
lseek(3, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
read(3, "ups=0(roo", 9) = 9
fstat(3, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
lseek(3, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
read(3, "t)\n", 10) = 3
read(3, 0x7f036b480653, 7)  = ? ERESTARTSYS (To be restarted if 
SA_RESTART is set)
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21620, si_status=0, 
si_utime=1, si_stime=0} ---
read(3,

4. After ctr+c
read(3, ^CProcess 21619 detached
 
Traceback (most recent call last):
  File "test.py", line 6, in 
buf = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "/usr/lib/python2.7/subprocess.py", line 567, in check_output
output, unused_err = process.communicate()
  File "/usr/lib/python2.7/subprocess.py", line 791, in communicate
wigig@wigig-Latitude-E5270:~$ stdout = _eintr_retry_call(self.stdout.read)
  File "/usr/lib/python2.7/subprocess.py", line 476, in _eintr_retry_call
return func(*args)

BTW, when MUX is created it always works.

--
messages: 303815
nosy: l4mer
priority: normal
severity: normal
status: open
title: subprocess with stderr=subprocess.STDOUT hang
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue31712] subprocess with stderr=subprocess.STDOUT hang

2017-10-06 Thread R. David Murray

R. David Murray  added the comment:

Given the title, are you saying that it works if you omit the 
stderr=subprocess.STDOUT?  At the beginning you say you are using an authorized 
key and mux so you don't need to enter a password, and at the end you say it 
works fine if the MUX is created.  So that sounds like the failure is when you 
are trying to establish the first connection.  Perhaps the problem is that the 
subprocess doesn't have access to your key for some reason, and therefore ssh 
is prompting for a password?

--
nosy: +gregory.p.smith, r.david.murray

___
Python tracker 

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



[issue31712] subprocess with stderr=subprocess.STDOUT hang

2017-10-06 Thread l4mer

l4mer  added the comment:

yes, works perfectly when omit stderr=subprocess.STDOUT no matter if mux exists.
Also from bash: ssh user@locahost id always works.

Problem exists only when stderr=subprocess.STDOUT and no MUX yet.
BTW, first connection create a MUX - but this seems to be an unimportant detail.

This is 100% reproducible.

--

___
Python tracker 

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



[issue31712] subprocess with stderr=subprocess.STDOUT hang

2017-10-06 Thread l4mer

l4mer  added the comment:

BTW, when you will check point 3 you will notice that we already read id 
output, so command execute correctly: "uid=0(root" ...
And problem is after that.

Steps I reproduce this issue:
- standard user have keys and
 in ~/.ssh/config
Host *
   ControlMaster auto
   ControlPath /tmp/ssh-%r@%h:%p
   ControlPersist yes

- on root (authorized_key installed)
cat ~user/.ssh/id_rsa.pub >> ~root/.ssh/authorized_keys

- on user, reproduce
ssh root@localhost -O exit # destroy mux
strace python test.py # script I paste before

I hit this problem of few machines, with different linux kernels ...
Seems like generic problem?

--

___
Python tracker 

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



[issue31713] python3 python-config script generates invalid includes

2017-10-06 Thread matthewlweber

New submission from matthewlweber :

Related to https://bugs.python.org/issue22907

If building in a path that starts with /usr, the includedir=$(echo 
"@includedir@" | sed "s#^$prefix_build#$prefix_real#") assignment in the 
python-config.sh ends up having the path it processes ran through a path 
substitution once before this line is executed because the @includedir@ in the 
python-config.sh.in is set to the string '${prefix}/include'.  ${prefix} is 
assigned just above includedir in python-config.sh to prefix=$(echo 
"$prefix_build" | sed "s#^$prefix_build#$prefix_real#")

I believe we need to update the includedir to 

includedir=$(echo "@includedir@")

Or rename the prefix variable in python-config.sh so that there isn't a naming 
conflict if a string is passed in via @includedir@ with that variable.

Without fixing this you end up with multiple /usr substitutions in the 
includedir string, each replaced with the real path.  ie resulting in an 
invalid path.

--
components: Cross-Build
messages: 303819
nosy: Alex.Willmer, matthewlweber
priority: normal
severity: normal
status: open
title: python3 python-config script generates invalid includes
versions: Python 3.4

___
Python tracker 

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



[issue7167] Smarter FTP passive mode

2017-10-06 Thread Albert-Jan Nijburg

Albert-Jan Nijburg  added the comment:

I understand the standpoint that the server is configured incorrectly, and I 
see why this might not be the best solution to the problem. 

But not everyone owns the ftp server they're connecting to. And the `EPSV` 
command often doesn't include the ipaddress, so many ftp clients are now using 
`EPSV` to circumvent the problem of the ip address and the dns address not 
matching up.

Would it not be sensible to give users the option to use just `EPSV` so people 
can connect to incorrectly configured ftp servers. Although this can't be a 
massive issue for people, because I'd expect this bug to be a bit more active. 

Curl for example defaults to EPSV and then falls back to PASV when it's not 
supported by the server. The ftp client in macos also defaults to EPSV. I'm not 
sugesting we do that, but it would be nice if we could tell the ftplib to use 
EPSV without it being a ipv6 address. 

In our specific situation, we have an ftp server that has a public and a 
private endpoint on different ip addresses, and the ftp server is configured to 
use the public ip address, but if we want to access in internally we need to 
use the internal host and ip address. This causes `ftplib` not to work, because 
the ips don't line up. 

We currently monkey patch ftplib to use `EPSV`, but it does state that you need 
to use EPSV when you connect with ipv6 it doesn't say you can't use it when you 
use ipv4.

--
nosy: +Albert-Jan Nijburg

___
Python tracker 

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



[issue31693] Document Py_GETENV

2017-10-06 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

test_regrtest is not the single test failing when COUNT_ALLOCS is defined. Not 
least than 12 tests are failing.

In Python 3, many tests were fixed by skipping them if COUNT_ALLOCS is defined: 
commit a793037d803abf098d172f686e2b95d27863c54d of bpo-19527.

Since Python 3.6, even if COUNT_ALLOCS is defined, statistics are no more 
dumped by default, but only if -X showalloccount is defined: commit 
7e160ce356036bccda2608d9ee10bfe276dfa97a of bpo-23034. Moreover, statitics are 
now written into stderr rather than stdout.

--
nosy: +haypo
title: Test `test_huntrleaks` fails in debug build with COUNT_ALLOCS -> [2.7] 
Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

___
Python tracker 

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



[issue31714] Improve re documentation

2017-10-06 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The proposed PR improves the documentation of re module and Regular Expression 
HOWTO.

* Clarify the effect of the LOCALE flag.

* Remove outdated statements.

* Add an example of escaping a replacement string.

* Add or correct some references.

* Improve and fix a formatting.

--
assignee: docs@python
components: Documentation, Regular Expressions
messages: 303822
nosy: akuchling, barry, docs@python, ezio.melotti, mrabarnett, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Improve re documentation
type: enhancement
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



[issue31714] Improve re documentation

2017-10-06 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +3878

___
Python tracker 

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



[issue31715] Add mimetype for extension .mjs

2017-10-06 Thread Bradley Meck

New submission from Bradley Meck :

I propose to add a mapping of file extension .mjs to mime type 
"text/javascript".
The "text/javascript" MIME is registered in 
https://www.iana.org/assignments/media-types, was moved to *should* as the MIME 
in HTML ( https://github.com/whatwg/html/pull/3096), and is being updated by 
https://datatracker.ietf.org/doc/draft-bfarias-javascript-mjs/

This extension is being used by Node.js for support of ECMAScript Modules (ESM).

--
components: Library (Lib)
messages: 303824
nosy: Bradley Meck
priority: normal
severity: normal
status: open
title: Add mimetype for extension .mjs
type: enhancement
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue24896] It is undocumented that re.UNICODE and re.LOCALE affect re.IGNORECASE

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I tried to correct the documentation in issue31714.

--

___
Python tracker 

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



[issue31714] Improve re documentation

2017-10-06 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue31714] Improve re documentation

2017-10-06 Thread Henk-Jaap Wagenaar

Henk-Jaap Wagenaar  added the comment:

I was looking at your changes and got myself in a muddle. What is you rational 
for when you use ``[character or string]`` versus ``'[character or string]``? 
You seem to be creating consistency there, but I cannot quite see the rules you 
are aiming for!

--
nosy: +Henk-Jaap Wagenaar

___
Python tracker 

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



[issue31714] Improve re documentation

2017-10-06 Thread Ezio Melotti

Ezio Melotti  added the comment:

ISTM that ``x`` is used when x is a regex or regex metachar, whereas ``'x'`` is 
used when 'x' is a string.  I find this distinction reasonable.

--

___
Python tracker 

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



[issue31716] os.path.isdir returns true for dots

2017-10-06 Thread Mor Haviv

New submission from Mor Haviv :

I uploaded this as a question on Stack Overflow and I suspect it might be a 
bug. Here is the link for the Stack Overflow question: 
https://stackoverflow.com/questions/46608731/python-os-path-isdir-returns-true-for-dots/46608842#46608842

The problem itself (copied from what I uploaded on Stack Overflow):

I'm programming my own shell in python. Right now I'm trying to implement the 
`cd` command to my shell.

The function that performs this command has several variables:

`self.current_dir = "C:\\"` - The default value, it changes depends on the 
user's input using the cd command

`dir = "..."` - The requested directory that the user types. "..." is an 
example for an input that causes the problem.

Here is my code:

def command_cd(self, dir):
if os.path.isdir(self.shell.current_dir + dir):
self.shell.current_dir = self.shell.current_dir + dir + "\\"

The problem is that for some strange reason, 
`os.path.isdir(self.shell.current_dir + dir)` returns `True` when the user 
types dots (Just like the example inputs for the variables which I gave above). 

The problem occurs even if you change the amount of dots (even above 5 dots) 
and I really have no idea what causes it.

There's obviously no folder named `...` or anything like it.


**If my problem isn't clear enough please comment and I'll edit it**

--
components: Windows
messages: 303827
nosy: morha13, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.path.isdir returns true for dots
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue31715] Add mimetype for extension .mjs

2017-10-06 Thread Bradley Meck

Change by Bradley Meck :


--
keywords: +patch
pull_requests: +3879
stage:  -> patch review

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Commit a793037d803abf098d172f686e2b95d27863c54d is not related to this issue. 
It skips the tests that were failed due to other side effect of COUNT_ALLOCS -- 
it makes type immortal. This is not a problem in 2.7 since all types are 
immortal in 2.7.

But there is other patch in issue19527: 
00141-fix-tests_with_COUNT_ALLOCS-v5.patch. It was not committed since 
issue23034 provided better solution. You can try to backport it to 2.7, but 
this will just complicate the testing code for almost no benefit. Nobody wanted 
to do this. It was a decision to ignore this issue in Python 3.5 and earlier.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31714] Improve re documentation

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

It is explained in the documentation:

"""
(In the rest of this
section, we'll write RE's in ``this special style``, usually without quotes, and
strings to be matched ``'in single quotes'``.)
"""

--

___
Python tracker 

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



[issue31716] os.path.isdir returns true for dots

2017-10-06 Thread Mor Haviv

Change by Mor Haviv :


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



[issue31716] os.path.isdir returns true for dots

2017-10-06 Thread Mor Haviv

Change by Mor Haviv :


--
resolution:  -> not a bug

___
Python tracker 

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



[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Oh, you are right Oren. Seems this is the only solution.

--
nosy: +haypo, lemburg, pitrou, serhiy.storchaka, tim.peters, twouters

___
Python tracker 

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



[issue31717] Socket documentation threading misstep?

2017-10-06 Thread Phillip

New submission from Phillip :

Very small, but,

https://docs.python.org/2/howto/sockets.html
https://docs.python.org/3/howto/sockets.html

have :
while True:
# accept connections from outside
(clientsocket, address) = serversocket.accept()
# now do something with the clientsocket
# in this case, we'll pretend this is a threaded server
ct = client_thread(clientsocket)
ct.run()

and for some reason I really want it to be ct.start()

--
assignee: docs@python
components: Documentation
messages: 303831
nosy: apoplexy, docs@python
priority: normal
severity: normal
status: open
title: Socket documentation threading misstep?
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue31716] os.path.isdir returns true for dots

2017-10-06 Thread Eryk Sun

Eryk Sun  added the comment:

This is standard Windows API behavior for the final path component. A single 
dot component means the current directory. Two dots means the parent directory. 
More than two dots and/or trailing spaces, gets reduced to a single dot, 
meaning the current directory. For example:

>>> os.path.abspath('.')
'C:\\Temp'
>>> os.path.abspath('..')
'C:\\'
>>> os.path.abspath('...')
'C:\\Temp'
>>> os.path.abspath('... ... ...')
'C:\\Temp'

Specifically, os.path.isdir is implemented as nt._isdir, which calls WinAPI 
GetFileAttributes to check for FILE_ATTRIBUTE_DIRECTORY, which in turn calls 
the NT system function NtQueryAttributesFile. 

GetFileAttributes has to translate the DOS path to an NT kernel path. In the 
kernel, none of this "." business exists. The kernel doesn't even have a 
concept of a working directory. Depending on your Windows version, it might 
call the runtime library function RtlDosPathNameToNtPathName_U_WithStatus to 
convert the path to a native OBJECT_ATTRIBUTES record. The first step is to 
normalize the path via RtlGetFullPathName_Ustr, which is what the Windows API 
GetFullPathName function calls like in the above abspath() examples.

--
nosy: +eryksun

___
Python tracker 

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



[issue31714] Improve re documentation

2017-10-06 Thread Brian Ward

Brian Ward  added the comment:

In re.rst, the instances of "Correcsponds the" should be "Corresponds to the" 
and "Doesn't have correcsponding inline flag" should be "No corresponding 
inline flag."

--
nosy: +Brian Ward

___
Python tracker 

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



[issue31717] Socket documentation threading misstep?

2017-10-06 Thread R. David Murray

R. David Murray  added the comment:

Based on the paragraph following the example, I don't think client_thread is a 
threading.Thread, and 'run' is meant to be a generic representation of a 
possible API.  Since Threads do have a 'run' method, this is certainly 
potentially confusing.  Maybe we should change it to 'start_thread' or 
something like that?

--
nosy: +r.david.murray
versions:  -Python 3.4, Python 3.5, Python 3.8

___
Python tracker 

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



[issue31717] Socket documentation threading misstep?

2017-10-06 Thread R. David Murray

R. David Murray  added the comment:

Or maybe instead of client_handler/run, it should be something like 
handle_client_asynchronously(clientsocket).

--

___
Python tracker 

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



[issue31558] gc.freeze() - an API to mark objects as uncollectable

2017-10-06 Thread Łukasz Langa

Łukasz Langa  added the comment:

Alright Python people, I don't see anybody being against the idea on the 
thread.  Can we get a review of the linked PR?  I don't think it would be good 
form for me to accept it.

--

___
Python tracker 

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



[issue31666] Pandas_datareader Error Message - ModuleNotFoundError: No module named 'pandas_datareader' with module in folder

2017-10-06 Thread Éric Araujo

New submission from Éric Araujo :

Hello!  Your bug report gives very little information for us to help you.  Can 
you give details such as: your environement / setup, your code, expected result 
and full error message?

https://devguide.python.org/tracker/#reporting-an-issue

--
nosy: +merwok

___
Python tracker 

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



[issue31717] Socket documentation threading misstep?

2017-10-06 Thread Phillip

Phillip  added the comment:

I could definitely understand that. After all, if it's slightly askew (or
strikes some as such) it forces critical thinking, which is good. I didn't
think calling run() was indicative of the three likely pathways to handle
the client socket in the following paragraph.

I'm indifferent, I just saw something so I said something, but ultimately I
think you guys do a tremendous job keeping this documentation good.

Thanks,

On Fri, Oct 6, 2017 at 10:44 AM, R. David Murray 
wrote:

>
> R. David Murray  added the comment:
>
> Or maybe instead of client_handler/run, it should be something like
> handle_client_asynchronously(clientsocket).
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue31700] one-argument version for Generator.typing

2017-10-06 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

You can use Iterator type, for example this works in mypy (didn't test in other 
type checkers):

  def f() -> Iterator[int]:
  yield 42

In case you want annotate something specifically as Generator[int, None, None] 
(for example to use its .close() method), then you can create a generic alias:

  T = TypeVar('T')
  Gen = Generator[T, None, None]

  def f() -> Gen[int]:
  ...

this is supported by mypy as well.

--
nosy: +levkivskyi

___
Python tracker 

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



[issue31713] python3 python-config script generates invalid includes

2017-10-06 Thread matthewlweber

Change by matthewlweber :


--
keywords: +patch
Added file: 
https://bugs.python.org/file47195/0029-python-config.sh-don-t-reassign-prefix.patch

___
Python tracker 

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



[issue31591] Closing socket raises AttributeError: 'collections.deque' object has no attribute '_decref_socketios'

2017-10-06 Thread reidfaiv

reidfaiv  added the comment:

I will withdraw this bug report. I am unable to isolate that issue, hence I can 
not confirm if this is purely Python crash or caused by some extension. It 
looks memory corruption to me as segfault moves around and produces different 
stack traces - the network code is probably just a victim.

--
resolution:  -> rejected
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



[issue31558] gc.freeze() - an API to mark objects as uncollectable

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What about msg302790?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-06 Thread Oren Milman

New submission from Oren Milman :

Given an uninitialized IncrementalNewlineDecoder:
uninitialized = 
io.IncrementalNewlineDecoder.__new__(io.IncrementalNewlineDecoder)

each of the following calls would raise a SystemError ('null argument to
internal routine'):
uninitialized.getstate()
uninitialized.setstate((b'foo', 0))
uninitialized.reset()

In contrast, the following call would raise a ValueError
('IncrementalNewlineDecoder.__init__ not called'):
uninitialized.decode(b'bar')

ISTM that getstate(), setstate(), and reset() should have the same behavior as
decode(). (Though i think that including the actual type name in the error
message would be better, as it could be a subclass of 
IncrementalNewlineDecoder).

--
components: IO
messages: 303842
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: some methods of uninitialized io.IncrementalNewlineDecoder objects raise 
SystemError
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



[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-06 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

After reading the doc entry for SimpleNamespace, I see running 
'SimpleNamespace(**{0:0})' as a bug because doing so results in an object than 
contradicts the doc.

1. "A simple object subclass that provides attribute access to its namespace, 
as well as a meaningful repr. Unlike ... you can ... delete attributes."

But, after 'sn = SimpleNamespace(**{0:0})', sn.0 is a SyntaxError and 
getattr(sn, 0) raises 'TypeError: getattr(): attribute name must be string'.  
As already noted, the 'attribute' does not appear in repr(sn).  'del sn.0' and 
'delattr(sn, 0)' also fail.  If this is a feature, it is extremely buggy.

2. "The type is roughly equivalent to the following code:"

class SimpleNamespace:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)

def __repr__(self):
keys = sorted(self.__dict__)
items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys)
return "{}({})".format(type(self).__name__, ", ".join(items))

def __eq__(self, other):
return self.__dict__ == other.__dict__

With this definition, SimpleNamespace(**{0:0}) raises TypeError.  To me, 
running versus raising is outside the bounds of 'roughly equivalent'.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Another solution (works in 3.6 too): set idpattern to 
r'(?-i:[_a-zA-Z][_a-zA-Z0-9]*)'.

This looks pretty weird, setting the re.IGNORECASE flag and then unsetting it. 
But it works, and don't break the user code that changes idpattern without 
changing flags.

--

___
Python tracker 

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



[issue31680] Expose curses library name and version on Python level

2017-10-06 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

pythoninfo seems like the right place.  It is publicly readable.  We just 
reserved the right to change it in any release as needed.  (This actually is 
useful to other users also as long as they know.) #15037 was originally filed 
for 3.4 and is currently marked for 3.6.  Backporting this to 3.6 will allow a 
3.6 fix for #15037.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-06 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +3881
stage:  -> patch review

___
Python tracker 

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



[issue31655] SimpleNamespace accepts non-string keyword names

2017-10-06 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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



[issue31680] Expose curses library name and version on Python level

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

No need to backport this to 3.6. The test in 3.6 can be skipped on OpenBSD, 
independently from the ncurses version.

--

___
Python tracker 

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



[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Is IncrementalNewlineDecoder subclassable?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +3882
stage:  -> patch review

___
Python tracker 

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



[issue19527] Test failures with COUNT_ALLOCS

2017-10-06 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +3883

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

I wrote PR 3910 to modify COUNT_ALLOCS: alllcations statistics are now written 
into stderr, rather than stdout.

The PR contains also changes to fix tests with COUNT_ALLOCS. I'm not sure about 
this part of the PR. I would prefer to not dump statistics by default, and add 
a new option to enable it.

I don't know if we can easily implement "-X showalloccount", since Python 2.7 
doesn't have sys._xoptions. Maybe we could use a new environment variable 
instead: PYTHONSHOWALLOCCOUNT=1?

I would prefer to add a new option instead of having to patch so many unit 
tests:

haypo@selma$ git diff 2.7.. --stat
 Lib/json/tests/test_tool.py |  
8 ++--
 Lib/test/support/__init__.py|  
3 +++
 Lib/test/test_abc.py|  
2 ++
 Lib/test/test_gc.py |  
4 +++-
 Lib/test/test_hash.py   |  
2 +-
 Lib/test/test_module.py |  
3 ++-
 Lib/test/test_multiprocessing.py|  
4 +++-
 Lib/test/test_regrtest.py   |  
1 +
 Lib/test/test_subprocess.py | 
17 +
 Lib/test/test_sys.py| 
21 +++--
 Lib/test/test_threading.py  | 
11 ---
 Lib/test/test_tools.py  | 
10 +++---
 Lib/test/test_warnings.py   |  
4 
 Lib/test/test_weakref.py|  
1 +
 Misc/NEWS.d/next/Core and Builtins/2017-10-06-21-56-47.bpo-31692.osJuVJ.rst |  
2 ++
 Python/pythonrun.c  |  
2 +-
 16 files changed, 76 insertions(+), 19 deletions(-)

--

___
Python tracker 

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



[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +3884
stage:  -> patch review

___
Python tracker 

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



[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

> Oh, you are right Oren. Seems this is the only solution.

There are other solutions. I wrote PR 3911 which checks if the list size 
changed after PyList_New(). If it's the case, a RuntimeError exception is 
raised.

We implemented similar checks in the dict type, if the dict is mutated during 
iterating on it.

--

___
Python tracker 

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



[issue31165] list_slice() does crash if the list is mutated indirectly by PyList_New()

2017-10-06 Thread STINNER Victor

Change by STINNER Victor :


--
title: null pointer deref and segfault in list_slice (listobject.c:455) -> 
list_slice() does crash if the list is mutated indirectly by PyList_New()

___
Python tracker 

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



[issue31165] null pointer deref and segfault in list_slice (listobject.c:455)

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

"Maybe we should prevent collection of garbage with circular references (that 
has __del__() or weakref callbacks) from PyObject_GC_New()?"

That would be a major change in the garbage collector. I would prefer to not 
touch the GC, any change can introduce a complex regression.

Running the GC when an object is allocated makes sense to me. It's to reclaim 
memory, and prevent a MemoryError which would only be caused by "missed GC".

--

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Do you going to backport also -X showrefcount?

--

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

My colleague Iryna Shcherbina came to me with this issue. I'm not sure that we 
really need to support COUNT_ALLOCS. But strangely, it seems simpler to fix 
bugs rather than guessing if users like this debug mode or not :-)

There are different ways to fix tests to make them passing with COUNT_ALLOCS. 
As I wrote, I would prefer to add a new Python 2.7 option to explicitly asks to 
dump allocations statistics: add a new PYTHONSHOWALLOCCOUNT=1 environment 
variable for example.

What do you think Serhiy? Do you prefer to decorate many 2.7 tests to skip them 
if COUNT_ALLOCS is used, or to add a new option?

I should try to implement -X showalloccount :-)

--

___
Python tracker 

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



[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-06 Thread Oren Milman

Oren Milman  added the comment:

Yes, although i don't know if there are usecases for that.

--

___
Python tracker 

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



[issue31719] [2.7] test_regrtest.test_crashed() fails on s390x

2017-10-06 Thread STINNER Victor

New submission from STINNER Victor :

On the s390x architecture, the test_regrtest.test_crashed() fails because 
Python doesn't crash.

test.support._crash_python() calls ctypes.string_at(0) to crash Python. In 
debug mode, ctypes.string_at(0) fails with an assertion error and the process 
is killed with the SIGABRT signal. In release mode, ctypes.string_at(0) returns 
an empty string but doesn't crash.

Attached PR adds a new _testcapi._read_null() function which does crash in a 
reliable way on s390x and x86 :-) The function uses the C "volatile" keyword to 
prevent compiler optimizations. I copied the code from my 
faulthandler._read_null() function in the master branch which was battle 
tested. It does crash on all platforms... except of AIX.

--
components: Tests
messages: 303854
nosy: haypo
priority: normal
severity: normal
status: open
title: [2.7] test_regrtest.test_crashed() fails on s390x
versions: Python 2.7

___
Python tracker 

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



[issue31719] [2.7] test_regrtest.test_crashed() fails on s390x

2017-10-06 Thread STINNER Victor

Change by STINNER Victor :


--
keywords: +patch
pull_requests: +3885
stage:  -> patch review

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread Iryna Shcherbina

Iryna Shcherbina  added the comment:

> I don't know if we can easily implement "-X showalloccount", since
> Python 2.7 doesn't have sys._xoptions. Maybe we could use a new
> environment variable instead: PYTHONSHOWALLOCCOUNT=1?


That is how it is bypassed in Fedora Py2 builds currently. I am attaching the 
patch we use.

--
Added file: 
https://bugs.python.org/file47196/00125-less-verbose-COUNT_ALLOCS.patch

___
Python tracker 

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



[issue31719] [2.7] test_regrtest.test_crashed() fails on s390x

2017-10-06 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +cstratak, ishcherb

___
Python tracker 

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



[issue31165] list_slice() does crash if the list is mutated indirectly by PyList_New()

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This is different case than mutating a dict while iterate it. In this case the 
failure is caused by GC, and it is always hard to handle such issues. In case 
of a dict you can just copy it before iterating. But what to do with 
RuntimeError from slicing a list if copying a list is vulnerable to the same 
issue?

The example of yet one solution you can see in dict_keys() in dictobject.c. I 
always wondered why this code is needed.

--

___
Python tracker 

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



[issue31165] list_slice() does crash if the list is mutated indirectly by PyList_New()

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

> This is different case than mutating a dict while iterate it. In this case 
> the failure is caused by GC, and it is always hard to handle such issues. In 
> case of a dict you can just copy it before iterating. But what to do with 
> RuntimeError from slicing a list if copying a list is vulnerable to the same 
> issue?

This issue was found by fuzzing with weird destructor. I don't think that 
anyone will hit the bug with "normal" code in the wild. Otherwise, we would 
have get a bug report before this one.

--

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I left this on to Benjamin, the RM of Python 2.7.

--

___
Python tracker 

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



[issue31692] [2.7] Test `test_huntrleaks()` of test_regrtest fails in debug build with COUNT_ALLOCS

2017-10-06 Thread STINNER Victor

STINNER Victor  added the comment:

Serhiy:
> Do you going to backport also -X showrefcount?

I see -X as a Python3 only thing. If I have to choose, I would prefer to add a 
new environment variable, since it's more in the "Python2 style".

Iryna:
> That is how it is bypassed in Fedora Py2 builds currently. I am attaching the 
> patch we use.

Oh, nice to see that we get the same idea: opt-in environment variable.

I'm unhappy with the variable name: PYTHONDUMPCOUNTS seems too generic IMHO :-(

I prefer "PYTHONSHOWALLOCCOUNT" since it's closer to Python 3 "-X 
showalloccount" option, and "alloc" mentions that they are counters on 
allocations. Not just "random" counters.

--

___
Python tracker 

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



[issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

There is other issues with IncrementalNewlineDecoder.__init__ -- it leaks 
references when called repeatedly.

The simplest solution of both issues will be moving the initialization to the 
new method. But this class looks designed for subclassing, and this can break 
subclasses that change arguments before passing them to the superclass' 
constructor.

--

___
Python tracker 

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



[issue31165] list_slice() does crash if the list is mutated indirectly by PyList_New()

2017-10-06 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Or the bug is so hard for reproducing, that nobody had enough information for 
reporting.

--

___
Python tracker 

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



[issue31340] Use VS 2017 compiler for build

2017-10-06 Thread Christoph Gohlke

Christoph Gohlke  added the comment:

I have Visual Studio 2015 and Visual Studio 2017 Community editions with latest 
patches installed.

Building a minimal C extension on Python 3.6.3 with distutils now uses MSVC 
14.11.25503. That is unexpected.

When building complex extensions that link to static libraries that were built 
with MSVC 14.0, linking fails, e.g. when building Pillow:

'jpeg.lib' was created with an older compiler than other objects; rebuild old 
objects and libraries

It looks like practically v141 is not binary compatible with v140.

--
nosy: +cgohlke

___
Python tracker 

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



[issue31340] Use VS 2017 compiler for build

2017-10-06 Thread Steve Dower

Steve Dower  added the comment:

Build artifacts (static libraries, in this case) are not compatible, but the 
built binaries are.

This may be a reasonable argument for not updating distutils's support in minor 
versions (and I'm totally happy to just stop updating distutils period - see 
the recent distutils-sig discussion for more context). If it had been raised 
before 3.6.3 was released then I'd have switched it back (or at least swapped 
the order, so if v140 was found then it would use that first and fall back on 
v141). Now it's done, I'm not sure whether it hurts more to change it again in 
3.6.4 or not...

The immediate workaround is to set DISTUTILS_USE_SDK and run in a VS 2015 
command prompt, which will bypass all the search logic. Better to rebuild the 
static libraries with v141 as well, but I know that's not trivial or always 
feasible. Alternatively, build with Python 3.6.2 or earlier - until we get the 
ABI stability properly figured out, that's still the best way to ensure 
compatibility with older releases.

I'll give the change back some more thought.

--

___
Python tracker 

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



[issue31340] Use VS 2017 compiler for build

2017-10-06 Thread Christoph Gohlke

Christoph Gohlke  added the comment:

I build most of my binaries after calling the correct vcvarsall.bat so I did 
not notice until today, when I was trying to build outside that environment. 

Also, I misread your comment (https://bugs.python.org/issue31340#msg301538) 
earlier and did not worry at that time.

I guess this might become a bigger issue once Appveyor switches to Python 
3.6.3. Projects using Anaconda's prebuilt static libraries for v140 will fail 
to link.

How about giving priority to VS 2015, i.e. "If you have VS 2015 then it will 
use that"?

--

___
Python tracker 

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



[issue31712] subprocess with stderr=subprocess.STDOUT hang

2017-10-06 Thread Martin Panter

Martin Panter  added the comment:

Presumuing your file descriptor 3 is the read end of the pipe to the child’s 
output, then there is probably a process somewhere that could still write to 
the write end. Normally “check_output” waits until it has read all possible 
output from the pipe(s).

This is probably not a bug in Python. Maybe it is a bug with SSH or your “MUX” 
(you didn’t explain what that is) leaving a process running in the background 
that could output to stderr. Try to track down what processes have your pipe 
open. Find out the number that identifies the pipe. It is the node number in 
the “lsof” command, or in the symbolic link under /proc:

$ lsof -a -c python -d 3
COMMAND   PIDUSER   FD   TYPE DEVICE SIZE/OFFNODE NAME
python3 26025 vadmium3r  FIFO0,8  0t0 4913217 pipe
$ ls -l "/proc/$(pgrep python)/fd/3"
lr-x-- 1 vadmium vadmium 64 Oct  6 22:17 /proc/26025/fd/3 -> pipe:[4913217]

Then look through the other files to find if other process(es) have the write 
end of the pipe open; “cat” in my example:

$ lsof | grep 4913217
python3   26025   vadmium3r FIFO0,8  0t04913217 pipe
cat   26026   vadmium1w FIFO0,8  0t04913217 pipe
$ ls -l /proc/*/fd/* | grep 4913217
lr-x-- 1 vadmium vadmium 64 Oct  6 22:17 /proc/26025/fd/3 -> pipe:[4913217]
l-wx-- 1 vadmium vadmium 64 Oct  6 22:16 /proc/26026/fd/1 -> pipe:[4913217]

The general problem does seem to be a recurring thing with the subprocess 
module, so maybe more documentation or other enhancements could help. Similar 
reports:

* Issue 31447: communicate not respecting timeout due to grandchild process
* Issue 30154: subprocess.run with timeout and output pipe from grandchild
* Issue 26534: check_output with shell=True and timeout doesn’t kill shell’s 
child
* Issue 23213: communicate hang with stderr leaked in “systemd” daemon
* Issue 13422: communicate hangs as long as a daemon leaves pipes open
* Issue 4216: communicate hang after starting “cpboot” service

--
nosy: +martin.panter

___
Python tracker 

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



[issue31712] subprocess with stderr=subprocess.STDOUT hang

2017-10-06 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

Please try to reproduce this with Python 3.6.

On 2.7, I highly recommend you stop using the Python 2.7 subprocess module and 
install the subprocess32 backport available on PyPI. It is *much* more reliable.

--

___
Python tracker 

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



[issue31340] Use VS 2017 compiler for build

2017-10-06 Thread Steve Dower

Steve Dower  added the comment:

> How about giving priority to VS 2015

That would be the fix, but it's not worth releasing an immediate 3.6.4 IMHO and 
by the time 3.6.4 comes about it could be more pain to change back than to 
leave it. That's the balance I'm thinking about for a while.

Including Ned so he's aware. If we do a snap 3.6.4 for some other reason then 
it's worth swapping the order, but after a few months out there I think the 
damage, small as it is, will have been dealt with.

--
nosy: +ned.deily

___
Python tracker 

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



[issue31340] Use VS 2017 compiler for build

2017-10-06 Thread Ned Deily

Ned Deily  added the comment:

If you think we should do a 3.6.4 to address this, we can do that.  I'll leave 
it up to your judgement.

--

___
Python tracker 

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



[issue31507] email.utils.parseaddr has no docstring

2017-10-06 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 93c0885dc84381cbbb970402b1a21bf690ee312c by Mariatta (Rohit 
Balasubramanian) in branch '3.6':
bpo-31507 Add docstring to parseaddr function in email.utils.parseaddr 
(GH-3647) (GH-3733)
https://github.com/python/cpython/commit/93c0885dc84381cbbb970402b1a21bf690ee312c


--
nosy: +Mariatta

___
Python tracker 

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



[issue31507] email.utils.parseaddr has no docstring

2017-10-06 Thread Mariatta Wijaya

Change by Mariatta Wijaya :


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