[issue40553] Python 3.8.2 Mac freezing/not responding when saving new programs

2020-05-09 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I asked about other people's experiences on python-list and got 2 responses so 
far.
---

On macOS The default Save/Save as dialogs are short, only displaying a few 
major folders along with Favorites and Recents.  That dialog doesn’t display 
folder contents.  However, you can get an expanded dialog by clicking on the 
little arrow to the right of the Where box.  Using that dialog allows one to 
select any folder and displays folder contents.  

I tried using both Save and Save as, and was unable to duplicate the problem 
with either the short or the long dialog.

Python 3.8.2
macOS Catalina 10.15.4
Bev in TX
---

Fairly recently, Tk has got many bugfixes because of changes in OSX. Here is 
the file that implements the file dialogs:
  https://core.tcl-lang.org/tk/artifact/d72cdfbcbfaa717f
and the history:
  
https://core.tcl-lang.org/tk/finfo?name=macosx/tkMacOSXDialog.c=d72cdfbcbfaa717f

As you can see, it has been touched two days ago (!) to restore some window 
behaviour, which was switched of because of Catalina last August (this commit)
https://core.tcl-lang.org/tk/info/59b1d265c2444112


Christian Gollwitzer
---

Ned, what is your latest experience with 8.6.10?

--

___
Python tracker 

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



Re: Concatenation of multiple video files in single file

2020-05-09 Thread Wildman via Python-list
On Sat, 09 May 2020 22:06:01 +0530, Akshay Ghodake wrote:

> Hello,
> 
> I want a help to concatenation of multiple video files into a single file
> in python.
> 
> Any help will be greatly appreciated.
> 
> Best regards,
> Akshay Ghodake

This might help...

https://kkroening.github.io/ffmpeg-python/

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40334] PEP 617: new PEG-based parser

2020-05-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

FWIW I propose that we add another Misc/NEWS for the same issue summarizing 
what happened between alpha6 and beta1. (A lot!)

--

___
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-05-09 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ac7a92cc0a821699df48bc2e30a02c25d6338f78 by Pablo Galindo in 
branch 'master':
bpo-40334: Avoid collisions between parser variables and grammar variables 
(GH-19987)
https://github.com/python/cpython/commit/ac7a92cc0a821699df48bc2e30a02c25d6338f78


--

___
Python tracker 

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



[issue40569] Add optional weights to random.sample()

2020-05-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Negative weights are undefined for choices() as well.  Just like bisect() and 
merge() don't verify their inputs are sorted.  Usually, full scan precondition 
checks are expensive in pure python and aren't worth penalizing correct code. 
As Henk-Jaap points-out, negative weights are just a special case of 
meaningless inputs.

--

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

> 4. use call_later() to terminate the future after 5 seconds

You should read that as "3.5" (I inserted it later).

--

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I came up with the script by (1) running the test locally and seeing the same 
hang, (2) moving the test function to its own script separate from the unit 
tests and seeing the same hang, and (3) successively stripping away code while 
continuing to check for the same hang. So it should be equivalent.

As for why it's related to signals, it's because of what the script does (it's 
not waiting on a subprocess). All it does is start an event loop and then do 
the following repeatedly:

1. starts a subprocess that sleeps indefinitely
2. create an empty future
3. set a SIGCHLD handler that calls set_result() on the future
4. use call_later() to terminate the future after 5 seconds
4. kill the subprocess
5. await on the future

Almost all of the time, (5) completes immediately (because the handler is 
called immediately). But sometimes, (5) takes 5 seconds (which means the 
timeout fired). And in the cases it takes 5 seconds, I'm able to observe both 
that (a) Python received the SIGCHLD right away, and (b) the signal handler 
only gets called when the loop is woken up by the call_later(). So during the 
await in (5), it seems like Python is holding onto the signal for 5 seconds 
without calling its signal handler.

--

___
Python tracker 

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



Re: Should setuptools version propagate to a module's __version__? If so, how?

2020-05-09 Thread Cameron Simpson

On 08May2020 18:07, John Ladasky  wrote:

I just came across a package in PyPI which is in a state of neglect.  The 
official version on the PyPI page is 1.3.1 -- but the installed module reports 
its version as 1.2.0.  This is confusing.

There are several bugs in this package besides the mismatched version number.  
I've forked a copy of the package on GitHub, and I will attempt a cleanup.

In another private package of my own, I performed an unsavory hack in setup.py.  There is a 
"version" argument to the setup() call.  I define "version" as a global 
variable in setup.py.  Before I call setup with this version number, I also modify the line of 
package code which defines its __version__.  This works for me, but it feels wrong.

Is there a recommended way to keep the internal reference and the 
setup.py reference in sync?  Is there any reason someone would NOT want 
these numbers to match?


My release script writes the setup.py on the fly, so it gets the version 
number from the release tag I use. I also autopatch the module itself to 
set __version__ to match when I make that release tag.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


[issue40569] Add optional weights to random.sample()

2020-05-09 Thread Henk-Jaap Wagenaar


Henk-Jaap Wagenaar  added the comment:

@rhettinger: I like this proposal.

@dheiberg: to me, it seems negative weights are explicitly not supported, from: 
https://docs.python.org/3/library/random.html#random.choices

"Weights are assumed to be non-negative."

Unless I am missing something. In my mind negative weights make no sense and 
the fact it produces garbage in your example is garbage-in-garbage-out.

Maybe an enhancement could be made (but it would be breaking for some abusing 
the behaviour you showed) for it to error (or do something sane? If such a 
thing exists) but that should be a separate issue.

--
nosy: +cryvate

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

How do you know that your reproducer is showing the same bug, or anything
related to signals? IIUC subprocess waiting by default doesn't involve a
signal handler.

On Sat, May 9, 2020, 14:40 Chris Jerdonek  wrote:

>
> Chris Jerdonek  added the comment:
>
> > this seems like an awful lot of energy to spend on some code
> that's not even used by default.
>
> True, but it seems likely to me that this signals :) a deeper, more
> general issue about CPython / signals (which is why I spent time on it).
> For example, my reproducer script doesn't use MultiLoopWatcher. I'd like to
> see if it can be reproduced with signals other than SIGCHLD, too.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40582] Inconsistent exceptions caused by typing + tuple subclasses

2020-05-09 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I think the behavior is consistent between tuple and an empty subclass:

>>> from typing import List
>>> class T(tuple):
pass

== Empty tuple/T ==

>>> List[()]
Traceback (most recent call last):
...
TypeError: Too few parameters for typing.List; actual 0, expected 1


>>> List[T()]
Traceback (most recent call last):
...
TypeError: Too few parameters for typing.List; actual 0, expected 1


== tuple/T whose only entry is 1 ==

>>> List[(1,)]
Traceback (most recent call last):
...
TypeError: Parameters to generic types must be types. Got 1.


>>> List[T((1,))]
Traceback (most recent call last):
...
TypeError: Parameters to generic types must be types. Got 1.


== tuple/T whose only entry is "" ==

>>> List[T(("",))]
Traceback (most recent call last):
...
SyntaxError: unexpected EOF while parsing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
...
SyntaxError: Forward reference must be an expression -- got ''


>>> List[("",)]
Traceback (most recent call last):
...
SyntaxError: unexpected EOF while parsing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
...
SyntaxError: Forward reference must be an expression -- got ''


== tuple/T whose only entry can rightly become a forward reference ==

>>> List[("Foo",)]
typing.List[ForwardRef('Foo')]


>>> List[T(("Foo",))]
typing.List[ForwardRef('Foo')]


Your ``return tuple.__new__(cls, ("",))`` constructor is just always
returning the same as ``T(("",))``

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue40569] Add optional weights to random.sample()

2020-05-09 Thread David Heiberg


David Heiberg  added the comment:

Just playing around with this and I think one thing to consider is how to 
handle negative weights. Should they even be allowed? One interesting behaviour 
I encountered with the current draft is the following:

>>> r.sample(['katniss', 'prim', 'gale', 'peeta'] , weights=[-2,1,1,1], k=1)
['peeta']

This will always return ['peeta'], or whatever happens to be in the last index. 
I believe this is because in `choices`, the `cum_weights` list would be [-2, 
-1, 0, 1], causing it to only be able to select the last value in the 
population. 

Looking into random.choices, it suggests that the weights were designed with 
negative ones in mind. However they were not accounted for and end up 
influencing the weights of the indexes around it. Another example is this:

>>> r.choices(['alice', 'bob', 'camile', 'david'], weights=[1, 1, -2, 1])
['alice']

This will always return ['alice'], showing that the negative weight of 'camile' 
is affecting indexes around it. 
Is there something I am missing? Otherwise this seems like it may warrant its 
own bug.

--
nosy: +dheiberg

___
Python tracker 

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



[issue32824] Docs: Using Python on a Macintosh has bad info per Apple site

2020-05-09 Thread Glenn Travis

Glenn Travis  added the comment:

Thank you, but how in the world does one know where to look or find that 
document at github.  I tried to search earlier and got hundreds of listings for 
python doc. 

Sent from my iPhone

> On May 9, 2020, at 16:36, Glenn Travis  wrote:
> 
> Thank you Remi
> 
> 
>> On May 9, 2020, at 4:15 PM, Rémi Lapeyre  wrote:
>> 
>> 
>> Rémi Lapeyre  added the comment:
>> 
>> Hi Gleen, the best way forward is to propose an improvement to the current 
>> documentation. It will get reviewed and merge if appropriate.
>> 
>> The source for this part is at 
>> https://github.com/python/cpython/blob/master/Doc/using/mac.rst and you can 
>> find the information needed to contribute in the Python Dev Guide: 
>> https://devguide.python.org/.
>> 
>> --
>> nosy: +remi.lapeyre
>> 
>> ___
>> Python tracker 
>> 
>> ___
>

--

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Current open doc:
https://docs.python.org/3.9/library/webbrowser.html#webbrowser.open

--

___
Python tracker 

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



[issue40397] Refactor typing._GenericAlias

2020-05-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

I think I have a shorter repro, not involving unions:

from typing import *
T = TypeVar("T")
S = TypeVar("S")
U = TypeVar("U")
class A(Generic[T]): ...
class B(Generic[T]): ...
class C(Generic[T, S]): ...
print(C[A[U], B[int]][str])

Fails in the same place, works in 3.8 (I didn't check just before the offending 
commit), and the same fix works.

--

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I just got my development machine back, so I will handle this.  I first 
determined that code and doc are same in all 3 versions (except for audit event 
bit, which I am willing to leave out).

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



[issue26817] Docs for StringIO should link to io.BytesIO

2020-05-09 Thread Zachary Ware


Change by Zachary Ware :


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



[issue40334] PEP 617: new PEG-based parser

2020-05-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +19331
pull_request: https://github.com/python/cpython/pull/20020

___
Python tracker 

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



[issue40571] Make lru_cache(maxsize=None) more discoverable

2020-05-09 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue40582] Inconsistent exceptions caused by typing + tuple subclasses

2020-05-09 Thread Ruairidh MacLeod


New submission from Ruairidh MacLeod :

When incorrectly defining a function with a typed List[T] argument where T is a 
tuple instance, a TypeError is correctly raised:

t = (1,)
def f(a: List[t]): ...
# => TypeError: Parameters to generic types must be types. Got 1.


When t is an instance of a tuple subclass though, and one of its items is an 
empty string, a SyntaxError is raised instead in the typing module:

class T(tuple):
def __new__(cls):
return tuple.__new__(cls, ("",))

t = T()
def f(a: List[t]): ...
# => SyntaxError: Forward reference must be an expression -- got ''

Full stack trace:

Traceback (most recent call last):
  File "/opt/python37/lib/python3.7/typing.py", line 449, in __init__
code = compile(arg, '', 'eval')
  File "", line 0

^
SyntaxError: unexpected EOF while parsing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 5, in 
def f(a: List[call]):
  File "/opt/python37/lib/python3.7/typing.py", line 254, in inner
return func(*args, **kwds)
  File "/opt/python37/lib/python3.7/typing.py", line 631, in __getitem__
params = tuple(_type_check(p, msg) for p in params)
  File "/opt/python37/lib/python3.7/typing.py", line 631, in 
params = tuple(_type_check(p, msg) for p in params)
  File "/opt/python37/lib/python3.7/typing.py", line 132, in _type_check
return ForwardRef(arg)
  File "/opt/python37/lib/python3.7/typing.py", line 451, in __init__
raise SyntaxError(f"Forward reference must be an expression -- got {arg!r}")
SyntaxError: Forward reference must be an expression -- got ''


Lastly, a different TypeError is raised for an empty subclass:

class C(tuple): ...
c = C()
def f(a: List[c]): ...
# => TypeError: Too few parameters for typing.List; actual 0, expected 1

This exception behavior seems inconsistent, although it's definitely a minor 
issue.

--
components: Interpreter Core
messages: 368554
nosy: rkm
priority: normal
severity: normal
status: open
title: Inconsistent exceptions caused by typing + tuple subclasses
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



Re: IP address to binary conversion

2020-05-09 Thread al . alexiev
Hi Alan,

Yes, agreed that any '!I' or '!L' combination will work on different type of 
platforms in a consistent manner, when applied in both directions.

I was referring to Alex Martelli's output, where the conversion back to IP 
seems to be reversed, even with '!L', which means that he's already with a 
little-endian byte order and using 'L' or '>> ip = '1.2.168.0'
>>> struct.unpack('L', socket.inet_aton(ip))[0]
11010561
>>> struct.unpack('>> struct.unpack('!L', socket.inet_aton(ip))[0]
16951296
>>>
>>> socket.inet_ntoa(struct.pack('!L',11010561))
'0.168.2.1'
>>> socket.inet_ntoa(struct.pack('>> socket.inet_ntoa(struct.pack('!L',16951296))
'1.2.168.0'
>>>


Greets,
Alex
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Concatenation of multiple video files in single file

2020-05-09 Thread Chris Angelico
On Sun, May 10, 2020 at 8:50 AM Akshay Ghodake  wrote:
>
> Hello,
>
> I want a help to concatenation of multiple video files into a single file
> in python.
>
> Any help will be greatly appreciated.

Step 1:
import subprocess

Step 2:
Run ffmpeg

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep C wrote:

On Sat, 09 May 2020 14:42:43 +0200, Python wrote:


Joydeep wrote:

I have a Pandas dataframe like below.

  XY
0  1234567890 1  54321N/A 2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


  >>> value = 12345 f'{value:,}'  # >= 3.6
'12,345'
  >>> '{:,}'.format(value)  # >= 2.7
'12,345'


I need all the numbers in the whole dataframe to be formatted like that,
not one value.


>>> data.applymap((lambda x: f"{x:,}") )
X Y
0  12,345  67,890.0
1  54,321   nan
2  67,890  12,345.0
>>> data.apply(np.vectorize((lambda x: f"{x:,}")))
X Y
0  12,345  67,890.0
1  54,321   nan
2  67,890  12,345.0

--
https://mail.python.org/mailman/listinfo/python-list


[issue30064] BaseSelectorEventLoop.sock_{recv, sendall}() don't remove their callbacks when canceled

2020-05-09 Thread Fantix King


Fantix King  added the comment:

Following the discussion - looks like `add_reader()` will cancel the previous 
`handle` on the same `fd` if found, so I think it is reasonable to solve this 
cancellation-race issue by checking if the `handle` is cancelled as shown in 
the attached patch (tests in uvloop passed with this patch). WDTY?

--
nosy: +fantix
Added file: https://bugs.python.org/file49146/cancelled-sock-recv-race.patch

___
Python tracker 

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



Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep C wrote:

On Sat, 09 May 2020 17:24:41 +0200, Python wrote:


Joydeep C wrote:

On Sat, 09 May 2020 15:46:27 +0200, Python wrote:


Joydeep C wrote:

On Sat, 09 May 2020 14:42:43 +0200, Python wrote:


Joydeep wrote:

I have a Pandas dataframe like below.

XY
0  1234567890 1  54321N/A 2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


>>> value = 12345 f'{value:,}'  # >= 3.6
'12,345'
>>> '{:,}'.format(value)  # >= 2.7
'12,345'


I need all the numbers in the whole dataframe to be formatted like
that,
not one value.


   >>> data.applymap((lambda x: f"{x:,}") )
   X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
   >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
   X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0


It's giving error - "Cannot specify ',' with 's'."


It means that you're not storing numbers in your dataframe but strings,
which is likely not what you want here. Fix that first.


Of course, they are strings. It's "N/A", not nan.


So convert back to float in the lambda, when appropriate, then use the
format string.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep wrote:

I have a Pandas dataframe like below.

 XY
0  1234567890
1  54321N/A
2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


>>> value = 12345
>>> f'{value:,}'  # >= 3.6
'12,345'
>>> '{:,}'.format(value)  # >= 2.7
'12,345'
--
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep C wrote:

On Sat, 09 May 2020 15:46:27 +0200, Python wrote:


Joydeep C wrote:

On Sat, 09 May 2020 14:42:43 +0200, Python wrote:


Joydeep wrote:

I have a Pandas dataframe like below.

   XY
0  1234567890 1  54321N/A 2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


   >>> value = 12345 f'{value:,}'  # >= 3.6
'12,345'
   >>> '{:,}'.format(value)  # >= 2.7
'12,345'


I need all the numbers in the whole dataframe to be formatted like
that,
not one value.


  >>> data.applymap((lambda x: f"{x:,}") )
  X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
  >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
  X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0


It's giving error - "Cannot specify ',' with 's'."


It means that you're not storing numbers in your dataframe but
strings, which is likely not what you want here. Fix that
first.





--
https://mail.python.org/mailman/listinfo/python-list


Concatenation of multiple video files in single file

2020-05-09 Thread Akshay Ghodake
Hello,

I want a help to concatenation of multiple video files into a single file
in python.

Any help will be greatly appreciated.

Best regards,
Akshay Ghodake
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-09 Thread Brad Solomon


Brad Solomon  added the comment:

To no surprise, not a lot of activity with the module over the last few years 
as it is fairly cut-and-dry.

$ git shortlog -sn --since '5 years ago' Lib/webbrowser.py
 3  Serhiy Storchaka
 1  David Steele
 1  Guido van Rossum
 1  Michael Haas
 1  Nick Coghlan
 1  Steve Dower
 1  Bumsik Kim
 1  Zhiming Wang

--

___
Python tracker 

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



[issue40578] Deprecate numeric item access for platform.uname()

2020-05-09 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

You have given no justification for removing item access for the fields except 
"some users are still relying on ... access by item position and length". 
Normally the fact that some people are doing this would be reason to reject 
this backwards-compatibility breaking change. Why is it a problem that people 
are using something which is documented as a tuple as a tuple?

--
nosy: +steven.daprano

___
Python tracker 

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



[issue26817] Docs for StringIO should link to io.BytesIO

2020-05-09 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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

> this seems like an awful lot of energy to spend on some code
that's not even used by default.

True, but it seems likely to me that this signals :) a deeper, more general 
issue about CPython / signals (which is why I spent time on it). For example, 
my reproducer script doesn't use MultiLoopWatcher. I'd like to see if it can be 
reproduced with signals other than SIGCHLD, too.

--

___
Python tracker 

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



[issue32824] Docs: Using Python on a Macintosh has bad info per Apple site

2020-05-09 Thread Glenn Travis

Glenn Travis  added the comment:

Thank you Remi

> On May 9, 2020, at 4:15 PM, Rémi Lapeyre  wrote:
> 
> 
> Rémi Lapeyre  added the comment:
> 
> Hi Gleen, the best way forward is to propose an improvement to the current 
> documentation. It will get reviewed and merge if appropriate.
> 
> The source for this part is at 
> https://github.com/python/cpython/blob/master/Doc/using/mac.rst and you can 
> find the information needed to contribute in the Python Dev Guide: 
> https://devguide.python.org/.
> 
> --
> nosy: +remi.lapeyre
> 
> ___
> Python tracker 
> 
> ___

--
nosy: +Old Sub Sailor

___
Python tracker 

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



[issue40576] Align docs for list.sort, sorted, and on the website

2020-05-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

To me, the PR isn't an improvement.  It makes the docs much more verbose 
without really adding information.  We already link to the sorting-howto which 
already discusses the pragmatics that arise in actual applications.

Also, there is no special benefit to cross-linking the list.sort() and sorted() 
docs.  While their implementation share a common foundation, that is just an 
implementation detail that is irrelevant from a user's point of view.

--
nosy: +rhettinger

___
Python tracker 

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



[issue40581] scipy's differential_evolution bug

2020-05-09 Thread Mike

Mike  added the comment:

ok thank you Christian. I will do.

> Le 9 mai 2020 à 23:06, Christian Heimes  a écrit :
> 
> 
> Christian Heimes  added the comment:
> 
> SciPy and Sage are 3rd party extensions to CPython and not maintained by us. 
> Please report the issue with SciPi, 
> https://www.scipy.org/scipylib/bug-report.html
> 
> --
> nosy: +christian.heimes
> resolution:  -> third party
> stage:  -> resolved
> status: open -> closed
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue32824] Docs: Using Python on a Macintosh has bad info per Apple site

2020-05-09 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Gleen, the best way forward is to propose an improvement to the current 
documentation. It will get reviewed and merge if appropriate.

The source for this part is at 
https://github.com/python/cpython/blob/master/Doc/using/mac.rst and you can 
find the information needed to contribute in the Python Dev Guide: 
https://devguide.python.org/.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Kyle Stanley


Kyle Stanley  added the comment:

> Would it make sense to deprecate it and stick with ThreadedChildWatcher?

I had proposed deprecating it in another bpo issue, but it was brought up that 
MutliLoopWatcher had only been added recently in 3.8. So, it might be a bit too 
soon to deprecate it already.

Although I suppose that if there are several complex and difficult to resolve 
issues with the implementation, it may very well be less damaging to deprecate 
it now rather than after it's gained a decent a decent amount of usage.

--

___
Python tracker 

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



[issue40581] scipy's differential_evolution bug

2020-05-09 Thread Christian Heimes


Christian Heimes  added the comment:

SciPy and Sage are 3rd party extensions to CPython and not maintained by us. 
Please report the issue with SciPi, 
https://www.scipy.org/scipylib/bug-report.html

--
nosy: +christian.heimes
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



[issue32824] Docs: Using Python on a Macintosh has bad info per Apple site

2020-05-09 Thread Glenn Travis


Glenn Travis  added the comment:

So, how do we wake this sleeping concern up?

--
nosy: +TotallyLost

___
Python tracker 

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



[issue40580] Macintosh Documentation Still Bad

2020-05-09 Thread Glenn Travis


Glenn Travis  added the comment:

Pull - Request?

--

___
Python tracker 

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



[issue40581] scipy's differential_evolution bug

2020-05-09 Thread Mike


New submission from Mike :

I have a random bug with scipy's optimize . 
I use it in the context of SageMath (Python 3.7.3).
I checked 3 algorithms  : shgo, dual_annealing and full_optimize.
All don't work well (at all !).

I optimise with a 3 parameters functions with given bounds. The algorithm 
randomly sends to my error function the "1e-8" value for any of the 3 
parameters. I displayed the vector + error to understand it. AS you can see, in 
this case, the first parameter is 1e-8 whereas it is outside the bounds. 
Sometimes it happens for the second parameter, or the 3rd 

--
[3.95049282e-19 3.03055607e-20 1.96212098e+29] 0.0030238733573031864
[3.95273920e-19 3.05821352e-20 1.90997635e+29] 0.002957956545311753
[3.95037412e-19 3.04080173e-20 1.93312145e+29] 0.0029572689364709224
sage.all_cmdline:33: IntegrationWarning: The occurrence of roundoff error is 
detected, which prevents 
  the requested tolerance from being achieved.  The error may be 
  underestimated.
[1.e-08 3.04080173e-20 1.93312145e+29] 1.0713560755245306
Overflow
[3.95037412e-19 3.04080173e-20 1.93312145e+29] 0.0029572689364709224
-
The behaviour is the same for all of them. However the value inserted is not 
always the same, I noticed 3 : 1e-10, 1e-8 and 1.49011612e-08

Moreover, all do not send nice values. For example, the full_optimize always 
send values close to the highest bound. Perhaps are the value computed with a 
simple linear average and I guess it should not be the case.

my bounds are :
bounds = [(1*e,4*e),(0.1*e,0.5*e),(1e5,1e40)]
with e=1.6e-19

Is there an alternative for optimization in python ?

regards,
Mike

--
messages: 368540
nosy: mmyara
priority: normal
severity: normal
status: open
title: scipy's differential_evolution bug
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



[issue40580] Macintosh Documentation Still Bad

2020-05-09 Thread Glenn Travis

Glenn Travis  added the comment:

Thank you for your reply.  I just wanted to renew or recall attention to the 
older one.  It seems to have been dormant for too long.

A C program is like a fast dance on a newly waxed dance floor by people 
carrying razors.  -W.R.

And now for something completely different. -M.P

> On May 9, 2020, at 2:39 PM, Rémi Lapeyre  wrote:
> 
> 
> Rémi Lapeyre  added the comment:
> 
> Hi Gleen, this looks like there already exists an issue for this problem, 
> please use it instead of opening a new one. 
> 
> Can you please open a new Pull-Request for solving this issue?
> 
> --
> nosy: +remi.lapeyre
> 
> ___
> Python tracker 
> 
> ___

--
nosy: +Old Sub Sailor

___
Python tracker 

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



[issue40580] Macintosh Documentation Still Bad

2020-05-09 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Docs: Using Python on a Macintosh has bad info per Apple site

___
Python tracker 

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



[issue40580] Macintosh Documentation Still Bad

2020-05-09 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Gleen, this looks like there already exists an issue for this problem, 
please use it instead of opening a new one. 

Can you please open a new Pull-Request for solving this issue?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40578] Deprecate numeric item access for platform.uname()

2020-05-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In issue40570, Marc-Andre writes:

> I don't think that deprecating standard tuple access is an option
for the uname() return value, since it's documented to be a tuple.

My thinking here is that as part of the deprecation, the documentation would be 
updated to reflect the recommended and long-term supported usage (attribute 
access + iterability), including the recommended way to adapt if one wants a 
tuple. The guidance would eliminate or indicate as deprecated the index-based 
access. Then, by way of the DeprecationWarning, those still relying on 
item-access would be encouraged to update their implementation to use the 
preferred form. 


By doing this, `platform` goes from having 3 right ways to do something:

```
system = platform.system()
system = platfurm.uname().system
system = platform.uname()[0]
```

to just the first two.

I don't see how documenting something makes it permanent, though I acknowledge 
it does affect how one approaches any deprecation.

--

___
Python tracker 

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



[issue40580] Macintosh Documentation Still Bad

2020-05-09 Thread Glenn Travis


New submission from Glenn Travis :

This was reported two years ago, and still is not fixed

https://bugs.python.org/issue32824#msg312028

and the documentation is even older.  It starts off referencing
"Mac OS X 10.8" and Apple Documents that are archived.

Then the section referencing using the Finder and Python Launcher does not work 
with macOS Catalina. 

Can this finally be corrected?

--
messages: 368536
nosy: TotallyLost
priority: normal
severity: normal
status: open
title: Macintosh Documentation Still Bad
type: resource usage
versions: Python 3.8

___
Python tracker 

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



[issue40397] Refactor typing._GenericAlias

2020-05-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

@Serhiy can you look at this? A possible fix might be:

diff --git a/Lib/typing.py b/Lib/typing.py
index 681ab6d21e..adcef1e82b 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -701,7 +701,8 @@ class _GenericAlias(_BaseGenericAlias, _root=True):
 arg = subst[arg]
 elif isinstance(arg, (_BaseGenericAlias, GenericAlias)):
 subargs = tuple(subst[x] for x in arg.__parameters__)
-arg = arg[subargs]
+if subargs:
+arg = arg[subargs]
 new_args.append(arg)
 return self.copy_with(tuple(new_args))
 

The immediate cause of the problem seems to be that we call arg[subargs] with 
subargs being (). So arg is a _GenericAlias but its __parameters__ is (). I'm 
not sure what path was taken previously. :-(

--

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

> you added a late binding optimization for the whole uname return
tuple to save the effort of ... shell access.

It wasn't to save the effort and it wasn't an optimization. There was a 
fundamental race condition where it became impossible to implement a `uname` 
command using Python because `platform.system()` (or anything else that 
delegated to `platform.uname()`) would unconditionally shell out to `uname`, 
and this would happen early, before a library could intercept the behavior. See 
issue35967 for more details on the motivation and challenges.

> I think this would have been better implemented...

This idea is interesting, but I believe it also falls prey to the same race 
condition if any code calls `platform.uname()` before a Python-based uname 
implementation has a chance to monkeypatch the behavior.

May I suggest that you either revive the conversation in issue35967 or open a 
new ticket to discuss improving the implementation so that the details aren't 
lost in this ticket, which was specifically about compatibility issues?

> I don't think that deprecating standard tuple access is an option
for the uname() return value, since it's documented to be a tuple.

I'll address this concern in the ticket I opened about the deprecation.

--

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-09 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Except is isn't, as he has been inactive for years.  Git log may or may not 
show more recent commits.  My dev machine is being repaired but should be back 
soon.

--

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

I don't have any particular insight into the bug, but I do have an
observation: this seems like an awful lot of energy to spend on some code
that's not even used by default. Would it make sense to deprecate it and
stick with ThreadedChildWatcher?

On Sat, May 9, 2020, 05:39 Chris Jerdonek  wrote:

>
> Chris Jerdonek  added the comment:
>
> I'm adding Nathaniel in case he can recognize this as one of the signal
> handler cases he's already come across.
>
> --
> nosy: +njs
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40575] _PyDict_GetItemIdWithError() should call _PyDict_GetItem_KnownHash()

2020-05-09 Thread Stefan Behnel


Change by Stefan Behnel :


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

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-09 Thread Brad Solomon


Brad Solomon  added the comment:

The module source notes "Maintained by Georg Brandl."

--

___
Python tracker 

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



[issue40561] Provide docstrings for public-facing webbrowser functions

2020-05-09 Thread Brad Solomon


Change by Brad Solomon :


--
nosy: +georg.brandl

___
Python tracker 

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



[issue40536] Addition of a "list of available time zones" function to zoneinfo

2020-05-09 Thread Paul Ganssle


Paul Ganssle  added the comment:

I have an initial implementation against the reference implementation here: 
https://github.com/pganssle/zoneinfo/pull/60

Once GH-19909 is merged, I will turn that into a PR against CPython.

For the first pass I went with:

1. free-standing function
2. returning set()
3. no cache
4. available_timezones()

--

___
Python tracker 

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



[issue40579] Second argument to iterator.next not described

2020-05-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The next() function has a different signature than the __next__() method.  The 
former takes one or two arguments.  That latter only takes one.

>>> it = iter('abcde')
>>> next(it)
'a'
>>> next(it, 'default')
'b'
>>> it.__next__()
'c'
>>> it.__next__('default')
Traceback (most recent call last):
  File "", line 1, in 
it.__next__('default')
TypeError: expected 0 arguments, got 1

--
nosy: +rhettinger

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-09 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

Ok, let me add some more context: When I wrote the uname interface
I was aware that calling the API will take some resources. That's
why I added the cache. IMO, that was enough as optimization.

Now, you added a late binding optimization for the whole uname return
tuple to save the effort of going out to the system and figure our
the value using separate APIs or even shell access.

I think this would have been better implemented in the various
uname() consumers
(https://github.com/python/cpython/blob/77c614624b6bf2145bef69830d0f499d8b55ec0c/Lib/platform.py#L898
and below), using a variant of the uname() API, say _uname(),
which leaves out the processor information for those APIs which don't
need it and only provide the late binding in processor() (which could
then also fill in the cache value for uname().

The uname() API would then still do the full lookup, but applications
could then use the specialized API to query only the information
they need.

I don't think that deprecating standard tuple access is an option
for the uname() return value, since it's documented to be a tuple.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, May 09 2020)
>>> Python Projects, Coaching and Support ...https://www.egenix.com/
>>> Python Product Development ...https://consulting.egenix.com/


::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   https://www.egenix.com/company/contact/
 https://www.malemburg.com/

--

___
Python tracker 

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



Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
On Sat, 09 May 2020 17:24:41 +0200, Python wrote:

> Joydeep C wrote:
>> On Sat, 09 May 2020 15:46:27 +0200, Python wrote:
>> 
>>> Joydeep C wrote:
 On Sat, 09 May 2020 14:42:43 +0200, Python wrote:

> Joydeep wrote:
>> I have a Pandas dataframe like below.
>>
>>XY
>> 0  1234567890 1  54321N/A 2  67890123456
>>
>> I need to make these numbers comma formatted. For example, 12345 =>
>> 12,345.
>
>>>> value = 12345 f'{value:,}'  # >= 3.6
> '12,345'
>>>> '{:,}'.format(value)  # >= 2.7
> '12,345'

 I need all the numbers in the whole dataframe to be formatted like
 that,
 not one value.
>>>
>>>   >>> data.applymap((lambda x: f"{x:,}") )
>>>   X Y
>>> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
>>>   >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
>>>   X Y
>>> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
>> 
>> It's giving error - "Cannot specify ',' with 's'."
> 
> It means that you're not storing numbers in your dataframe but strings,
> which is likely not what you want here. Fix that first.

Of course, they are strings. It's "N/A", not nan.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40579] Second argument to iterator.next not described

2020-05-09 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

It's documented here: https://docs.python.org/3/library/functions.html#next

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40576] Align docs for list.sort, sorted, and on the website

2020-05-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

I still think it's a mistake to point to list.sort() from sorted(). If anything 
I think it should be the other way around.

We'll see what other people think.

--

___
Python tracker 

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



[issue40579] Second argument to iterator.next not described

2020-05-09 Thread Andrew Black


New submission from Andrew Black :

The documentation for the built-in function next (which calls the __next__ 
method on an iterator) discusses its behavior when the iterator is exhausted.
It talks about the StopIteration exception.  However, it does not say anything 
about calling next with two arguments.  See the library documentation at 
https://docs.python.org/3/library/stdtypes.html#iterator-types

My impression was that the presence of the second argument would suppress the 
StopIteration exception; instead next would return the value of the second 
argument.  That is the way that list iterators behave, for example.  This 
behavior should be documented.

--
assignee: docs@python
components: Documentation
messages: 368525
nosy: Andrew Black, docs@python
priority: normal
severity: normal
status: open
title: Second argument to iterator.next not described
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue40578] Deprecate numeric item access for platform.uname()

2020-05-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In https://github.com/jaraco/cpython/tree/bc73729eb9, I started drafting a 
proposed implementation to address this concern, but ran into a snag - the 
tests immediately reveal that `tuple(platform.uname())` invokes `__len__`, 
triggering the deprecation warning... so deprecating it while supporting 
`tuple(result)` may not be possible.

--

___
Python tracker 

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



Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
On Sat, 09 May 2020 15:46:27 +0200, Python wrote:

> Joydeep C wrote:
>> On Sat, 09 May 2020 14:42:43 +0200, Python wrote:
>> 
>>> Joydeep wrote:
 I have a Pandas dataframe like below.

   XY
 0  1234567890 1  54321N/A 2  67890123456

 I need to make these numbers comma formatted. For example, 12345 =>
 12,345.
>>>
>>>   >>> value = 12345 f'{value:,}'  # >= 3.6
>>> '12,345'
>>>   >>> '{:,}'.format(value)  # >= 2.7
>>> '12,345'
>> 
>> I need all the numbers in the whole dataframe to be formatted like
>> that,
>> not one value.
> 
>  >>> data.applymap((lambda x: f"{x:,}") )
>  X Y
> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
>  >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
>  X Y
> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0

It's giving error - "Cannot specify ',' with 's'."
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40576] Align docs for list.sort, sorted, and on the website

2020-05-09 Thread Sam Lijin


Sam Lijin  added the comment:

I do clarify that they're not the same thing and that `sorted` accepts any 
iterable: 
https://github.com/python/cpython/pull/20017/files#diff-30d76a3dc0c885f86917b7d307ccf279

--

___
Python tracker 

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



[issue37573] asyncio: freeze when using MultiLoopChildWatcher on Solaris

2020-05-09 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

This looks like a duplicate of #38323: https://bugs.python.org/issue38323

--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue40576] Align docs for list.sort, sorted, and on the website

2020-05-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

sorted() does not just delegate to list.sort(): it sorts any iterable.

>>> sorted({0:1,2:3,-1:4})
[-1, 0, 2]

I think your change conflates the two by pointing to list.sort() from sorted().

--
nosy: +eric.smith

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I've gone ahead and merged PR 20015 to fix the issue, but I'm happy to revisit 
if a better approach is proposed.

--
keywords: +3.9regression -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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset 2c3d508c5fabe40dac848fb9ae558069f0576879 by Jason R. Coombs in 
branch 'master':
bpo-40570: Improve compatibility of uname_result with late-bound .platform 
(#20015)
https://github.com/python/cpython/commit/2c3d508c5fabe40dac848fb9ae558069f0576879


--

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks Marc-Andre for the suggestion, but I don't think that approach is viable 
here. The whole point of issue35967 was to defer the execution of the 
`.processor` behavior until it was requested. The intention is not to extend 
the tuple, but to shorten it (at least not to require the last element to be 
provided at construction time). Perhaps I'm missing something here, so feel 
free to provide a more concrete example of what you have in mind. Just be 
cautious not to violate the intention 
(https://github.com/python/cpython/blob/77c614624b6bf2145bef69830d0f499d8b55ec0c/Lib/platform.py#L784-L787).

I created issue40578 to track deprecation of uname for positional access.

--

___
Python tracker 

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



[issue40578] Deprecate numeric item access for platform.uname()

2020-05-09 Thread Jason R. Coombs


New submission from Jason R. Coombs :

In issue40570, I learned that some users are still relying on legacy tuple-like 
behaviors of `platform.uname()`, namely the access by item position and length:

```
platform.uname()[0]
len(platform.uname())
```

I propose to deprecate these behaviors and constrain the supported interface to 
the following:

```
platform.uname().attribute
items = tuple(platform.uname())
```

In other words, the `uname_result` would only support access of the items by 
attribute or iteration of all attributes.

Any users wishing to access items by position or to calculate the length of the 
result would need to explicitly construct a tuple from the result.

--
messages: 368517
nosy: jaraco, lemburg
priority: normal
severity: normal
status: open
title: Deprecate numeric item access for platform.uname()
type: enhancement

___
Python tracker 

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



Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Peter Otten
Joydeep C wrote:

> On Sat, 09 May 2020 14:42:43 +0200, Python wrote:
> 
>> Joydeep wrote:
>>> I have a Pandas dataframe like below.
>>> 
>>>  XY
>>> 0  1234567890 1  54321N/A 2  67890123456
>>> 
>>> I need to make these numbers comma formatted. For example, 12345 =>
>>> 12,345.
>> 
>>  >>> value = 12345 f'{value:,}'  # >= 3.6
>> '12,345'
>>  >>> '{:,}'.format(value)  # >= 2.7
>> '12,345'
> 
> I need all the numbers in the whole dataframe to be formatted like that,
> not one value.


>>> import pandas as pd
>>> df = pd.DataFrame([[12345., 67890.], [54321, "N/A"]], columns=["X","Y"])
>>> df
   X  Y
0  12345  67890
1  54321N/A

[2 rows x 2 columns]

Reading the docstring for you:

>>> help(df)

 |  
 |  to_string(self, buf=None, columns=None, col_space=None, colSpace=None, 
header=True, index=True, na_rep='NaN', formatters=None, float_format=None, 
sparsify=None, nanRep=None, index_names=True, justify=None, 
force_unicode=None, line_width=None, max_rows=None, max_cols=None, 
show_dimensions=False)
 |  Render a DataFrame to a console-friendly tabular output.
 |  
 |   Parameters
 |   --
 |   frame : DataFrame
 |   object to render
...
 |  float_format : one-parameter function, optional
 |  formatter function to apply to columns' elements if they are 
floats
 |  default None

So:

>>> print(df.to_string(float_format="{:,.0f}".format))
   X  Y
0 12,345 67,890
1 54,321N/A



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
On Sat, 09 May 2020 14:42:43 +0200, Python wrote:

> Joydeep wrote:
>> I have a Pandas dataframe like below.
>> 
>>  XY
>> 0  1234567890 1  54321N/A 2  67890123456
>> 
>> I need to make these numbers comma formatted. For example, 12345 =>
>> 12,345.
> 
>  >>> value = 12345 f'{value:,}'  # >= 3.6
> '12,345'
>  >>> '{:,}'.format(value)  # >= 2.7
> '12,345'

I need all the numbers in the whole dataframe to be formatted like that, 
not one value.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40576] Align docs for list.sort, sorted, and on the website

2020-05-09 Thread Sam Lijin


Change by Sam Lijin :


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

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I'm adding Nathaniel in case he can recognize this as one of the signal handler 
cases he's already come across.

--
nosy: +njs

___
Python tracker 

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



Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
I have a Pandas dataframe like below.

XY
0  1234567890
1  54321N/A
2  67890123456

I need to make these numbers comma formatted. For example, 12345 => 
12,345.

Please help.

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Not able use installed modules

2020-05-09 Thread Bob Gailer
On May 8, 2020 2:15 PM, "boB Stepp"  wrote:
[snip]
> This may be a naive question on my part, but, as far as I can tell, most
> instructions that I have encountered for installing Python packages state
the
> installation instructions as "pip install ...", which seems to repeatedly
> lead to these type of OP questions.  Has there ever been given thought to
> changing these "standard" installation instructions to something less
error
> fraught for the newcomer/novice?

> --
> Wishing you only the best,
>
> boB Stepp

I agree. I've been using python for many many years and have been
repeatedly frustrated with pip.

Bob Gailer
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue40575] _PyDict_GetItemIdWithError() should call _PyDict_GetItem_KnownHash()

2020-05-09 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +inada.naoki

___
Python tracker 

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



[issue40577] Spyder doesn't launch from Anaconda on MacBook

2020-05-09 Thread Christian Heimes


Christian Heimes  added the comment:

This is a bug in a 3rd party module, not in CPython. Please report the issue 
with Anaconda and Spyder.

--
nosy: +christian.heimes
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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I'm attaching a slightly simpler version of the script.

--
Added file: https://bugs.python.org/file49145/test-kill2.py

___
Python tracker 

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



[issue40577] Spyder doesn't launch from Anaconda on MacBook

2020-05-09 Thread Abhinav Vikram


New submission from Abhinav Vikram :

I just installed Anaconda to start coding in Python. However, after installing, 
the moment I launch Spyder I get the error "Python quit unexpectedly" error. I 
have tried running "conda update --all" and even reinstalling anaconda but no 
help.

Just for sanity check i looked up python version in the Terminal it is 3.7.6. 
If anyone can suggest a way to fix it it'll be most helpful.

Process:   python [6870]
Path:  /opt/anaconda3/python.app/Contents/MacOS/python
Identifier:python
Version:   0
Code Type: X86-64 (Native)
Parent Process:??? [6869]
Responsible:   python [6870]
User ID:   501

Date/Time: 2020-05-09 16:12:47.228 +0530
OS Version:Mac OS X 10.13.6 (17G12034)
Time Awake Since Boot: 19000 seconds

System Integrity Protection: enabled

Crashed Thread:0  Dispatch queue: com.apple.main-thread

Exception Type:EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:   0x0001, 0x
Exception Note:EXC_CORPSE_NOTIFY

Termination Signal:Illegal instruction: 4
Termination Reason:Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [0]

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   _multiarray_umath.cpython-37m-darwin.so 0x0001075b144b 
npy_cpu_supports + 139
1   _multiarray_umath.cpython-37m-darwin.so 0x00010742f0fe 
InitOperators + 94
2   _multiarray_umath.cpython-37m-darwin.so 0x00010742dc00 
PyInit__multiarray_umath + 160
3   com.continuum.python0x000105bc3c1d 
_PyImport_LoadDynamicModuleWithSpec + 557
4   com.continuum.python0x000105bc3033 _imp_create_dynamic 
+ 243
5   com.continuum.python0x000105a57c0f 
_PyMethodDef_RawFastCallDict + 255
6   com.continuum.python0x000105a5931d PyCFunction_Call + 61
7   com.continuum.python0x000105b93d9d 
_PyEval_EvalFrameDefault + 46845
8   com.continuum.python0x000105b8746e 
_PyEval_EvalCodeWithName + 414
9   com.continuum.python0x000105a58a03 
_PyFunction_FastCallKeywords + 195
10  com.continuum.python0x000105b95d67 call_function + 183
11  com.continuum.python0x000105b92b92 
_PyEval_EvalFrameDefault + 42226
12  com.continuum.python0x000105a582d5 
function_code_fastcall + 117
13  com.continuum.python0x000105b95d67 call_function + 183
14  com.continuum.python0x000105b92afc 
_PyEval_EvalFrameDefault + 42076
15  com.continuum.python0x000105a582d5 
function_code_fastcall + 117
16  com.continuum.python0x000105b95d67 call_function + 183
17  com.continuum.python0x000105b93ad4 
_PyEval_EvalFrameDefault + 46132
18  com.continuum.python0x000105a582d5 
function_code_fastcall + 117
19  com.continuum.python0x000105b95d67 call_function + 183
20  com.continuum.python0x000105b93ad4 
_PyEval_EvalFrameDefault + 46132
21  com.continuum.python0x000105a582d5 
function_code_fastcall + 117
22  com.continuum.python0x000105b95d67 call_function + 183
23  com.continuum.python0x000105b93ad4 
_PyEval_EvalFrameDefault + 46132
24  com.continuum.python0x000105a582d5 
function_code_fastcall + 117
25  com.continuum.python0x000105a5a978 object_vacall + 248
26  com.continuum.python0x000105a5ab83 
_PyObject_CallMethodIdObjArgs + 243
27  com.continuum.python0x000105bbc798 
PyImport_ImportModuleLevelObject + 3640
28  com.continuum.python0x000105b91919 
_PyEval_EvalFrameDefault + 37497
29  com.continuum.python0x000105b8746e 
_PyEval_EvalCodeWithName + 414
30  com.continuum.python0x000105b81e9b builtin_exec + 347
31  com.continuum.python0x000105a57c0f 
_PyMethodDef_RawFastCallDict + 255
32  com.continuum.python0x000105a5931d PyCFunction_Call + 61
33  com.continuum.python0x000105b93d9d 
_PyEval_EvalFrameDefault + 46845
34  com.continuum.python0x000105b8746e 
_PyEval_EvalCodeWithName + 414
35  com.continuum.python0x000105a58a03 
_PyFunction_FastCallKeywords + 195
36  com.continuum.python0x000105b95d67 call_function + 183
37  com.continuum.python0x000105b92b92 
_PyEval_EvalFrameDefault + 42226
38  com.continuum.python0x000105a582d5 
function_code_fastcall + 117
39  com.continuum.python0x000105b95d67 call_function + 183
40  com.continuum.python0x000105b92afc 
_PyEval_EvalFrameDefault + 42076
41  com.continuum.python  

[issue40551] PRs should be rebased on top of master before running the build/tests

2020-05-09 Thread Filipe Laíns

Filipe Laíns  added the comment:

> re-trigger the CI, to make everything works correctly with master.

*re-trigger the CI, to make *sure* everything works correctly with master.

--

___
Python tracker 

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



[issue38323] asyncio: MultiLoopWatcher has a race condition (test_asyncio: test_close_kill_running() hangs on AMD64 RHEL7 Refleaks 3.x)

2020-05-09 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

I'm attaching a stand-alone script that can reproduce the issue. It doesn't use 
unittest or even MultiLoopChildWatcher.

It starts an event loop and then repeatedly calls loop.subprocess_exec() with 
0.2 seconds in between until the "hang" happens (which shows up as a timeout). 
I recommend running the script for about 15 seconds, and if it doesn't happen, 
re-run it again. You might need to run it a half-dozen or dozen times to see 
the hang, but it can also happen right away.

I'm sure the script can be cleaned up and simplified a lot more. This is just a 
start. I wanted to see how much of the cruft I could strip out quickly.

This is what the output looks like after one of the hangs:

[81]: 16.77
/.../cpython/Lib/subprocess.py:1048: ResourceWarning: subprocess 3282 is still 
running
  _warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
killing pid: 3283
BaseSubprocessTransport: awaiting in _wait
_sig_child: started
releasing waiter: okay
okay
[82]: 16.99
/.../cpython/Lib/subprocess.py:1048: ResourceWarning: subprocess 3283 is still 
running
  _warn("subprocess %s is still running" % self.pid,
ResourceWarning: Enable tracemalloc to get the object allocation traceback
killing pid: 3284
BaseSubprocessTransport: awaiting in _wait
_sig_child: started
releasing waiter: **TIMEOUT**
not okay: **TIMEOUT**

You can ignore the ResourceWarnings. You can also see at the end that the 
_sig_child() handler was called even in the timeout case (right before the 
loop.call_later(TIMEOUT, ...) callback began).

--
Added file: https://bugs.python.org/file49144/test-kill.py

___
Python tracker 

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



[issue40551] PRs should be rebased on top of master before running the build/tests

2020-05-09 Thread Filipe Laíns

Filipe Laíns  added the comment:

> "Rather than build the commits that have been pushed to the branch the
pull request is from, we build the merge between the source branch and
the upstream branch."

Okay, great. But this still only happens for Linux. And still has the same 
problem, the build needs to be re-triggered.

> Both are fine, but...

...

> Bot shouldn't use rebase, but merge master branch.
Rebase in pull request branch break the pull request sometime.
See this thread:
https://discuss.python.org/t/info-rebase-origin-master-push-f-workflow-corrupts-pull-request-rarely/2558/7

Okay, so maybe I was not clear enough here. The PR would be rebased locally in 
the CI runs before building and running the tests. Nothing would ever be 
pushed. We don't really want users have to pull their branch before making 
changes, also the users might not give us write access to their branch.

What I am proposing is to do here the same as Travis apparently does, and then 
maybe figure out a workflow where we (semi-/)automatically  re-trigger the CI, 
to make everything works correctly with master.

This is a low risk change. Rethinking the core workflow is the difficult part.

--

___
Python tracker 

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



[issue40576] Align docs for list.sort, sorted, and on the website

2020-05-09 Thread Sam Lijin


New submission from Sam Lijin :

It's mildly confusing to see `pydoc sorted` and `pydoc list.sort` to look so 
different, esp. since sorted just delegates to list.sort.

By extension, https://docs.python.org/3/library/functions.html#sorted should 
also be aligned with this, but I'm not super familiar with what the distinction 
content in the docstrings and the website is intended to be, if there is any 
guiding philosophy there.

sorted() appears to have been documented as an afterthought as part of this 
commit:
https://github.com/python/cpython/commit/f9e227e5a9d7a74393ef259c861660c3d1f36f83

list.sort was last updated in 2018 by 
https://github.com/python/cpython/pull/8516

I have an incoming PR for this.

--
assignee: docs@python
components: Documentation
messages: 368508
nosy: docs@python, sxlijin
priority: normal
severity: normal
status: open
title: Align docs for list.sort, sorted, and on the website
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



[issue40426] Unable to use lowercase hexadecimal digits for percent encoding

2020-05-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Concur with Christian. Heh, I was going to propose the same.

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

___
Python tracker 

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



[issue40551] PRs should be rebased on top of master before running the build/tests

2020-05-09 Thread Inada Naoki

Inada Naoki  added the comment:

On Sat, May 9, 2020 at 6:08 PM Filipe Laíns  wrote:
>
> > * Travis-CI, at least, does test against "merge commit", not HEAD of PR 
> > branch.
>
> Where? https://github.com/python/cpython/blob/master/.travis.yml

https://docs.travis-ci.com/user/pull-requests/

"Rather than build the commits that have been pushed to the branch the
pull request is from, we build the merge between the source branch and
the upstream branch."

> * Automatically
> * Semi-automatically

Both are fine, but...

>
> Please note in both situations, automatically rebasing PRs *is* the first 
> step. After that, it's just figuring out a suitable model to re-trigger the 
> checks before merging.

Bot shouldn't use rebase, but merge master branch.
Rebase in pull request branch break the pull request sometime.
See this thread:
https://discuss.python.org/t/info-rebase-origin-master-push-f-workflow-corrupts-pull-request-rarely/2558/7

--

___
Python tracker 

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



[issue40575] _PyDict_GetItemIdWithError() should call _PyDict_GetItem_KnownHash()

2020-05-09 Thread Stefan Behnel


Change by Stefan Behnel :


--
components: +Interpreter Core
keywords: +easy (C)

___
Python tracker 

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



[issue40575] _PyDict_GetItemIdWithError() should call _PyDict_GetItem_KnownHash()

2020-05-09 Thread Stefan Behnel


New submission from Stefan Behnel :

_PyDict_GetItemIdWithError() looks up interned strings, which always have their 
hash value initialised. It can call _PyDict_GetItem_KnownHash() directly.

--
messages: 368506
nosy: scoder
priority: low
severity: normal
stage: needs patch
status: open
title: _PyDict_GetItemIdWithError() should call _PyDict_GetItem_KnownHash()
type: performance
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



[issue40551] PRs should be rebased on top of master before running the build/tests

2020-05-09 Thread Filipe Laíns

Filipe Laíns  added the comment:

> * Travis-CI, at least, does test against "merge commit", not HEAD of PR 
> branch.

Where? https://github.com/python/cpython/blob/master/.travis.yml

> * As you said already, master branch grow after PR is created anyway.

> This issue proposes " this only works at the time the pull request is 
> created."  It doesn't help that case.

Please note that the proposed fix is just that. I detailed that we should do 
something else, but this was the first step.

> * We run CI and buildbots against master branch too.  So we can find breakage 
> soon when something go wrong.

Right, but then it might not be trivial to add a fix or revert changes. If more 
changes are merged before someone deals with the breakage, it might become very 
difficult to fix, at this point you are playing whack-a-mole reverting 
patches...

So, I disagree with you. This is a real issue. It's not a matter of if, it's a 
matter of when. And a matter of, how bad will it be when it happens?

There are two ways we could go about this:

* Automatically
No-one merges anything manually, they add a tag or comment to trigger the build 
bot. The bot will restart the tests and merge if they pass.

* Semi-automatically
When someone approves the patch, the tests will automatically be re-triggered, 
it then is on the developer to make sure there are no major differences from 
master at the time of merging, to avoid any issues. The tests can be triggered 
manually, but perhaps it would be best to introduce a `/test` command in the 
bots to do this, avoiding the developer to go through a few UI jumps.
If this is chosen, all current developers should be notified, and this added to 
the dev wiki. It also should be noted during the onboard process for new 
developers.

Please note in both situations, automatically rebasing PRs *is* the first step. 
After that, it's just figuring out a suitable model to re-trigger the checks 
before merging.

--

___
Python tracker 

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



[issue40566] Apply PEP 573 to abc module

2020-05-09 Thread Dong-hee Na


Dong-hee Na  added the comment:

I am now closing the issue. Thanks for the review

--
nosy: +christian.heimes
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



[issue40566] Apply PEP 573 to abc module

2020-05-09 Thread miss-islington


miss-islington  added the comment:


New changeset 77c614624b6bf2145bef69830d0f499d8b55ec0c by Dong-hee Na in branch 
'master':
bpo-40566: Apply PEP 573 to abc module (GH-20005)
https://github.com/python/cpython/commit/77c614624b6bf2145bef69830d0f499d8b55ec0c


--
nosy: +miss-islington

___
Python tracker 

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



[issue40570] len(platform.uname()) has changed in Python 3.9

2020-05-09 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

Hi Jason,

to achieve better backwards compatibility, it's probably better to use
the approach taken for CodeInfo in the codecs.py module:

class CodecInfo(tuple):
"""Codec details when looking up the codec registry"""

def __new__(cls, encode, decode, streamreader=None, streamwriter=None,
incrementalencoder=None, incrementaldecoder=None, name=None,
*, _is_text_encoding=None):
self = tuple.__new__(cls, (encode, decode, streamreader,
streamwriter))
self.name = name
self.encode = encode
self.decode = decode
self.incrementalencoder = incrementalencoder
self.incrementaldecoder = incrementaldecoder
self.streamwriter = streamwriter
self.streamreader = streamreader
if _is_text_encoding is not None:
self._is_text_encoding = _is_text_encoding
return self

def __repr__(self):
return "<%s.%s object for encoding %s at %#x>" % \
(self.__class__.__module__, self.__class__.__qualname__,
 self.name, id(self))

This used to be a 4 entry tuple and was extended to hold additional
fields. To the outside, it still looks like a 4-tuple in all aspects,
but attribute access permits accessing the additional fields.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Experts (#1, May 09 2020)
>>> Python Projects, Coaching and Support ...https://www.egenix.com/
>>> Python Product Development ...https://consulting.egenix.com/


::: We implement business ideas - efficiently in both time and costs :::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   https://www.egenix.com/company/contact/
 https://www.malemburg.com/

--

___
Python tracker 

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



Re: SaveAs on macOS Catalina.

2020-05-09 Thread Christian Gollwitzer

Am 09.05.20 um 04:37 schrieb Bev In TX:



On May 8, 2020, at 8:29 PM, Terry Reedy  wrote:

https://bugs.python.org/issue40553


On macOS The default Save/Save as dialogs are short, only displaying a few 
major folders along with Favorites and Recents.  That dialog doesn’t display 
folder contents.  However, you can get an expanded dialog by clicking on the 
little arrow to the right of the Where box.  Using that dialog allows one to 
select any folder and displays folder contents.

I tried using both Save and Save as, and was unable to duplicate the problem 
with either the short or the long dialog.

Python 3.8.2
macOS Catalina 10.15.4


Can it be a problem with the underlying Tk version? If so, it would be 
helpful to isolate the Tk call and convert it to an equivalent Tcl 
script for the core developers to test.


Fairly recently, Tk has got many bugfixes because of changes in OSX. 
Here is the file that implements the file dialogs:


https://core.tcl-lang.org/tk/artifact/d72cdfbcbfaa717f

and the history:

https://core.tcl-lang.org/tk/finfo?name=macosx/tkMacOSXDialog.c=d72cdfbcbfaa717f

As you can see, it has been touched two days ago (!) to restore some 
window behaviour, which was switched of because of Catalina last August 
(this commit)

https://core.tcl-lang.org/tk/info/59b1d265c2444112


Christian
--
https://mail.python.org/mailman/listinfo/python-list