[issue17972] inspect module docs omits many functions

2018-11-06 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue22355] inconsistent results with inspect.getsource / .getsourcelines

2018-11-06 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think this issue is covered with issue35101. It has an open PR as per the 
proposed fix with tests : https://github.com/python/cpython/pull/10209/files

--
nosy: +xtreak

___
Python tracker 

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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-06 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy:  -miss-islington
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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-06 Thread miss-islington


miss-islington  added the comment:


New changeset 25bd1073996f26ad4895d3eb2d09315361c3cc84 by Miss Islington (bot) 
in branch '3.6':
bpo-33000: Document that IDLE's shell has no line limit. (GH-10373)
https://github.com/python/cpython/commit/25bd1073996f26ad4895d3eb2d09315361c3cc84


--

___
Python tracker 

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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-06 Thread miss-islington


miss-islington  added the comment:


New changeset 2b2a8c130ceb47842cfbd0c725b5b6599b26cf27 by Miss Islington (bot) 
in branch '3.7':
bpo-33000: Document that IDLE's shell has no line limit. (GH-10373)
https://github.com/python/cpython/commit/2b2a8c130ceb47842cfbd0c725b5b6599b26cf27


--
nosy: +miss-islington

___
Python tracker 

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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9675

___
Python tracker 

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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9676

___
Python tracker 

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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 76cd0c30d60961d1a10e2673834a455d2b51f695 by Terry Jan Reedy in 
branch 'master':
bpo-33000: Document that IDLE's shell has no line limit. (#10373)
https://github.com/python/cpython/commit/76cd0c30d60961d1a10e2673834a455d2b51f695


--

___
Python tracker 

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



[issue33000] IDLE Doc: Text consumes unlimited RAM, consoles likely not

2018-11-06 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +9674
stage: needs patch -> patch review

___
Python tracker 

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



[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

Since this is how it works since 3.6, I think it's reasonable to make this part 
of the spec. For dictionary order we waited a release between implementing it 
that way and making it part of the spec; effectively we've already waited two 
releases (3.6 and 3.7) for this. So I say let's do it. This isn't something 
that's PEP-worthy anyway.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue35180] Ctypes segfault or TypeError tested for python2.7 and 3

2018-11-06 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

As soon as you use ctypes, you sign up for all the security vulnerabilities, 
including denial of service, buffer overrun, use-after-free, etc. that plain 
old C programs are subject to. In this case, it's just a NULL pointer 
dereference (read: segfault in most normal cases), but in general, if you don't 
use ctypes with the same discipline as you would actual C code (at best it 
provides a little in the way of automatic memory management), you're subject to 
all the same problems.

Side-note: When replying to e-mails, don't include the quotes from the e-mail 
you're replying to; it just clutters the tracker.

--

___
Python tracker 

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



[issue33529] Infinite loop on folding email if headers has no spaces

2018-11-06 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +9673

___
Python tracker 

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



[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I would kindly suggest waiting until there is some consensus on this before 
doing any Pull Request.

--

___
Python tracker 

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



[issue33678] selector_events.BaseSelectorEventLoop.sock_connect should preserve socket type

2018-11-06 Thread Gus Goulart


Gus Goulart  added the comment:

This error seems to come from base_events.py, lines 142-145, and since it's an 
OS specific limitation, I can't see Sebastien's suggestion as a feasible 
solution.
Maybe we could come up with something along the lines of the following patch. 
What do you think about it?

diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index 3726c556d4..15ee4d9d1b 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -142,6 +142,9 @@ def _ipaddr_info(host, port, family, type, proto):
 if '%' in host:
 # Linux's inet_pton doesn't accept an IPv6 zone index after host,
 # like '::1%lo0'.
+if sys.platform.startswith('linux'):
+return OSError("Linux's inet_pton doesn't accept an IPv6 "
+   "zone index after host")
 return None
 
 for af in afs:
diff --git a/Lib/test/test_asyncio/test_base_events.py 
b/Lib/test/test_asyncio/test_base_events.py
index 6d544d1eda..1b944ff89e 100644
--- a/Lib/test/test_asyncio/test_base_events.py
+++ b/Lib/test/test_asyncio/test_base_events.py
@@ -109,6 +109,9 @@ class BaseEventTests(test_utils.TestCase):
 self.assertIsNone(
 base_events._ipaddr_info('::3', 1, INET, STREAM, TCP))
 
+@unittest.skipIf(sys.platform.startswith('linux'),
+"Linux's inet_pton doesn't accept an IPv6 zone index after host")
+def test_for(self):
 # IPv6 address with zone index.
 self.assertIsNone(
 base_events._ipaddr_info('::3%lo0', 1, INET6, STREAM, TCP))

--
keywords: +patch
nosy: +gus.goulart, taleinat
Added file: https://bugs.python.org/file47913/issue33678.patch

___
Python tracker 

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



[issue35170] 3.7.1 compile failure on CentOS 6.10; _ctypes did not build

2018-11-06 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage:  -> resolved
status:  -> closed

___
Python tracker 

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



[issue35081] Move internal headers to Include/internal/

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 9fc57a384825530635ef5ec093a31d864ea14f7c by Victor Stinner in 
branch 'master':
bpo-35081: Add pycore_fileutils.h (GH-10371)
https://github.com/python/cpython/commit/9fc57a384825530635ef5ec093a31d864ea14f7c


--

___
Python tracker 

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



[issue35181] Doc: Namespace Packages: Inconsistent documentation of __loader__ being None

2018-11-06 Thread Barry A. Warsaw


Change 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



[issue35170] 3.7.1 compile failure on CentOS 6.10; _ctypes did not build

2018-11-06 Thread lana.deere


lana.deere  added the comment:

I did 'yum install libffi-devel' on my machine as suggested and that cured the 
ctypes issue.  This issue can be closed; if I run into any
other problems I can open other issues for them.

--

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:

> I've checked it, everything works as Victor described.

Yeah! That's great when it just works!

--

___
Python tracker 

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



[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Pekka Klärck

Pekka Klärck  added the comment:

Haven't created a PR yet. Go ahead and great one if you have time Luna! We'd 
need a decision about this too, but if the decision is no, then it would 
nevertheless be a good idea to mention in the docs that the order is not 
guaranteed.

--

___
Python tracker 

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



[issue34655] Support sendfile in asyncio streams API

2018-11-06 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

My initial thought was that os.sendfile() raises OSError on sending more than 
0x7fff_f000 but I was wrong.
I've checked it, everything works as Victor described.

Thank you guys for the feedback.

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



[issue35181] Doc: Namespace Packages: Inconsistent documentation of __loader__ being None

2018-11-06 Thread Julien Palard

New submission from Julien Palard :

The documentation states that a __loader__ of a namespace package should be 
None:

- [1] "For namespace packages this should be set to None."
- [2] "To indicate to the import machinery that the spec represents a namespace 
portion. the path entry finder sets “loader” on the spec to None".

But this looks wrong [3], looks like it has been changed in [4]/[5].

I think one should rely on __file__ being None on namespace packages (which 
make sense as they span over multiple directories) instead of __loader__ being 
None (a side effect of the import machinery ?).


[1]: 
https://docs.python.org/3/library/importlib.html#importlib.machinery.ModuleSpec.loader
[2]: https://docs.python.org/3/reference/import.html#path-entry-finder-protocol
[3]: 
https://stackoverflow.com/questions/52869541/namespace-package-spec-loader-and-loader-attributes-not-set-to-none
[4]: https://bugs.python.org/issue32303
[5]: 
https://github.com/python/cpython/pull/5481/files#diff-a6592cec2ebc8dba9bbf7d396370b138L319

--
assignee: docs@python
components: Documentation
messages: 329392
nosy: docs@python, mdk
priority: normal
severity: normal
status: open
title: Doc: Namespace Packages: Inconsistent documentation of __loader__ being 
None
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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I merged a first edition of the new section.  It does not include Mac behavior, 
so will need revision.  But I want to do some experiments with tk/inter on 
various systems before doing so.

--
dependencies: +IDLE Doc: Text consumes unlimited RAM, consoles likely not
stage: patch review -> needs patch

___
Python tracker 

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



[issue35081] Move internal headers to Include/internal/

2018-11-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +9672

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:

The manual page says:

   sendfile() will transfer  at  most  0x7000  (2,147,479,552)  bytes,
   returning  the  number of bytes actually transferred.  (This is true on
   both 32-bit and 64-bit systems.)

I understand that you can pass a larger length, but a single sendfile() 
function call will never copy more than 0x7000 bytes. I see nothing wrong 
here.

If you want to be sure, try to copy more bytes than 0x7000 and see what 
happens :-) Use strace to check system calls.

--

___
Python tracker 

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



[issue34805] Explicitly specify `MyClass.__subclasses__()` returns classes in definition order

2018-11-06 Thread Luna Chen

Luna Chen  added the comment:

Hi Pekka Klärck, I would like to work on this issue and make a PR if you 
haven't done it yet. 

Thanks!:)

--
nosy: +BNMetrics

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:

> In that case I think asyncio's sendfile() should simply do the math to 
> transmit that many bytes by taking into account that os.sendfile() may return 
> less bytes than requested.

The internal sendfile() implementation in asyncio already loops until all bytes 
are sent. Extract of unix_events.py:

def _sock_sendfile_native_impl(self, fut, registered_fd, sock, fileno,
   offset, count, blocksize, total_sent):
...
try:
sent = os.sendfile(fd, fileno, offset, blocksize)
except (BlockingIOError, InterruptedError):
...
else:
if sent == 0:
# EOF
self._sock_sendfile_update_filepos(fileno, offset, total_sent)
fut.set_result(total_sent)
else:
offset += sent
total_sent += sent
self.add_writer(fd, self._sock_sendfile_native_impl, fut, ...)

asyncio doesn't need to be modified.

--

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:

os.write(data) can write less than len(data) bytes. It's by contract, as 
socket.send(data) can send less than len(data).

It is used to truncated the length argument to INT_MAX, to be able to cast it 
to an int on Windows. Extract of _Py_write():

#ifdef MS_WINDOWS
if (count > 32767 && isatty(fd)) {
/* Issue #11395: the Windows console returns an error (12: not
   enough space error) on writing into stdout if stdout mode is
   binary and the length is greater than 66,000 bytes (or less,
   depending on heap usage). */
count = 32767;
}
#endif
if (count > _PY_WRITE_MAX) {
count = _PY_WRITE_MAX;
}

with:

#if defined(MS_WINDOWS) || defined(__APPLE__)
/* On Windows, the count parameter of read() is an int (bpo-9015, bpo-9611).
   On macOS 10.13, read() and write() with more than INT_MAX bytes
   fail with EINVAL (bpo-24658). */
#   define _PY_READ_MAX  INT_MAX
#   define _PY_WRITE_MAX INT_MAX
#else
/* write() should truncate the input to PY_SSIZE_T_MAX bytes,
   but it's safer to do it ourself to have a portable behaviour */
#   define _PY_READ_MAX  PY_SSIZE_T_MAX
#   define _PY_WRITE_MAX PY_SSIZE_T_MAX
#endif



Can we do something similar for sendfile()?

--
nosy: +vstinner

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

Do you mean raising an exception if "count" argument is passed and > 
2,147,479,552? In that case I think asyncio's sendfile() should simply do the 
math to transmit that many bytes by taking into account that os.sendfile() may 
return less bytes than requested. With non-blocking sockets in particular that 
is true regardless from the size being passed.

--

___
Python tracker 

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



[issue35178] Typo/trivial mistake in warnings.py (may be related to 2.x to 3.x conversion)

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:

> Typo/trivial mistake in warnings.py (may be related to 2.x to 3.x conversion)

It's not a typo: it's that my change now requires the last argument of 
formatwarning() to be a keyword argument called 'line'.

The error comes from numpy.

But I'm fine to now require that the last formatwarning() argument is called 
'line' and pass its value as an positional argument, not as a keyword argument.

In that case, I would like to see an unit test to check that replacing 
warnings.formatwarning() with a new function and the last parameter of this 
function is not called 'line' still works.

--

___
Python tracker 

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



[issue35170] 3.7.1 compile failure on CentOS 6.10; _ctypes did not build

2018-11-06 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

The in-tree copy of libffi was removed in #27979 (between 3.6 and 3.7) for all 
platforms except Windows and macOS. Therefore, you need libffi development 
package installed in your system to build CPython 3.7. 

As for PIP, personally, I think that's an overkill to require ctypes, 
especially at CPython build time. If you don't want to build ctypes, I believe 
you may use '--without-ensurepip' configure option as a workaround.

--
nosy: +izbyshev, zach.ware

___
Python tracker 

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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2018-11-06 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

You should start from master.  Bugfixes can backported afterwards if 
appropriate.  Thanks!

--

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2018-11-06 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Ah sorry, I was typing so long and had an idle session that I didn't realize 
@r.david.murray added a comment with the explanation. Just to add I tried using 
Perl module (https://metacpan.org/release/Email-Address) that uses regex for 
parsing that returns me two addresses and the regex is also not much 
comprehensible.

use v5.14;
use Email::Address;

my $line = 'John Doe j...@example.com ';
my @addresses = Email::Address->parse($line);
say $addresses[0];
say $addresses[1];

say "Angle address regex";
say $Email::Address::angle_addr;


j...@example.com
ot...@example.net
Angle address regex
(?^:(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*<(?^:(?^:(?^:(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*(?^:[^\x00-\x1F\x7F()<>\[\]:;@\\,."\s]+(?:\.[^\x00-\x1F\x7F()<>\[\]:;@\\,."\s]+)*)(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*)|(?^:(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*"(?^:(?^:[^\\"])|(?^:\\(?^:[^\x0A\x0D])))*"(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*))\@(?^:(?^:(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*(?^:[^\x00-\x1F\x7F()<>\[\]:;@\\,."\s]+(?:\.[^\x00-\x1F\x7F()<>\[\]:;@\\,."\s]+)*)(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*)|(?^:(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*\[(?:\s*(?^:(?^:[^\[\]\\])|(?^:\\(?^:[^\x0A\x0D]*\s*\](?^:(?^:\s*\((?:\s*(?^:(?^:(
 
?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*)))>(?^:(?^:\s*\((?:\s*(?^:(?^:(?>[^()\\]+))|(?^:\\(?^:[^\x0A\x0D]))|))*\s*\)\s*)|\s+)*)


Thanks

--

___
Python tracker 

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



[issue22393] multiprocessing.Pool shouldn't hang forever if a worker process dies unexpectedly

2018-11-06 Thread Oscar Esteban


Oscar Esteban  added the comment:

Hi Antoine,

I may take a stab at it. Before I start, should I branch from master or from 
3.7.1 (as 3.7 is still accepting bugfixes).

Best,
Oscar

--

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2018-11-06 Thread Mark Sapiro


Mark Sapiro  added the comment:

I agree that my example with an @ in the 'display name', although actually seen 
in the wild, is non-compliant, and that the behavior of parseaddr() in this 
case is not a bug.

Sorry for the noise.

--

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2018-11-06 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Is this a case of realname having @ inside an unquoted string? As I can see 
from the RFC the acceptable characters of an atom other than alphabets and 
digits that comprises a phrase are ['!', '#', '$', '%', '&', "'", '*', '+', 
'-', '/', '=', '?', '^', '_', '`', '{', '|', '}', '~'] . So just curious if 
it's a case of @ inside unquoted string as name?

>>> for char in accepted:
... print(parseaddr(f'John Doe jdoe{char}example.com '))
...
('John Doe jdoe!example.com', 'ot...@example.net')
('John Doe jdoe#example.com', 'ot...@example.net')
('John Doe jdoe$example.com', 'ot...@example.net')
('John Doe jdoe%example.com', 'ot...@example.net')
('John Doe jdoe', 'ot...@example.net')
("John Doe jdoe'example.com", 'ot...@example.net')
('John Doe jdoe*example.com', 'ot...@example.net')
('John Doe jdoe+example.com', 'ot...@example.net')
('John Doe jdoe-example.com', 'ot...@example.net')
('John Doe jdoe/example.com', 'ot...@example.net')
('John Doe jdoe=example.com', 'ot...@example.net')
('John Doe jdoe?example.com', 'ot...@example.net')
('John Doe jdoe^example.com', 'ot...@example.net')
('John Doe jdoe_example.com', 'ot...@example.net')
('John Doe jdoe`example.com', 'ot...@example.net')
('John Doe jdoe{example.com', 'ot...@example.net')
('John Doe jdoe|example.com', 'ot...@example.net')
('John Doe jdoe}example.com', 'ot...@example.net')
('John Doe jdoe~example.com', 'ot...@example.net')

>>> parseaddr('"John Doe j...@example.com" ')
('John Doe j...@example.com', 'ot...@example.net')

>>> parseaddr('John Doe j...@example.com ')
('', 'John Doe j...@example.com')

--
nosy: +xtreak

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2018-11-06 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
assignee: davin -> 
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2018-11-06 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset bccacd19fa7b56dcf2fbfab15992b6b94abb by Antoine Pitrou 
(Alexander Buchkovsky) in branch 'master':
bpo-17560: Too small type for struct.pack/unpack in mutliprocessing.Connection 
(GH-10305)
https://github.com/python/cpython/commit/bccacd19fa7b56dcf2fbfab15992b6b94abb


--

___
Python tracker 

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



[issue30455] Generate all tokens related code and docs from Grammar/Tokens

2018-11-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
title: Generate C code from token.py and not vice versa -> Generate all tokens 
related code and docs from Grammar/Tokens
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2018-11-06 Thread R. David Murray


R. David Murray  added the comment:

The formatting of that doctest paragraph got messed up.  Let me try again:

>>> m = message_from_string("From: John Doe j...@example.com 
\n\n", policy=default)
>>> m['From'].addresses
(Address(display_name='', username='John Doe jdoe', domain='example.com'),)

--

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2018-11-06 Thread R. David Murray


R. David Murray  added the comment:

>>> m = message_from_string("From: John Doe j...@example.com 
>>> \n\n", policy=default)
>>> m['From'].addresses(Address(display_name='', username='John Doe jdoe', 
domain='example.com'),)

The new policies have more error recovery for non-RFC compliant addresses than 
decode_header, but the two agree in this case.  What is happening here is that 
(1) an unquoted/unencoded '@' is not allowed in a display name (2) if the 
address is not '<>' quoted, then everything before the @ is the username and 
(3) in the absence of a comma after the end of the fqdn (which is not allowed 
to contain blanks) any additional tokens are discarded.

One could argue that we could treat the blank after the FQDN as a "missing 
comma", and there would be some merit to that argument.  You could also argue 
that a "<>" quoted string would trump the occurrence of the @ earlier in the 
token list.  However, the RFC822 grammar is designed to be parsed character by 
character, so that would not be a typical way for an RFC822 parser to try to do 
postel-style error recovery.

So, I don't think there is a bug here, but I'd be curious what other email 
address parsing libraries do, and that could influence whether extensions to 
the "make a guess when the string doesn't conform to the RFC" code would be 
acceptable.

--

___
Python tracker 

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



[issue30455] Generate C code from token.py and not vice versa

2018-11-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Alternate PR 10370 generates all files from a single file Grammar/Tokens using 
a single script Tools/scripts/generate_token.py.

In addition, the script doesn't write files when the content is not changed. 
Thus it can be used with read-only sources.

--

___
Python tracker 

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



[issue30455] Generate C code from token.py and not vice versa

2018-11-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +9671

___
Python tracker 

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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 7476fefb65075161d57435c8dd7e92437578d3c1 by Terry Jan Reedy (Miss 
Islington (bot)) in branch '3.6':
bpo-23220: Explain how IDLE's Shell displays output (GH-10356) (#10369)
https://github.com/python/cpython/commit/7476fefb65075161d57435c8dd7e92437578d3c1


--

___
Python tracker 

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



[issue35169] Improve error messages for assignment

2018-11-06 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9670

___
Python tracker 

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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread miss-islington


miss-islington  added the comment:


New changeset 34fcee9ed81c954d6418241ad546f71e103d3b9b by Miss Islington (bot) 
in branch '3.7':
bpo-23220: Explain how IDLE's Shell displays output (GH-10356)
https://github.com/python/cpython/commit/34fcee9ed81c954d6418241ad546f71e103d3b9b


--
nosy: +miss-islington

___
Python tracker 

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



[issue9731] Add ABCMeta.has_methods and tests that use it

2018-11-06 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9669

___
Python tracker 

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2018-11-06 Thread Mark Sapiro


Mark Sapiro  added the comment:

The issue is illustrated much more simply as follows:

email.utils.parseaddr('John Doe j...@example.com ')

returns

('', 'John Doe j...@example.com')

whereas it should return

('John Doe j...@example.com', 'ot...@example.net')

I'll look at developing a patch.

--
nosy: +msapiro

___
Python tracker 

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



[issue22021] shutil.make_archive() root_dir do not work

2018-11-06 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
pull_requests: +9668
stage: needs patch -> patch review

___
Python tracker 

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



[issue22021] shutil.make_archive() root_dir do not work

2018-11-06 Thread Tobias Kunze


Tobias Kunze  added the comment:

Yes, this is a documentation issue: A patch clarifying what root_dir and 
base_dir do, and how they interact (or how they are to be used in combination) 
would be sufficient to close this issue.

--

___
Python tracker 

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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9667

___
Python tracker 

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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9666

___
Python tracker 

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



[issue23220] IDLE: Document how Shell displays user code output

2018-11-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 75d9d59ab3a372d3d78e6a1f5e9f256e29d0a9a6 by Terry Jan Reedy in 
branch 'master':
bpo-23220: Explain how IDLE's Shell displays output (GH-10356)
https://github.com/python/cpython/commit/75d9d59ab3a372d3d78e6a1f5e9f256e29d0a9a6


--

___
Python tracker 

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



[issue35180] Ctypes segfault or TypeError tested for python2.7 and 3

2018-11-06 Thread Bob

Bob  added the comment:

Hi Josh thanks for answering me and so quick.
So if I understood correctly, by inserting an unexpected and unchecked on 
value, it could lead to a potential vulnerability in the program? Or just a 
plain failure (which could be a denial of service also)?

Thanks again.

Sent with ProtonMail Secure Email.

‐‐‐ Original Message ‐‐‐
On Tuesday, November 6, 2018 5:07 PM, Josh Rosenberg  
wrote:

> Josh Rosenberg shadowranger+pyt...@gmail.com added the comment:
>
> The TypeError on Py3 would be because functions taking c_char_p need 
> bytes-like objects, not str, on Python 3. '%s' % directory is pointless when 
> directory is a str; instead you need to encode it to a bytes-like object, 
> e.g. opendir(os.fsencode(directory)) (os.fsencode is Python 3 specific; plain 
> str works fine on Py 2).
>
> Your segfault isn't occurring when you load dirfd, it occurs when you call it 
> on the result of opendir, when opendir returned NULL on failure (due to the 
> non-existent directory you call it with). You didn't check the return value, 
> and end up doing flagrantly illegal things with it.
>
> In neither case is this a bug in Python; ctypes lets you do evil things that 
> break the rules, and if you break the rules the wrong way, segfaults are to 
> be expected. Fix your argument types (for Py3), check your return values (for 
> Py2).
>
> ---
>
> nosy: +josh.r
> resolution: -> not a bug
> stage: -> resolved
> status: open -> closed
>
> Python tracker rep...@bugs.python.org
> https://bugs.python.org/issue35180

--

___
Python tracker 

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



[issue35180] Ctypes segfault or TypeError tested for python2.7 and 3

2018-11-06 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

The TypeError on Py3 would be because functions taking c_char_p need bytes-like 
objects, not str, on Python 3. '%s' % directory is pointless when directory is 
a str; instead you need to encode it to a bytes-like object, e.g. 
opendir(os.fsencode(directory)) (os.fsencode is Python 3 specific; plain str 
works fine on Py 2).

Your segfault isn't occurring when you load dirfd, it occurs when you call it 
on the result of opendir, when opendir returned NULL on failure (due to the 
non-existent directory you call it with). You didn't check the return value, 
and end up doing flagrantly illegal things with it.

In neither case is this a bug in Python; ctypes lets you do evil things that 
break the rules, and if you break the rules the wrong way, segfaults are to be 
expected. Fix your argument types (for Py3), check your return values (for Py2).

--
nosy: +josh.r
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



[issue35180] Ctypes segfault or TypeError tested for python2.7 and 3

2018-11-06 Thread Bob


New submission from Bob :

~Description of the problem:

I was using ctypes to get a directory file descriptor, and to do so I found 
this mailing list (https://lists.gt.net/python/dev/696028) from 2008 where a 
user wrote a piece that could do what the asking user and me were looking for.
What concerns me is how much this code has been used when I looked though 
Github and Google and came across the same exact pieces.

The code provided looks like this:

from ctypes import CDLL, c_char_p, c_int, Structure, POINTER
from ctypes.util import find_library

class c_dir(Structure):
"""Opaque type for directory entries, corresponds to struct DIR"""
c_dir_p = POINTER(c_dir)

c_lib = CDLL(find_library("c"))
opendir = c_lib.opendir
opendir.argtypes = [c_char_p]
opendir.restype = c_dir_p
dirfd = c_lib.dirfd < -- IT FAILS HERE // STACK TRACE PROVIDED
dirfd.argtypes = [c_dir_p]
dirfd.restype = c_int
closedir = c_lib.closedir
closedir.argtypes = [c_dir_p]
closedir.restype = c_int

dir_p = opendir(".")
print "dir_p = %r" % dir_p
dir_fd = dirfd(dir_p)
print "dir_fd = %r" % dir_fd
print "closed (rc %r)" % closedir(dir_p) 

When I implemented it in my machine, I changed it a bit so "opendir()" got its 
arguments from an imputed value, and the final program looks like this:

from ctypes import *
import sys
import ctypes
from ctypes.util import find_library

class c_dir(Structure):
"""Opaque type for directory entries, corresponds to struct DIR""" 

def get_directory_file_descriptor(directory):
c_dir_p = POINTER(c_dir)
c_lib = CDLL(find_library("c"))
opendir = c_lib.opendir
opendir.argtypes = [c_char_p]
opendir.restype = c_dir_p
dirfd = c_lib.dirfd < -- SAME. FAILS HERE.
dirfd.argtypes = [c_dir_p]
dirfd.restype = c_int
closedir = c_lib.closedir
closedir.argtypes = [c_dir_p]
closedir.restype = c_int

dir_p = opendir("%s" % directory)
print ("dir_p = %s:%r" % (directory, dir_p))
dir_fd = dirfd(dir_p)
print("dir_fd = %r" % dir_fd)
print ("closed (rc %r)" % closedir(dir_p))

get_directory_file_descriptor(sys.argv[1])

When I run it *with python 2.7*, the program runs normally if I enter the 
expected value, like "/home/". But if I don't, the program exits with a 
segmentation fault.
In python 3, it fails no matter what with a TypeError.

INPUT when NOT giving the error (in python 2.7): /home/
INPUT when giving the error: aaa

~Stack trace from python 2.7:

Program received signal SIGSEGV, Segmentation fault.
dirfd (dirp=0x0) at ../sysdeps/posix/dirfd.c:27
27  ../sysdeps/posix/dirfd.c: No such file or directory.
(gdb) bt
#0  dirfd (dirp=0x0) at ../sysdeps/posix/dirfd.c:27
#1  0x76698e40 in ffi_call_unix64 () from 
/usr/lib/x86_64-linux-gnu/libffi.so.6
#2  0x766988ab in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#3  0x768a83df in _call_function_pointer (argcount=1, 
resmem=0x7fffd630, 
restype=, atypes=, avalues=0x7fffd610, 
pProc=0x778b8960 , flags=4353)
at /build/python2.7-dPs3Rr/python2.7-2.7.12/Modules/_ctypes/callproc.c:837
#4  _ctypes_callproc (pProc=0x778b8960 , argtuple=, 
flags=4353, 
argtypes=(,), 
restype=<_ctypes.PyCSimpleType at remote 0xa38ce0>, checker=0x0)
at /build/python2.7-dPs3Rr/python2.7-2.7.12/Modules/_ctypes/callproc.c:1180
#5  0x768acd82 in PyCFuncPtr_call.lto_priv.107 
(self=self@entry=0x77e322c0, 
inargs=inargs@entry=(,), 
kwds=kwds@entry=0x0)
at /build/python2.7-dPs3Rr/python2.7-2.7.12/Modules/_ctypes/_ctypes.c:3954
#6  0x004c15bf in PyObject_Call (kw=0x0, arg=(,), 
func=<_FuncPtr(__name__='dirfd') at remote 0x77e322c0>) at 
../Objects/abstract.c:2546
#7  do_call (nk=, na=, pp_stack=0x7fffd890, 
func=<_FuncPtr(__name__='dirfd') at remote 0x77e322c0>) at 
../Python/ceval.c:4567
#8  call_function (oparg=, pp_stack=0x7fffd890) at 
../Python/ceval.c:4372
#9  PyEval_EvalFrameEx () at ../Python/ceval.c:2987
#10 0x004c136f in fast_function (nk=, na=, n=1, 
pp_stack=0x7fffd9b0, func=) at 
../Python/ceval.c:4435
#11 call_function (oparg=, pp_stack=0x7fffd9b0) at 
../Python/ceval.c:4370
#12 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
#13 0x004b9ab6 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
#14 0x004eb30f in PyEval_EvalCode (
locals={'c_void_p': <_ctypes.PyCSimpleType at remote 0xa3df50>, 'c_int64': 
<_ctypes.PyCSimpleType at remote 0xa1d7b0>, 'c_ssize_t': <_ctypes.PyCSimpleType 
at remote 0xa1d7b0>, 'c_longdouble': <_ctypes.PyCSimpleType at remote 
0xa3c360>, 'Union': <_ctypes.UnionType at remote 0x76abc400>, 'cdll': 
) at remote 0x77e2c450>, 
'c_wchar': <_ctypes.PyCSimpleType at remote 0xa3f0b0>, 'memset': , 'c_bool': <_ctypes.PyCSimpleType at remote 
0xa3e620>, 'CFUNCTYPE': , 'DEFAULT_MODE': 0, 
'string_at': , 'c_voidp': 
<_ctypes.PyCSimpleType at re---Type  to continue, or q  to 
quit---
mote 0xa3df50>, '__name__': '__main__', 'c_uint64': 

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
nosy: +giampaolo.rodola -ned.deily, ronaldoussoren

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
components: +Library (Lib), asyncio -macOS
nosy: +yselivanov

___
Python tracker 

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



[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov


New submission from Andrew Svetlov :

On Linux maximum data size for sendfile call is 0x7000: 

sendfile() will transfer at most 0x7000 (2,147,479,552) bytes,  returning  
the  number  of  bytes  actually
transferred.  (This is true on both 32-bit and 64-bit systems.)

Limiting max block size to this value on all OSes makes sense: splitting 
transferring the very huge file into several syscalls doesn't hurt performance 
anyway.

Windows uses DWORD for size in TransmitFile, so the size is limited as well.

--
components: macOS
messages: 329366
nosy: asvetlov, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Limit max sendfile chunk to 0x7000
versions: 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



[issue22021] shutil.make_archive() root_dir do not work

2018-11-06 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

Since Serhiy said that this is a pure documentation issue, I thought that a doc 
PR is all that was needed, which I would be happy to make. Am I missing 
something here?

--

___
Python tracker 

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



[issue35178] Typo/trivial mistake in warnings.py (may be related to 2.x to 3.x conversion)

2018-11-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This may be a consequence of issue26568.

--
nosy: +serhiy.storchaka, vstinner

___
Python tracker 

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



[issue35081] Move internal headers to Include/internal/

2018-11-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +9664

___
Python tracker 

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



[issue35178] Typo/trivial mistake in warnings.py (may be related to 2.x to 3.x conversion)

2018-11-06 Thread Tashrif Billah


New submission from Tashrif Billah :

```
2018-11-06 09:51:27,314 /home/tb571/Downloads/pnlpipe/pnlscripts/wmql.py DEBUG  
Running 
['/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/scripts/tract_math',
 
'/home/tb571/Downloads/pnlpipe/_data/003_GNX_007/Ukf-003_GNX_007-761f2a551e.vtk',
 'tract_remove_short_tracts', '2', '/tmp/tmpq2z9fmfc/ukfpruned.vtk']
Traceback (most recent call last):
  File 
"/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/scripts/tract_math",
 line 115, in main
tractography, *args.operation_parameters)
  File 
"/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tract_math/decorator.py",
 line 141, in wrapper
process_output(out, file_output=file_output)
  File 
"/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tract_math/decorator.py",
 line 176, in process_output
tractography_to_file(file_output, output)
  File 
"/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/__init__.py",
 line 85, in tractography_to_file
return tractography_to_vtk_file(filename, tractography, **kwargs)
  File 
"/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/vtkInterface.py",
 line 29, in tractography_to_vtk_file
tractography.tracts_data()
  File 
"/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/vtkInterface.py",
 line 324, in write_vtkPolyData
poly_data = tracts_to_vtkPolyData(tracts, tracts_data=tracts_data)
  File 
"/home/tb571/Downloads/pnlpipe/soft_dir/tract_querier-c57d670/tract_querier/tractography/vtkInterface.py",
 line 267, in tracts_to_vtkPolyData
vtk_ids = ns.numpy_to_vtkIdTypeArray(ids, deep=True)
  File 
"/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/vtk/util/numpy_support.py",
 line 198, in numpy_to_vtkIdTypeArray
return numpy_to_vtk(num_array, deep, vtk.VTK_ID_TYPE)
  File 
"/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/vtk/util/numpy_support.py",
 line 137, in numpy_to_vtk
assert not numpy.issubdtype(z.dtype, complex), \
  File 
"/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/site-packages/numpy/core/numerictypes.py",
 line 743, in issubdtype
FutureWarning, stacklevel=2
  File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/warnings.py", line 
101, in _showwarnmsg
_showwarnmsg_impl(msg)
  File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/warnings.py", line 
28, in _showwarnmsg_impl
text = _formatwarnmsg(msg)
  File "/home/tb571/miniconda3/envs/pnlpipe3/lib/python3.6/warnings.py", line 
116, in _formatwarnmsg
msg.filename, msg.lineno, line= msg.line)
TypeError: custom_formatwarning() got an unexpected keyword argument 'line'
```

--
components: Argument Clinic
messages: 329363
nosy: larry, tashrifbillah
priority: normal
pull_requests: 9663
severity: normal
status: open
title: Typo/trivial mistake in warnings.py (may be related to 2.x to 3.x 
conversion)
type: compile error
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



[issue35081] Move internal headers to Include/internal/

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5ed6995675b084fe583b71f96fdde4413bb2a77b by Victor Stinner in 
branch 'master':
bpo-35081: Add _PyCoreConfig_AsDict() (GH-10362)
https://github.com/python/cpython/commit/5ed6995675b084fe583b71f96fdde4413bb2a77b


--

___
Python tracker 

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



[issue35168] shlex punctuation_chars inconsistency

2018-11-06 Thread tphh


tphh  added the comment:

So a documentation update and a better run time error message which clarifies 
that shlex.punctuation_chars is read-only?

--

___
Python tracker 

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



[issue35081] Move internal headers to Include/internal/

2018-11-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +9662

___
Python tracker 

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



[issue35176] for loop range bug

2018-11-06 Thread Dan Armentrout


Dan Armentrout  added the comment:

Thank you for your quick explanation of this to me.

Dan

On Tue, Nov 6, 2018 at 8:04 AM Steven D'Aprano 
wrote:

>
> Steven D'Aprano  added the comment:
>
> This is not a bug, this is standard behaviour, working as designed.
>
> 'a' is not a copy of the list 'x', 'a' is another name for the same list
> as 'x'. Any in-place modifications you make to 'a' happens to the object
> itself, the list, which is visible regardless of which name you refer to it
> by.
>
> If you are a C programmer, you can think of this as being similar to
> pointers: think of 'x' as a pointer to the list, and 'a' as a pointer to
> the same list. (That's more or less what happens under the hood.) From the
> Python level, we say that both names 'a' and 'x' refer to the same object.
>
> If you want a copy, you can use the copy module, or for lists, you can
> take a slice: a = x[:] makes a copy of the list.
>
> For immutable objects like strings, you don't need a copy, because you
> cannot modify them in place: any operation on a string always creates a new
> string, leaving the old one untouched.
>
> --
> nosy: +steven.daprano
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35177] Add missing dependencies between AST/parser header files

2018-11-06 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue35177] Add missing dependencies between AST/parser header files

2018-11-06 Thread STINNER Victor


New submission from STINNER Victor :

Currently, there are *implicit* dependencies between AST/parser header files. 
For example, ast.h uses node and mod_ty types but don't include node.h nor 
Python-ast.h. And parsetok.h uses node and grammer but don't include nor 
grammar.h.

Because of that, C files have to include header files in the "correct order" 
and need to include header files even if they don't use directly.

At the end, we get something like pythonrun.c:

#include "Python-ast.h"
#include "pycore_state.h"
#include "grammar.h"
#include "node.h"
#include "token.h"
#include "parsetok.h"
#include "errcode.h"
#include "code.h"
#include "symtable.h"
#include "ast.h"
#include "marshal.h"
#include "osdefs.h"
#include 

whereas most header files are useless, pythonrun.c still compiles with:

#include "pycore_state.h"
#include "token.h"  /* INDENT in err_input() */
#include "parsetok.h"   /* PyParser_ParseFileObject() */
#include "errcode.h"/* E_EOF */
#include "symtable.h"   /* PySymtable_BuildObject() */
#include "ast.h"/* PyAST_FromNodeObject() */
#include "marshal.h"/* PyMarshal_ReadLongFromFile */
#include 

I propose to add explicit dependencies in header files directly, rather than 
using black magic in C files.

Attached PR fix this issue.

--
components: Interpreter Core
messages: 329359
nosy: vstinner
priority: normal
severity: normal
status: open
title: Add missing dependencies between AST/parser header files
versions: Python 3.8

___
Python tracker 

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



[issue35176] for loop range bug

2018-11-06 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is not a bug, this is standard behaviour, working as designed.

'a' is not a copy of the list 'x', 'a' is another name for the same list as 
'x'. Any in-place modifications you make to 'a' happens to the object itself, 
the list, which is visible regardless of which name you refer to it by.

If you are a C programmer, you can think of this as being similar to pointers: 
think of 'x' as a pointer to the list, and 'a' as a pointer to the same list. 
(That's more or less what happens under the hood.) From the Python level, we 
say that both names 'a' and 'x' refer to the same object.

If you want a copy, you can use the copy module, or for lists, you can take a 
slice: a = x[:] makes a copy of the list.

For immutable objects like strings, you don't need a copy, because you cannot 
modify them in place: any operation on a string always creates a new string, 
leaving the old one untouched.

--
nosy: +steven.daprano
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



[issue35176] for loop range bug

2018-11-06 Thread Dan Armentrout


New submission from Dan Armentrout :

If you run the following code:

x=[3,4,5]
a=x
for i in range(0,len(a)):
a[i]=0

All x values are changed to equal a.

--
components: Windows
messages: 329357
nosy: darmentr, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: for loop range bug
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



[issue35175] Builtin function all() is handling dict() types in a weird way.

2018-11-06 Thread Josh Rosenberg


Change by Josh Rosenberg :


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



[issue35175] Builtin function all() is handling dict() types in a weird way.

2018-11-06 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Dictionary iterates over keys and this is expected behavior. If you need to 
iterate by values you should use dict().values()

$ python3 -c 'for i in dict(a=1): print(i)'
a
$ python3 -c 'print(all(dict(a=False)))' # Iterate by keys and thus 'a' is True
True
$ python3 -c 'print(all(dict(a=False).values()))' # Iterate by values explicitly
False

# Relevant PEP section :

https://www.python.org/dev/peps/pep-0234/#dictionary-iterators

> Dictionaries implement a tp_iter slot that returns an efficient iterator that 
> iterates over the keys of the dictionary. During such an iteration, the 
> dictionary should not be modified, except that setting the value for an 
> existing key is allowed (deletions or additions are not, nor is the update() 
> method). This means that we can write

> for k in dict: ...

https://stackoverflow.com/questions/3294889/iterating-over-dictionaries-using-for-loops


This is not a bug but an expected behavior unless I am missing something from 
the script attached

--
nosy: +xtreak

___
Python tracker 

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



[issue22021] shutil.make_archive() root_dir do not work

2018-11-06 Thread STINNER Victor


STINNER Victor  added the comment:

> Is anybody working on this or can I submit a PR?

Yes: Joannah Nanjekye wrote PR 10191 (from Issue22021.patch) which has been 
rejected. This issue is more complex from what it looks.

--

___
Python tracker 

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



[issue35175] Builtin function all() is handling dict() types in a weird way.

2018-11-06 Thread Daniel Stoinov


New submission from Daniel Stoinov :

When a dictionary is passed to all() function, it iterates the keys instead of 
the values.

--
files: all-dict-example.py
messages: 329354
nosy: stnv
priority: normal
severity: normal
status: open
title: Builtin function all() is handling dict() types in a weird way.
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47912/all-dict-example.py

___
Python tracker 

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



[issue34205] Ansible: _PyImport_LoadDynamicModuleWithSpec() crash on an invalid object (UNREF invalid object)

2018-11-06 Thread Julien Palard


Julien Palard  added the comment:

Can't reproduce in 3.6.7.

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

___
Python tracker 

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



[issue35174] Calling for super().__str__ seems to call self.__repr__ in list subclass

2018-11-06 Thread Camion


Camion  added the comment:

@Serhiy Storchaka, this doesn't seem logical, is certainly counter intuitive, 
and I fear there is a lack of expressivity.

- first of all, this is NOT about having str and repr returning the same at 
all, but about building the same _kind of_ structure representations for str 
and repr, but with str of sub elements in __str__, and with repr of sub 
elements in __repr__.

It is not logical at all and completely counter intuitive, if you explicitely 
ask str of the superclass, to get repr of the subclass. Getting repr of the 
superclass would be logical, but not repr of the subclass.

Now, it might happen that I missed another way to write what I tried (casting 
the object to it's super class with super(), to avoid explicitly naming the 
superclass) but if there is not, we then have something lacking in terms of 
expressivity.

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

___
Python tracker 

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



[issue34589] Py_Initialize() and Py_Main() should not enable C locale coercion

2018-11-06 Thread Nick Coghlan


Nick Coghlan  added the comment:

The discussion with Victor on https://bugs.python.org/issue34914 highlighted 
the fact that it's OK to use 8-bit string comparisons to check for "-E", "-I", 
and a "-X coerce_legacy_c_locale=0" due to the fact that all encodings used as 
locale encodings are sufficiently ASCII compatible for that to work as desired.

So before proceeding with merging https://github.com/python/cpython/pull/9257, 
I'm going to review that possibility, and see how much code it would actually 
add to support an extra internal helper API like:

int _Py_LegacyLocaleCoercionEnabled(int argv, char* argv[]);

That would then inspect the unprocessed 8-bit command line arguments, as well 
as the process environment, to determine whether or not locale coercion should 
be attempted, making the complete dance:

_Py_SetLocaleFromEnv(LC_CTYPE);
if (_Py_LegacyLocaleDetected() && _Py_LegacyLocaleCoercionEnabled(argc, 
argv))
{
_Py_CoerceLegacyLocale(_locale_coercion);
}

If we wanted to officially expose this for embedding apps, the API would need a 
bit more thought, so it probably makes sense to wait and see if the 
nominally-private-but-exposed-to-the-linker approach is good enough in practice.

--

___
Python tracker 

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



[issue35145] sqlite3: "select *" should optionally sniff and autoconvert TEXT datetime fields

2018-11-06 Thread Robert Pollak


Robert Pollak  added the comment:

Here is now a reduced version of my real use case: 2017v2-reduced.db. The file 
was originally created with "Oracle DBConvert". This file contains a table 
without rows.
I was wrong in my last comment: There's also no sniffing needed here, see 
either of the following useful outputs:
```
In [5]: pd.read_sql_query('PRAGMA table_info("t2")', con)['type']
Out[5]: 
0   DATETIME
1VARCHAR (3)
Name: type, dtype: object

In [6]: pd.read_sql_query('SELECT SQL FROM sqlite_master WHERE name = "t2"', 
con).iloc[0,0]
Out[6]: 'CREATE TABLE t2 (localtime DATETIME DEFAULT NULL, freq VARCHAR (3))'
```
This also works with the original file from "Oracle DBConvert".

Wouldn't it make sense for sqlite3 to use this information, e.g. when connect() 
is called with something like `detect_types=CONVERT_DATETIME`? One could even 
call the option CONVERT_ORACLE_DATETIME to describe that one cannot expect it 
to work with files from other sources.

If yes, then I suggest changing this issue's title to '"SELECT *" should 
optionally autoconvert DATETIME fields if found in DDL'.

The question is of course how much sqlite generating software creates this 
metadata. But Oracle is certainly an important actor. And sqlite3 itself could 
also save this DDL instead of extending the field names (which seems more 
hacky).

--
Added file: https://bugs.python.org/file47911/2017v2-reduced.db

___
Python tracker 

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



[issue35015] availability directive breaks po files

2018-11-06 Thread Julien Palard


Change by Julien Palard :


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

___
Python tracker 

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