[issue38328] Speed up the creation time of constant list and set literals.

2019-11-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
title: Speed up the creation time of constant list literals. -> Speed up the 
creation time of constant list and set literals.

___
Python tracker 

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



[issue37309] idlelib/NEWS.txt for 3.9.0 and backports

2019-11-11 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests: +16622
pull_request: https://github.com/python/cpython/pull/17115

___
Python tracker 

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



[issue38328] Speed up the creation time of constant list literals.

2019-11-11 Thread Brandt Bucher


Brandt Bucher  added the comment:

I have created a new patch (PR 17114) that performs this optimization directly 
in the compiler, rather than the peephole optimizer. I think I like the new one 
better.

--

___
Python tracker 

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



[issue38328] Speed up the creation time of constant list literals.

2019-11-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +16621
pull_request: https://github.com/python/cpython/pull/17114

___
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-11 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Zachary determined that the issue is that writing calls 
iomenu.IOBinding.fixlastline, which unconditionally adds \n at the end if there 
is one.  That is not needed for the Shell and wrong when it ends with a prompt, 
which is the normal case.

--
versions: +Python 3.7, Python 3.8, Python 3.9 -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



[issue17306] Improve the way abstract base classes are shown in help()

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Benjamin, are you still interested in working on this?

--

___
Python tracker 

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



[issue38385] statistics: incorrect documentation

2019-11-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
priority: normal -> low
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



[issue38385] statistics: incorrect documentation

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 733b9a308e3c49855888e2e12397ae56d831e780 by Raymond Hettinger in 
branch 'master':
bpo-38385: Fix iterator/iterable terminology in statistics docs (GH-17111)
https://github.com/python/cpython/commit/733b9a308e3c49855888e2e12397ae56d831e780


--

___
Python tracker 

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



[issue38385] statistics: incorrect documentation

2019-11-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16620
pull_request: https://github.com/python/cpython/pull/17113

___
Python tracker 

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



[issue38565] Expose the value passed of typed passed to functools.lru_cache

2019-11-11 Thread Manjusaka


Manjusaka  added the comment:

Raymond, thanks for fixing many errors for my patch!

--

___
Python tracker 

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



[issue38565] Expose the value passed of typed passed to functools.lru_cache

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Scott, thank you for the suggestion.
Serhiy, thank for pointing to the simplest implementation.
Zheaoli, thanks for the patch.

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

___
Python tracker 

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



[issue38565] Expose the value passed of typed passed to functools.lru_cache

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 051ff526b5dc2c40c4a53d87089740358822edfa by Raymond Hettinger 
(Manjusaka) in branch 'master':
bpo-38565: add new cache_parameters method for lru_cache (GH-16916)
https://github.com/python/cpython/commit/051ff526b5dc2c40c4a53d87089740358822edfa


--

___
Python tracker 

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



[issue38754] Python3.7 site-packages

2019-11-11 Thread Ned Deily


Ned Deily  added the comment:

Sorry you are having problems. Unfortunately, those messages are not coming 
from Python itself so there doesn't appear to be anything we can do here.  
Searching on the web for "could not get file information for" suggests that the 
messages are coming from Arch's package manager, pacman.  Suggest you ask on a 
Arch-related forum or perhaps on something like StackOverflow.  Good luck!

--
nosy: +ned.deily
resolution:  -> third party
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



[issue38440] Possible new issues with IDLE

2019-11-11 Thread Tal Einat


Tal Einat  added the comment:

> * The pop-up message box for interrupting currently running code will appear 
> several times in succession.  Dismissing the box doesn't clear a queue of 
> events, so the message may occur several times in a row.

I've been unable to reproduce this on Windows. Raymond, is this specific to 
macOS?

--

___
Python tracker 

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



[issue37903] IDLE Shell sidebar.

2019-11-11 Thread Tal Einat


Tal Einat  added the comment:

Raymond, FWIW, this will fix at least one of the issues you've mentioned: 
"Cntl-A on macOS jumps before the >>> prompt".

--

___
Python tracker 

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



[issue37903] IDLE Shell sidebar.

2019-11-11 Thread Tal Einat


Tal Einat  added the comment:

> Can you also show a script running with F5 showing a restart, the output from 
> the script and a subsequent interactive session that shows the inspecting 
> variables.  Also show what an exception and SyntaxError looks like.

I've attached a screenshot showing everything that Raymond asked for.

--
Added file: https://bugs.python.org/file48709/screenshot2.png

___
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-11 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

#33397 add a FontSizer class to textview.py and uses it there and for the doc 
viewer in help.py.  It should be used for this issue also.

--

___
Python tracker 

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



[issue27805] io.open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2019-11-11 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +16619
pull_request: https://github.com/python/cpython/pull/17112

___
Python tracker 

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



[issue9399] Provide a 'print' action for argparse

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Marking this as closed because there has been no activity or interest for over 
five years.

If anyone wants to revive this and write a PR, feel free to reopen.  The core 
idea is plausible, but this doesn't seem to be a recurring need.

--
resolution:  -> out of date
stage: test needed -> 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



[issue37759] Polish whatsnew for 3.8

2019-11-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
priority: high -> normal
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



[issue38385] statistics: incorrect documentation

2019-11-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue38438] argparse "usage" overly-complex with nargs="*"

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Bob, thanks for the suggestion.

Brandt, thanks for the PR.

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

___
Python tracker 

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



[issue38773] Fatal Python error: Aborted

2019-11-11 Thread Rohit


New submission from Rohit :

Python is crashing frequently. The frequency lies anywhere in between 10 hours 
to 24 hours of running the program.

Packages used in my program:
numba.cuda, numpy, sklearn.cluster, cv2, falcon, multiprocessing, faulthandler 

Priority: High

--
components: Interpreter Core
files: python_error.txt
messages: 356410
nosy: rohitlal.125...@gmail.com
priority: normal
severity: normal
status: open
title: Fatal Python error: Aborted
type: crash
versions: Python 3.6
Added file: https://bugs.python.org/file48708/python_error.txt

___
Python tracker 

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



[issue36128] ResourceReader for FileLoader inconsistently handles path separators

2019-11-11 Thread Gregory Szorc


Gregory Szorc  added the comment:

I just noticed that there is a parallel discussion ongoing in 
https://gitlab.com/python-devs/importlib_resources/issues/58.

--

___
Python tracker 

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



[issue36128] ResourceReader for FileLoader inconsistently handles path separators

2019-11-11 Thread Gregory Szorc


Gregory Szorc  added the comment:

I think disallowing relative paths that are parents of the current anchor point 
is a reasonable restriction and acceptable backwards incompatible behavior.

Disallowing all relative paths with slashes is a larger issue. I would support 
that if designing/implementing things today as it simplifies things greatly. 
But since an implementation allowing slashes has shipped in 3.7 and 3.8, I'm 
not sure if the backwards incompatibility could be stomached, so I'm not going 
to advocate for it.

--

___
Python tracker 

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2019-11-11 Thread Clem Flory


Change by Clem Flory :


--
nosy: +cjflory

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d8e08456025d9349abbf76035c821d3f7b2d722a by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-38771:  Explict test for None in code example (GH-17108) (GH-17109)
https://github.com/python/cpython/commit/d8e08456025d9349abbf76035c821d3f7b2d722a


--

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset cb1c06e3bfbce7f4e8dcb0db84bcee54c8d4fa21 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.7':
bpo-38771:  Explict test for None in code example (GH-17108) (GH-17110)
https://github.com/python/cpython/commit/cb1c06e3bfbce7f4e8dcb0db84bcee54c8d4fa21


--

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16617
pull_request: https://github.com/python/cpython/pull/17110

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16616
pull_request: https://github.com/python/cpython/pull/17109

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 98480cef9dba04794bd61c7e7cca643d384c8c35 by Raymond Hettinger 
(Jonathan Scholbach) in branch 'master':
bpo-38771:  Explict test for None in code example (GH-17108)
https://github.com/python/cpython/commit/98480cef9dba04794bd61c7e7cca643d384c8c35


--

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The example was just meant to be a quick snippet to suggest a possible use 
case.  It isn't a stand-alone application.  However, stylistically, this is an 
improvement and I'll accept some variation of the PR.

--
priority: normal -> low
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue38772] shutil.copytree fail to copy some bytes

2019-11-11 Thread Stéphane Archer

New submission from Stéphane Archer :

I use shutil.copytree to copy photos from many sd cards to a hard drive.
I use thread for each sd card. then I check if the content has been copying 
correctly with filecmp.cmpfiles with shallow to false. and surprise!!!
some files are not identical. usually, just one byte has not been properly 
copying

--
components: IO
files: diff.png
messages: 356403
nosy: Stéphane Archer
priority: normal
severity: normal
status: open
title: shutil.copytree fail to copy some bytes
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48707/diff.png

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue38739] pyperformance html5lib cannot import Mapping (and fails)

2019-11-11 Thread Travis Lazar


Travis Lazar  added the comment:

FYI: this affects tornado_http and django_template as well.

--

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I can see that making generators unhashable would have found your bug earlier, 
but it is otherwise unjustified: generators are just objects that are compared 
by identity. It would break other people's code, which is a very invasive 
change to make just so that a small subset of "forgot to call tuple" bugs might 
sometimes be found earlier.

Personally, I think that Serhiy's comment that there is "a chance" that this 
will be accepted is over-optimistic, but either way this would need to have a 
PEP.

I'm going to close this as "Not a bug" but that doesn't mean discussion has to 
stop. If you feel strongly enough about this issue to write a PEP proposing 
this change, please take the discussion to the Python-Dev mailing list with a 
summary and see if you can get somebody to sponsor the PEP. If you do, feel 
free to re-open as an Enhancement.

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



[issue38769] generators are currently hashable

2019-11-11 Thread Tim Peters


Tim Peters  added the comment:

Yes, what Steven said.  All kinds of functions (including, but not limited to, 
generator-iterators) are compared by object identity, nothing at all about 
internal state.  The contract of hash() is that if a == b, then we must have 
that hash(a) == hash(b) too.  That's got nothing to do with internal state 
either, _only_ with how __eq__ is implemented.

There is no sense in which any kind of function object is "mutable" that has 
any effect on its object identity, so also no sense in which it can affect 
__eq__ results, so no reason at all for __hash__ to care.  It's all working as 
designed and as intended.

--

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Ammar Askar


Ammar Askar  added the comment:

An easier way to understand might be to just write out the generator expression 
"manually":

  def generator_expression():
for k, v in sorted(self.__dict__.items()):
  yield k
  return hash(my_generator_expression())

Would you say that `generator_expression` here is mutable or immutable? The 
code that underpins how it generates values is clearly immutable just like 
functions but the values it closes over can be changed.

Another minimal example:

>>> def f():
...   yield from some_list
...
>>> some_list = [1,2,3]
>>> list(f())
[1, 2, 3]
>>> some_list = [1,2,3,4,5]
>>> list(f())
[1, 2, 3, 4, 5]

Would you say that `f` is immutable or mutable in this case?

--
nosy: +ammar2

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Jonathan Scholbach


Change by Jonathan Scholbach :


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

___
Python tracker 

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



[issue38771] Bug in example of collections.ChainMap

2019-11-11 Thread Jonathan Scholbach


New submission from Jonathan Scholbach :

Below "Examples and Recipes", the Documentation of collections.ChainMap has an 
"Example of letting user specified command-line arguments take precedence over 
environment variables which in turn take precedence over default values:" In 
there, a ChainMap is created which represents the default values, updated by 
the command-line arguments, if they have been set. The relevant code snippet is 
the following:
   
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--user')
parser.add_argument('-c', '--color')
namespace = parser.parse_args()
command_line_args = {k:v for k, v in vars(namespace).items() if v}

If user passes an empty string as value for any of the command-line arguments, 
that argument would not appear in `command_line_args` (because the boolean 
value of empty string is `False`). However, passing the empty string as a value 
for a command-line argument, would reflect the intent of overwriting the 
default value (setting it to the empty string). With the current example code, 
this would erroneously not be reflected in the `command_line_args`. This is 
caused by checking for the boolean of `v` instead of checking for `v` not being 
`None`. So, this should be handled correctly by writing

command_line_args = {k: v for k, v in vars(namespace).items() if v is not 
None}

--
assignee: docs@python
components: Documentation
messages: 356398
nosy: docs@python, jonathan.scholbach
priority: normal
severity: normal
status: open
title: Bug in example of collections.ChainMap
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



[issue38769] generators are currently hashable

2019-11-11 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Anthony, can you please explain what you mean when you describe generators as 
"mutable"? I don't understand what you mean.

To *me*, the value of a generator, in so far as comparisons goes, is its 
identity, not its invisible internal state. You can test that by noting that 
two generators with the same state compare unequal:

py> def gen():
... yield 1
...
py> a = gen()
py> b = gen()
py> a == b
False

Furthermore, the hash of the generator doesn't change when its internal state 
changes.

py> hash(a)
192456114
py> next(a)
1
py> hash(a)
192456114


And as for functions being "immutable", you can attach arbitrary attributes to 
them, so their object state can change. Does that make them mutable? Either 
way, it doesn't matter, since functions are also compared by identity. Their 
value is their identity, not their state. (Two functions with the same internal 
state are compared as unequal.)

--
nosy: +steven.daprano

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Anthony Sottile


Anthony Sottile  added the comment:

I think I'm missing what you're saying, apologies I'm probably confused :(

--

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Tim Peters


Tim Peters  added the comment:

What makes you think generator-iterator objects are mutable?

--

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Anthony Sottile


Anthony Sottile  added the comment:

function objects are immutable though

--

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Tim Peters


Tim Peters  added the comment:

Function objects can be used as dict keys too.  Given that, it would be _very_ 
surprising if generator-iterators weren't.  I don't really see a good point to 
leaving this open.  Live with it - it's a feature ;-)

--
nosy: +tim.peters

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I agree with Raymond. By default all objects are compared by identity and are 
hashable. User classes are hashable, files are hashable, iterators are 
hashable. Generator objects are just not special enough to be non-hashable.

We can reconsider this. But it a part of much larger Python language change. It 
should be discussed on Python-Dev. We should estimate the benefit and the 
amount of possible breakage. I think there is a chance of changing this, but we 
need more information.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue38764] Deterministic globbing.

2019-11-11 Thread Matthew Barnett


Matthew Barnett  added the comment:

I could also add: would sorting be case-sensitive or case-insensitive? Windows 
is case-insensitive, Linux is case-sensitive.

--
nosy: +mrabarnett

___
Python tracker 

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



[issue38770] Pickle handle self references in classes

2019-11-11 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-11 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:

The PR was linked by mistake (it is for a different issue), so I unlinked it.

--

___
Python tracker 

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
keywords:  -patch
stage: patch review -> needs patch

___
Python tracker 

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



[issue37838] typing.get_type_hints not working with forward-declaration and decorated functions

2019-11-11 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
pull_requests:  -16560

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> there are other such mutable objects in python which do define
> __hash__ = None such as list and dict

Those objects compare on their contents, not on object identity.

Take a look at how hashing works in dataclasses.  You can have a mix of mutable 
and immutable fields as long as both __eq__ and __hash__ depend on only the 
immutable fields.

Also, take a look at database cursor objects.  Both __eq__ and __hash__ use 
object identity even though fetchone() advances the internal state (just like 
an iterator).

Anyway, the breaking of existing working code makes this a non-starter.

--

___
Python tracker 

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



[issue38770] Pickle handle self references in classes

2019-11-11 Thread Saim Raza


New submission from Saim Raza :

If the __qualname__ of a class is set to have a circular reference to itself, 
pickle behaves differently based on protocol. Following script demonstrates the 
issue:

==
from __future__ import print_function

import pickle, sys

class Foo:
__name__ = __qualname__ = "Foo.ref"
pass

Foo.ref = Foo

print(sys.version_info)

for proto in range(0, pickle.HIGHEST_PROTOCOL + 1):
print("{}:".format(proto), end=" ")
try:
pkl = pickle.dumps(Foo, proto)
print("Dump OK,", end=" ")
assert(pickle.loads(pkl) is Foo)
print("Load OK,")
except Exception as err:
print(repr(err))
==
OUTPUT:
Python2.7:
sys.version_info(major=2, minor=7, micro=16, releaselevel='final', serial=0)
0: Dump OK, Load OK,
1: Dump OK, Load OK,
2: Dump OK, Load OK,

Python3.7:
sys.version_info(major=3, minor=7, micro=3, releaselevel='final', serial=0)
0: RecursionError('maximum recursion depth exceeded while pickling an object')
1: RecursionError('maximum recursion depth exceeded while pickling an object')
2: RecursionError('maximum recursion depth exceeded while pickling an object')
3: RecursionError('maximum recursion depth exceeded while pickling an object')
4: Dump OK, Load OK,
==

This was introduced as a side effect of issue#23611 (?). I can think of the 
following approaches to fix the issue and make the behavior consistent:

1. Check if the class has a self-reference and raise an error for all protocols.
2. Use memoization to handle self-references. I am not sure what should be 
dumped in this case. In the example above `Foo` will exist in the namespace but 
not `Foo.ref`. 
3. Dump such classes similar to Python 2 pickle and Python 3 pickle protocol >= 
4.

I had a stab at pickle.py and had a bit of success in doing point 3 above. 
Posting this issue for discussions. I would be happy to submit a PR for this 
issue.

Thanks,
Saim Raza

--
components: Library (Lib)
messages: 356388
nosy: Saim Raza, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Pickle handle self references in classes
type: behavior
versions: Python 2.7, Python 3.7

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Anthony Sottile


Anthony Sottile  added the comment:

:shrugs: it did go through a round of code review but was simply missed -- the 
testing bit is fair

there are other such mutable objects in python which do define __hash__ = None 
such as list and dict

--

___
Python tracker 

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



[issue38438] argparse "usage" overly-complex with nargs="*"

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a0ed99bca8475cbc82e9202aa354faba2a4620f4 by Raymond Hettinger 
(Brandt Bucher) in branch 'master':
bpo-38438: Simplify argparse "star nargs" usage. (GH-17106)
https://github.com/python/cpython/commit/a0ed99bca8475cbc82e9202aa354faba2a4620f4


--

___
Python tracker 

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



[issue38764] Deterministic globbing.

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

ISTM that if glob had been sorted, it would have only thinly masked the data 
pipeline issues that were encountered.  The code would still have been easily 
broken by someone renaming, adding, or removing a file.  In their case, it was 
the semantic context of the files where the application order was important, 
the actual filenames were incidental to the bug.

Also having user depend on sorting may lead to other bugs as well.  1) Sorts in 
one version of Python but not another, 2) Sorts in some functions but not 
others, and 3) The sort is text based so that file1, file2, ..., file11, file12 
don't sort as expected.

FWIW, I didn't put a strong -1.  However, the "sorting of discovered children" 
is a warning sign that we're doing too much.

--

___
Python tracker 

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



[issue38764] Deterministic globbing.

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> This seems like an inappropriately elitist attitude.

Please drop the personal attacks and abusive tone.  The tracker is for 
technical discussions.

--

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> the author had forgotten the `tuple(...)` call (or incorrectly 
> assumed a parenthesized generator was a tuple comprehension)

Presumably that will bite the author in many ways, not just hashability.  There 
are many other places where substituting a generator for a tuple would result 
in a downstream error.  ISTM, this user error would have been caught with even 
minimal testing or code review.


> it seems wrong that generators are currently hashable as they are mutable

It is perfectly reasonable given that generators compare based on object 
identity.


> Thoughts on `__hash__ = None` for generators?

That would break currently working code that depends on hashability.  I have 
seen such code in production more than once (using distinct generator instances 
as dictionary keys for example).

--

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +rhettinger

___
Python tracker 

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



[issue38769] generators are currently hashable

2019-11-11 Thread Anthony Sottile


New submission from Anthony Sottile :

We recently found a bug in one of our codebases that looked ~roughly like this:

class C:
...

def __hash__(self):
return hash((v for k, v in sorted(self.__dict__.items(

which resulted in a production bug

The *intention* was to hash a tuple of those elements but the author had 
forgotten the `tuple(...)` call (or incorrectly assumed a parenthesized 
generator was a tuple comprehension) -- either way it seems wrong that 
generators are currently hashable as they are mutable

Thoughts on `__hash__ = None` for generators?

--
components: Interpreter Core
messages: 356382
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: generators are currently hashable
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



[issue36852] Python3.7.2 fails to cross-compile (yocto / openembedded) when target is mips softfloat

2019-11-11 Thread Matthias Schoepfer


Matthias Schoepfer  added the comment:

Hi Matthias,

thanks for clarification. Maybe I am under a totally wrong impression, but to 
me is having soft float comparable to not having some special SSE instruction 
sets with x86. You are missing some instructions, that your code may or may not 
need, and the compiler replaces them with some other, not hardware accelerated 
functions. 

To what extend is the handcrafted version better than the one, autotools are 
providing? 

I really like to learn here. 

Many thanks already!

--

___
Python tracker 

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



[issue38767] Replace Mersenne Twister RNG with a PCG family algorithm

2019-11-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

FWIW, here's the NumPy GitHub issue that led to PCG64 being chosen as the 
default BitGenerator. Warning: the comment thread is long (with many 
contributions from the PCG author).

https://github.com/numpy/numpy/issues/13635

--

___
Python tracker 

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



[issue38767] Replace Mersenne Twister RNG with a PCG family algorithm

2019-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

We had looked at this once before and the proposal was rejected (better to 
stick with the devil you know than than one that hasn't been extensively 
studied).

Also, there is some value to having a large state space, shuffle() and sample() 
consume a lot of entropy to assure that a selection from the entire population 
is possible.

At best, PCG would be an additional algorithm rather than a replacement -- it 
is already possible to subclass Random and substitute other generators (the 
docs link to an example for the complementary-multiply-with-carry generator).

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



[issue36128] ResourceReader for FileLoader inconsistently handles path separators

2019-11-11 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

One simple restriction would be to disallow relative paths outside of the 
resource anchor location.

--

___
Python tracker 

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



[issue38767] Replace Mersenne Twister RNG with a PCG family algorithm

2019-11-11 Thread Tim Peters


Tim Peters  added the comment:

Python is a general-purpose language, and as such I believe it's inappropriate 
for it to be "a leader" in adopting new PRNGs.  That's for area specialists to 
pioneer.

If NumPy switched, that is a good reason to evaluate this again.  But for 
backward compatibility we'd probably still need to support the current Twister 
anyway (for programs that set the seed, we try to keep results bit-for-bit 
reproducible across releases).

Note that Python didn't switch _to_ the Twister before it was, in effect, a de 
facto standard across many scientific libraries.

Something not noted in the earlier report:  TOMS rejected the PCG paper, so it 
will probably never be published.  I don't much care, but those who do care 
about peer-reviewed publication may see that as a deal killer.

--
nosy: +tim.peters

___
Python tracker 

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



[issue38767] Replace Mersenne Twister RNG with a PCG family algorithm

2019-11-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

See discussion in #30880. That issue was closed, though it's possible that it's 
time to reconsider.

--

___
Python tracker 

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



[issue38767] Replace Mersenne Twister RNG with a PCG family algorithm

2019-11-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

Also worth noting that NumPy 1.17 has now adopted PCG for their default 
BitGenerator.

--

___
Python tracker 

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



[issue36852] Python3.7.2 fails to cross-compile (yocto / openembedded) when target is mips softfloat

2019-11-11 Thread Matthias Klose


Matthias Klose  added the comment:

You misunderstand. The GNU triplets are ambiguous. mips 32bit big endian soft 
float, and mips 32bit big endian hard float are *not* ABI compatible, but map 
to the same GNU triplet.

The check *is* cross compiler aware, it's run with the target 
preprocessor/compiler.

--

___
Python tracker 

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



[issue36852] Python3.7.2 fails to cross-compile (yocto / openembedded) when target is mips softfloat

2019-11-11 Thread Matthias Schoepfer


Matthias Schoepfer  added the comment:

Hi Matthias,

thanks for your comment. I am not sure, if I understand correctly or if it is 
really the problem here. So, if you take a look at the patch, or at the current 
version of configure.ac right now, there is s section:

AC_MSG_CHECKING([for the platform triplet based on compiler characteristics])

There is a handcrafted C Program (well, rather C-Preprocessor), which tries to 
guess, for what Platform the compiler is used for. The initial problem with my 
platform is this line:

# elif defined(__mips_hard_float)

The reason beeing, on mips soft float, __mips_hard_float is not defined. But 
the triplet should be mips-linux-gnu. Otherwise, the build will fail later down 
the road. 

One could add || defined (__mips_soft_float) to fix this issue. Indeed, that 
was my first patch. But I was not really satisfied. I think, using a custom C 
program for finding out the target triplet is generally not the right approach, 
because, you will always miss an architecture or fail to correctly guess the 
triplet (my guess). I think, it is much better, to rely on autotools for this. 
At the end of the day, autotools where made for that purpose, right? 
So I replaced the whole program with AC_CANONICAL_TARGET. It should always do 
the right thing *and* is Cross-Compiler aware. In the end, the triplet is 
mips-linux-gnu. It also removes lots of hard to maintain code (seems, like 
nobody really knows its internals?!). 

My trouble is, that I do not know, what other side effects this might have. On 
the latest release of yocto, my patch is used, and at least, I am not aware of 
any problems, but that does not mean, that there are none... 

Regards,
   Matthias

--

___
Python tracker 

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



[issue38768] Support lldb enhancement in MacOS

2019-11-11 Thread Manjusaka


New submission from Manjusaka :

After MacOS 10.15.x, Apple has changed this system feature that will make more 
difficult for using GDB in MacOS. 

So is there any chance to support lldb enhancement such as py-list and etc.?

--
components: macOS
messages: 356372
nosy: Manjusaka, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Support lldb enhancement in MacOS
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



[issue38767] Replace Mersenne Twister RNG with a PCG family algorithm

2019-11-11 Thread Tilman Roeder


New submission from Tilman Roeder :

Currently, the `random.random()` function / the random module uses the Mersenne 
Twister algorithm for generating random numbers.

While this algorithm has acceptable statistical properties for most use-cases 
(and does feature a ridiculously large period), it is slow and very memory 
intensive when compared with algorithms from the PCG family (see 
http://www.pcg-random.org). PCG family algorithms also have much better 
statistical properties than the Mersenne Twister.

I would propose to replace the underlying generator in `random` with a suitable 
PCG family algorithm, while not changing any of the external interfaces of the 
module. I think that the change would make the module faster, better in terms 
of memory usage, and improve the statistical properties of Python's default 
random numbers.

I have not done anything in the direction in terms of writing any code, but if 
this sounds like something that would be sensible, I would be happy to work on 
the change and submit a PR.

Also, this is the first time I am contributing to Python/ writing an issue 
here, so apologies if this is not the correct place to make a suggestion like 
this.

--
components: Extension Modules
messages: 356371
nosy: dyedgreen, mark.dickinson, rhettinger
priority: normal
severity: normal
status: open
title: Replace Mersenne Twister RNG with a PCG family algorithm
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



[issue38764] Deterministic globbing.

2019-11-11 Thread Brandt Bucher


Brandt Bucher  added the comment:

I'm not sure listdir and walk should be sorted, for the reasons Raymond 
mentioned. And I was actually surprised to learn today that pathlib.Path.glob 
doesn't use the glob module internally. Was there some reasoning behind this 
decision? Separator handling, perhaps?

Either way, these seem to be out of the scope of this issue... not every change 
needs to be a repo-wide omnibus! I think incremental improvements like the 
proposed one are often fine.

--

___
Python tracker 

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



[issue28533] Replace asyncore

2019-11-11 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I'm happy to work on replacing asyncore usage in one of the other test files.

Sounds good, just let us know which one(s) you're working on. (:

--

___
Python tracker 

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



[issue37096] Add large-file tests for modules using sendfile(2)

2019-11-11 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

Alright added some more disk space at the buildbots, however it seems that it 
is not related to that. The current Fedora rawhide buildbot has 19GB of free 
space and the test is still failing.

I tested on the Fedora stable buildbot for which I reduced intentionally the 
free disk space to 14GB and it passed: 
https://buildbot.python.org/all/#/builders/233/builds/398

So something else might be at play here.

--

___
Python tracker 

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



[issue38766] AttributeError: 'xml.etree.ElementTree.ParseError' has no attribute 'filename'

2019-11-11 Thread mlj


mlj  added the comment:

Bleh.

Sorry. I've crucially forgottn that this is an issue when running unit-tests 
under `nose` and isn't exclusively a core problem. Let me do some more 
debugging and then decide who the correct people to annoy are.

--
resolution:  -> works for me
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



[issue38766] AttributeError: 'xml.etree.ElementTree.ParseError' has no attribute 'filename'

2019-11-11 Thread mlj


New submission from mlj :

traceback.py and how it handles 'SyntaxError's, which includes a bunch of 
assumptions about attributes that a SyntaxError should have defined:

https://github.com/python/cpython/blob/master/Lib/traceback.py#L516

Definition of xml.etree.ElementTree.ParseError, marking it out as a sub-class 
of a SyntaxError:

https://github.com/python/cpython/blob/master/Lib/xml/etree/ElementTree.py#L106

How a ParseError is raised by ElementTree, noting that it doesn't set 
`filename` (and probably `text` too) as an attribute of the exception isntance:

https://github.com/python/cpython/blob/master/Lib/xml/etree/ElementTree.py#L1625

The most recent commit in the code areas I've highlighted is from 
`6bc2c1e7ebf359224e5e547f58ffc2c42cb36a39` from March 2015, which added in the 
assumptions about attributes to `traceback.py`.

The whole thing is markedly confusing, because the code in `traceback.py` isn't 
being run inside an exception handler, so when it crashes it completly 
obfuscates the actual root-cause of the issue (in other cases you'd get the 
"while handling this error, another happened" which is much more user friendly).

I'm not sure what the correct fix here is but I tried making 
xml.etree.ElementTree.ParseError a standalone exception, not a sub-class of 
SyntaxError but it didn't take. Probably shouldn't be delving about in the guts 
of the python-core on my laptop, but ho-hum.

--
components: XML
messages: 356366
nosy: mlj
priority: normal
severity: normal
status: open
title: AttributeError: 'xml.etree.ElementTree.ParseError' has no attribute 
'filename'
type: crash
versions: Python 2.7, 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



[issue38728] Update PC/pyconfig.h to support disabling auto linking

2019-11-11 Thread Jean-Christophe Fillion-Robin


Jean-Christophe Fillion-Robin  added the comment:

PY_NO_LINK_LIB will work well. I will work on a patch later this week.

--

___
Python tracker 

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



[issue28533] Replace asyncore

2019-11-11 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

@dankreso, the issue is still open and no one has claimed it yet. So feel free 
to open a pull request.

--

___
Python tracker 

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



[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-11 Thread Pekka Klärck

Pekka Klärck  added the comment:

Based on the `ast` source code there are also other functions that use  the 
undocumented `_attributes` attribute:

- copy_location
- fix_missing_locations
- increment_lineno

--

___
Python tracker 

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



[issue38765] `ast.AST._attributes` is used by `ast.dump()` but not documented

2019-11-11 Thread Pekka Klärck

New submission from Pekka Klärck :

We have implemented an ast for our own tool so that we extend Python's standard 
`ast.AST`. When using `ast.dump(node, include_attributes=True)`, we were 
surprised to notice that line numbers weren't dumped although the docs of 
`ast.dump()` said they should be and we had set both `lineno` and `end_lineno` 
attributes to our nodes.

Looking at the implementation of `ast.dump()` revealed that 
`include_attributes=True` alone wasn't enough, the node also needed to have 
`_attributes` attribute similarly as it needs to have `_fields` for 
`ast.dump()` to be able to dump also child nodes. The problem is that 
`_attributes` isn't documented at all. Related to that, `ast.dump()` using 
`_fields` isn't documented either, but at least `_fields` is mentioned in the 
docs otherwise. Relevant links to `ast.dump()` docs and to the source code 
below.

`ast.AST` documents the `_fields` attribute but doesn't mention similar 
`_attributes`:
https://docs.python.org/3/library/ast.html#ast.AST

`ast.dump()` documents the `include_attributes` argument but doesn't mention 
that `_attributes` is needed (or that `_fields` needs to be set correctly to 
get child notes dumped):
https://docs.python.org/3/library/ast.html#ast.dump

`ast.dump()` source code shows that the undocumented `_attributes` needs to be 
set in addition to using `include_attributes=True`:
https://github.com/python/cpython/blob/3.8/Lib/ast.py#L123

--
messages: 356362
nosy: pekka.klarck
priority: normal
severity: normal
status: open
title: `ast.AST._attributes` is used by `ast.dump()` but not documented

___
Python tracker 

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



[issue36128] ResourceReader for FileLoader inconsistently handles path separators

2019-11-11 Thread Marcin Kasperski


Marcin Kasperski  added the comment:

Hmm, I noticed this but accidentally and tried to port 
https://github.com/pypa/setuptools/issues/1635 to new api. Well:

>>> import multiprocessing
>>> import sys
>>> reader = 
>>> sys.modules['multiprocessing'].__spec__.loader.get_resource_reader('multiprocessing')
>>> reader.open_resource('../../../../etc/passwd')
<_io.FileIO name='/usr/lib/python3.7/multiprocessing/../../../../etc/passwd' 
mode='rb' closefd=True>

I suppose this is the case which deserve some thought (originally I faced it 
when some webapp used pkg_resources to provide static files and used resource 
api as a way to validate urls impacted by external input).

Tested on python 3.7.3, on Ubuntu 19.04.

--
nosy: +Mekk

___
Python tracker 

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



[issue38757] mocking an exception, arguments do not seem to be passed to the mock

2019-11-11 Thread Chris Withers


Chris Withers  added the comment:

Agreed.

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



[issue38500] Provide a way to get/set PyInterpreterState.frame_eval without needing to access interpreter internals

2019-11-11 Thread Mark Shannon


Mark Shannon  added the comment:

Fabio,

If the user changes the `__code__` attribute of a function then, AFAICT, your 
debugger does the wrong thing, but bytecode modification does the right thing.

Suppose we have two functions `spam` and `eggs`.
Set a break point in `eggs`, set `spam.__code__ = eggs.__code__`, then call 
`spam`.
With bytecode modification, we get the correct result. That is, execution 
breaks in the source code of `eggs` when `spam` is run.
I think your debugger will do the wrong thing as it will execute the original 
code of `spam`. Could you confirm what it does?

But that's not the main issue, IMO. The big problem is that changing out the 
interpreter is not composable, unlike bytecode modification.

Suppose we have MyProfiler and YourDebugger.
MyProfiler wants to record calls and YourDebugger wants to support breakpoints.

With bytecode modification, and some care, we can do both.
Swapping out the interpreter is likely to cause all sorts of errors and 
confusion.

--

___
Python tracker 

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



[issue38747] Slowly introduce a subset of Jupyter console (IPython) features into CPython command line interactive mode

2019-11-11 Thread Marco Sulla

Marco Sulla  added the comment:

@Terry:

> Jupyter Console is, I read, QT based

Nope. It's shell based by default. You can open it also as a QT app, like IDLE, 
but by default `jupyter console` is via terminal.

> they must use "‘magic’ commands" entered after the '>>>' prompt 
> instead of code.  Guido specifically vetoed the idea

Indeed I'm against too, and I wrote it. And if you read my proposals, I do not 
suggest any magic word

> the answer to that proposal would be to use a PYTHONSTARTUP module 
> with code such as "import pprint as _; pprint = _.pprint"

I know this, but it should be the default behaviour, IMHO. I mean, you can 
invoke `help()` in REPL but also in a `.py`. It makes no sense, but you can do 
it and you have not to import a separate module before.

> The console feeds pasted lines *1 at a time* to interactive Python

This is fixed by many terminal editors, like `vi`, with bracketed paste mode, 
as I wrote.

> When REPL sends a prompt, everything up to and including a prompt is 
> somehow marked read-only.

A workaround could be simulate input by user. Ugly but effective.

> Syntax-coloring [...] requires full screen editing

???

> [Syntax-coloring] also needs to be configurable

This could be IMHO delayed, or not implemented at all. If you don't like the 
colors, you can always not use it :D It will suffice that the colors will be as 
much as possible readable also by the majority of color-blind person.

--

___
Python tracker 

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



[issue38762] Logging displays wrong "processName" if "sys.modules" is cleared in child process

2019-11-11 Thread Vinay Sajip


Vinay Sajip  added the comment:

This will be a rare use case, and I would expect anyone clearing sys.modules in 
the child process to handle this consequence themselves (e.g. by reimporting 
multiprocessing after clearing out the other modules, since they apparently 
still want some of multiprocessing's functionality in the child process). I'll 
certainly look at PRs to address the issue using an import of multiprocessing 
if it's not already there. I'm not so keen on the other approaches you've 
suggested.

--

___
Python tracker 

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



[issue38764] Deterministic globbing.

2019-11-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If sort the output of glob(), we should sort also the output of Path.glob(), 
listdir(), and maybe walk().

--

___
Python tracker 

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



[issue28533] Replace asyncore

2019-11-11 Thread dankreso


dankreso  added the comment:

Hi, is this still open?

I'm happy to work on replacing asyncore usage in one of the other test files.

--
nosy: +dankreso

___
Python tracker 

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