[issue41672] imaplib: wrong return type documented

2020-09-09 Thread Dong-hee Na


Dong-hee Na  added the comment:

Please ping me when you submit the PR

--

___
Python tracker 

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



[issue40288] [subinterpreters] atexit module should not be loaded more than once per interpreter

2020-09-09 Thread Dong-hee Na


Dong-hee Na  added the comment:

@vstineer
I'd like to update PR 19562 not to create more than one instance.
if the PR is updated, would you like to review this PR?

--

___
Python tracker 

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



[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2020-09-09 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
versions: +Python 3.10 -Python 3.8

___
Python tracker 

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



[issue41561] test_ssl fails in Ubuntu 20.04: test_min_max_version_mismatch

2020-09-09 Thread Bug Reporter


Bug Reporter  added the comment:

I don't know if it matters, but I started having this problem when I switched 
from Ubuntu 18.04 (native python3.7) to 20.04 (native python3.8.2). I specify 
--prefix to a folder in my home directory, but while running make test Ubuntu 
gives a system error which refers to Ubuntu's python. I don't know exactly at 
what test it happens, approximately in the middle, but it should not happen at 
all because the tests should only call the python compiled by me.

--

___
Python tracker 

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



[issue40564] Using zipfile.Path with several files prematurely closes zip

2020-09-09 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In jaraco/zipp, I've implemented three of the options above:

- https://github.com/jaraco/zipp/tree/bugfix/bpo-40564-option-1
- https://github.com/jaraco/zipp/tree/bugfix/bpo-40564-option-2
- https://github.com/jaraco/zipp/tree/bugfix/bpo-40564-option-5

--

___
Python tracker 

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



[issue19438] Where is NoneType in Python 3?

2020-09-09 Thread Andrés Delfino

Andrés Delfino  added the comment:

ammar2 found this mail mentioning the changes in that commit 
https://mail.python.org/pipermail/python-dev/2007-November/075386.html

"I've removed the 'new' module from py3k and also removed a lot of types
from the 'types' module in py3k. It only contains types that aren't
easily available through builtins."

--

___
Python tracker 

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



Re: Python download problem

2020-09-09 Thread MRAB

On 2020-09-09 10:23, Talin Alnaber wrote:


Good evening,
I would like to ask for help regarding Python installation ,
I'm a beginner and I would like to challenge myself to start coding using 
Python language , but unfortunately I'm having problems while installing it ,
I used python.org to install the latest Windows version of Python ( 3.8.5) on 
my Windows 10 64 bit computer , after clicking on this link to download the 
file Windows (x86-64 executable installer) I opened it and check the boxes


  , I continued with the steps until it was successfully downloaded .
After that I opened CMD and this screen appeared for me


I wrote python --version then enter and I got error
'python' is not recognized as an internal or external command,operable program 
or batch file.


I tried to fix it following these steps as the following
Edit the system environment variables>>environment variables >>Path >>edit>>browse 
.exe path C:\Program Files\Python38>>ok
(this is the link that I paste in the path)
C:\Program Files\Python38

and same problem occurred .
I opened Python IDLE , then I wrote Print("HI") >> enter , and I got HI as a 
result


Does that mean that it is python is working fine on my PC and if yes , can I 
use IDLE to run the future scripts instead of CMD or I need to fix the CMD ?


These days it's recommended to use the Python launcher:

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


[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Steve Dower


Steve Dower  added the comment:

The comment you quoted was referring to the NamedTemporaryFile(do_not_delete) 
flag.

Yes, we'd have to reimplement the UCRT function using the system API. 
Ultimately, it's not a great compatibility layer if you want to match POSIX 
semantics and not just the C specification, which is why we do it so often :)

--

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Eryk Sun


Eryk Sun  added the comment:

> Nothing preventing someone from contributing the flag on open as well. 

To be clear, supporting delete-access sharing would require re-implementing C 
_wopen in terms of CreateFileW, _open_osfhandle, etc. It could be implemented 
as _Py_wopen in Python/fileutils.c.

--

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Steve Dower


Steve Dower  added the comment:

Issue41490 can also be fixed by using FILE_SHARE_DELETE on all opened files 
(and that's a release blocker, so we need to fix it somehow), and if DeleteFile 
has been updated as you suggest then it might even help with the "pip replacing 
its own script executable" issue.

Nothing preventing someone from contributing the flag on open as well. There's 
definitely value there, but I think it's a workaround when we can make things 
Just Work more transparently.

--

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Eryk Sun


Eryk Sun  added the comment:

> Why do we need to use this O_TEMPORARY flag at all?

Using the O_TEMPORARY flag isn't necessary, but it's usually preferred because 
it ensures the file gets deleted even if the process is terminated abruptly. 
However, it opens the file with delete access, and most Windows programs don't 
share delete access for normal file opens. This can be worked around in Python 
code by using an opener that calls CreateFileW with delete-access sharing. But 
it can't be worked around in general. 

I prefer to provide a way to omit O_TEMPORARY, but still use it by default. 
When it's omitted, I'd also like to be able to close the file within the 
context block without deleting it, for which one use case is to reopen the file 
in a program that doesn't share read or write access. A new delete_on_close 
option would support this case, in addition to providing a way to omit the 
O_TEMPORARY flag. For example:

with tempfile.NamedTemporaryFile(delete_on_close=False) as f:
f.close()
subprocess.run([cmd, f.name])

The file will still be deleted by the context manager, but the tradeoff is that 
it's not as reliable as the default delete-on-close behavior that uses the 
O_TEMPORARY flag.

--

___
Python tracker 

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



[issue38572] Misleading AttributeError accessing fileno attribute in tarfile

2020-09-09 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
nosy_count: 4.0 -> 5.0
pull_requests: +21244
pull_request: https://github.com/python/cpython/pull/22178

___
Python tracker 

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



[issue41428] PEP 604 -- Allow writing union types as X | Y

2020-09-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Now that PR 21515 is landed, we should consider what sections of the docs/spec 
needs to be updated.

--

___
Python tracker 

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



Re: Module exists and cannot be found

2020-09-09 Thread Menno Holscher

Op 09-09-2020 om 07:35 schreef James Moe via Python-list:

python 3.6.10
opensuse tumbleweed
Tumbleweed is a rolling distro, so that is extremely old for Tumbleweed. 
I would expect Python 3.8.4 or 3.8.5 to be current there.


If you want to use another version, you would have to run in a virtual 
environment. Did you do that?

linux 5.8.4


Module PyQt5 is most definitely installed. 
How did you check? You want to be in the same virtual environment the 
program runs in.


From my installation (openSuse Leap, so there I run Python 3.6):

Python 3.6.10 (default, Jan 16 2020, 09:12:04) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: No module named 'PyQt5'
>>>

No PyQt5 as I do not have a Qt program in the environment :=)

Vriendelijke groet/Kind regards,

Menno Hölscher


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


[issue35815] Able to instantiate a subclass with abstract methods from __init_subclass__ of the ABC

2020-09-09 Thread Thijs Damsma


Change by Thijs Damsma :


--
nosy: +tda
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



[issue41428] PEP 604 -- Allow writing union types as X | Y

2020-09-09 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 1b4552c5e8e925f24c15f707050f22c977171125 by Maggie Moss in branch 
'master':
bpo-41428: Implementation for PEP 604 (GH-21515)
https://github.com/python/cpython/commit/1b4552c5e8e925f24c15f707050f22c977171125


--
nosy: +pablogsal

___
Python tracker 

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



Re: newbie

2020-09-09 Thread Michael Torrie
On 9/8/20 7:24 PM, Grant Edwards wrote:
> On 2020-09-08, Don Edwards  wrote:
> 
>> I may need. My aim is to write a program
>> that simulates croquet - 2 balls colliding with the strikers (cue) ball
>> going into the hoop (pocket), not the target ball. I want to be able to
>> move the balls around and draw trajectory lines to evaluate different
>> positions. Is there a package for this or maybe one to draw and one to
>> move? Any help much appreciated.
> 
> Is pygame still a thing?

Yes. https://www.pygame.org/.  Should be in most Linux distributions'
repositories.

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


[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Chary Chary


Chary Chary  added the comment:

I am not sure, this is the correct place to ask this "educational" question, 
but I will do this any way:

where is this O_TEMPORARY flag defined?

if I looks at 
[tempfile.py](https://github.com/python/cpython/blob/3ff6975e2c0af0399467f234b2e307cc76efcfa9/Lib/tempfile.py#L539)
 then appears, that it is defined in the os.py module.

But in 
[os.py](https://github.com/python/cpython/blob/3ff6975e2c0af0399467f234b2e307cc76efcfa9/Lib/os.py)
 I can't find it

--

___
Python tracker 

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



Python download problem

2020-09-09 Thread Talin Alnaber




Good evening,
I would like to ask for help regarding Python installation ,
I'm a beginner and I would like to challenge myself to start coding using 
Python language , but unfortunately I'm having problems while installing it ,
I used python.org to install the latest Windows version of Python ( 3.8.5) on 
my Windows 10 64 bit computer , after clicking on this link to download the 
file Windows (x86-64 executable installer) I opened it and check the boxes


 , I continued with the steps until it was successfully downloaded .
After that I opened CMD and this screen appeared for me


I wrote python --version then enter and I got error
'python' is not recognized as an internal or external command,operable program 
or batch file.


I tried to fix it following these steps as the following
Edit the system environment variables>>environment variables >>Path 
>>edit>>browse .exe path C:\Program Files\Python38>>ok
(this is the link that I paste in the path)
C:\Program Files\Python38

and same problem occurred .
I opened Python IDLE , then I wrote Print("HI") >> enter , and I got HI as a 
result


Does that mean that it is python is working fine on my PC and if yes , can I 
use IDLE to run the future scripts instead of CMD or I need to fix the CMD ?



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


[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Chary Chary


Chary Chary  added the comment:

Why do we need to use this O_TEMPORARY flag at all?

I understand that we are using OS functionality, available on Windows, rather 
than implementing it in Python. But why doing this, if we already do this for 
none-nt systems in Python any way?

Doesn't it just complicate the code?

https://github.com/python/cpython/blob/fa8c9e70104b0aef966a518eb3a80a4881906ae0/Lib/tempfile.py#L423

--

___
Python tracker 

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



[issue41687] sendfile implementation is not compatible with Solaris

2020-09-09 Thread miss-islington

miss-islington  added the comment:


New changeset fa8c9e70104b0aef966a518eb3a80a4881906ae0 by Jakub Kulík in branch 
'master':
bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
https://github.com/python/cpython/commit/fa8c9e70104b0aef966a518eb3a80a4881906ae0


--
nosy: +miss-islington

___
Python tracker 

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



[issue41753] subprocess.run on windows does not convert path to string

2020-09-09 Thread Eryk Sun


Eryk Sun  added the comment:

The underlying subprocess.Popen class was updated in 3.8 to support path-like 
objects in `args` (with shell=False) and `executable` on Windows [1]. This 
change was not backported to 3.6 and 3.7.

---

[1] https://docs.python.org/3/library/subprocess.html#subprocess.Popen

--
nosy: +eryksun

___
Python tracker 

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



Re: Module exists and cannot be found

2020-09-09 Thread Barry Scott



> On 9 Sep 2020, at 06:35, James Moe via Python-list  
> wrote:
> 
> python 3.6.10
> opensuse tumbleweed
> linux 5.8.4
> 
> An old program based on Python (BackInTime) has recently been having
> difficulties functioning. See below.
> 
> Module PyQt5 is most definitely installed. Apparently there is more to getting
> modules loaded than there used to be.

How did you check you have PyQt5 is installed like this?

$ python3.6
>>> import PyQt5

If that works then. How do you run the app?

> 
> (Also, I am not familiar with Python.)
> 
> [ error message (verbose option) ]
> Traceback (most recent call last):
>  File "/home/jmoe/diy/backintime-master/qt/app.py", line 35, in 
>import qttools
>  File "", line 971, in _find_and_load
>  File "", line 955, in _find_and_load_unlocked
>  File "", line 665, in _load_unlocked
>  File "", line 678, in exec_module
>  File "", line 219, in _call_with_frames_removed
>  File "/home/jmoe/diy/backintime-master/qt/qttools.py", line 21, in 
>from PyQt5.QtGui import (QFont, QColor, QKeySequence)
>  File "", line 971, in _find_and_load
>  File "", line 941, in _find_and_load_unlocked
>  File "", line 219, in _call_with_frames_removed
>  File "", line 971, in _find_and_load
>  File "", line 953, in _find_and_load_unlocked
> ModuleNotFoundError: No module named 'PyQt5'
> [ end ]


I forget what does seeing frozen importlib imply?
A free stand app with embedded python maybe?

> 
> [ the 1st code lines causing the above ]
> qttools.py:
>  import os
>  import sys
>  import gettext
>  from PyQt5.QtGui import (QFont, QColor, QKeySequence) <<<-- line 21
>  ...
> 
> app.py:
>  import os
>  import sys
> 
>  if not os.getenv('DISPLAY', ''):
>os.putenv('DISPLAY', ':0.0')
> 
>  import datetime
>  import gettext
>  import re
>  import subprocess
>  import shutil
>  import signal
>  from contextlib import contextmanager
>  from tempfile import TemporaryDirectory
> 
>  import qttools<<<--- line 35
>  qttools.registerBackintimePath('common')
>  ...
> [ end ]
> 
> -- 
> James Moe
> jmm-list at sohnen-moe dot com
> Think.
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Eryk Sun


Eryk Sun  added the comment:

> For this case, I think the best thing we can probably do is change the 
> default share mode for _all_ opens to include FILE_SHARE_DELETE. 

The C runtime doesn't provide a way to share delete access, except for the 
O_TEMPORARY flag, so Python would have to re-implement open(). Also, this 
doesn't help with re-opening a temporary file in another process since most 
programs do not share file delete access. 

There could be an option to enable a context-manager delete that's independent 
of closing the file. For example, if delete=True and delete_on_close=False, 
then _TemporaryFileCloser.close doesn't delete the file. Instead the file would 
be deleted via os.unlink in _TemporaryFileWrapper.__exit__. The default would 
be delete=True and delete_on_close=True, which would use the O_TEMPORARY flag 
in Windows. Combining delete=False with delete_on_close=True would raise a 
ValueError.

> bringing the default Windows behaviour slightly more in line with 
> how POSIX likes to do things.

In Windows 10, using FILE_SHARE_DELETE is even closer to POSIX behavior when 
the filesystem is NTFS, which supports POSIX delete semantics by renaming the 
file to a hidden system directory ("\$Extend\$Deleted") and setting its delete 
disposition. WinAPI DeleteFileW has been updated to use POSIX semantics if the 
filesystem supports it:

>>> f = tempfile.NamedTemporaryFile()
>>> h = msvcrt.get_osfhandle(f.fileno())
>>> os.unlink(f.name)
>>> info = GetFileInformationByHandleEx(h, FileStandardInfo)
>>> info['DeletePending']
True
>>> GetFinalPathNameByHandle(h, 0)
'?\\C:\\$Extend\\$Deleted\\00180002C4F4301F419F'

--

___
Python tracker 

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



[issue41688] Document how **= does not fall back on **

2020-09-09 Thread Brett Cannon


Change by Brett Cannon :


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



[issue41688] Document how **= does not fall back on **

2020-09-09 Thread miss-islington

miss-islington  added the comment:


New changeset 4c4c354de2c9a290afbd4e5fcba07e3696ca0396 by Miss Islington (bot) 
in branch '3.8':
[3.8] [3.9] bpo-41688: Document bug in **= dispatching in the language data… 
(GH-22172) (GH-22175)
https://github.com/python/cpython/commit/4c4c354de2c9a290afbd4e5fcba07e3696ca0396


--

___
Python tracker 

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



[issue41753] subprocess.run on windows does not convert path to string

2020-09-09 Thread Kaushik G


Kaushik G  added the comment:

Thank you for your response.

There are two concerns I have here.

1. Python's promise of being straightforward. In MOST cases pathlib.Path 
objects do the right thing, casting to a string such that pathlib.Path is a 
drop in replacement. This exception is unexpected.

2. Cross platform consistency. Looks like this works on macOS and Linux. Why 
should it fail on Windows?

Thanks!

--

___
Python tracker 

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



[issue41753] subprocess.run on windows does not convert path to string

2020-09-09 Thread Eric V. Smith


Eric V. Smith  added the comment:

Among others, see:
issue 41649
issue 31961

In general, I think the consensus is that the caller should convert each 
argument to a string. It's not subprocess's job to convert each parameter to a 
string.

--
nosy: +eric.smith

___
Python tracker 

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



[issue41688] Document how **= does not fall back on **

2020-09-09 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21243
pull_request: https://github.com/python/cpython/pull/22175

___
Python tracker 

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



[issue41688] Document how **= does not fall back on **

2020-09-09 Thread miss-islington

miss-islington  added the comment:


New changeset 46bc21e1780016aaacd34e472f838dc792fb674c by Ammar Askar in branch 
'3.9':
[3.9] bpo-41688: Document bug in **= dispatching in the language data… 
(GH-22172)
https://github.com/python/cpython/commit/46bc21e1780016aaacd34e472f838dc792fb674c


--
nosy: +miss-islington

___
Python tracker 

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



[issue41753] subprocess.run on windows does not convert path to string

2020-09-09 Thread Kaushik G


New submission from Kaushik G :

a call of the form `subprocess.run([x, y, z])` where one of the elements is a 
`pathlib.Pat`h fails on windows because the path is not converted to a string 
as it should. This works fine (as expected) on macOS and Linux.

A typical error message is:

`TypeError: argument of type 'WindowsPath' is not iterable`

--
components: Windows
messages: 376651
nosy: kaushik.ghose, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: subprocess.run on windows does not convert path to 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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I do not think there is a bug. If we ever decide to change the behavior, the 
changes can only go in future Python version.

And if we decide to make changes, I think that it would be better to make the 
pure Python implementation using __new__() instead of __init__() and make 
__reduce__() using copyreg.__newobj__.

--
type: behavior -> enhancement
versions: +Python 3.10 -Python 3.6

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +eric.snow

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Chary Chary


Chary Chary  added the comment:

Steve Dower, thanks for looking at this.

After reading the thread from my amature point of view I kind of liked 
suggestion of Daniel Lenski to replace the binary delete argument of the 
current NamedTemporaryFile implementation with finer-grained options 
https://bugs.python.org/issue14243#msg164369

This would also take care of the comment from Dave Abrahams, that 

<> https://bugs.python.org/issue14243#msg155457

As for your comment to include FILE_SHARE_DELETE. If the decision is taken to 
go this path, shall we also not include FILE_SHARE_READ and FILE_SHARE_WRITE?
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilea

--

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Erez Zinman


Erez Zinman  added the comment:

Just to be clear, what I did is (works with both "copy" and "pickle"):


```

def _new_and_init(cls):
inst = cls.__new__(cls)
OrderedDict.__init__(inst)
return inst


class A(OrderedDict):

def __reduce__(self):
# This fixes a bug in Python 3.6
ret = list(super().__reduce__())

ret[0] = _new_and_init
ret[1] = (self.__class__, )

return tuple(ret)

```

And that works... I also verified that indeed old->new pickling will just call 
_init__ on unpickling, so this would just retain the previous behavior.

--

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Erez Zinman


Erez Zinman  added the comment:

The first argument can be remedied by creating a new method that deals with 
that (something like `def _new_init(cls)`, and passing the `cls` as argument).

The third argument is not really an argument - there is a bug that needs a 
precedent to be solved.

Concerning the second argument, I think it is only problematic when pickling in 
a new version of python and unpickling in an old one, and not vice versa 
(because the reduction from previous versions calls __init__). In the old->new 
direction, there wouldn't be much of a problem because the worst thing that 
happens, is that this bug could occur.
If that doesn't satisfy you, I hope that this change can be made in the future, 
when a version that allows such a lack of backward-compatibility is released.

--

___
Python tracker 

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



[issue41703] Most bytecode changes are absent from Python 3.9 What's new

2020-09-09 Thread Mark Shannon


Mark Shannon  added the comment:

Thanks for the reminder. Tis' done.

--
stage: patch review -> 

___
Python tracker 

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



[issue41703] Most bytecode changes are absent from Python 3.9 What's new

2020-09-09 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +21242
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22174

___
Python tracker 

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



[issue14243] tempfile.NamedTemporaryFile not particularly useful on Windows

2020-09-09 Thread Steve Dower


Steve Dower  added the comment:

In general, if a bug here appears to be inactive, it's probably waiting on 
someone to volunteer to move it forward. Often merely posting to a thread is 
enough.

For this case, I think the best thing we can probably do is change the default 
share mode for _all_ opens to include FILE_SHARE_DELETE. This would also help a 
number of other situations, as well as bringing the default Windows behaviour 
slightly more in line with how POSIX likes to do things.

As far as I'm aware this would only be harmful in cases where people are trying 
to implicitly lock files on Windows by keeping an open handle, and are using a 
different code path on other platforms where that won't work.

--
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

First, closures cannot be pickled. You have to pass self.__class__ as an 
argument.

Second, it will break compatibility with older Python versions. Pickles created 
in new Python could not be unpickled in older Pythons.

Third, it is the behavior which does not have precedents. Unpickling usually 
calls either just __new__() or both __new__() and __init__() of the same class.

--

___
Python tracker 

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



[issue40124] Clearer assertion error

2020-09-09 Thread Udi


Udi  added the comment:

I don't see anything in the documentation of drain() that states that it cannot 
be called from multiple tasks.

I'm also not sure why this assertion is necessary. If self._drain_waiter is 
already set, could the other task just await on it?

--
nosy: +udifuchs

___
Python tracker 

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



[issue41748] HTMLParser: parsing error

2020-09-09 Thread Ezio Melotti


Ezio Melotti  added the comment:

The html.parser follows the HTML 5 specs as closely as possible.  There are a 
few corner cases where it behaves slightly differently but it's only while 
dealing with invalid markup, and the differences should be trivial and 
generally not worth the extra complexity to deal with them.

In this case, if I recall correctly, the way the comma is handled is just a 
left-over from the previous version of the parser, that predates the HTML 5 
specs.  In tags like  there was an ambiguous situation and 
parsing it  was deemed a reasonable interpretation, so 
the comma was treated as an attribute separator (and there should be test cases 
for this).

This likely caused the issue reported by the OP, and I think it should be 
fixed, even if technically it's a change in behavior and will break some of the 
tests.

If I'm reading the specs[0] correctly:
*  should be parsed as , and
*  should be parsed as , where 
',baz' is the attribute name


> Also, there is no warning about security in the html.parser documentation?

I'm not aware of any specific security issues, since html.parser just 
implements the parser described by the HTML 5 specs.  If there are any security 
issues caused by divergences from the specs, they should be fixed.  I'm not 
sure why a warning would be needed.

> Is this module mature and maintained enough to be considered as reliable?

Even though it hasn't been updated to the latest version of the specs (5.2 at 
the time of writing), it has been updated to implement the parsing rules 
described by the HTML 5 specs.  I don't know if the parsing rules changed 
between 5.0 and 5.2.

> Or should we warn users about possible issues on corner cases, and point to 
> BeautilfulSoup for a more mature HTML parser?

BeautifulSoup is built on top of html.parser (and can also use other parses, 
like lxml).  BS uses the underlying parsers to parse the HTML, then builds the 
tree and provides, among other things, functions to search and edit it.
When I upgraded html.parser to HTML 5 I worked with the author of BeautifulSoup 
(Leonard Richardson), to make sure that my changes were compatible with BS. We 
also discussed about some corner cases he found and other feature requests and 
issues he had with the old version of the parser.  That said, a link to BS 
would be a nice addition, since it's a great library.


[0] starting from 
https://www.w3.org/TR/html52/syntax.html#tokenizer-before-attribute-name-state

--
nosy: +ezio.melotti
stage:  -> test needed

___
Python tracker 

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



[issue41688] Document how **= does not fall back on **

2020-09-09 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
nosy: +ammar2
nosy_count: 2.0 -> 3.0
pull_requests: +21241
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22172

___
Python tracker 

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



[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2020-09-09 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue41748] HTMLParser: parsing error

2020-09-09 Thread STINNER Victor


STINNER Victor  added the comment:

Also, there is no warning about security in the html.parser documentation? Is 
this module mature and maintained enough to be considered as reliable? Or 
should we warn users about possible issues on corner cases, and point to 
BeautilfulSoup for a more mature HTML parser?

https://docs.python.org/dev/library/html.parser.html

--

___
Python tracker 

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



[issue14916] PyRun_InteractiveLoop fails to run interactively when using a Linux pty that's not tied to stdin/stdout

2020-09-09 Thread pmp-p


pmp-p  added the comment:

all PyRun_InteractiveOne* functions are also affected
it is really annoying when implementing repl behaviour when embedding( use 
cases :  pyodide, android, wasi )

But I think the correct patch is : 
-char *newtok = PyOS_Readline(stdin, stdout, tok->prompt);
+char *newtok = PyOS_Readline(tok->fp? tok->fp : stdin, stdout, 
tok->prompt);

--
nosy: +pmpp

___
Python tracker 

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



[issue41748] HTMLParser: parsing error

2020-09-09 Thread STINNER Victor


STINNER Victor  added the comment:

HTMLParser.check_for_whole_start_tag() uses locatestarttagend_tolerant regular 
expression to find the end of the start tag. This regex cuts the string at the 
first comma (","), but not if the comma is the first character of an attribute 
name

* '' => '' => ' BUG

The regex is quite complex:

locatestarttagend_tolerant = re.compile(r"""
  <[a-zA-Z][^\t\n\r\f />\x00]*   # tag name
  (?:[\s/]*  # optional whitespace before attribute name
(?:(?<=['"\s/])[^\s/>][^\s/=>]*  # attribute name
  (?:\s*=+\s*# value indicator
(?:'[^']*'   # LITA-enclosed value
  |"[^"]*"   # LIT-enclosed value
  |(?!['"])[^>\s]*   # bare value
 )
 (?:\s*,)*   # possibly followed by a comma
   )?(?:\s|/(?!>))*
 )*
   )?
  \s*# trailing whitespace
""", re.VERBOSE)
endendtag = re.compile('>')

The problem is that this part of the regex:

#(?:\s*,)*   # possibly followed by a comma

The comma is not seen as part of the attribute name.

--

___
Python tracker 

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



[issue41748] HTMLParser: parsing error

2020-09-09 Thread Ademar Nowasky Junior


Ademar Nowasky Junior  added the comment:

Yes, I understand that in the same way. Both are valid attr names. 

Maybe it's worth noting that Javascript has no problem handling this.

--

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Erez Zinman


Erez Zinman  added the comment:

small correction: meant `self.__class__` in the above function.

Also, it is based on 
https://github.com/python/cpython/blob/76553e5d2eae3e8a47406a6de4f354fe33ff370b/Lib/collections/__init__.py#L302

--

___
Python tracker 

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



Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-09 Thread Mats Wichmann
On 9/8/20 5:18 PM, Richard Damon wrote:
> On 9/8/20 7:06 PM, Mats Wichmann wrote:
>> On 9/7/20 5:01 PM, Driuma Nikita wrote:

>> for i, el in enumerate(_list[:]):
>>  del _list[i]
>>
> The issue isn't so much that he is modifying the list that he is
> iterating over, but also when he deletes _list[0], all the other
> elements move down,

yes, quite right, brain fail here, ignore me
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Erez Zinman


Erez Zinman  added the comment:

Looking at the implementation of `__init__` 
(https://github.com/python/cpython/blob/76553e5d2eae3e8a47406a6de4f354fe33ff370b/Lib/collections/__init__.py#L109),
 it seems that you can fix this bug while retaining backward compatibility if 
you would use `__new__` in the `__reduce__` function, followed by an 
`OrderedDict.__init__`. The difference is that you don't call 
`__class__.__init__`, but rather `OrderedDict.__init__`. Some thing like the 
following:


def __reduce__(self):
'Return state information for pickling'
inst_dict = vars(self).copy()
for k in vars(OrderedDict()):
inst_dict.pop(k, None)

def initializer():
inst = __class__.__new__(__class__)
OrderedDict.__init__(inst)

return initializer, (), inst_dict or None, None, iter(self.items())


The items will "restored" later using the `odict_iter`.

--

___
Python tracker 

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



[issue41748] HTMLParser: parsing error

2020-09-09 Thread STINNER Victor


STINNER Victor  added the comment:

HTML 5.2 specification says
https://www.w3.org/TR/html52/syntax.html#elements-attributes

"Attribute names must consist of one or more characters other than the space 
characters, U+ NULL, U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), 
U+003E GREATER-THAN SIGN (>), U+002F SOLIDUS (/), and U+003D EQUALS SIGN (=) 
characters, the control characters, and any characters that are not defined by 
Unicode."

It is confirmed in the "12.2 Parsing HTML documents" section of the "HTML 
Living Standard":
"""
12.2.5.33 Attribute name state

Consume the next input character:

U+0009 CHARACTER TABULATION (tab)
U+000A LINE FEED (LF)
U+000C FORM FEED (FF)
U+0020 SPACE
U+002F SOLIDUS (/)
U+003E GREATER-THAN SIGN (>)
EOF
Reconsume in the after attribute name state.
U+003D EQUALS SIGN (=)
Switch to the before attribute value state.
ASCII upper alpha
Append the lowercase version of the current input character (add 0x0020 to 
the character's code point) to the current attribute's name.
U+ NULL
This is an unexpected-null-character parse error. Append a U+FFFD 
REPLACEMENT CHARACTER character to the current attribute's name.
U+0022 QUOTATION MARK (")
U+0027 APOSTROPHE (')
U+003C LESS-THAN SIGN (<)
This is an unexpected-character-in-attribute-name parse error. Treat it as 
per the "anything else" entry below.
Anything else
Append the current input character to the current attribute's name.
"""
https://html.spec.whatwg.org/multipage/parsing.html#attribute-name-state

I understand that "," *is* a legit character in a HTML attribute name. So "a," 
and ",a" *are* valid HTML attribute names. Do I understand correctly?

--
nosy: +vstinner

___
Python tracker 

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



[issue41571] Implement thread-related commands in pdb

2020-09-09 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +iritkatriel

___
Python tracker 

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



[issue41752] Wave shouldn't try to close an open file at all costs

2020-09-09 Thread Karel


New submission from Karel :

The standard `wave` library tries to close a file unconditionally. I believe 
this is wrong.

>From the docs:
Wave_write.close(): Make sure nframes is correct, and close the file if it was 
opened by wave. *This method is called upon object collection.* [...]

This leads to problems when an exception is throw when a file is open. See the 
following MWE:
```
from io import BytesIO
import wave
audio_out = BytesIO() 
with wave.open(audio_out, "w") as file_out:
raise Exception('aaa!') 

Error: # channels not specified
```

Even when I remove the context manager, so it shouldn't close the file 
automatically, it still does, the following:
```
file_out = wave.open(audio_out, "w")
raise Exception('aaa!')
```
doesn't throw an error at me immediately, but when the file_out variable is 
running out of scope, I get a printout saying: `Exception ignored in: > [...] 
wave.Error: # channels not specified`.

Expected behaviour: When I use a Wave_write object as a context manager, it 
tries to close the file unconditionally (as it does now). When I call 
`wave.open` manually, no automatic file closing is done.

--
components: Library (Lib)
messages: 376634
nosy: biosthezerg
priority: normal
severity: normal
status: open
title: Wave shouldn't try to close an open file at all costs
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



[issue41571] Implement thread-related commands in pdb

2020-09-09 Thread Dong-hee Na


Dong-hee Na  added the comment:

I am +1 on this project :)

--

___
Python tracker 

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



[issue41571] Implement thread-related commands in pdb

2020-09-09 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue41749] Little improve on imghdr library

2020-09-09 Thread Dong-hee Na


Dong-hee Na  added the comment:

IMHO, those use cases are already intended.
We can read such use case on test code but also documentation.

It will break legacy usage. I am -1 on change the API signature.
We should think deeply before changing this.

--
nosy: +corona10

___
Python tracker 

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



ANN: python-blosc 1.9.2 released!

2020-09-09 Thread Francesc Alted
=
Announcing python-blosc 1.9.2
=

What is new?


This is a maintenance release to better support recent versions of Python
(3.8 and 3.9).  Also, and due to the evolution of modern CPUs,
the number of default threads has been raised to 8 (from 4).
Finally, zero-copy decompression is now supported by allowing bytes-like
input.  Thanks to Lehman Garrison.

For more info, you can have a look at the release notes in:

https://github.com/Blosc/python-blosc/blob/master/RELEASE_NOTES.rst

More docs and examples are available in the documentation site:

http://python-blosc.blosc.org


What is it?
===

Blosc (http://www.blosc.org) is a high performance compressor optimized
for binary data.  It has been designed to transmit data to the processor
cache faster than the traditional, non-compressed, direct memory fetch
approach via a memcpy() OS call.  Blosc works well for compressing
numerical arrays that contain data with relatively low entropy, like
sparse data, time series, grids with regular-spaced values, etc.

python-blosc (http://python-blosc.blosc.org/) is the Python wrapper for
the Blosc compression library, with added functions (`compress_ptr()`
and `pack_array()`) for efficiently compressing NumPy arrays, minimizing
the number of memory copies during the process.  python-blosc can be
used to compress in-memory data buffers for transmission to other
machines, persistence or just as a compressed cache.

There is also a handy tool built on top of python-blosc called Bloscpack
(https://github.com/Blosc/bloscpack). It features a command line
interface that allows you to compress large binary data files on-disk.
It also comes with a Python API that has built-in support for
serializing and deserializing Numpy arrays both on-disk and in-memory at
speeds that are competitive with regular Pickle/cPickle machinery.


Sources repository
==

The sources and documentation are managed through github services at:

http://github.com/Blosc/python-blosc





  **Enjoy data!**

-- 
The Blosc Development Team
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue41748] HTMLParser: parsing error

2020-09-09 Thread Ademar Nowasky Junior


Change by Ademar Nowasky Junior :


--
type: security -> crash

___
Python tracker 

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



[issue28850] Regression in Python 3: Subclassing PrettyPrinter.format doesn't work anymore

2020-09-09 Thread Georg Brandl


Change by Georg Brandl :


--
nosy:  -georg.brandl

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

So we are restricted by backward compatibility with the original pure Python 
implementation.

Sometimes it is feasible to break backward compatibility, but there should be 
very good reasons for it.

--

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It would break the code which expect that __init__() be called (I do not know 
if there are much such code, but still). It also would not work with the 
original pure Python implementation of OrderedDict, which initializes the 
OrderedDict object in __init__(), not in __new__().

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue28850] Regression in Python 3: Subclassing PrettyPrinter.format doesn't work anymore

2020-09-09 Thread Irit Katriel


Change by Irit Katriel :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41750] unpractical printing of datetimes by the interpreter

2020-09-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The UTC timezone implementation in the stdlib works well:

>>> import datetime
>>> datetime.datetime(2020, 9, 9, 8, 0, tzinfo=datetime.timezone.utc)
datetime.datetime(2020, 9, 9, 8, 0, tzinfo=datetime.timezone.utc)

I guess you use a third-part implementation of the UTC timezone. In such case 
please report your issue to this implementation.

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Erez Zinman


Erez Zinman  added the comment:

Proposed solution - change OrderedDict's `__reduce_ex__ ` function. The code 
below works like expected if I override `__reduce_ex__` like so:

```

def __reduce_ex__(self, protocol):
ret = list(super().__reduce_ex__(protocol))
ret[0] = type(self).__new__
ret[1] = type(self), 
return tuple(ret, )


```

--

___
Python tracker 

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



[issue41751] Error copying an instance of a subclass of OrderedDict

2020-09-09 Thread Erez Zinman


New submission from Erez Zinman :

This bug occurs when copying/pickling an ordered-dict subtype that has default 
items. The initialization function that's returned is **not** `object.__new__` 
so the default items are set when the copied/pickled item is created. The 
problem I encountered is that when deleting an initial item, it appears in the 
copy. See the MWE below:

```
from collections import OrderedDict
import copy


class A(OrderedDict):
def __init__(self):
self['123'] = 123

a = A()
del a['123']
copy.copy(a)


# --> A([('123', 123)])

```


This can cause other problems as well, because you don't assume that the class 
is re-initialized on deserialization/copy.

--
components: Library (Lib)
messages: 376627
nosy: erezinman
priority: normal
severity: normal
status: open
title: Error copying an instance of a subclass of OrderedDict
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue41750] unpractical printing of datetimes by the interpreter

2020-09-09 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +belopolsky, p-ganssle

___
Python tracker 

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



[issue41750] unpractical printing of datetimes by the interpreter

2020-09-09 Thread J Rt


New submission from J Rt :

I think the way datetimes get printed by the interpreter is a bit unpractical. 
For example:

datetime.datetime(2020, 9, 9, 8, 0, tzinfo=) 

The reason for the inpracticality is that this cannot be put right into python 
back:

>>>datetime.datetime(2020, 9, 9, 8, 0, tzinfo=)
>>> 
  File "", line 1
datetime.datetime(2020, 9, 9, 8, 0, tzinfo=)
   ^
SyntaxError: invalid syntax

Would there be a way to make the output printed directly usable again in the 
interpreter? Printing datetime.datetime(2020, 9, 9, 8, 0, tzinfo=pytz.utc) for 
example, or something like that?

--
components: Library (Lib)
messages: 376626
nosy: jean.rblt
priority: normal
severity: normal
status: open
title: unpractical printing of datetimes by the interpreter
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue41726] Update refcounts info of PyType_FromModuleAndSpec in refcounts.dat

2020-09-09 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 1e2f051a6127904cfee5f9e4021dd6e4a4d51c0f by Hai Shi in branch 
'master':
bpo-41726: Update the refcounts info of PyType_FromModuleAndSpec in 
refcounts.dat (GH-22112)
https://github.com/python/cpython/commit/1e2f051a6127904cfee5f9e4021dd6e4a4d51c0f


--

___
Python tracker 

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



[issue41703] Most bytecode changes are absent from Python 3.9 What's new

2020-09-09 Thread Ned Deily


Ned Deily  added the comment:

Mark, PR 22151 needs to be merged to the 3.9 branch as well.  You can add the 
"Needs backport to 3.9" label to the original PR.

--
nosy: +ned.deily

___
Python tracker 

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



Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-09 Thread Chris Angelico
On Wed, Sep 9, 2020 at 6:18 PM Nicholas Cole  wro
>
> On Wed, Sep 9, 2020 at 8:52 AM Chris Angelico  wrote:
>
> [snip]
> > And if you absolutely have to mutate in place:
> >
> > items[:] = [i for i in items if i not in "bcd"]
>
> How does that work to mutate in place?

Technically it constructs a new filtered list, and then replaces the
contents of the original list with the filtered one. That's
effectively an in-place mutation; any other reference to that same
list will see the change. Compare:

a = list(range(20))
b = a
a = [n for n in a if n % 3]
print(a)
print(b)

You'll see that a and b now differ. But if you use slice assignment:

a[:] = [n for n in a if n % 3]

you'll see that the two are still the same list (and "a is b" will
still be True). It's replacing the contents, rather than rebinding the
name.

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


[issue20468] resource module documentation is incorrect

2020-09-09 Thread Greg Lindahl


Greg Lindahl  added the comment:

I just tripped on the bug that the maxrss field is kilobytes on Linux and bytes 
on Darwin.

I don't think referring to the C manpages is sufficient to prevent confusion. I 
don't actually use my package on a Mac, I just use Travis-CI to test it.

--
nosy: +wumpus

___
Python tracker 

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



Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-09 Thread Nicholas Cole
On Wed, Sep 9, 2020 at 8:52 AM Chris Angelico  wrote:

[snip]
> And if you absolutely have to mutate in place:
>
> items[:] = [i for i in items if i not in "bcd"]

How does that work to mutate in place?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35328] Set a environment variable for venv prompt

2020-09-09 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue40300] logging.Formatter crashes when default_msec_format is None.

2020-09-09 Thread Vinay Sajip


Change by Vinay Sajip :


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



Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-09 Thread Chris Angelico
On Wed, Sep 9, 2020 at 5:45 PM Peter Otten <__pete...@web.de> wrote:
>
> Peter Otten wrote:
>
> > If the list is huge you can also delete in reverse order:
> >
> > for i in reversed(len(_list)):
>
> Make that reversed(range(len(_list))).
>
> > if discard(_list[i]):
> > del _list[i]
>
> Example:
>
> >>> items = ['a', 'b', 'c', 'd', 'e']
> >>> for i, item in enumerate(items):
> ... if item in "bcd":
> ... del items[i]
> ...
> >>> items
> ['a', 'c', 'e']
> >>> items = ['a', 'b', 'c', 'd', 'e']
> >>> for i in reversed(range(len(items))):
> ... if items[i] in "bcd":
> ... del items[i]
> ...
> >>> items
> ['a', 'e']
>

But that's still pretty clunky AND inefficient (deleting from the
middle of a list is a slow operation). Filtering is far better.

items = [i for i in items if i not in "bcd"]

And if you absolutely have to mutate in place:

items[:] = [i for i in items if i not in "bcd"]

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


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

2020-09-09 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue38447] test_multiprocessing_spawn: Dangling processes: {} on AMD64 RHEL7 Refleaks 3.7

2020-09-09 Thread STINNER Victor


STINNER Victor  added the comment:

Issue seen on x86 Windows7 3.8:
https://buildbot.python.org/all/#/builders/270/builds/30

0:52:12 load avg: 6.48 [367/423/1] test_multiprocessing_spawn failed (env 
changed) (12 min 32 sec)
Warning -- Dangling processes: {}

I keep the issue closed since I spent a lot of time trying to reproduce it, and 
I failed. The failure looks rare and really hard to reproduce.

--

___
Python tracker 

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



Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-09 Thread Peter Otten
Peter Otten wrote:

> If the list is huge you can also delete in reverse order:
> 
> for i in reversed(len(_list)):

Make that reversed(range(len(_list))).

> if discard(_list[i]):
> del _list[i]

Example:

>>> items = ['a', 'b', 'c', 'd', 'e']
>>> for i, item in enumerate(items):
... if item in "bcd":
... del items[i]
... 
>>> items
['a', 'c', 'e']
>>> items = ['a', 'b', 'c', 'd', 'e']
>>> for i in reversed(range(len(items))):
... if items[i] in "bcd":
... del items[i]
... 
>>> items
['a', 'e']


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


[issue41525] Python '--help' has corrupted text.

2020-09-09 Thread STINNER Victor


STINNER Victor  added the comment:

xtreak: "serhiy , I can similar quotes present in Lib/pydoc_data/topics.py too 
which is autogenerated. Could this cause issues with pydoc too while reading 
topics?"

If you consider that it is an issue, please open a new issue.

--

___
Python tracker 

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



[issue19438] Where is NoneType in Python 3?

2020-09-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the link.  It looks like NoneType got inadvertently caught up in the 
sweep of names that had direct synonyms.

--

___
Python tracker 

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



Audacity and pipe_test.py

2020-09-09 Thread Steve
I am trying to adapt this short file to be used for simple control of the
Audacity audio recording program.
I can get the following does to work:
   do_command("Record1stChoice")  #Creates a new track and starts
recording
do_command("AddLabel:")  #Places a label in the label track
do_command("Stop") # stops the recording

But not this one:
do_command("SetLabel:Label='1' Text='Hello' ")

This is supposed to place "Hello" into the label.
Steve


Foonote:
The patient shall strive to suffer the symptoms of the disease that has been
diagnosed by the doctor.


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


Re: Fwd: PYTHON BUG. deleting elements of list.

2020-09-09 Thread Peter Otten
Mats Wichmann wrote:

> On 9/7/20 5:01 PM, Driuma Nikita wrote:
> 
> 
>  _list = list(range(50))
>  for i, el in enumerate(_list):
>  del _list[i]
>  print(_list)
> 
> 
> Don't change the the list while you are iterating over it, it messes up
> the iteration. It's not "randomly deleting", it's when next is called to
> fetch the next item, the list has changed.
> 
> One workaround is to iterate over a copy. For example here's using
> slicing to create a new list to iterate over:
> 
> for i, el in enumerate(_list[:]):
>  del _list[i]

As Richard says, this won't work. 
Usually the best approach is to copy the items you want to keep:

_list = [item for item in _list if keep(item)]

If the list is huge you can also delete in reverse order:

for i in reversed(len(_list)):
if discard(_list[i]):
del _list[i]

(If you want to delete /all/ items use _list.clear() or del _list[:])


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


Re: newbie

2020-09-09 Thread Cameron Simpson
On 09Sep2020 01:24, Grant Edwards  wrote:
>On 2020-09-08, Don Edwards  wrote:
>> I may need. My aim is to write a program
>> that simulates croquet - 2 balls colliding with the strikers (cue) ball
>> going into the hoop (pocket), not the target ball. I want to be able to
>> move the balls around and draw trajectory lines to evaluate different
>> positions. Is there a package for this or maybe one to draw and one to
>> move? Any help much appreciated.
>
>Is pygame still a thing?

Looks like:

https://pypi.org/project/pygame/
https://pypi.org/project/pygame-geometry/

Don, there's a "Getting Started" page for Pygame here:

https://www.pygame.org/wiki/GettingStarted

including some platform specific notes.

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