[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-04-19 Thread Tigran


Tigran  added the comment:

Do we have any news about this?

--
nosy: +nargit

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Vinay Sajip


Vinay Sajip  added the comment:

What is the practical impact on the time taken for test runs? How much does the 
total time for a test run reduce as a result of refactoring test.support to 
minimise imports?

--
nosy: +vinay.sajip

___
Python tracker 

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



[issue39849] Compiler warninig: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]

2020-04-19 Thread hai shi


hai shi  added the comment:

I found this warning too(ps: my gcc is 9.3.0 ;)
Can we add a inner macro like `_unused(var) (void) var`? 
Hi, serhiy, can you give us some advice?

--

___
Python tracker 

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



[issue39849] Compiler warninig: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]

2020-04-19 Thread hai shi


Change by hai shi :


--
keywords: +patch
nosy: +shihai1991
nosy_count: 2.0 -> 3.0
pull_requests: +18947
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19615

___
Python tracker 

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



[issue40198] macOS Python builds from Python.org ignore DYLD_LIBRARY_PATH due to hardened runtime

2020-04-19 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the report. Yes, the choice of entitlements to request whith code 
hardening was somewhat arbitrary; we tried to keep them to a minimum.  I didn't 
anticipate that the DYLD_ env variables would be used much, sorry about that. 
Future python.org macOS installers will include that entitlement, starting with 
2.7.18 (the final 2.7 release), 3.7.8, 3.8.3, and 3.9.0a6.

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
versions: +Python 2.7

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-04-19 Thread Shantanu


Change by Shantanu :


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

___
Python tracker 

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



[issue37006] Add top level await statement support for doctest

2020-04-19 Thread jack1142


Change by jack1142 :


--
nosy: +jack1142

___
Python tracker 

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



[issue23082] pathlib relative_to() can give confusing error message

2020-04-19 Thread Sadhana Srinivasan


Change by Sadhana Srinivasan :


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

___
Python tracker 

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



[issue40335] Regression in multiline SyntaxError offsets

2020-04-19 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The regression happened in:

commit 41d5b94af44e34ac05d4cd57460ed104ccf96628
Author: Lysandros Nikolaou 
Date:   Sun Apr 12 21:21:00 2020 +0300

bpo-40246: Report a better error message for invalid string prefixes 
(GH-19476)

Will try to get a look at this shortly

--
nosy: +lys.nikolaou

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-04-19 Thread Lysandros Nikolaou


Change by Lysandros Nikolaou :


--
nosy: +lys.nikolaou

___
Python tracker 

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



[issue40335] Regression in multiline SyntaxError offsets

2020-04-19 Thread gaborbernat


Change by gaborbernat :


--
nosy: +gaborbernat

___
Python tracker 

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



[issue40335] Regression in multiline SyntaxError offsets

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue9751] _PyInstance_Lookup() defeats its purpose

2020-04-19 Thread Zackery Spytz


Zackery Spytz  added the comment:

Python 2 is EOL.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue23980] Documentation for format units starting with 'e' is inconsistent

2020-04-19 Thread Zackery Spytz


Change by Zackery Spytz :


--
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 
3.5

___
Python tracker 

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



[issue40335] Regression in multiline SyntaxError offsets

2020-04-19 Thread Anthony Sottile


Change by Anthony Sottile :


--
nosy: +pablogsal

___
Python tracker 

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



[issue40335] Regression in multiline SyntaxError offsets

2020-04-19 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue40335] Regression in multiline SyntaxError offsets

2020-04-19 Thread Anthony Sottile


New submission from Anthony Sottile :

this was noticed in pyflakes's testsuite: 
https://github.com/PyCQA/pyflakes/pull/532#pullrequestreview-396059622

I've created a small script to reproduce the problem

```
import sys

SRC = b"""\
def foo():
'''

def bar():
pass

def baz():
'''quux'''
"""

try:
exec(SRC)
except SyntaxError as e:
print(
f'{sys.version}\n\n'
f'{type(e).__name__}:\n'
f'- line: {e.lineno}\n'
f'- offset: {e.offset}\n'
f'- text: {e.text!r}\n'
)
```

This was "fixed" in python3.8, but has regressed:

```
$ python3.6 t2.py
3.6.9 (default, Nov  7 2019, 10:44:02) 
[GCC 8.3.0]

SyntaxError:
- line: 8
- offset: 52
- text: "'''\n\ndef bar():\npass\n\ndef baz():\n'''quux'''\n"

$ python3.8 t2.py
3.8.2 (default, Feb 26 2020, 02:56:10) 
[GCC 7.4.0]

SyntaxError:
- line: 8
- offset: 8
- text: "'''\n\ndef bar():\npass\n\ndef baz():\n'''quux'''\n"

$ ./python t2.py
3.9.0a5+ (heads/master:3955da8568, Apr 19 2020, 14:29:48) 
[GCC 7.5.0]

SyntaxError:
- line: 8
- offset: 52
- text: "'''\n\ndef bar():\npass\n\ndef baz():\n'''quux'''\n"

```

--
components: Interpreter Core
messages: 366805
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: Regression in multiline SyntaxError offsets
type: behavior
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



[issue40327] list(sys.modules.items()) can throw RuntimeError: dictionary changed size during iteration

2020-04-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

We should consider making this change just about everywhere in the standard 
library.  Besides avoiding a race condition, running a for loop over 
`d.copy().items()` is more memory efficient and possibly faster than a for loop 
over `list(d.items())`.

--

___
Python tracker 

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



[issue23980] Documentation for format units starting with 'e' is inconsistent

2020-04-19 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 7.0 -> 8.0
pull_requests: +18944
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/19610

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-04-19 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-04-19 Thread Guido van Rossum


New submission from Guido van Rossum :

Note: PEP 617 is currently under review by the Steering Council, but if they 
approve we'd like to get it into alpha 6, and reviews are welcome (even though 
we're still finagling some corner cases of the implementation).

--
messages: 366803
nosy: gvanrossum, pablogsal
priority: normal
severity: normal
status: open
title: PEP 617: new PEG-based parser
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



[issue40334] PEP 617: new PEG-based parser

2020-04-19 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


--
nosy: +BTaskaya

___
Python tracker 

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



[issue40333] Request for multi-phase initialization API to run code after importlib init

2020-04-19 Thread Gregory Szorc


New submission from Gregory Szorc :

I'm porting PyOxidizer to the PEP 587 APIs. So far, it is mostly 
straightforward.

I was looking forward to adopting the multi-phase initialization API because I 
thought it would enable me to get rid of the very ugly hack PyOxidizer uses to 
inject its custom meta path importer. This hack is described in gory detail at 
https://docs.rs/pyembed/0.7.0/pyembed/technotes/index.html#our-importing-mechanism
 and the tl;dr is we use a modified version of the 
`importlib._bootstrap_external` module to configure a builtin extension module 
on sys.meta_path so it can handle all imports during initialization.

The good news is the multi-phase initialization API gives us an injection point 
between "core" and "main." I _think_ I would be able to import the built-in 
extension here and register it on sys.meta_path.

However, the new multi-phase initialization API doesn't give us the total 
control that we need. Specifically, PyOxidizer's importer is leveraging a few 
functions in importlib._bootstrap_external as part of its operation. So it 
needs this module to be available before it can be loaded and installed on 
sys.meta_path. It also wants total control over sys.meta_path. So we don't want 
importlib._bootstrap_external to be mucking with sys.meta_path and imports 
being performed before PyOxidizer has a chance to readjust state.

The critical feature that PyOxidizer needs is the ability to muck with 
sys.meta_path and importlib *after* importlib externals are initialized and 
*before* any non-builtin, non-frozen import is attempted. In the current state 
of the initialization code, we need to run custom code between 
init_importlib_external() and when the first non-builtin, non-frozen import is 
attempted (currently during _PyUnicode_InitEncodings()).

Would it be possible to get a multi-phase initialization API that stops after 
init_importlib_external()?

If not, could we break up PyConfig._install_importlib into 2 pieces to allow 
disabling of just importlib._bootstrap_external and provide a supported 
mechanism to initialize the external mechanism between "core" and "main" 
initialization? (Although I'm not sure if this is possible, since "main" 
finishes initializing aspects of "sys" before init_importlib_external() and I'm 
not sure if it is safe to initialize importlib externals before this is done. 
I'm guessing there is a reason that code runs before importlib is fully 
initialized.)

I suppose I could change PyOxidizer's functionality a bit to work around the 
lack of an importlib._bootstrap_external module between "core" and "main" 
initialization. I'm pretty sure I could make this work. But my strong 
preference is to inject code after importlib external support is fully 
initialized but before any imports are performed with it.

Overall the PEP 587 APIs are terrific and a substantial improvement over what 
came before. Thank you for all your work on this feature, Victor!

--
components: C API
messages: 366802
nosy: indygreg, vstinner
priority: normal
severity: normal
status: open
title: Request for multi-phase initialization API to run code after importlib 
init
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



[issue40333] Request for multi-phase initialization API to run code after importlib init

2020-04-19 Thread Gregory Szorc


Change by Gregory Szorc :


--
type:  -> enhancement

___
Python tracker 

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



[issue40332] RegEx for numbers in documentation (easy fix - solution provided)

2020-04-19 Thread Brandon


New submission from Brandon :

The regular expression used for matching numbers in the documentation for the 
regular expressions module (the tokenizer section) doesn't match the string 
".5", but does match the string "3.".

Here's a link to the tokenizer section of the documentation: 
https://docs.python.org/3/library/re.html#writing-a-tokenizer

The tokenizer example uses r'\d+(\.\d*)?' for matching numbers. I would 
personally match ".5" as a number before I would match "3." as a number. In 
order to do this, I would use r'(\d*\.)?\d+' instead of r'\d+(\.\d*)?'. Python 
3's interpreter matches both "3." and ".5" as numbers when interpreting code, 
so you could use a different regex example for matching both if you wanted to 
be consistent with Python's own interpreter.

--
components: Regular Expressions
messages: 366801
nosy: TheBrandonGuy, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: RegEx for numbers in documentation (easy fix - solution provided)
type: behavior
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



[issue40307] multiprocessing.BaseManager does not retain Client type.

2020-04-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +davin, pitrou

___
Python tracker 

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



[issue40307] multiprocessing.BaseManager does not retain Client type.

2020-04-19 Thread Alessandro Molina


Change by Alessandro Molina :


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

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-04-19 Thread Simon Percivall


Simon Percivall  added the comment:

Any and all code from astunparse is certainly available for inclusion. Go ahead.

--
nosy: +simon.percivall

___
Python tracker 

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



[issue40329] Faulty dict arg gives ValueError but mostly TypeError

2020-04-19 Thread Tomas Nordin


Tomas Nordin  added the comment:

Serhiy Storchaka  writes:

> Serhiy Storchaka  added the comment:
>
> It is all correct. Note that set is unordered, so "element #0" can be 1, and 
> can be "one". If it is 1, you get a type error. If it is "one", which is a 
> sequence with length 3, you get a value error.

Yes! Thanks, sorry for the noise.

--

___
Python tracker 

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



[issue40327] list(sys.modules.items()) can throw RuntimeError: dictionary changed size during iteration

2020-04-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Suggest making this change:

-for module_name, module in list(sys.modules.items()):
+for module_name, module in sys.modules.copy().items():

--
nosy: +rhettinger

___
Python tracker 

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



[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-19 Thread Tim Peters


Tim Peters  added the comment:

Things get complicated here because in older versions of Python an instance of 
ForeverObject(True) could "leak" forever:  if an object in a trash cycle had a 
__del__ method, that method would never be called, and the object would never 
be collected.

Starting in Python 3.4, that changed:  __del__ no longer inhibits collection of 
objects in cyclic trash.  However, __del__ is called no more than once starting 
in 3.4.  If an object is resurrected by __del__, it's marked with a "__del__ 
was already called" bit, and __del__ is never called again by magic if/when the 
object becomes trash again.

I don't think the weakref docs were changed, because nobody cares ;-)  

What it _intended_ to mean by "about to be finalized" is clear as mud.  What it 
actually means is akin to "about to have its memory destroyed and recycled".

In current CPython, for your ForeverObject(False), `del o` does not make the 
object trash "for real".  __del__ runs immediately (due to deterministic, 
synchronous reference counting) and resurrects it.  That cuts off the "about to 
have its memory destroyed and recycled" part, so the callback doesn't run.

But if you do

del o

again, _then_ the callback runs.  __del__ isn't run again, so the object isn't 
resurrected again, so the "about to have its memory destroyed and recycled" 
part applies.

In cyclic gc, there is no deterministic order in which end-of-life actions 
occur.  There may well be thousands of objects in cyclic trash, or reachable 
only from cyclic trash.  The order picked is more-or-less arbitrary, just 
trying like hell to ensure that no end-of-life action ever "sees" an object 
whose memory has already been destroyed and recycled.

To make progress at all, it _assumes_ all the cyclic trash really will be 
reclaimed (memory destroyed and recycled).  That's why it runs all weakref 
callbacks to trash objects (provided the weakref isn't also trash).  It also 
runs all finalizers (except on objects with a __del__ that has already been 
called).  Only after _all_ that is done does it even start to destroy and 
recycle memory.

Although, along the way, memory _may_ be destroyed and recycled as a result of 
refcounts falling to 0 as end-of-life actions (callbacks and finalizers) are 
invoked.

And, yup, it's as delicate as it sounds ;-)

--

___
Python tracker 

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



[issue28002] ast.unparse can't roundtrip some f-strings

2020-04-19 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> If that sounds good, I can submit a PR and inform the original author

I can't say anything before seeing the approach but fixing the problem 
definitely sounds good.

--

___
Python tracker 

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



[issue37373] Configuration of windows event loop for libraries

2020-04-19 Thread Ben Darnell


Ben Darnell  added the comment:

> Would it be acceptable for you to *require* use of uvloop when Tornado is 
> used with AsyncIO?

How, exactly? Adding the dependency is no problem, but AFAIK I'd still be stuck 
with an import-time side effect to set the event loop policy (or a .pth file 
hack, I guess). Maybe an import-time side effect that chooses uvloop is better 
since it's a functional superset of the two default windows event loops, but 
setting the policy at import time still has its problems (What if another 
module has initialized the event loop before tornado is imported? What if 
someone also wants to set a custom policy to work around asyncio's strict "only 
on the main thread" defaults?)

That's why I started this thread not asking for a proactor+selector hybrid 
event loop, but a better way to *configure* the event loop because policies 
aren't really doing the job in this case. 

> I considered using the `selectors` module directly, but it's not as simple as 
> it sounds.

FWIW, I've reconsidered this. Treating SelectorEventLoop as a black box means 
you don't have enough control over synchronization and it's hard to avoid 
spurious wakeups and busy loops on the selector thread. I have a (broken) 
prototype using SelectorEventLoop that I plan to rewrite to call select.select 
directly.

--

___
Python tracker 

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



[issue17986] Alternative async subprocesses (pep 3145)

2020-04-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

Should this still be open given that PEP 3145 is withdrawn and asyncio 
subprocesses have been used in production for five Python releases now?

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue39651] Exceptions raised by EventLoop.call_soon_threadsafe

2020-04-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

Good catch. We should fix this for Python 3.8.3.

--
nosy: +lukasz.langa
priority: normal -> release blocker

___
Python tracker 

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



[issue37373] Configuration of windows event loop for libraries

2020-04-19 Thread Łukasz Langa

Łukasz Langa  added the comment:

I'd be +1 to bringing uvloop into the stdlib, it would solve many things while 
introducing an acceptable dependency in the form of libuv.

However, uvloop itself is written in Cython which makes it impossible for us to 
directly merge it. So that option is pretty much off the table as rewriting the 
library is not something we have resources for right now.

Ben, Nathaniel is onto something though. Would it be acceptable for you to 
*require* use of uvloop when Tornado is used with AsyncIO? That indeed solves 
the Windows problems, and more. I use uvloop in all asyncio applications I 
maintain (*except for Black which is tested to work on Windows with the 
Proactor loop).

For Python 3.9, it is a bit late, but not *too late* yet, to make the Proactor 
loop support AFD_POLL. Maybe counter-intuitively I would feel better about 
*that* rather than have a background thread with a SelectorEventLoop.

--

___
Python tracker 

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



[issue40083] No run option available in python idle in version 3.8.2

2020-04-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

3. You did not answer about the tcl/tk version.

4. When you start from the start menu, there is no Editor window, just the 
Shell window, which does not have the Run menu.  Again, how did you get an 
editor window?

5. Search the Web for an illustrated explanation or ask on python-list.

6. 'touch' was the wrong word.  I should have asked, "Have you changed any of 
the  files in Lib/idlelib?  If which ones, and how?"

--

___
Python tracker 

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



[issue40324] python 3.8.2 idle not opening

2020-04-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The relevant one.  Skip 3 and 4.

--

___
Python tracker 

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



[issue40331] Increase test coverage for the statistics module

2020-04-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +steven.daprano

___
Python tracker 

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



[issue40331] Increase test coverage for the statistics module

2020-04-19 Thread Tzanetos Balitsaris


Change by Tzanetos Balitsaris :


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

___
Python tracker 

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



[issue40331] Increase test coverage for the statistics module

2020-04-19 Thread Tzanetos Balitsaris


New submission from Tzanetos Balitsaris :

The statistics module is already highly tested but it seems that there are 4 
statements [0] that are not executed by the equivalent unit tests. 
Specifically, 3 statements which are part of the `_convert`, `_find_lteq`, and 
`_find_rteq` functions, and 1 statement of the `harmonic_mean` function.

[0] 
https://codecov.io/gh/python/cpython/src/8aea4b3605059e243f1827d9328d6fc8d698c0a7/Lib/statistics.py

--
components: Tests
messages: 366788
nosy: tzabal
priority: normal
severity: normal
status: open
title: Increase test coverage for the statistics module
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



[issue40275] test.support has way too many imports

2020-04-19 Thread hai shi


hai shi  added the comment:

> I used -X importtime.
copy that, thanks.

In master branch:
import time:  5011 | 133562 | test.support

After apply serhiy's patches:
import time:  4863 |  66940 | test.support

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I used -X importtime.

Your benchmark measures the performance of look up in sys.modules.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread hai shi


hai shi  added the comment:

> These three PRs combined reduce the number of imported modules from 179 to 
> 105 (not including 24 modules imported by the bare interpreter) and reduce 
> the hot import time from 160 ms to 80 ms.

Good job, serhiy. I tested your patches in my vm, the number of importing 
module have been reduced. Could you paste your performance benchmark test? I 
got a no siginificant change :( when I run: 
$ ./python -m pyperf timeit --compare-to python3.9 "from test import support" 
-p 100
python3.9: 
.
 820 ns +- 206 ns

python: 
.
 809 ns +- 201 ns

Mean +- std dev: [python3.9] 820 ns +- 206 ns -> [python] 809 ns +- 201 ns: 
1.01x faster (-1%)
Not significant!

--

___
Python tracker 

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



[issue40148] Add PurePath.with_stem()

2020-04-19 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue40148] Add PurePath.with_stem()

2020-04-19 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 8aea4b3605059e243f1827d9328d6fc8d698c0a7 by Tim Hoffmann in 
branch 'master':
bpo-40148: Add PurePath.with_stem() (GH-19295)
https://github.com/python/cpython/commit/8aea4b3605059e243f1827d9328d6fc8d698c0a7


--

___
Python tracker 

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



[issue40330] ShareableList size guard incorrect for str data

2020-04-19 Thread Antoine Pitrou


Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue38891] ShareableList read and write access is O(N), should be O(1)

2020-04-19 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue38891] ShareableList read and write access is O(N), should be O(1)

2020-04-19 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset c8f1715283ec51822fb37a702bf253cbac1af276 by Thomas Krennwallner 
in branch 'master':
bpo-38891: avoid quadratic item access performance of ShareableList (GH-18996)
https://github.com/python/cpython/commit/c8f1715283ec51822fb37a702bf253cbac1af276


--
nosy: +pitrou

___
Python tracker 

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



[issue40329] Faulty dict arg gives ValueError but mostly TypeError

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is all correct. Note that set is unordered, so "element #0" can be 1, and 
can be "one". If it is 1, you get a type error. If it is "one", which is a 
sequence with length 3, you get a value error.

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



[issue40330] ShareableList size guard incorrect for str data

2020-04-19 Thread Antoine Pitrou


New submission from Antoine Pitrou :

The size check is done before encoding to utf-8...

--

___
Python tracker 

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



[issue40330] ShareableList size guard incorrect for str data

2020-04-19 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
assignee: pitrou
components: Library (Lib)
nosy: pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: ShareableList size guard incorrect for str data
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



[issue40329] Faulty dict arg gives ValueError but mostly TypeError

2020-04-19 Thread Tomas Nordin


New submission from Tomas Nordin :

Hello Python bug tracker

Trying to create a dict with a top level set pair will fail, but how
will it fail?

Here comes a terminal session to reproduce the behavior. The same
command is just repeated.

--8<--
$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot convert dictionary update sequence element #0 to a sequence

# Understand, can't convert 1 to sequence.

$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
  File "", line 1, in 
ValueError: dictionary update sequence element #0 has length 3; 2 is required

# Not so helpful to me, don't understand.

$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot convert dictionary update sequence element #0 to a sequence

# OK, thanks

$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot convert dictionary update sequence element #0 to a sequence

$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
  File "", line 1, in 
TypeError: cannot convert dictionary update sequence element #0 to a sequence

$ python3 -c 'd = dict({1, "one"})'
Traceback (most recent call last):
  File "", line 1, in 
ValueError: dictionary update sequence element #0 has length 3; 2 is required

# Again?
-->8--

I searched the bug tracker on "dict typeerror valueerror" but couldn't
find something similar. What do you think about this?

$ python3 --version
Python 3.7.3

Best regards
--
Tomas

--
components: Library (Lib)
messages: 366781
nosy: tomnor
priority: normal
severity: normal
status: open
title: Faulty dict arg gives ValueError but mostly TypeError
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



[issue40328] Add tools for generating mappings_XX.h

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
components: +Demos and Tools
nosy: +hyeshik.chang, serhiy.storchaka
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



[issue39207] concurrent.futures.ProcessPoolExecutor does not properly reap jobs and spawns too many workers

2020-04-19 Thread miss-islington


miss-islington  added the comment:


New changeset 1ac6e379297cc1cf8acf6c1b011fccc7b3da2cbe by Kyle Stanley in 
branch 'master':
bpo-39207: Spawn workers on demand in ProcessPoolExecutor (GH-19453)
https://github.com/python/cpython/commit/1ac6e379297cc1cf8acf6c1b011fccc7b3da2cbe


--
nosy: +miss-islington

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

These three PRs combined reduce the number of imported modules from 179 to 105 
(not including 24 modules imported by the bare interpreter) and reduce the hot 
import time from 160 ms to 80 ms.

--

___
Python tracker 

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



[issue39207] concurrent.futures.ProcessPoolExecutor does not properly reap jobs and spawns too many workers

2020-04-19 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

2020-04-19 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18939
pull_request: https://github.com/python/cpython/pull/19603

___
Python tracker 

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



[issue40328] Add tools for generating mappings_XX.h

2020-04-19 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue39107] Upgrade tcl/tk to 8.6.10 (Windows and maxOS)

2020-04-19 Thread szb512


szb512  added the comment:

That backfired horribly.

--

___
Python tracker 

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



[issue40328] Add tools for generating mappings_XX.h

2020-04-19 Thread Dong-hee Na


New submission from Dong-hee Na :

AFAIK, there are no tools for generating mappings_XX.h under Modules/cjkcodecs.

It would cause a maintainable issue,
fortunately, I got the old source from 
https://github.com/BackupTheBerlios/cjkpython.
And I success to port into Python3 version and successfully reproduce to 
generating header file except for mappings_hk.h mappings_tw.h.

The patch will include a generator and Unicode mapping file.
I am not the codec expert but hopefully it will help us.

--
messages: 366777
nosy: corona10, inada.naoki, vstinner
priority: normal
severity: normal
status: open
title: Add tools for generating mappings_XX.h

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18937
pull_request: https://github.com/python/cpython/pull/19601

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18936
pull_request: https://github.com/python/cpython/pull/19600

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

logging is also imported in unittest and indirectly in asyncio.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread hai shi


Change by hai shi :


--
pull_requests: +18935
pull_request: https://github.com/python/cpython/pull/19599

___
Python tracker 

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



[issue39285] PurePath.match indicates case-sensitive nature and presents a case-insensitive example

2020-04-19 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue39285] PurePath.match indicates case-sensitive nature and presents a case-insensitive example

2020-04-19 Thread miss-islington


miss-islington  added the comment:


New changeset 143147d94f3e55a929327ddae1d0d3c260d71cef by Miss Islington (bot) 
in branch '3.7':
bpo-39285: Clarify example for PurePath.match (GH-19458)
https://github.com/python/cpython/commit/143147d94f3e55a929327ddae1d0d3c260d71cef


--

___
Python tracker 

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



[issue39285] PurePath.match indicates case-sensitive nature and presents a case-insensitive example

2020-04-19 Thread miss-islington


miss-islington  added the comment:


New changeset 8c0734397603d84e3a2e753463b44cf904147cc4 by Miss Islington (bot) 
in branch '3.8':
bpo-39285: Clarify example for PurePath.match (GH-19458)
https://github.com/python/cpython/commit/8c0734397603d84e3a2e753463b44cf904147cc4


--

___
Python tracker 

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



[issue40269] Inconsistent complex behavior with (-1j)

2020-04-19 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I tried to make repr of floats producing a string which rounds up with eval()

We've looked at this before. There just isn't any sane and easy way to do this, 
except for changing the repr to be "complex(real, imag)", which is the solution 
that I favour.

And this seems like a non-starter to me:

>>> complex(0.0, -0.0)
-(-0.0-0j)

This is a case where the cure is worse than the disease.

We should also not change the repr lightly: the last time it was changed, it 
caused disruption at least for Cython, and probably for NumPy too. As a 
corollary, if we _do_ change it, we should make sure we get it right so that 
we're changing it to something we're not going to want to change again in 5 
years' time. And I suspect that if we don't solve the underlying roundtrip 
problem, then this is going to come up again.

I'm +1 on changing the repr to "complex(..., ...)", +0 on modifying it to 
always include both real and imaginary parts _and_ format those parts as though 
they're floats; -1 on other changes.

--

___
Python tracker 

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



[issue39285] PurePath.match indicates case-sensitive nature and presents a case-insensitive example

2020-04-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18934
pull_request: https://github.com/python/cpython/pull/19598

___
Python tracker 

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



[issue39285] PurePath.match indicates case-sensitive nature and presents a case-insensitive example

2020-04-19 Thread miss-islington


miss-islington  added the comment:


New changeset c12375aa0b838d34067efa3f1b9a1fbc632d0413 by Tim Lo in branch 
'master':
bpo-39285: Clarify example for PurePath.match (GH-19458)
https://github.com/python/cpython/commit/c12375aa0b838d34067efa3f1b9a1fbc632d0413


--
nosy: +miss-islington

___
Python tracker 

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



[issue39285] PurePath.match indicates case-sensitive nature and presents a case-insensitive example

2020-04-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18933
pull_request: https://github.com/python/cpython/pull/19597

___
Python tracker 

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



[issue40326] A string contains an empty string?

2020-04-19 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

https://docs.python.org/3/reference/expressions.html#membership-test-operations

--
nosy: +steven.daprano

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-19 Thread Yuval S


Change by Yuval S :


--
pull_requests: +18932
pull_request: https://github.com/python/cpython/pull/19596

___
Python tracker 

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



[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

2020-04-19 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

== Master ==

.\python.bat -m pyperf timeit -s "import random, math; 
data=random.getrandbits(8*10_000_000).to_bytes(10_000_000, 'big')" "temp = 
data.hex(); '\n'.join(temp[n:n+128] for n in range(0, len(temp), 128))"

Mean +- std dev: 74.3 ms +- 1.1 ms

.\python.bat -m pyperf timeit -s "import random; 
data=random.getrandbits(8*10_000_000).to_bytes(10_000_000, 'big')" 
"data.hex('\n', -64)"

Mean +- std dev: 44.0 ms +- 0.3 ms

== PR 19594 ==

.\python.bat -m pyperf timeit -s "import random, math; 
data=random.getrandbits(8*10_000_000).to_bytes(10_000_000, 'big')" "temp = 
data.hex(); '\n'.join(temp[n:n+128] for n in range(0, len(temp), 128))"

Mean +- std dev: 65.2 ms +- 0.6 ms

.\python.bat -m pyperf timeit -s "import random; 
data=random.getrandbits(8*10_000_000).to_bytes(10_000_000, 'big')" 
"data.hex('\n', -64)"

Mean +- std dev: 18.1 ms +- 0.1 ms

--
type:  -> performance

___
Python tracker 

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



[issue40260] modulefinder traceback regression starting on Windows

2020-04-19 Thread Barry Alan Scott


Barry Alan Scott  added the comment:

I have pushed the fix onto https://github.com/python/cpython/pull/19595
with an API test case and the changes to keep the debain subclassing
working.

I'm new the the work flow. Let me know if I need to change anything.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread hai shi


hai shi  added the comment:

> asyncio is now imported in unittest. Removing direct import from test.support 
> does not help.

Oh, thanks, you are right. Looks like we need check which submodules should be 
splitted.

--

___
Python tracker 

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



[issue40260] modulefinder traceback regression starting on Windows

2020-04-19 Thread Barry Alan Scott


Change by Barry Alan Scott :


--
pull_requests: +18931
pull_request: https://github.com/python/cpython/pull/19595

___
Python tracker 

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



[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

2020-04-19 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
Python tracker 

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



[issue40284] Add mapping methods to types.SimpleNamespace

2020-04-19 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

asyncio is now imported in unittest. Removing direct import from test.support 
does not help.

--

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

+1 for splitting test.support on several submodules!

Some imports can also be lazy.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue22548] Bogus parsing of negative zeros in complex literals

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests:  -18927

___
Python tracker 

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



[issue40275] test.support has way too many imports

2020-04-19 Thread hai shi


hai shi  added the comment:

> "import test.support" imports not less than 171... That's quite "heavy".

If we split some "heavy" modules to xxxutils, what benefits  will we make in 
fact(more exact module importing behavior)?

--

___
Python tracker 

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



[issue40269] Inconsistent complex behavior with (-1j)

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I tried to make repr of floats producing a string which rounds up with eval() 
(see PR 19593).

>>> complex(0.0, 1.0)
1j
>>> complex(0.0, -1.0)
(0-1j)
>>> complex(-0.0, 1.0)
-(0-1j)
>>> complex(-0.0, -1.0)
(-0.0-1j)
>>> complex(1.0, 0.0)
(1+0j)
>>> complex(-1.0, 0.0)
(-1+0j)
>>> complex(1.0, -0.0)
-(-1+0j)
>>> complex(-1.0, -0.0)
-(1+0j)

The largest problem is with complex(-0.0, 0.0) and complex(-0.0, 0.0). The only 
forms which evaluate to these numbers are:

>>> complex(-0.0, 0.0)
(-0.0-0j)
>>> complex(0.0, -0.0)
-(-0.0-0j)

But it conflicts with the constructor:

>>> complex('(-0.0-0j)')
-(0+0j)

--

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-19 Thread Yuval S


Yuval S  added the comment:

Thank you for the attention and the quick fix. However, the current 
documentation for "Notes on Reproducibility" should still address this issue of 
hash randomization. Not only `sample` is affected by this, but any code that 
combines strings (or bytes or datetime) with hash and random, e.g.

>>> import random
>>> random.seed(6)
>>> a = list(set(str(i) for i in range(500)))
>>> print(a[int(random.random() * 500)])

or, this

>>> import random
>>> import datetime
>>> random.seed(6)
>>> print(random.choice(range(hash(datetime.datetime(2000,1,1)) % 100)))

will still produce non-reproducible results even after the fix. Here is my 
suggestion for documentation:

> Hash randomization, which is enabled by default since version 3.3, is not 
> affected by `random.seed()`. For this reason, code that relies on string 
> hashes, such as code that relies on the ordering of `set` or `dict`, might be 
> non-reproducible, unless string hash randomization is disabled or seeded 
> (see: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHASHSEED).

My vote would be to keep hash randomization ties to `random.seed()`, and this 
would make all use cases more predictable, as well as allow `random.sample()` 
to support `set`.

--

___
Python tracker 

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



[issue40327] list(sys.modules.items()) can throw RuntimeError: dictionary changed size during iteration

2020-04-19 Thread Markus Mohrhard


New submission from Markus Mohrhard :

We have hit an issue in the pickle module where the code throws an exception in 
a threaded environment:

The interesting piece of the backtrace is:

  File "/xxx/1004060/lib/python3.7/site-packages/numpy/core/__init__.py", line 
130, in _ufunc_reduce
return _ufunc_reconstruct, (whichmodule(func, name), name)
  File "/xxx/lib/python3.7/pickle.py", line 309, in whichmodule
for module_name, module in list(sys.modules.items()):
RuntimeError: dictionary changed size during iteration

I tried to find a code path that would explain how the dict could be changed 
while the list is created but have not been able to find a code path that 
releases the GIL.

The executable is using many threads with imports happening in random threads 
and a custom class loader but we already make sure that the class loader is 
always holding the GIL.

The issue happens quite rarely (maybe once every one thousand's execution) so I 
don't have a reproducer right now.

--
components: Extension Modules
messages: 366762
nosy: Markus Mohrhard
priority: normal
severity: normal
status: open
title: list(sys.modules.items()) can throw RuntimeError: dictionary changed 
size during iteration
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



[issue40275] test.support has way too many imports

2020-04-19 Thread hai shi


Change by hai shi :


--
keywords: +patch
nosy: +shihai1991
nosy_count: 1.0 -> 2.0
pull_requests: +18929
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19592

___
Python tracker 

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



[issue40269] Inconsistent complex behavior with (-1j)

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18928
pull_request: https://github.com/python/cpython/pull/19593

___
Python tracker 

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



[issue22548] Bogus parsing of negative zeros in complex literals

2020-04-19 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
nosy_count: 3.0 -> 4.0
pull_requests: +18927
pull_request: https://github.com/python/cpython/pull/19593

___
Python tracker 

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



[issue40313] bytes.hex(sep, bytes_per_sep) is many times slower than manually inserting the separators

2020-04-19 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I replicated this behavior. This looks like the relevant loop in pystrhex.c:

for (i=j=0; i < arglen; ++i) {
assert((j + 1) < resultlen);
unsigned char c;
c = (argbuf[i] >> 4) & 0x0f;
retbuf[j++] = Py_hexdigits[c];
c = argbuf[i] & 0x0f;
retbuf[j++] = Py_hexdigits[c];
if (bytes_per_sep_group && i < arglen - 1) {
Py_ssize_t anchor;
anchor = (bytes_per_sep_group > 0) ? (arglen - 1 - i) : (i + 1);
if (anchor % abs_bytes_per_sep == 0) {
retbuf[j++] = sep_char;
}
}
}

It looks like this can be refactored a bit for a tighter inner loop with fewer 
if-tests. I can work on a PR.

--
nosy: +Dennis Sweeney
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Yuval, thanks for the report.

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-19 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 4fe002045fcf40823154b709fef0948b2bc5e934 by Raymond Hettinger in 
branch 'master':
bpo-40325: Deprecate set object support in random.sample() (GH-19591)
https://github.com/python/cpython/commit/4fe002045fcf40823154b709fef0948b2bc5e934


--

___
Python tracker 

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



[issue40326] A string contains an empty string?

2020-04-19 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, it is.

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



[issue40326] A string contains an empty string?

2020-04-19 Thread Ronie Martinez


New submission from Ronie Martinez :

Testing if an empty string is in a given string returns True. Tried only on 
Python 3.7 but might exists on other versions.

Python 3.7.6 (default, Mar 13 2020, 18:48:35) 
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin

```
>> "" in "hello"
True
```

--
components: Interpreter Core
messages: 366757
nosy: roniemartinez
priority: normal
severity: normal
status: open
title: A string contains an empty string?
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



[issue40244] AIX: build: _PyObject_GC_TRACK Asstertion failure

2020-04-19 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Moving assertion from _PyObject_GC_TRACK to gen_dealloc (just before the 
_PyObject_GC_TRACK call) results with success ()

 if (gen->gi_weakreflist != NULL)
 PyObject_ClearWeakRefs(self);
-
+_PyObject_ASSERT_FROM(self, !_PyObject_GC_IS_TRACKED(self),
+  "object already tracked by they garbage collector",
+  __FILE__, __LINE__, "_PyObject_GC_TRACK");
 _PyObject_GC_TRACK(self);
 
 if (PyObject_CallFinalizerFromDealloc(self))

--

___
Python tracker 

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