[issue38609] Trashcan mechanism segfault during interpreter finalization in Python 3.7.5

2019-11-13 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

You only have to check, using a public API, if you have no control over when 
C++ objects are destructed. I'd personally try to structure code to make sure 
that C++ objects owning references to Python objects get destructed before the 
interpreter is finalised (or release their references). 

The code you mention is not using a public API, Py_IsInitialized 
 is a public API 
that can be used to check if the interpreter is initialised.

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



[issue38791] readline history file is hard-coded

2019-11-13 Thread Jonathan Conder


Jonathan Conder  added the comment:

I agree. Did a cursory search before posting but missed it somehow

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



[issue17642] IDLE add font resizing hot keys and wheel

2019-11-13 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz

___
Python tracker 

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



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

2019-11-13 Thread Zackery Spytz


Zackery Spytz  added the comment:

Thank you, Terry, for modifying the PR and merging it.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue38775] Cloudpickle.py file is crashing due to data type incompatibility.

2019-11-13 Thread Kafeel Ansari


Kafeel Ansari  added the comment:

Hi @xtreak ,
Thank you for the reply . Please find below detailed description. 

I was using python 3.8 and installed pyspark 2.4.4 . I encountered error 
related to cloudpickle file. Please find the attached snapshot. 

I tried to convert the value of co.co_code in cloudpickle.py file (line 132) 
from bytes to int to check if it is really a issue with cloudpickle file. 

Please let me know if you need more information .

--
Added file: https://bugs.python.org/file48714/Spark_cloudpickle_error.JPG

___
Python tracker 

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



[issue38791] readline history file is hard-coded

2019-11-13 Thread Zackery Spytz


Zackery Spytz  added the comment:

This issue seems like a duplicate of bpo-29779 (which has a pull request).

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2019-11-13 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
pull_requests: +16659
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17150

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2019-11-13 Thread Zackery Spytz


New submission from Zackery Spytz :

If a KeyboardInterrupt occurs while an IDLE calltip is being displayed,
the calltip will persist until a new calltip event. The calltip should
be removed immediately in this case.

--
assignee: terry.reedy
components: IDLE
messages: 356580
nosy: ZackerySpytz, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE calltips may not properly close on KeyboardInterrupt
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38789] difflib lacks a way to check if results are empty

2019-11-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> tim.peters
nosy: +tim.peters
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Guido van Rossum


Guido van Rossum  added the comment:

This should not have been an issue but a discussion on python-list or perhaps 
python-ideas.

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony


Anthony  added the comment:

Vedran thank you for the detailed comments.

I want to separate the idea side and implementation:
The idea is having defaults expressed in a way of least surprise and in the 
least amount of code.

Specifically that 
[1]
makes more sense then 
field(default_factory=lambda: [1])

or more generally that
default
makes more sense then 
field(default_factory=lambda: default)

I agree there's a lot lacking in my example starting point implementation.
Let's not let what's lacking in that implementation distract from the spirit of 
the idea.

The scope of that example is meat to illustrate creating a default that is of 
least surprising, specifically that a new instance of a class is isolated.
But I think the point of whether or not the default is isolated feels like a 
distraction. 

If a motivation for using type annotations is to restrict to reduce errors. To 
me, "prototyping" defaults by having them declared as soon as possible in the 
class is a further restriction. I believe that's a reasonable coding practice, 
and actually a good thing. 

To me this is the current situation, in order to setup a class using @dataclass 
a user must either:

a) Have a relatively in depth understanding of python. I think proofs of that 
include both PEP having to have a section justifying that. And that there was 
such discussion in the issue. 
A point of higher level languages is to nicely abstract lower level APIs, if I 
have to learn the lower level API in order to use the language it reduces the 
benefit, and that's really what the points made sound like.

b) Calling two "special" / additional functions and adding a (relatively) large 
amount of code. I can't think of anything else in python where the default 
method requires knowing two separate additional functions! Python is all about 
short, semantically meaningful expressions yet this feels like the total 
opposite!

If setting up defaults is a common point of error or "bad code" then why not 
setup the standard library in such a way that it does it right?
ie that a user can specify the default they want and the library sets up the 
default in the right way.
If that's as a separate object, or a mutable object, either way. The point 
being that setting up a default should be straightforward.

This is my first attempt at a contribution, even if all it is is highlighting a 
problem and the "solution" I'm suggesting may be the wrong one. But so far all 
of comments feel like they are defending a cascade of "not ideal" situations. 
Let's try actually looking at the root from the user's perspective and how can 
we improve this!

--
nosy: +gvanrossum

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur with Vedran and recommend this proposal be rejected.

During training and code review, we spend a lot of time trying to get people to 
not write code like this.  By making dataclasses behave differently than the 
rest of language, we would would lose the clear, bright line we have now.  IOW, 
this would be bug bait.

--
nosy: +rhettinger

___
Python tracker 

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



[issue38791] readline history file is hard-coded

2019-11-13 Thread Jonathan Conder


Change by Jonathan Conder :


--
keywords: +patch
pull_requests: +16658
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17149

___
Python tracker 

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-13 Thread Debi Mishra


Debi Mishra  added the comment:

Hi @Jason.Killen. I am new to cpython and would like to try this one out. Thank 
you.

--
nosy: +mdebi

___
Python tracker 

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



[issue26389] Expand traceback module API to accept just an exception as an argument

2019-11-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It would be nice to see this one come to fruition.

--
nosy: +rhettinger

___
Python tracker 

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



[issue26389] Expand traceback module API to accept just an exception as an argument

2019-11-13 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

> were you interested in continuing with Brett's (and your) suggestion for the 
> API by making the first argument positional-only and the others optional?

Yes, but I currently do not have the time; if someone else want to take over; 
or if you need to close this issue or corresponding PR for now please feel free 
to do so. I'll come back to it at some point.

--

___
Python tracker 

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



[issue38791] readline history file is hard-coded

2019-11-13 Thread pmp-p


Change by pmp-p :


--
nosy: +twouters

___
Python tracker 

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



[issue38791] readline history file is hard-coded

2019-11-13 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



[issue38791] readline history file is hard-coded

2019-11-13 Thread Jonathan Conder


New submission from Jonathan Conder :

Other tools such as bash and less allow their history file to be customised 
with an environment variable. Will add a patch for this in a bit.

This could also be customised using PYTHONSTARTUP, but then the user has to 
duplicate a bunch of code which is already part of the site module.

--
components: Library (Lib)
messages: 356573
nosy: jconder
priority: normal
severity: normal
status: open
title: readline history file is hard-coded
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Vedran Čačić

Vedran Čačić  added the comment:

It seems to me that what you're missing is that "class declarations" are still 
perfectly normal executable statements (in most other superficially similar 
programming languages, they are not). So, when you say

class A:
b = []

it is actually executed, a new empty list is made, and named A.b. If you then 
construct a = A(), then a.b is that same object. It must be, you never made any 
other list in the process. So if you really want a.b to be a _different_ empty 
list, you have to make it at some point. The most obvious way to do it is just 
to copy the A.b --- that's why people usually talk about copying.

Your approach is different: it seems to me that you say, if A.b is a list, then 
make a new empty list, if it is a set, then make a new empty set, and if it is 
a dict, then make a new empty dict. Not to mention that it feels very weird 
when having e.g.

class A:
b = [4]

(-:, it doesn't take into account any other types. Which leads to another your 
problem, the one of perspective. Lists, sets and dicts are not that "common 
case" as you seem to think. Yes, they are in the beginners' code -- and that's 
why current dataclass implementation flags them as errors, since it's quite 
possible that people who write such things don't actually understand how Python 
is executed. But specialcasing them to actually do something useful would be 
the wrong thing to do, since it would incentivize people who should know 
better, back into using those simple types. I think it is shown in the 
discussion mentioned.

--

___
Python tracker 

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



[issue38630] subprocess.Popen.send_signal() should poll the process

2019-11-13 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

To further elaborate on the creation time solution, the idea in pseudo-code is 
the following:

class Popen:

def __init__(self, ...):
self._execute_child(...)
try:
self._ctime = get_create_time(self.pid)
except ProcessLookupError:
self._ctime = None

def send_signal(self, sig):
if self._ctime is not None:
if self._ctime != get_create_time(self.pid):
raise ProecssLookupError("PID has been reused")
os.kill(self.pid, sig)

Technically there is still a race condition between _execute_child() and 
get_create_time(), but:

1) the time between the two calls is supposed to be extremely short
2) an OS should not reuse a PID that fast, precisely in order to minimize the 
chances of such a race condition to occur
3) as a general rule, on most systems PIDs are supposed to be assigned 
sequentially and wrap around. E.g. on Linux:

~$ for i in $(seq 20); do ps; done | grep ps
3199 pts/000:00:00 ps
3200 pts/000:00:00 ps
3201 pts/000:00:00 ps
3202 pts/000:00:00 ps
3203 pts/000:00:00 ps
3204 pts/000:00:00 ps
3205 pts/000:00:00 ps
3207 pts/000:00:00 ps
3208 pts/000:00:00 ps
3209 pts/000:00:00 ps
3210 pts/000:00:00 ps
3213 pts/000:00:00 ps
3214 pts/000:00:00 ps
3215 pts/000:00:00 ps
3216 pts/000:00:00 ps
3217 pts/000:00:00 ps
3218 pts/000:00:00 ps
3219 pts/000:00:00 ps
3221 pts/000:00:00 ps
3223 pts/000:00:00 ps

As for Windows, the termination is based on the process handle instead of the 
PID, so I assume that means Windows is safe in this regard. There was a prior 
discussion about this actually:
https://bugs.python.org/issue36067#msg336243
Getting process creation time is relatively easy, even though 
platform-dependent (and should be done in C).
pidfd API would be nicer to use, but it seems it's not portable and relatively 
recent.

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-13 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 3ccdd9b180f9a3f29c8ddc8ad1b331fe8df26519 by Benjamin Peterson in 
branch 'master':
closes bpo-38692: Add a pidfd child process watcher to asyncio. (GH-17069)
https://github.com/python/cpython/commit/3ccdd9b180f9a3f29c8ddc8ad1b331fe8df26519


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



[issue38692] add a pidfd child process watcher

2019-11-13 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

Thanks everyone for the reviews. I will go ahead and merge the PR.

Shall we return to #38591 for planning the future of child watching?

--

___
Python tracker 

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



[issue38609] Trashcan mechanism segfault during interpreter finalization in Python 3.7.5

2019-11-13 Thread ysnt27


ysnt27  added the comment:

Thanks for making the issue clear.

My understanding is that,
all C++ destructors have to check Python interpreter before Py_DECREF,
like this.

``` cplusplus
  ~something() {
// PyThreadState *_tstate = PyThreadState_GET();
PyThreadState *_tstate = _PyThreadState_UncheckedGet();
if (_tstate) {
  Py_DECREF(somelist);
}
  }
```

Is this right?

--

___
Python tracker 

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



[issue38529] Python 3.8 improperly warns about closing properly closed streams

2019-11-13 Thread Alexander Mohr


Change by Alexander Mohr :


--
nosy: +thehesiod

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-13 Thread Kyle Stanley


Kyle Stanley  added the comment:

> > The child watchers API has to go. It's confusing, painful to use, it's not 
> > compatible with third-party event loops. It increases the API surface 
> > without providing us with enough benefits.

> +1

Also, adding to this, the child watchers are one of the least used components 
of asyncio's public API. So, I think the deprecation and removal cost will be 
fairly minimal. See the GitHub code usage (includes exact copies of 
Lib/asyncio/unix_events.py, so there's some redundancy):

MultiLoopChildWatcher: 
https://github.com/search?l=Python=MultiLoopChildWatcher=Code (20 
results, just added in 3.8)
ThreadedChildWatcher: 
https://github.com/search?l=Python=ThreadedChildWatcher=Code (77 
results, default unix child watcher, rarely used explicitly)
FastChildWatcher: 
https://github.com/search?l=Python=FastChildWatcher=Code (4,426 results)
SafeChildWatcher: 
https://github.com/search?l=Python=SafeChildWatcher=Code (7,007 results)
All of asyncio usage: https://github.com/search?l=Python=asyncio=Code 
(599,131 results)

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-13 Thread Kyle Stanley


Kyle Stanley  added the comment:

> We can merge this PR as is (Benjamin, thanks for working on this!), but I 
> think that as soon as we merge it we should do some refactoring and 
> deprecations.

> The child watchers API has to go. It's confusing, painful to use, it's not 
> compatible with third-party event loops. It increases the API surface without 
> providing us with enough benefits.

+1

> In 3.9 we will use kqueue / pidfd / threads / winapis -- whatever is 
> available, but we never use SIGCHLD by default.

IIRC, we don't use SIGCHLD by default at the moment, since ThreadedChildWatcher 
is the default child watcher. Should we change the default to be the new 
PidfdChildWatcher for Linux kernels 5.3+ in Python 3.9, and fallback to 
ThreadedChildWatcher for systems without pidfd_open()?

--

___
Python tracker 

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



[issue38790] test_fcntl failing on macOS CI

2019-11-13 Thread Steve Dower


New submission from Steve Dower :

See 
https://dev.azure.com/Python/cpython/_build/results?buildId=53812=ms.vss-test-web.build-test-results-tab

Traceback (most recent call last):
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/unittest/case.py", line 60, 
in testPartExecutor
yield
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/unittest/case.py", line 659, 
in run
self._callTestMethod(testMethod)
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/unittest/case.py", line 616, 
in _callTestMethod
method()
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/test/test_fcntl.py", line 
149, in test_lockf_exclusive
p.start()
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/process.py", 
line 121, in start
self._popen = self._Popen(self)
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/context.py", 
line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/context.py", 
line 283, in _Popen
return Popen(process_obj)
  File 
"/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/popen_spawn_posix.py",
 line 32, in __init__
super().__init__(process_obj)
  File 
"/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/popen_fork.py", 
line 19, in __init__
self._launch(process_obj)
  File 
"/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/popen_spawn_posix.py",
 line 47, in _launch
reduction.dump(process_obj, fp)
  File 
"/Users/runner/runners/2.160.0/work/1/s/Lib/multiprocessing/reduction.py", line 
60, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 
'TestFcntl.test_lockf_exclusive..try_lockf_on_other_process'

--
components: Tests, macOS
messages: 356565
nosy: alexandre.vassalotti, ned.deily, ronaldoussoren, steve.dower
priority: normal
severity: normal
stage: needs patch
status: open
title: test_fcntl failing on macOS CI
type: behavior

___
Python tracker 

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 for a more informative repr (like we did with regex match objects).

There are a lot of parameters to subprocess.Popen().  RR is on the right track 
suggesting that only a small, useful subset of those be included:  args and the 
return code.  

We could add the *pid* argument as well, but may be no more useful or 
attractive than the current repr's object id.

The repr should be enclosed in angle brackets because it can't recreate the 
object.

--
nosy: +rhettinger

___
Python tracker 

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



[issue38781] Clear buffer in MemoryHandler flush

2019-11-13 Thread Daniel Andersson


Daniel Andersson  added the comment:

The suggested change has been merged. I'm closing this issue. Thank you Vinay 
Sajip for reviewing.

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



[issue38758] @dataclass defaults

2019-11-13 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not sure what you're proposing.

--

___
Python tracker 

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-13 Thread Jason Killen


Jason Killen  added the comment:

I think this sounds great and I'll take a crack at it over the next few days.  
If anybody wants to jump ahead of me I don't mind.

--

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread miss-islington


miss-islington  added the comment:


New changeset 694c03fabb5cf3df0102cc317670a10fc39c6786 by Miss Islington (bot) 
in branch '3.8':
bpo-38785: Prevent asyncio from crashing  (GH-17144)
https://github.com/python/cpython/commit/694c03fabb5cf3df0102cc317670a10fc39c6786


--

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread miss-islington


miss-islington  added the comment:


New changeset 87b4d3994e4f81d6e39a5e86c1b7040df065ea37 by Miss Islington (bot) 
in branch '3.7':
bpo-38785: Prevent asyncio from crashing  (GH-17144)
https://github.com/python/cpython/commit/87b4d3994e4f81d6e39a5e86c1b7040df065ea37


--

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8, Python 3.9

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16657
pull_request: https://github.com/python/cpython/pull/17148

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread miss-islington


miss-islington  added the comment:


New changeset dad6be5ffe48beb74fad78cf758b886afddc7aed by Miss Islington (bot) 
(Andrew Svetlov) in branch 'master':
bpo-38785: Prevent asyncio from crashing  (GH-17144)
https://github.com/python/cpython/commit/dad6be5ffe48beb74fad78cf758b886afddc7aed


--
nosy: +miss-islington

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16656
pull_request: https://github.com/python/cpython/pull/17147

___
Python tracker 

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



[issue11354] argparse: nargs could accept range of options count

2019-11-13 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Do we have examples of real world APIs that actually need this functionality? 
Offhand, I don't recall having worked with any command-line tool that would 
accept "at least two but no more than four filenames" for example.

Given that this isn't trivial to implement, we should take a moment to evaluate 
whether users actually need it.  We had eight years since the original proposal 
without anyone chiming in to say, "yes, I need this".

--

___
Python tracker 

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



[issue38692] add a pidfd child process watcher

2019-11-13 Thread Yury Selivanov


Yury Selivanov  added the comment:

We can merge this PR as is (Benjamin, thanks for working on this!), but I think 
that as soon as we merge it we should do some refactoring and deprecations.

The child watchers API has to go. It's confusing, painful to use, it's not 
compatible with third-party event loops. It increases the API surface without 
providing us with enough benefits.

What I propose:

* merge this watcher and try to use it as the default on modern Linuxes.  We 
don't document it.

* deprecate add_child_watcher and all child watcher classes in 3.9. Aim for 
removal in 3.11.  

In 3.9 we will use kqueue / pidfd / threads / winapis -- whatever is available, 
but we never use SIGCHLD by default.

--

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony


Anthony  added the comment:

Hey Eric, I think our emails crossed in the wind, please see my comment that 
includes (as a sub component) a similar idea to what's proposed in the article 
you linked.

--

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Eric V. Smith


Eric V. Smith  added the comment:

The problem is that what you wrote isn't what most people want. Here's your 
example without dataclasses. I've added an "append_to_x" method, which does the 
obvious thing:


>>> class C:
...   def __init__(self, x=[]):
...  self.x = x
...  
...   def append_to_x(self, val):
... self.x.append(val)
... 

Now create two objects, and inspect their "x" properties:
>>> a = C()
>>> b = C()
>>> a.x
[]
>>> b.x
[]

So far so good. Now append something to "a.x":
>>> a.append_to_x(10)
>>> a.x
[10]

And notice that "b.x" changes, too:
>>> b.x
[10]

So the naive behavior isn't what you want. dataclasses is trying to prevent you 
from doing this.

You should look at "mutable defaults", perhaps starting here (from a random 
Google search): 
https://blog.florimond.dev/python-mutable-defaults-are-the-source-of-all-evil

--

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony

Anthony  added the comment:

To clarify,
A major assumption I'm making is that the default is empty, or the
"copying" is handled as some separately coupled concept.
A motivation here is wanting to do operations like .append() that depend on
the object existing.

On Wed, Nov 13, 2019 at 1:04 PM Anthony Sarkis 
wrote:

> Thanks for adding it, I read it now.
>
> And sorry to back track a moment - I love the idea of @dataclass and I can
> only imagine how must work it was to implement as I am only a beginner.
>
> I'm looking at this primarily from the narrow view point of a user - not
> so much understanding the backdrop of how it can actually work.
> But I still think this is worth considering as I think this is common
> pattern based on this logic:
>
> When using the default construction method it seems reasonable to pass a
> default, such as a List.
> Because
> def __init__(x=[]):
>   self.x = x
> Is the cleanest way I can think of to write that.
> In this new context, if x: list = [] is the cleanest way to write it.
> Therefore it should do that, however it is actually implemented.
>
> Let's imagine for a moment that @dataclass becomes the default way of
> constructing classes in python.
> Do we really want such a common case to require such verbose language?
>
> Looking at Guido's first comment on this, I think that detection mechanism
> is what I would expect to happen. To illustrate verbosely:
> https://gist.github.com/swirlingsand/d59d01ef79c5ee93f430ed324199bc65
> I clearly misunderstood the way classes get passed by default.
> I continue to believe that defining it in the argument should be equal to
> defining it after. (if there are no other context items present).
>
> From a beginners perspective here, It would appear that in a sense the
> default init is actually "silently failing" in that the expected (because
> of the two instances not being equal to each other as shown in L10 above)
> isolation is not happening.
> In a sense then, @dataclass is turning that silent "failure" into a
> ValueError which is actually better.
>
> What about something like this:
> https://gist.github.com/swirlingsand/2494bc482902fada2248698f7b8af61e
> If the common case is for it to be None, then this doesn't fire so there's
> no cost.
> If it's a common default then it handles it as expected.
> If it's not found it raises a ValueError like before, so there's no loss
> or harm.
> A handful of defaults here may cover 80% of cases and the 20% can continue
> to be handled by ValueError
> In a project with 40 classes with 10 defaults per class that's 400 lines
> of code that look like:
> []
> instead of
> field(default_factory=lambda: [])
> (or {} etc.)
>
> Issue #3 has many comments around copying, but that's not my concern, I'm
> just talking about the defaults where the attribute is not provided at all
> (ie is None).
>
> I did the above example in regular python since I don't know enough about
> how @dataclass is implemented, but it seems reasonable that if it can work
> in normal python there should be a way to say augment operation() on line
> 21 with field()
>
>
>
>
>
>
> On Wed, Nov 13, 2019 at 10:11 AM Vedran Čačić 
> wrote:
>
>>
>> Vedran Čačić  added the comment:
>>
>> Have you read https://github.com/ericvsmith/dataclasses/issues/3?
>>
>> --
>> nosy: +veky
>>
>> ___
>> Python tracker 
>> 
>> ___
>>
>

--

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Anthony

Anthony  added the comment:

Thanks for adding it, I read it now.

And sorry to back track a moment - I love the idea of @dataclass and I can
only imagine how must work it was to implement as I am only a beginner.

I'm looking at this primarily from the narrow view point of a user - not so
much understanding the backdrop of how it can actually work.
But I still think this is worth considering as I think this is common
pattern based on this logic:

When using the default construction method it seems reasonable to pass a
default, such as a List.
Because
def __init__(x=[]):
  self.x = x
Is the cleanest way I can think of to write that.
In this new context, if x: list = [] is the cleanest way to write it.
Therefore it should do that, however it is actually implemented.

Let's imagine for a moment that @dataclass becomes the default way of
constructing classes in python.
Do we really want such a common case to require such verbose language?

Looking at Guido's first comment on this, I think that detection mechanism
is what I would expect to happen. To illustrate verbosely:
https://gist.github.com/swirlingsand/d59d01ef79c5ee93f430ed324199bc65
I clearly misunderstood the way classes get passed by default.
I continue to believe that defining it in the argument should be equal to
defining it after. (if there are no other context items present).

>From a beginners perspective here, It would appear that in a sense the
default init is actually "silently failing" in that the expected (because
of the two instances not being equal to each other as shown in L10 above)
isolation is not happening.
In a sense then, @dataclass is turning that silent "failure" into a
ValueError which is actually better.

What about something like this:
https://gist.github.com/swirlingsand/2494bc482902fada2248698f7b8af61e
If the common case is for it to be None, then this doesn't fire so there's
no cost.
If it's a common default then it handles it as expected.
If it's not found it raises a ValueError like before, so there's no loss or
harm.
A handful of defaults here may cover 80% of cases and the 20% can continue
to be handled by ValueError
In a project with 40 classes with 10 defaults per class that's 400 lines of
code that look like:
[]
instead of
field(default_factory=lambda: [])
(or {} etc.)

Issue #3 has many comments around copying, but that's not my concern, I'm
just talking about the defaults where the attribute is not provided at all
(ie is None).

I did the above example in regular python since I don't know enough about
how @dataclass is implemented, but it seems reasonable that if it can work
in normal python there should be a way to say augment operation() on line
21 with field()

On Wed, Nov 13, 2019 at 10:11 AM Vedran Čačić 
wrote:

>
> Vedran Čačić  added the comment:
>
> Have you read https://github.com/ericvsmith/dataclasses/issues/3?
>
> --
> nosy: +veky
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue11354] argparse: nargs could accept range of options count

2019-11-13 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue25866] Reference 3. Data Model: miscellaneous minor cleanups on the word "sequence".

2019-11-13 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-13 Thread Tal Einat


Change by Tal Einat :


--
stage:  -> needs patch

___
Python tracker 

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



[issue38744] python 3.8 hang in multiprocessing.Pool() locking on FreeBSD

2019-11-13 Thread Dmitry Marakasov


Dmitry Marakasov  added the comment:

> What happens if you instead write:

It survived more than 4000 runs, it looks like it doesn't experience the 
problem.

--

___
Python tracker 

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-13 Thread Tal Einat


Tal Einat  added the comment:

I agree that this could be nice. A PR (with tests!) would be welcome!

--
keywords: +easy

___
Python tracker 

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-13 Thread Jason Killen


Change by Jason Killen :


--
nosy: +Jason.Killen

___
Python tracker 

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



[issue38722] runpy should use io.open_code() instead of open()

2019-11-13 Thread Jason Killen


Jason Killen  added the comment:

I'll plan on tackling this one.  I already did pdb.

--
nosy: +Jason.Killen

___
Python tracker 

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



[issue38453] ntpath.realpath() does not fully resolve relative paths

2019-11-13 Thread Steve Dower


Steve Dower  added the comment:

My latest push to PR 16967 is a significant change to what ntpath.realpath will 
return for broken symlinks, but I think it's the right change.

Basically, if the OS fully resolves the path, great! We'll return that (and 
handle \\?\ stripping)

If the OS doesn't, we'll assume it's a broken link and try and read the link 
target from the path. Most of the time, we'll get "not a link", but if it 
succeeds then we'll return here. For absolute links, we'll return it. For 
relative symlinks, we'll join with the parent directory. For relative 
anything-else, we'll return the path to the link itself.

If we can't read a link (most likely), then we'll work up the path doing the 
same thing. Once we successfully get further than the original path, we'll join 
the unprocessed tail on and return without attempting to resolve anything more 
(assuming that the OS would have done it earlier if it was possible).

So if you look at the changed test_ntpath.py you'll see the different results 
(the test_shutil.py changes are mainly to avoid long/short name comparison 
failures when realpath() fixes them, by putting the test files in the actual 
test directory instead of global TEMP).

--

___
Python tracker 

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



[issue38721] modulefinder should use import hooks properly

2019-11-13 Thread Dominic Littlewood


Dominic Littlewood <11dlittlew...@gmail.com> added the comment:

Okay, I've started putting together a proper PR, and I've had some thoughts.


There's a useful script at the bottom of the importlib documentation that 
readers should consult. This can be used to correctly find the spec for a 
module, and therefore the loader. (AddPackagePath and ReplacePackage are not 
needed, and should be deprecated.) For modules already on sys.path, the loader 
can be identified from module.__loader__.

If the loader is an InspectLoader, the code can be retrieved and examined to 
see what is imported. (Remember to check whether None is returned.) If not, we 
will assume nothing is imported - which is what modulefinder currently does 
with extension modules.

Since run_script takes a file path rather than a module name, it will have to 
find the appropriate loader for the task. This will be a simple choice between 
SourceFileLoader and SourcelessFileLoader, depending on what kind of file is 
being used.


It is also possible to use functions in importlib._bootstrap instead.
This enhancement would indirectly cause open_code to be used properly, so the 
bug I originally posted is redundant.

--
title: modulefinder should use io.open_code() instead of open() -> modulefinder 
should use import hooks properly
type: security -> enhancement

___
Python tracker 

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



[issue38744] python 3.8 hang in multiprocessing.Pool() locking on FreeBSD

2019-11-13 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
nosy: +pablogsal

___
Python tracker 

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



[issue38744] python 3.8 hang in multiprocessing.Pool() locking on FreeBSD

2019-11-13 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

What happens if you instead write:

with Pool() as pool:
pool.map(sleep, [0.01] * 10)

--

___
Python tracker 

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



[issue38686] WWW-Authenticate qop="auth,auth-int" rejected by urllib

2019-11-13 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
assignee:  -> orsenthil
nosy: +orsenthil

___
Python tracker 

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



[issue38758] @dataclass defaults

2019-11-13 Thread Vedran Čačić

Vedran Čačić  added the comment:

Have you read https://github.com/ericvsmith/dataclasses/issues/3?

--
nosy: +veky

___
Python tracker 

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



[issue34716] MagicMock.__divmod__ should return a pair

2019-11-13 Thread Vedran Čačić

Vedran Čačić  added the comment:

Yes, this is impossible using only "universal Python" (independent of 
implementation). Though, of course, it's possible in CPython if you analyze the 
source code (or AST) and count the targets on the left side.

--
nosy: +veky

___
Python tracker 

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



[issue38707] Multiprocessing: bug with Native ID for threading.mainthread()

2019-11-13 Thread Jake Tesler


Jake Tesler  added the comment:

PR was updated with tests and is ready for core developer review and then the 
merge to cpython:master. After that (if I understand correctly) a backport will 
automatically get picked into the 3.8 branch if there aren't any conflicts.

--

___
Python tracker 

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



[issue25866] Reference 3. Data Model: miscellaneous minor cleanups on the word "sequence".

2019-11-13 Thread Alex


Alex  added the comment:

Hi, I've taken a look at these suggestions and the documentation and I've 
posted a patch to get things moving :)

A couple of points about the suggested changes that I haven't included in the 
patch:

1) I think changing the documentation for __dir__() to say it can return an 
iterable needs some discussion.

The documentation also says:
"The ``__dir__`` function should accept no arguments, and return a list of 
strings that represents the names accessible on module. If present, this 
function overrides the standard :func:`dir` search on a module."
And this should definitely be updated from "list of strings" to either 
"sequence of strings" or "iterable of strings".

However, I'm not sure about updating docs to include "accidental" functionality 
- looking at the testing, news, and documentation from commit 
https://github.com/python/cpython/commit/3bbb72265411585e64a5d2ccb5ba51763f20e311
 the intention was to allow __dir__ to return a sequence.

I think updating the docs to say __dir__ should return an iterator would be a 
separate issue which would also include test enchancements, so I've left that 
change out of my patch and I've just corrected the line I've quoted above.

2) > The docs still say that the ABCs are in `collections` rather than 
`collections.abc`.

I couldn't find an instance of this, it's probably been corrected at some point.

Any thoughts on the above, the other suggestions, or the patch?

--
keywords: +patch
nosy: +alclarks
Added file: https://bugs.python.org/file48713/issue25866.v1.patch

___
Python tracker 

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



[issue37564] ArgumentParser should support bool type according to truth values

2019-11-13 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Tal Einat


Tal Einat  added the comment:

Thanks for bringing this up and making the PR, python273!

--

___
Python tracker 

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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Tal Einat


Tal Einat  added the comment:


New changeset 61289d436661025a3111065482275d49a4850b8d by Tal Einat (Kirill) in 
branch 'master':
bpo-38786: Add parsing of https links to pydoc (GH-17143)
https://github.com/python/cpython/commit/61289d436661025a3111065482275d49a4850b8d


--

___
Python tracker 

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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Tal Einat


Change by Tal Einat :


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



[issue38524] functools.cached_property is not supported for setattr

2019-11-13 Thread Tal Einat


Tal Einat  added the comment:

I agree with Nick: While possible, this would be unnecessarily confusing.

As Serhiy wrote, the proper way to address the situation seems to be improving 
the documentation. A PR would be welcome!

--
keywords: +easy
nosy: +taleinat

___
Python tracker 

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



[issue38517] functools.cached_property should support partial functions and partialmethod's

2019-11-13 Thread Tal Einat


Tal Einat  added the comment:

According to issue38524, this should be closed.

--

___
Python tracker 

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



[issue38517] functools.cached_property should support partial functions and partialmethod's

2019-11-13 Thread Tal Einat


Change by Tal Einat :


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



[issue38517] functools.cached_property should support partial functions and partialmethod's

2019-11-13 Thread Tal Einat


Tal Einat  added the comment:

Note that it is already possible, though awkward, to create cached properties 
dynamically. Using the example from PR GH-16838:

class ProcNet:
pass

for proto in ('icmp', 'icmp6', 'raw', 'raw6', 'tcp', 'tcp6', 'udp', 'udp6', 
'udplite', 'udplite6'):
@cached_property
def prop(self, *, proto=proto):
with open(os.path.join("/proc/net", proto)) as file:
return file.read()
setattr(ProcNet, proto, prop)
prop.__set_name__(ProcNet, proto)

IMO this is good enough, considering that this is all pretty much required for 
dynamically creating normal (uncached) properties and other types of 
descriptors.

--
nosy: +taleinat

___
Python tracker 

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



[issue38789] difflib lacks a way to check if results are empty

2019-11-13 Thread Simon Friedberger


New submission from Simon Friedberger :

It seems there is no easy way to use difflib to show a diff but only when there 
actually are differences. The SequenceMatcher has ratio() but that isn't really 
available through Differ or any of the convenience functions. Vice versa, when 
using SequenceMatcher the pretty display is not available.

--
components: Library (Lib)
messages: 356536
nosy: simon_
priority: normal
severity: normal
status: open
title: difflib lacks a way to check if results are empty
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



[issue38789] difflib lacks a way to check if results are empty

2019-11-13 Thread Simon Friedberger


Change by Simon Friedberger :


--
type:  -> enhancement

___
Python tracker 

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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests:  -16652

___
Python tracker 

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



[issue38738] Fix formatting of True and False

2019-11-13 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thanks Vinay, Kyle and Terry for your review!

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



[issue38788] Inconsistent documentation of tell/seek on textiobase/textiowrapper

2019-11-13 Thread Ulrik Haugen


New submission from Ulrik Haugen :

The class hierarchy suggests the only tell/seek implementations one
needs to look up are in iobase and those have the semantics i was
expecting:
https://docs.python.org/3.8/library/io.html#class-hierarchy

Plowing on one might discover that there are separate implementations
of tell/seek for textiobase whose documentation probably explains the
unexpected values tell returns.


The documentation for tell available from the help() command still
reflects the semantics i was expecting.

The documentation for seek available from the help() command still
reflects the semantics i was expecting. It does however suggest that
the first argument has been renamed from offset to cookie which the
online documentation has not yet caught up to at:
https://docs.python.org/3.8/library/io.html#io.TextIOBase.seek

The documentation body for seek from the help() command still refers to
offset though there is now no argument of that name.


>>> help(fh.tell)
Help on built-in function tell:

tell() method of _io.TextIOWrapper instance
Return current stream position.

>>> help(fh.seek)
Help on built-in function seek:

seek(cookie, whence=0, /) method of _io.TextIOWrapper instance
Change stream position.

Change the stream position to the given byte offset. The offset is
interpreted relative to the position indicated by whence.  Values
for whence are:

* 0 -- start of stream (the default); offset should be zero or positive
* 1 -- current stream position; offset may be negative
* 2 -- end of stream; offset is usually negative

Return the new absolute position.

--
components: Library (Lib)
messages: 356534
nosy: qha
priority: normal
severity: normal
status: open
title: Inconsistent documentation of tell/seek on textiobase/textiowrapper
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



[issue38787] PEP 573: Module State Access from C Extension Methods

2019-11-13 Thread Marcel Plch


Change by Marcel Plch :


--
keywords: +patch
pull_requests: +16655
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17145

___
Python tracker 

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



[issue38787] PEP 573: Module State Access from C Extension Methods

2019-11-13 Thread Marcel Plch


New submission from Marcel Plch :

Currently, there is not way to access per-module state from the methods of 
types defined in extension modules.

This PEP provides a fix to this issue.

PEP 573 - https://www.python.org/dev/peps/pep-0573/

Reference implementation - 
https://github.com/Dormouse759/cpython/tree/pep-c-rebase_newer

--
components: Extension Modules
messages: 356533
nosy: Dormouse759, ncoghlan, petr.viktorin, scoder, terry.reedy
priority: normal
severity: normal
status: open
title: PEP 573: Module State Access from C Extension Methods
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
keywords: +patch
pull_requests: +16654
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17144

___
Python tracker 

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



[issue38784] ip_network does not clear/update the broadcast_address cache when network_address is changed.

2019-11-13 Thread Inada Naoki


Inada Naoki  added the comment:

It is documented, if you read it carefully.

"Network objects are hashable, so they can be used as keys in dictionaries."

https://docs.python.org/3/library/ipaddress.html#network-objects

"""
An object is hashable if it has a hash value which never changes during its 
lifetime (it needs a __hash__() method), and can be compared to other objects 
(it needs an __eq__() method). Hashable objects which compare equal must have 
the same hash value.
"""

https://docs.python.org/3/glossary.html#term-hashable

Make it mutable is not an option.

--

___
Python tracker 

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



[issue38784] ip_network does not clear/update the broadcast_address cache when network_address is changed.

2019-11-13 Thread Johannes Erwerle


Johannes Erwerle  added the comment:

since it hasn't been documented that those classes are all designed to be 
immutable (and many things work when they are mutable) many people probably use 
it that way.
Declaring them immutable via the docs now would "break" existing code.

--

___
Python tracker 

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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +16652
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/2975

___
Python tracker 

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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Tal Einat


New submission from Tal Einat :

See latest PR, GH-17143.

--

___
Python tracker 

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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +16653
pull_request: https://github.com/python/cpython/pull/17143

___
Python tracker 

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



[issue38786] Add parsing of https links to pydoc

2019-11-13 Thread Tal Einat


Change by Tal Einat :


--
components: Library (Lib)
nosy: python273, taleinat
priority: normal
severity: normal
stage: needs patch
status: open
title: Add parsing of https links to pydoc
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue38784] ip_network does not clear/update the broadcast_address cache when network_address is changed.

2019-11-13 Thread Inada Naoki


Inada Naoki  added the comment:

All classes in the ipaddress module are designed as immutable.

While it is not documented, you can see __hash__ is overridden.  It means you 
must not change the object state.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, inada.naoki

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Looks like get_future_loop() function misses ENSURE_FUTURE_ALIVE macro call.

--

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread STINNER Victor


STINNER Victor  added the comment:

The crash occurs in _asyncio_Future_get_loop():

(gdb) frame
#0  0x7fffea2fe689 in _Py_INCREF (op=0x0) at ./Include/object.h:459
459 op->ob_refcnt++;

(gdb) up
#1  0x7fffea301b14 in _asyncio_Future_get_loop_impl (self=0x7fffea2615f0)
at /home/vstinner/python/master/Modules/_asynciomodule.c:1094
1094Py_INCREF(self->fut_loop);

(gdb) p self->fut_loop
$1 = 0x0

(gdb) where
#0  0x7fffea2fe689 in _Py_INCREF (op=0x0) at ./Include/object.h:459
#1  0x7fffea301b14 in _asyncio_Future_get_loop_impl (self=0x7fffea2615f0)
at /home/vstinner/python/master/Modules/_asynciomodule.c:1094
#2  0x7fffea2fef01 in _asyncio_Future_get_loop (self=0x7fffea2615f0, 
_unused_ignored=0x0)
at /home/vstinner/python/master/Modules/clinic/_asynciomodule.c.h:252
#3  0x00645364 in cfunction_vectorcall_NOARGS (
func=, 
args=0x0, nargsf=0, kwnames=0x0) at Objects/methodobject.c:424
#4  0x0042f8d1 in _PyObject_VectorcallTstate (tstate=0x81ae00, 
callable=, args=0x0, nargsf=0, kwnames=0x0) at 
./Include/cpython/abstract.h:111
#5  0x0042f930 in _PyObject_Vectorcall (
callable=, args=0x0, nargsf=0, kwnames=0x0) at 
./Include/cpython/abstract.h:120
#6  0x0042f988 in _PyObject_CallNoArg (
func=)
at ./Include/cpython/abstract.h:148
#7  0x0042fc57 in PyObject_CallNoArgs (
func=)
at Objects/call.c:83
#8  0x7fffea2ffc16 in get_future_loop (
fut=)
--Type  for more, q to quit, c to continue without paging--q
Quit

(gdb) py-bt
Traceback (most recent call first):
  
  
  File "/home/vstinner/python/master/Lib/asyncio/events.py", line 81, in _run
self._context.run(self._callback, *self._args)
  File "/home/vstinner/python/master/Lib/asyncio/base_events.py", line 2641, in 
_run_once
  File "/home/vstinner/python/master/Lib/asyncio/base_events.py", line 1101, in 
run_forever
await waiter
  File "/home/vstinner/python/master/Lib/asyncio/base_events.py", line 621, in 
run_until_complete
self.run_forever()
  File "/home/vstinner/python/master/Lib/asyncio/runners.py", line 299, in run
  File "/home/vstinner/python/master/scratch_15.py", line 56, in 
asyncio.run(main())

--
nosy: +vstinner

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thanks for the report!
I would say that deriving from the future class without calling 
super().__init__() is an error.
After fixing this the snippet raises expected "RuntimeError: yield was used 
instead of yield from in task" error.

--

___
Python tracker 

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



[issue34716] MagicMock.__divmod__ should return a pair

2019-11-13 Thread Jackson Riley


Jackson Riley  added the comment:

On second thoughts, perhaps option 2 is best (more in keeping with the usual 
behaviour of MagicMock).
Alternatively, could I propose a fourth option:

4. Change the behaviour of MagicMock more generally such that trying to unpack 
a MagicMock instance into two variables, for example, would assign a new 
MagicMock instance to each.

This would fix this issue and also seems like a sensible thing for MagicMock in 
general. I may be missing something/this may not be easy to set-up, I don't 
know!

--

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread Alex


Alex  added the comment:

Get seg fault on running script in attachment:

root@fake:/opt/securisync/be# python3.7 scratch_15.py
In tratata before
In tratata2 before
Segmentation fault

--

___
Python tracker 

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



[issue38785] Segmentation fault in asyncio

2019-11-13 Thread Alex


New submission from Alex :

Get Segmentation fault on run script in attachment.

--
components: asyncio
files: scratch_15.py
messages: 356523
nosy: akayunov, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Segmentation fault in asyncio
type: crash
versions: Python 3.7
Added file: https://bugs.python.org/file48712/scratch_15.py

___
Python tracker 

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



[issue38784] ip_network does not clear/update the broadcast_address cache when network_address is changed.

2019-11-13 Thread Johannes Erwerle


Change by Johannes Erwerle :


--
title: ip_network does not clear/update the broadcast_address cache when  the 
IP address is changed. -> ip_network does not clear/update the 
broadcast_address cache when  network_address is changed.

___
Python tracker 

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



[issue38784] ip_network does not clear/update the broadcast_address cache when the IP address is changed.

2019-11-13 Thread Johannes Erwerle


New submission from Johannes Erwerle :

The ip_network class in the ipaddress module does cache the broadcast_address 
attribute.
But when the network address is changed the cache is not cleared/updated.

Example:

> from ipaddress import ip_network
> 
> print("--")
> 
> net = ip_network("10.0.0.0/8")
> print("net", net)
> print("broadcast_address", net.broadcast_address)
> print("increase")
> net.network_address += 2**24
> print("net", net)
> print("net.broadcast_address", net.broadcast_address)
>
> print("--")
>
> net2 = ip_network("10.0.0.0/8")
> print("net2", net2)
> print("no call to broadcast_address")
> print("increase")
> net2.network_address += 2**24
> print("net2", net2)
> print("net2.broadcast_address", net2.broadcast_address)

--
messages: 356522
nosy: 992jo
priority: normal
severity: normal
status: open
title: ip_network does not clear/update the broadcast_address cache when  the 
IP address is changed.
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue38784] ip_network does not clear/update the broadcast_address cache when the IP address is changed.

2019-11-13 Thread Johannes Erwerle


Change by Johannes Erwerle :


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