[issue31761] Failures and crashes when running tests by import.

2017-10-19 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I am re-opening because there is a bug, a conflict between doc and code comment 
and actual behavior, and one which has nothing to do with IDLE.  The question 
is whether to fix it or to delete the invitation to invoke the bug.

The reason the devguide gives an alternative for running tests is so that 
someone with only installed Python and no command line could still test their 
installation and even contribute a patch on the tracker.

On 2000-08-23, Tim Peters add the following comment to test.autotest:
# This should be equivalent to running regrtest.py from the cmdline.
# It can be especially handy if you're in an interactive shell, e.g.,
# from test import autotest.

The autotest code was later copied into test.__main__, and both are now:
  from test.libregrtest import main
  main()
So 'from test import __main__' is the same as importing autotest, and should be 
the same as importing and running libregrtest

To test the equivalence in the setting where either import might be useful, I 
opened both python and IDLE from the 3.7.0a2 Windows start icons and imported 
autotest.  The test deterministicly crashes after test_marshal.  I call the 
stoppage a crash because wrapping the import in try: ... except BaseException 
has no effect.  The Python console just vanishes.  IDLE restarts.
...
0:05:51 [207/407/5] test_marshal

=== RESTART: Shell =
>>>

So the claimed equivalence in worse than just not true.  There were, I believe, 
3 failures in the Python console.  The extra 2 in IDLE are due to the #25588 
fix guarding against sys.stderr being None is needed in a couple of other 
places.

In any case, either running tests by importing should be made to work (again, 
presuming it once did) or deprecated and autotest removed.

--
resolution: not a bug -> 
stage: resolved -> 
status: closed -> open
title: regrtest: faulthandler.enable() fails with io.UnsupportedOperation: 
fileno when run from IDLE -> Failures and crashes when running tests by import.
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



[issue31163] Return destination path in Path.rename and Path.replace

2017-10-19 Thread Janko Krstic

Change by Janko Krstic :


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

___
Python tracker 

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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-10-19 Thread Peter Lovett

New submission from Peter Lovett :

Documentation of StreamReaderWriter at
https://docs.python.org/3/library/codecs.html#codecs.StreamReaderWriter
section 7.2.1.4.3 is missing the default value on the errors argument.

Should change from:
class codecs.StreamReaderWriter(stream, Reader, Writer, errors)
to be:
class codecs.StreamReaderWriter(stream, Reader, Writer, errors='strict')

--
assignee: docs@python
components: Documentation
messages: 304646
nosy: PeterLovett, docs@python
priority: normal
severity: normal
status: open
title: Missing default argument detail in documentation of StreamReaderWriter
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



[issue31800] datetime.strptime: Support for parsing offsets with a colon

2017-10-19 Thread Mario Corchero

Mario Corchero  added the comment:

I have a patch to add 'Z' support as well if we are interested in making it the 
same as it glibc does. (as it supports it as well)

--

___
Python tracker 

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



[issue31800] datetime.strptime: Support for parsing offsets with a colon

2017-10-19 Thread Mario Corchero

Mario Corchero  added the comment:

As a note

Seems support for the ":" was added in 2015 for glibc:
http://code.metager.de/source/xref/gnu/glibc/time/strptime_l.c#765

Commit e952e1df

Before that, it basically just ignores the minutes.

--

___
Python tracker 

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



[issue31820] Calling email.message.set_payload twice produces an invalid eml

2017-10-19 Thread Zirak

Zirak  added the comment:

On irc, bitmancer suggested that this problem is already solved by the
email.message.EmailMessage class, as it is:


In [119]: m = email.message.EmailMessage()

In [120]: m.set_content('abc', 'utf8', cte='base64')

In [121]: m.get_payload()
Out[121]: 'YWJjCg==\n'

In [122]: m.set_content('abc', 'utf8', cte='base64')

In [123]: m.get_payload()
Out[123]: 'YWJjCg==\n'

In [124]: m.get_payload(decode=True)
Out[124]: b'abc\n'

In [125]: print(m)
MIME-Version: 1.0
Content-Type: text/utf8; charset="utf-8"
Content-Transfer-Encoding: base64

YWJjCg==


Because this isn't a critical bug and `email.message.Message` is quite
deprecated, and this is solved by a newer API, this bug may not need
addressing.

--
resolution:  -> wont fix
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



[issue31823] Opaque default value for close_fds argument in Popen.__init__

2017-10-19 Thread Алексей Аверченко

New submission from Алексей Аверченко :

[11:30:03 ~]$ python
Python 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> help(subprocess.Popen.__init__)
Help on function __init__ in module subprocess:

__init__(self, args, bufsize=-1, executable=None, stdin=None, stdout=None, 
stderr=None, preexec_fn=None, close_fds=, 
shell=False, cwd=None, env=None, universal_newlines=False, startupinfo=None, 
creationflags=0, restore_signals=True, start_new_session=False, pass_fds=(), *, 
encoding=None, errors=None)
Create new Popen instance.

--
components: Library (Lib)
messages: 304642
nosy: Алексей Аверченко
priority: normal
severity: normal
status: open
title: Opaque default value for close_fds argument in Popen.__init__
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



[issue31819] Add sock_recv_into to AbstractEventLoop

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

Merged. Thank you, Antoine!

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



[issue31819] Add sock_recv_into to AbstractEventLoop

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 525f40d231aba2c004619fc7a5207171ed65b0cb by Yury Selivanov 
(Antoine Pitrou) in branch 'master':
bpo-31819: Add AbstractEventLoop.sock_recv_into() (#4051)
https://github.com/python/cpython/commit/525f40d231aba2c004619fc7a5207171ed65b0cb


--

___
Python tracker 

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



[issue31819] Add sock_recv_into to AbstractEventLoop

2017-10-19 Thread Guido van Rossum

Guido van Rossum  added the comment:

SGTM.

On Oct 19, 2017 11:05 AM, "Yury Selivanov"  wrote:

>
> Yury Selivanov  added the comment:
>
> I'm going to approve this unless there are any objections.
>
> --
> nosy: +gvanrossum
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue31822] Document that urllib.parse.{Defrag, Split, Parse}Result are namedtuples

2017-10-19 Thread Mike Frysinger

Mike Frysinger  added the comment:

specifically, the docs for these classes:
https://docs.python.org/2/library/urlparse.html#results-of-urlparse-and-urlsplit
https://docs.python.org/3/library/urllib.parse.html#urlparse-result-object

> The result objects from the urlparse() and urlsplit() functions are subclasses
> of the tuple type. These subclasses add the attributes described in those
> functions, as well as provide an additional method:
> ...
> class urlparse.SplitResult(scheme, netloc, path, query, fragment)
>   Concrete class for urlsplit() results.

changing "subclasses of the tuple type" to "subclasses of 
collections.namedtuples" would be great.  also adding hints to use _replace to 
update values would be great :).

--
nosy: +vapier

___
Python tracker 

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



[issue31810] Travis CI, buildbots: run "make smelly" to check if CPython leaks symbols

2017-10-19 Thread Sanyam Khurana

Change by Sanyam Khurana :


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

___
Python tracker 

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



[issue31822] Document that urllib.parse.{Defrag, Split, Parse}Result are namedtuples

2017-10-19 Thread Allen Li

New submission from Allen Li :

It would be useful to document that urllib.parse.{Defrag,Split,Parse}Result are 
namedtuples, and make that API officially public if it was not otherwise.

These classes are implemented as namedtuples in Python 2 and 3, and I am not 
aware of a reason that that would need to change in the future.

In particular, the namedtuple _replace() method is very useful for modifying 
parts of a URL, a common use case.

 u = urllib.parse.urlsplit(some_url)
 u = u._replace(netloc=other_netloc)
 urllib.parse.urlunsplit(u)

 # Alternatives not depending on namedtuple API
 parts = list(u)
 parts[1] = other_netloc  # Using a magic index
 urllib.parse.urlunsplit(u)

 u = urllib.parse.SplitResult(  # Very ugly
 scheme=u.scheme,
 netloc=other_netloc,
 path=u.path,
 query=u.query,
 fragment=u.fragment)

--
assignee: docs@python
components: Documentation
messages: 304637
nosy: Allen Li, docs@python
priority: normal
severity: normal
status: open
title: Document that urllib.parse.{Defrag,Split,Parse}Result are namedtuples
type: enhancement
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue31821] pause_reading() doesn't work from connection_made()

2017-10-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
keywords: +patch
pull_requests: +4022
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



[issue31821] pause_reading() doesn't work from connection_made()

2017-10-19 Thread Antoine Pitrou

New submission from Antoine Pitrou :

At least in SelectorEventLoop, as add_reader() is called inconditionally after 
connection_made() returns.

--
components: Library (Lib), asyncio
messages: 304636
nosy: giampaolo.rodola, haypo, pitrou, yselivanov
priority: normal
severity: normal
stage: needs patch
status: open
title: pause_reading() doesn't work from connection_made()
type: behavior
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



[issue31818] [macOS] _scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

2017-10-19 Thread STINNER Victor

STINNER Victor  added the comment:

Another workaround is to call get_proxies() in a fresh subprocess, and use
a pipe to retrieve the result.

--

___
Python tracker 

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



[issue31810] Travis CI, buildbots: run "make smelly" to check if CPython leaks symbols

2017-10-19 Thread STINNER Victor

STINNER Victor  added the comment:

Sanyam: please first try to write a change for Travis CI: modify
.travis.yml, create a PR and check if it works.

--

___
Python tracker 

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



[issue31815] Make itertools iterators interruptible

2017-10-19 Thread Tim Peters

Tim Peters  added the comment:

Segfaults are different:  they usually expose an error in CPython's 
implementation.  We don't prioritize them because the user may have to restart 
their program (who cares? <0.5 wink>), but because they demonstrate the 
language implementation is accessing memory wildly.  That in turn can result in 
anything, from arbitrarily wrong program results, through file corruption, to 
massive security holes.  It's far more a "correctness" than a "usability" 
concern.

If a user provokes a segfault by (ab)using low-level facilities (say, ctypes), 
we don't care - that's on them.  But most segfaults have pointed to legitimate 
corner-case errors in CPython itself.

There's no correctness issue in whether iterators are always interruptible - it 
doesn't merit the same concern.

--
nosy: +tim.peters

___
Python tracker 

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



[issue31810] Travis CI, buildbots: run "make smelly" to check if CPython leaks symbols

2017-10-19 Thread Sanyam Khurana

Sanyam Khurana  added the comment:

Hi Haypo,

I'd like to work on a patch for this issue.

Can you please guide me how the tests are configured for buildbots?

--
nosy: +CuriousLearner

___
Python tracker 

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



[issue31632] Asyncio: SSL transport does not support set_protocol()

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset 9c23b173b823b5e6da01d85c570c7ae2ab07b38b by Yury Selivanov (Miss 
Islington (bot)) in branch '3.6':
bpo-31632: fix set_protocol() in _SSLProtocolTransport (GH-3817) (GH-3817) 
(#4052)
https://github.com/python/cpython/commit/9c23b173b823b5e6da01d85c570c7ae2ab07b38b


--

___
Python tracker 

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



[issue31457] LoggerAdapter objects cannot be nested

2017-10-19 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 4d9a8f22999de489ede9216ff983d4359d837760 by Mariatta (Miss 
Islington (bot)) in branch '3.6':
bpo-31457: Don't omit inner ``process()`` calls with nested LogAdapters 
(GH-4044) (GH-4050)
https://github.com/python/cpython/commit/4d9a8f22999de489ede9216ff983d4359d837760


--
nosy: +Mariatta

___
Python tracker 

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



[issue31819] Add sock_recv_into to AbstractEventLoop

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

I'm going to approve this unless there are any objections.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue31820] Calling email.message.set_payload twice produces an invalid eml

2017-10-19 Thread Zirak

New submission from Zirak :

Example:

In [52]: import email.message

In [53]: m = email.message.Message()

In [54]: m.set_payload('abc', 'utf8')

In [55]: m.get_payload() # correctly encoded
Out[55]: 'YWJj\n'

In [56]: m.set_payload('abc', 'utf8')

In [57]: m.get_payload() # no more encoding?
Out[57]: 'abc'

In [58]: m.get_payload(decode=True) # wut?
Out[58]: b'i\xb7'

In [59]: print(str(m))
MIME-Version: 1.0
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: base64

abc


While the first `set_payload` correctly encodes and sets the message's
Content-Transfer-Encoding, the second call doesn't properly encode the
payload according to its existing Content-Transfer-Encoding.
Tested on 3.6, 3.5 and 2.7.

`email.message.set_payload` does not directly encode the payload,
instead `email.message.set_charset` does, around line 353:
https://github.com/python/cpython/blob/b067c8fdd1e205bd0411417b6d5e4b832c3773fc/Lib/email/message.py#L353-L368

In both invocations of `set_payload`, the payload is not encoded
according to the encoding. On the first invocation, the `CTE` header
is correctly set according to `charset.get_body_encoding` (#354 and
#368) and the payload is encoded (#356 or #367, the latter in this
case).

On the second invocation, the `CTE` header is already set, so the
payload is never encoded.

This is especially dangerous when passing `decode=True` to
`get_payload` after the 2nd `set_payload`, as that may throw an error
in some cases (trying to base64 decode a string which makes no sense
to it. that's how I arrived on this bug, but I can't for the life of
me replicate an exception).

This is a bit finicky to fix. If we change `set_charset` to always
encode the current payload, we risk double-encoding when `set_charset`
is not called through `set_payload`. However if `set_charset` tries to
decode the payload, it will produce incorrect results when *it is*
called through `set_payload`. urgh.

We can move the actual encoding code away from `set_charset`, either
into `set_payload` or a third function, but that'll break any code
calling `set_payload` without a charset and then calling
`set_charset`. urgh.

One possible solution is for both `set_charset` and `set_payload` to
call a third function, e.g. `_encode_payload`. Perhaps something like
(pseudocode):


def set_payload(self, payload, charset):
# ...
if 'Content-Transfer-Encoding' in self:
self._payload = self._encode_payload(payload)
self.set_charset(charset)
# ...

def set_charset(self, charset):
# ...
if 'Content-Transfer-Encoding' not in self:
self._payload = self._encode_payload()
self.add_header(...)

def _encode_payload(self, payload):
# code in lines 353-366



This way, `set_charset` handles the cases where CTE was never defined,
and `set_payload` makes sure to encode the payload when a CTE is
present. It may work, but something about this gives me unrest. For
example, if you `set_charset` once and it encodes your payload as
base64, and you `set_charset` again with a charset whose
`get_body_encoding` returns qp, the payload would still be base64 even
though it *should be* qp. urgh.

Is this a big enough concern? Is there a superior approach I'm
missing?

Thanks in advance!

--
components: email
messages: 304628
nosy: Zirak Ertan, barry, r.david.murray
priority: normal
severity: normal
status: open
title: Calling email.message.set_payload twice produces an invalid eml
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue31632] Asyncio: SSL transport does not support set_protocol()

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

Loïc, thank you for the contribution!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue31632] Asyncio: SSL transport does not support set_protocol()

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:


New changeset ea2ef5d0ca869d4550820ed53bdf56013dbb9546 by Yury Selivanov 
(jlacoline) in branch 'master':
bpo-31632: fix set_protocol() in _SSLProtocolTransport (#3817) (#3817)
https://github.com/python/cpython/commit/ea2ef5d0ca869d4550820ed53bdf56013dbb9546


--

___
Python tracker 

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



[issue31632] Asyncio: SSL transport does not support set_protocol()

2017-10-19 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4021

___
Python tracker 

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



[issue31452] asyncio.gather does not cancel tasks if one fails

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

I'm going to reject this issue as it's not backwards compatible.  I'll work on 
adding a new TaskGroup primitive in the next couple of days that would address 
this problem.

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



[issue30457] Allow retrieve the number of waiters pending for most of the asyncio lock primitives

2017-10-19 Thread Yury Selivanov

Yury Selivanov  added the comment:

> The nature of the `pending` method is to give to the developer a way to check 
> how many waiters are still pending. This not only helps to make this code 
> more explicit also other pieces of code that might need access to the length 
> of the waiters.

This also is a perfect way to introduce races in your code.  I'm going to 
reject this, sorry.  I've demonstrated that it's possible to do what you wanted 
to do without adding new functionality.

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



[issue31819] Add sock_recv_into to AbstractEventLoop

2017-10-19 Thread Antoine Pitrou

Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue31819] Add sock_recv_into to AbstractEventLoop

2017-10-19 Thread Antoine Pitrou

New submission from Antoine Pitrou :

As sock_recv() is already exposed, it is a no-brainer to add sock_recv_into(), 
allowing finer buffer management when people are willing to handle a socket 
object.

--
components: Library (Lib), asyncio
messages: 304623
nosy: giampaolo.rodola, haypo, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: Add sock_recv_into to AbstractEventLoop
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue31457] LoggerAdapter objects cannot be nested

2017-10-19 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4019

___
Python tracker 

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



[issue31457] LoggerAdapter objects cannot be nested

2017-10-19 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset ce9e62544571e7ade7186697d5dd065fb4c5243f by Łukasz Langa in 
branch 'master':
bpo-31457: Don't omit inner ``process()`` calls with nested LogAdapters (#4044)
https://github.com/python/cpython/commit/ce9e62544571e7ade7186697d5dd065fb4c5243f


--

___
Python tracker 

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



[issue31818] [macOS] _scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

2017-10-19 Thread Ned Deily

Ned Deily  added the comment:

Ronald is the expert on this but, from what I understand, I don't think there 
is any reason to spend time on trying to further analyze this.  This issue has 
been around since day one of _scproxy and affects all versions of Python on 
macOS.  There is nothing we can do to fix it, and, after all these years, it 
isn't likely that Apple is going to change the underlying framework.  What we 
could do is: (1) better document the restriction; (2) find another way to 
access the system's network proxy configuration (not likely), or (3) change how 
we use the System Configuration framework, i.e. either don't call it at all or 
don't call it by default (but that seems like overfill for an edge case for 
which there already is a fairly simple workaround).  Ronald, what do you think?

--

___
Python tracker 

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



[issue31800] datetime.strptime: Support for parsing offsets with a colon

2017-10-19 Thread Paul G

Paul G  added the comment:

This seems very useful to me. I very frequently advise people *against* using 
dateutil.parser (despite my conflict of interest as maintainer of dateutil) for 
well-known formats, but the problem frequently comes up of, "what should I do 
when I have date created by isoformat()?", to which there's no clean satisfying 
answer other than, "use dateutil.parser even though you know the format."

I think the strptime page that Mario linked to is evidence that the %z 
directive is *intended* to match against -HH:MM, and so that might be the most 
"standard" solution.

That said, I somewhat prefer the granularity of the GNU date extensions %z, %:z 
and %::z, since this allows downstream users to be stricter about what they are 
willing to accept. I think either approach is defensible, but that *something* 
should be done soon, preferably for the 3.7 release.

--
nosy: +p-ganssle

___
Python tracker 

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



[issue31233] socketserver.ThreadingMixIn leaks running threads after server_close()

2017-10-19 Thread STINNER Victor

STINNER Victor  added the comment:

The current code leaks memory since it never clears threads which completed. We 
need a cleanup function similar to ForkingMixIn.collect_children() which is 
called by handle_timeout() and service_actions().

We can check if a thread is alive: thread.is_alive(), to decide to remove it or 
not.

Moreover, maybe we should keep a list of weak references?

--

___
Python tracker 

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



[issue31811] async and await missing from keyword list in lexical analysis doc

2017-10-19 Thread F. Lamar

F. Lamar  added the comment:

I a new contributor. This seems like a simple fix. I'd be happy to work on it. 
I will submit ar PR on or before 10-22-17

--
nosy: +F. Lamar

___
Python tracker 

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



[issue31818] [macOS] _scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

2017-10-19 Thread STINNER Victor

STINNER Victor  added the comment:

@Mirko: You can please try to get the Python traceback of the Ansible crash? 
You may want to try faulthandler: enable it and write its output into a file.
https://faulthandler.readthedocs.io/

--

___
Python tracker 

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



[issue31818] [macOS] _scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

2017-10-19 Thread STINNER Victor

STINNER Victor  added the comment:

Confirmation from Apple:

https://developer.apple.com/library/content/technotes/tn2083/_index.html#//apple_ref/doc/uid/DTS10003794-CH1-SUBSECTION52

"""
Many Mac OS X frameworks do not work reliably if you call fork but do not call 
exec. The only exception is the System framework and, even there, the POSIX 
standard places severe constraints on what you can do between a fork and an 
exec.
(...)
Listing 13  Core Foundation complaining about fork-without-exec

The process has forked and you cannot use this CoreFoundation \
functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_\
COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.
"""

--

___
Python tracker 

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



[issue31818] [macOS] _scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

2017-10-19 Thread STINNER Victor

STINNER Victor  added the comment:

Hi, can you please explain how to reproduce your issue?

According to the crash report, it seems like you are running Ansible on macOS 
and that the Python function _scproxy.get_proxies() was called.

get_proxies() calls CFPreferencesCopyAppValue() which calls indirectly 
performForkChildInitialize(). It seems like Ansible forked the process or 
something like that. Finally, performForkChildInitialize() calls _objc_fatal() 
which kills the process with abort().

The parent process is also Python ("Parent Process: python2.7 [4305]") which 
confirms that the application used fork().

See also:

* bpo-9405: Similar but old (2010) crash caused by SCDynamicStoreCopyProxies in 
a small Python application using multiprocessing and so using fork
* bpo-27126: "Apple-supplied libsqlite3 on OS X is not fork safe;  can cause 
crashes"
* "fork() without exec() is dangerous in large programs" article by Evan Jones 
(2016-August-16): http://www.evanjones.ca/fork-is-dangerous.html -- this 
article mentions bpo-27126

Ned Deily's advice from bpo-9405: "A quick workaround is to make a 
[get_proxies()] call from the main process."

IMHO the safest fix is to not run any Python program after fork(). Using use 
subprocess to use fork() immmediately followed by exec(). It's not safe to 
execute code after fork(), many functions are not "fork safe". But I know that 
many applications don't care, since there is also a lot of functions which are 
fork safe...

--
nosy: +haypo
title: macOS HighSierra final - Python Crash because of _scproxy -> [macOS] 
_scproxy.get_proxies() crash -- get_proxies() is not fork-safe?

___
Python tracker 

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



[issue31756] subprocess.run should alias universal_newlines to text

2017-10-19 Thread Andrew Clegg

Change by Andrew Clegg :


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

___
Python tracker 

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



[issue31818] macOS HighSierra final - Python Crash because of _scproxy

2017-10-19 Thread Mirko Friedenhagen

New submission from Mirko Friedenhagen :

The same bug which shows up in https://bugs.python.org/issue30837 is in both 
the System python provided by Apple (2.7.10) as well as the one coming via 
Homebrew (2.7.14) (See 
https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb) for 
build instructions.

The culprit is the same as before, `_scproxy`. Setting the environment variable 
`no_proxy` did the trick for me as well. I attached the crash report

--
components: macOS
files: python2.7_2017-10-18-092216-1_lmka-2hpphfdty3.crash
messages: 304614
nosy: Mirko Friedenhagen, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: macOS HighSierra final - Python Crash because of _scproxy
type: crash
versions: Python 2.7
Added file: 
https://bugs.python.org/file47227/python2.7_2017-10-18-092216-1_lmka-2hpphfdty3.crash

___
Python tracker 

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



[issue31814] subprocess_fork_exec more stable with vfork

2017-10-19 Thread Albert Zeyer

Albert Zeyer  added the comment:

This is a related issue, although with different argumentation:
https://bugs.python.org/issue20104

--

___
Python tracker 

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



[issue31817] Compilation Error with Python 3.6.1/3.6.3 with Tkinter

2017-10-19 Thread Josh Cullum

New submission from Josh Cullum :

Hi Guys,

I'm trying to build Python 3.6.1 and 3.6.3, with both, .configure / make / make 
install work correctly as they should, however, trying to import _tkinter 
doesn't work.

Going back to the compilation, I get the following error in the make log:

*** WARNING: renaming "_tkinter" since importing it failed: 
build/lib.linux-x86_64-3.6/_tkinter.cpython-36m-x86_64-linux-gnu.so: undefined 
symbol: Tcl_GetCharLength

Following modules built successfully but were removed because they could not be 
imported:
_tkinter


Any Idea's on how to fix the undefined symbol error? This happens with both 
Tcl/Tk 8.6.6 and 8.6.7.

The following is the configure options:
--prefix=/tools/apps/python/3.6.1 
--with-tcltk-includes='-I/tools/apps/Tcl/8.6.7/include 
-I/tools/apps/Tk/8.6.7/include' --with-tcltk-libs='-L/tools/apps/Tcl/8.6.7/lib 
-L/tools/apps/Tk/8.6.7/lib' --enable-optimizations --enable-shared

--
components: Tkinter
messages: 304612
nosy: jpc2350
priority: normal
severity: normal
status: open
title: Compilation Error with Python 3.6.1/3.6.3 with Tkinter
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



[issue14912] Pdb does not stop at a breakpoint after a restart command and source changes

2017-10-19 Thread Wipolun

Wipolun  added the comment:

Worked for me on https://www.cheshiremouldings.co.uk/stair-parts/

--
nosy: +wipolun

___
Python tracker 

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



[issue17799] settrace docs are wrong about "c_call" events

2017-10-19 Thread raylu

Change by raylu :


--
nosy: +raylu

___
Python tracker 

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



[issue31816] Unexpected behaviour of `dir()` after implementation of __dir__

2017-10-19 Thread Christian Heimes

Christian Heimes  added the comment:

https://docs.python.org/3/library/functions.html#dir also states that "The 
resulting list is sorted alphabetically." The section has an example where 
__dir__ returns an unsorted list but dir() returns a sorted list:

>>> class Shape:
... def __dir__(self):
... return ['area', 'perimeter', 'location']
>>> s = Shape()
>>> dir(s)
['area', 'location', 'perimeter']

Since the primary purpose of dir() is convenient use for humans, sorting makes 
perfectly sense. If you need tight control over order of values, you should 
make your object iterable instead or provide another method.

Several dunder methods perform some sort of post-processing or post-check:

>>> class Example:
... def __bool__(self): return 2
... 
>>> bool(Example())
Traceback (most recent call last):
  File "", line 1, in 
TypeError: __bool__ should return bool, returned int

>>> class MyInt(int):
... pass
... 
>>> type(MyInt(1))

>>> class Example:
... def __int__(self):
... return MyInt(1)
... 
>>> int(Example())
1
>>> type(int(Example()))


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



[issue31816] Unexpected behaviour of `dir()` after implementation of __dir__

2017-10-19 Thread Nils Diefenbach

Nils Diefenbach <23okrs20+pyt...@mykolab.com> added the comment:

Alright. Are there any other magic methods that do some post-processing on a 
custom implementation of them ? 

I couldn't think of one, which is why this behaviour appeared odd to me.

--
status: pending -> open

___
Python tracker 

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



[issue31816] Unexpected behaviour of `dir()` after implementation of __dir__

2017-10-19 Thread Christian Heimes

Christian Heimes  added the comment:

dir() and __dir__ work as designed and documented:

https://docs.python.org/3/reference/datamodel.html?highlight=__dir__#object.__dir__

Called when dir() is called on the object. A sequence must be returned. dir() 
converts the returned sequence to a list and sorts it

--
nosy: +christian.heimes
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

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



[issue31815] Make itertools iterators interruptible

2017-10-19 Thread Nick Coghlan

Nick Coghlan  added the comment:

I'd personally be happy enough if the infinite iterators implemented 
__length_hint__() as always raising TypeError so the machine-breaking cases of 
incremental consumption of ever-increasing amounts of memory were blocked - I 
was suggesting on python-ideas that enabling pervasive signal checking would be 
too intrusive for anyone to be willing to implement it.

However, Serhiy's patch showed me that it isn't particularly intrusive at all, 
and the risk of surprising consumers is low, since __next__() methods can 
already raise arbitrary exceptions.

--

___
Python tracker 

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



[issue31816] Unexpected behaviour of `dir()` after implementation of __dir__

2017-10-19 Thread Nils Diefenbach

New submission from Nils Diefenbach <23okrs20+pyt...@mykolab.com>:

When defining a custom __dir__ method in a class, calling dir() on
said class still sorts the output. This is, imo, unexpected behaviour, 
especially if the order of output was specified in __dir__ and is somehow 
relevant.

Example and more detail here
https://stackoverflow.com/questions/46824459/custom-dir-returns-list-of-attributes-sorted-alphabetically

--
messages: 304606
nosy: nlsdfnbch
priority: normal
severity: normal
status: open
title: Unexpected behaviour of `dir()` after implementation of __dir__
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue31618] Change sys.settrace opcode tracing to occur after frame line number update

2017-10-19 Thread Nick Coghlan

Nick Coghlan  added the comment:

Thanks for the fix!

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



[issue31785] Move instruction code from ceval.c to a separate file

2017-10-19 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

No one has spoken up for this feature request, so I'm marking it as closed.  
Thank you for the suggestion, but I think it is prudent to decline.

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



[issue31618] Change sys.settrace opcode tracing to occur after frame line number update

2017-10-19 Thread George King

Change by George King :


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

___
Python tracker 

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



[issue31681] pkgutil.get_data() leaks open files in Python 2.7

2017-10-19 Thread George King

Change by George King :


--
pull_requests: +4016

___
Python tracker 

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