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

2020-08-02 Thread Shantanu


Shantanu  added the comment:

Just bumping this issue, as per dev guide, since 
https://github.com/python/cpython/pull/19612 has been ready for about two 
months. Would be grateful for review :-)

--

___
Python tracker 

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



[issue41260] datetime: strftime method takes different keyword argument: fmt (pure) or format (C)

2020-08-02 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +20856
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/21712

___
Python tracker 

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



Re: (Issue resolved!) Issue with Python module downloads from Library for a beginner Python coder.

2020-08-02 Thread Sarvesh Poddar via Python-list
 Hi terry,
I am so happy to mention that your suggestion worked! I moved the file from 
Tkinter to Lib and I am suddenly able to import the file. 
Thanks you so much @Bob, @Arjun, @Cameron for your suggestions. I can finally 
move forward. I hope to contribute to this community in future after gaining 
enough experience on the Python subject. Looking forward!
On Monday, 3 August, 2020, 12:51:28 am IST, Terry Reedy  
wrote:  
 
 On 8/2/2020 2:36 AM, Sarvesh Poddar via Python-list wrote:

[I downloaded]
https://mcsp.wartburg.edu/zelle/python/graphics.py)

I have unmangled the traceback and added explanations.

> Traceback (most recent call last):
>   File "", line 1, in 
>     import graphics

You typed this in IDLE Shell in response to the >>> prompt.

>   File 
>"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 
>1

This says that you put the file in the same directory as python.exe.  It 
should better be in
".../Lib/site-packages" or in a directory in "/Users/".  None the 
less, the import worked.

>     Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 
>bit (Intel)] on win32
>            ^
> SyntaxError: invalid syntax

This says that the first line of graphics.py begins with "Python 
3.8.5..."  This is the startup message printed by python.exe when run in 
interactive mode, and by IDLE's interactive Shell.  It is text, not 
python code.  It is not the first line of the file at that link (I 
checked).

Look at the file on your disk and check its first line.  You may have to 
put '%appdata%' in the directory box if the /User//appdata 
directory is hidden on your machine.

>   I have installed, uninstalled and then re-installed Python 3.8.5 multiple 
>times but the problem remains.  

> I did a thorough internet search and most of them suggested using sys path 
> and following is the result,

This suggestion is for when the import fails because the module is not 
found.  In your case, it was found and the import process started.

> import sys>>> sys.path['', 
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\idlelib',
>  
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
>  'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs', 
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib', 
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32', 
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages']

> When I write a different line -  (from import graphics *), this is the output:
> from graphics import *Traceback (most recent call last):  File "", 
> line 1, in     from graphics import *  File 
> "C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", 
> line 1    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC 
> v.1926 32 bit (Intel)] on win32           ^SyntaxError: invalid syntax

Same bad first line, same error.


-- 
Terry Jan Reedy


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


Re: Issue with Python module downloads from Library for a beginner Python coder.

2020-08-02 Thread Sarvesh Poddar via Python-list
 Hello Dennis,
Sorry for my copy-paste error and thanks for highlighting the same. I will make 
sure that from next time I will maintain the line breaks.
I tried opening it in CMD and it did open with the skewed triangle figure 
although I am still not able to use it in my IDLE environment. Unfortunately, I 
am not able to move ahead with my Python classes because of this, as it 
specifically asks to import the module before proceeding. I saved the file in 
tkinter folder now and receive the same problem,
>>> import graphicsTraceback (most recent call last):  File "", line 
>>> 1, in     import graphicsModuleNotFoundError: No module named 
>>> 'graphics'
Location of the file - C:\Program Files (x86)\Lib\tkinter

Didn't work out.
On Monday, 3 August, 2020, 12:47:26 am IST, Dennis Lee Bieber 
 wrote:  
 
 On Sun, 2 Aug 2020 06:36:28 + (UTC), Sarvesh Poddar via Python-list
 declaimed the following:

> Hi,
>I am currently using Python 3.8.5 with IDLE environment that comes 
>pre-installed with the Python application. I am using the book "An 
>Introduction to computer science" by John Zelle as my reference.
>The problem I am facing is "There is a python program named "graphics.py" that 
>is used as reference in the book and I downloaded the python file from 
>internet (link to the file - 
>https://mcsp.wartburg.edu/zelle/python/graphics.py). I have kept this module 
>in (C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32) and this is 
>were my Python files also lie in C drive. The problem is that I am not able to 
>import graphics.py file and when I try to do that following is the error I 
>receive,
>Traceback (most recent call last):
>  File "", line 1, in     import graphics
>  File 
>"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 
>1
>    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 
>bit (Intel)] on win32           ^SyntaxError: invalid syntax
> I have installed, uninstalled and then re-installed Python 3.8.5 multiple 
>times but the problem remains. I did a thorough internet search and most of 
>them suggested using sys path and following is the result,
>

    In future, you might want to ensure your cut and/or posting
client, maintains line breaks -- many of your pastes seem to "unwrap"
stuff...


>When I write a different line -  (from import graphics *), this is the output:
>from graphics import *Traceback (most recent call last):  File "", 
>line 1, in     from graphics import *  File 
>"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 
>1    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 
>bit (Intel)] on win32           ^SyntaxError: invalid syntax

... such as the above, which appears to have turned something like 7 lines
of output into one long string/paragraph.


    My only suggestion is to drop OUT of IDLE or whatever, and open a
Windows command shell... and try running a script from that shell. I note
that this library makes use of Tkinter -- which is also used by IDLE. The
two uses may be causing complications. Going to a command shell avoids
that.

-=-=-
C:\Users\Wulfraed\Downloads>type testgraphics.py
import graphics

print(dir(graphics))


C:\Users\Wulfraed\Downloads>python testgraphics.py
['BAD_OPTION', 'Circle', 'DEFAULT_CONFIG', 'Entry', 'GraphWin',
'GraphicsError', 'GraphicsObject', 'Image', 'Line', 'OBJ_ALREADY_DRAWN',
'Oval', 'Point', 'Polygon', 'Rectangle', 'Text', 'Transform',
'UNSUPPORTED_METHOD', '_BBox', '__builtins__', '__cached__', '__doc__',
'__file__', '__loader__', '__name__', '__package__', '__spec__',
'__version__', '_root', '_update_lasttime', 'color_rgb', 'os', 'sys',
'test', 'time', 'tk', 'update']

C:\Users\Wulfraed\Downloads>
-=-=-

    Heck... from the command shell, navigate to the directory in which you
saved graphics.py and enter

-=-=-
C:\Users\Wulfraed\Downloads>python graphics.py
-=-=-

    On my system, that pops up a small window with skewed triangle, some
text, and a grey input field.


-- 
    Wulfraed                Dennis Lee Bieber        AF6VN
    wlfr...@ix.netcom.com    http://wlfraed.microdiversity.freeddns.org/

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


[issue29269] test_socket failing in solaris

2020-08-02 Thread Brian Vandenberg


Brian Vandenberg  added the comment:

Solaris will be around for at least another 10-15 years.

The least you could do is look into it and offer some speculations.

--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

I didn't reopen the issue explicitly. Just pressed the submit button again when 
the notification about edited bug appeared.

--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

The point is that without a clear description of buffering in Python 3, it is 
impossible to understand what goes when Python is wrapped by Docker, 
supervisord, redirected to file etc.

--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't know anything about Docker, so I can't help you there. Please don't 
reopen the issue again.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

To avoid too much outside reference, the commit message I am unsure of is this.

> Run Python 3 in unbuffered mode to see lines in `docker logs` as soon as they 
> appear. When Python 3 is not attached to a terminal, it turns on the 
> buffering, like when `docker` runs in a background.

I am not sure.

1. How Python detects it is attached to terminal or not.
2. That it is Python that turns on stdout buffering.
3. What happens to stdout with child processes when they run with docker in 
different modes - foreground, background (-d), interactive (-i), with tty (-t) 
and without tty.

--
resolution: wont fix -> 
status: closed -> open

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue41210] Docs: More description(warning) about LZMA1 + BCJ with FORMAT_RAW

2020-08-02 Thread Hiroshi Miura


Change by Hiroshi Miura :


--
title: Docs: More description of reason about LZMA1 data handling with 
FORMAT_ALONE -> Docs: More description(warning) about LZMA1 + BCJ with 
FORMAT_RAW

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 3c4fc864ce931db90214c54d742062a80dbef7c4 by Miss Islington (bot) 
in branch '3.9':
bpo-41425: Make tkinter doc example runnable (GH-21706)
https://github.com/python/cpython/commit/3c4fc864ce931db90214c54d742062a80dbef7c4


--

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 4bc8445c392e22fb926eeea50d3e943b6241affa by Miss Islington (bot) 
in branch '3.8':
bpo-41425: Make tkinter doc example runnable (GH-21706)
https://github.com/python/cpython/commit/4bc8445c392e22fb926eeea50d3e943b6241affa


--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

I don't think that waiting another six months is going to make this happen 
either. Maybe you can petition realpython.com to publish something about this.

Honestly it sounds like this ties too many different topics together to easily 
fit in the library docs: in order to make a large number of different use cases 
easy, how I/O works under the hood in Python is truly complex.

So I'm going to close this rather than have it add to our issue count.

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



[issue41210] Docs: More description of reason about LZMA1 data handling with FORMAT_ALONE

2020-08-02 Thread Hiroshi Miura


Hiroshi Miura  added the comment:

Here is a draft of additional text


Usage of :const:`FILTER_LZMA1` with :const:`FORMAT_RAW` is not recommended.
Because it may produce a wrong output in a certain condition, decompressing 
a combination of :const:`FILTER_LZMA1` and BCJ filters in :const:`FORMAT_RAW`.
It is because LZMA1 format sometimes lacks End of Stream (EOS) mark that
lead BCJ filters can not be flushed.


I've tried to write without a description of liblzma implementation, but only a 
nature of API and file format specification.

--

___
Python tracker 

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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Anatoli Babenia


Anatoli Babenia  added the comment:

Not sure I can volunteer - need to find a sustenance ASAP. But given that 
nothing moved in this direction over the past 6 months, another week spent not 
writing this stuff won't change anything.

In any case it would start with the following problem - "Logs don't show up if 
running in Kubernetes" - https://github.com/bottlepy/bottle/issues/1130

I've encountered it a 3 days session on adding CI to my favourite cheat sheet 
server 
https://github.com/chubin/cheat.sh/pull/224/commits/10bfaab38cc649d765637bf4af4791266d21a3f7
 and I am still not sure I am right. That's why I want to read something about 
it.

--

___
Python tracker 

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



[issue41460] Translation Error in in Functional Programming HOWTO page

2020-08-02 Thread 李冰

New submission from 李冰 :

There seems a translation error in Python Documentation in Functional 
Programming HOWTO page.

The page's English version's url is 
https://docs.python.org/3/howto/functional.html
And the Japanese version's url is 
https://docs.python.org/ja/3/howto/functional.html.

In English version, there is a paragraph: 

"In declarative languages, you write a specification that describes the problem 
to be solved, and the language implementation figures out how to perform the 
computation efficiently. SQL is the declarative language you’re most likely to 
be familiar with; a SQL query describes the data set you want to retrieve, and 
the SQL engine decides whether to scan tables or use indexes, which subclauses 
should be performed first, etc."

The corresponding Japanses translation is this:

"宣言型 言語で書くのは、解くべき問題を説明する仕様書であって、それを効率的に計算処理する方法を見付けるのは言語実装の役目です。SQL 
はおそらく一番よく知られた宣言型言語です; SQL 
のクエリは取得したいデータセットを説明しているだけで、テーブルを走査するかインデックスを使うか、どのサブクローズから実行するか等々を決めるのは SQL 
エンジンなのです。"

In the above paragraph, I think the translator translate the word "subclauses" 
to "サブクローズ", which is wrong.

In Japanese, サブ means sub and クローズ means close, so it is just "subclose", not 
"subclause".

That is all. Thank you.

--
messages: 374713
nosy: mydairyyao
priority: normal
severity: normal
status: open
title: Translation Error in in Functional Programming HOWTO page
type: enhancement

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20855
pull_request: https://github.com/python/cpython/pull/21711

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +20854
pull_request: https://github.com/python/cpython/pull/21710

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset c36dbac588e1d99975f285a874bb20e9f5040af4 by Ankit Chandawala in 
branch 'master':
bpo-41425: Make tkinter doc example runnable (GH-21706)
https://github.com/python/cpython/commit/c36dbac588e1d99975f285a874bb20e9f5040af4


--

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


miss-islington  added the comment:


New changeset 45d37cbb04279a52c63dd180aacda7d35e02a0ef by Miss Islington (bot) 
in branch '3.8':
bpo-41424: Remove extra words in Tkinter-Packer documentation (GH-21707)
https://github.com/python/cpython/commit/45d37cbb04279a52c63dd180aacda7d35e02a0ef


--

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


miss-islington  added the comment:


New changeset 905c7de6e4bbccf8c3dfa593fa287aecac497472 by Miss Islington (bot) 
in branch '3.9':
bpo-41424: Remove extra words in Tkinter-Packer documentation (GH-21707)
https://github.com/python/cpython/commit/905c7de6e4bbccf8c3dfa593fa287aecac497472


--

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset ecaf949cc487887883c14dff7a96e09ac9404994 by Nathan M in branch 
'master':
bpo-41424: Remove extra words in Tkinter-Packer documentation (GH-21707)
https://github.com/python/cpython/commit/ecaf949cc487887883c14dff7a96e09ac9404994


--

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +20852
pull_request: https://github.com/python/cpython/pull/21708

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread miss-islington


Change by miss-islington :


--
pull_requests: +20853
pull_request: https://github.com/python/cpython/pull/21709

___
Python tracker 

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



Python running in the Command Prompt Window questions

2020-08-02 Thread Steve
When I double click on a .py file, it executes at the command prompt with black 
background and small white font. 

Is there python code to change the font size and background color?

===
FootNote:
Would it be ironic if Popeye’s chicken was fried in Olive Oil?


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


[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Nathan Maynes


Change by Nathan Maynes :


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

___
Python tracker 

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



[issue41447] Resource Tracker in Multiprocessing Shared Memory not working correctly

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Looks like a duplicate of https://bugs.python.org/issue38119

--
nosy: +gvanrossum
resolution:  -> duplicate
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



[issue41449] An article on Python 3 stdout and stderr output buffering

2020-08-02 Thread Guido van Rossum

Guido van Rossum  added the comment:

Maybe you’ll get some explanation or pointers on python-list. Or were you 
volunteering to write something?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +20849
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21706

___
Python tracker 

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



[issue41398] cgi module, parse_multipart fails

2020-08-02 Thread Guido van Rossum

Guido van Rossum  added the comment:

So per the stackoverflow explanation you shouldn’t do that? Should we close 
this?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue41335] free(): invalid pointer in list_ass_item() in Python 3.7.3

2020-08-02 Thread Howard A. Landman


Howard A. Landman  added the comment:

Made some progress. By running it under gdb and breaking in malloc_printerr(), 
I got a better stack trace:

Breakpoint 1, malloc_printerr (str=0x76e028f8 "free(): invalid pointer")
at malloc.c:5341
5341malloc.c: No such file or directory.
(gdb) bt
#0  malloc_printerr (str=0x76e028f8 "free(): invalid pointer") at malloc.c:5341
#1  0x76d44d50 in _int_free (av=0x76e1f7d4 , 
p=0x43417c , have_lock=)
at malloc.c:4165
#2  0x001b4f40 in list_dealloc (op=0x760ef288) at ../Objects/listobject.c:324
#3  0x001be784 in frame_dealloc (
f=Frame 0x765fcc30, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 719, in read_regs24 
(i=40, reg=28)) at ../Objects/frameobject.c:470
#4  function_code_fastcall (globals=, nargs=, 
args=, co=) at ../Objects/call.c:291
#5  _PyFunction_FastCallKeywords (func=, stack=, 
nargs=, kwnames=) at ../Objects/call.c:408
#6  0x0011f984 in call_function (kwnames=0x0, oparg=, 
pp_stack=0x7effed40) at ../Python/ceval.c:4554
#7  _PyEval_EvalFrameDefault (f=, throwflag=)
at ../Python/ceval.c:3110
#8  0x0011d63c in PyEval_EvalFrameEx (throwflag=0, 
f=Frame 0x760e8960, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 962, in measure 
(self=, reg1=[130, 66, 0, 7, 255, 
255, 6, 64, 0, 1, 65535, 1600, Breakpoint 1, malloc_printerr (str=0x76e028f8 
"free(): invalid pointer")
at malloc.c:5341
5341malloc.c: No such file or directory.
(gdb) bt
#0  malloc_printerr (str=0x76e028f8 "free(): invalid pointer") at malloc.c:5341
#1  0x76d44d50 in _int_free (av=0x76e1f7d4 , 
p=0x43417c , have_lock=)
at malloc.c:4165
#2  0x001b4f40 in list_dealloc (op=0x760ef288) at ../Objects/listobject.c:324
#3  0x001be784 in frame_dealloc (
f=Frame 0x765fcc30, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 719, in read_regs24 
(i=40, reg=28)) at ../Objects/frameobject.c:470
#4  function_code_fastcall (globals=, nargs=, 
args=, co=) at ../Objects/call.c:291
#5  _PyFunction_FastCallKeywords (func=, stack=, 
nargs=, kwnames=) at ../Objects/call.c:408
#6  0x0011f984 in call_function (kwnames=0x0, oparg=, 
pp_stack=0x7effed40) at ../Python/ceval.c:4554
#7  _PyEval_EvalFrameDefault (f=, throwflag=)
at ../Python/ceval.c:3110
#8  0x0011d63c in PyEval_EvalFrameEx (throwflag=0, 
f=Frame 0x760e8960, for file 
/home/pi/src/QTD/src/tdc7201/tdc7201/__init__.py, line 962, in measure 
(self=, reg1=[130, 66, 0, 7, 255, 
255, 6, 64, 0, 1, 65535, 1600, 1, None, None, None, 1284, 322, 2371, 0, 0, 0, 
0, 0, 0, 0, 0, 2322, 23172, None], chip_select=1, sclk=23, miso=21, mosi=19, 
cs1=24, cs2=26, enable=12, osc_enable=16, trig1=7, int1=37, trig2=None, 
int2=None, start=18, stop=22, meas_mode=2, cal_pers=10, cal_count=, norm_lsb=, tof1=, tof2=, tof3=0, tof4=0, tof5=0) 
at remote 0x76191750>, simulate=True, error_prefix='59835 ', 
log_file=<_io.TextIOWrapper at remote 0x761df4b0>, cf1=130, timeout=, n_stop=3, threshold=, pulse=2))
at ../Python/ceval.c:3930
1, None, None, None, 1284, 322, 2371, 0, 0, 0, 0, 0, 0, 0, 0, 2322, 23172, 
None], chip_select=1, sclk=23, miso=21, mosi=19, cs1=24, cs2=26, enable=12, 
osc_enable=16, trig1=7, int1=37, trig2=None, int2=None, start=18, stop=22, 
meas_mode=2, cal_pers=10, cal_count=, 
norm_lsb=, tof1=, 
tof2=, tof3=0, tof4=0, tof5=0) at remote 
0x76191750>, simulate=True, error_prefix='59835 ', log_file=<_io.TextIOWrapper 
at remote 0x761df4b0>, cf1=130, timeout=, n_stop=3, 
threshold=, pulse=2))
at ../Python/ceval.c:3930
...

read_regs24 (i=40, reg=28) performs an SPI read of 13 24-bit registers (so 39 
bytes); the corresponding Python code is:

def read_regs24(self):
"""Read all 24-bit chip registers, using auto-increment feature."""
result24 = self._spi.xfer([self.MINREG24|self._AI,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
#print("AI read 24-bits =", result24)
#print("length =", len(result24))
i = 1
for reg in range(self.MINREG24, self.MAXREG24+1):
# Data comes in MSB first.
self.reg1[reg] = (result24[i] << 16) | (result24[i+1] << 8) | 
result24[i+2]
i += 3

The zero padding is necessary to make sure that enough SPI clock cycles are 
sent for the data bytes to get clocked back in. The _AI flag turns on 
auto-increment, so each byte is from the next address.

So it looks like the bug is either in the spidev library, or in Python 
deallocation of this frame. I'll try pulling the sent data list outside the 
method, since it is always the same; that will avoid the list alloc/dealloc, 
and may 

[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks, I was looking for this.

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



Re: questions re: calendar module

2020-08-02 Thread Richard Damon
On 8/2/20 5:38 PM, o1bigtenor wrote:
> On Sun, Aug 2, 2020 at 2:08 PM Dennis Lee Bieber  
> wrote:
>> On Sat, 1 Aug 2020 19:24:41 -0500, o1bigtenor 
>> declaimed the following:
>>
>>> It is very disappointing - - - -suggests that thinking outside the space of
>>> one year is somehow deprecated. Frustrated when what you do demands
>>> that you think in longer periods of time (and yet have to function within
>>> the week as well).
>> Yet follows what most /print/ calendars contain (though some 
>> companies
>> put the last four months of the current year in a 4-up page, before doing
>> one month per page for the new year). "Daily planner" journals also tend to
>> cover just one year, from Jan 1 to Dec 31.
>>
>> If you are willing to view the calendar in a browser, using
>> calendar.HTMLCalendar() may be the fastest way toward what you intend. You
>> could start, perhaps, with generating full year calendars (setting the
>> width to 12 months), and then package them as rows into an outer table
>> (granted, you won't get week numbers this way, but it may be a starting
>> point).
>> -=-=-=-
> I understand that what I'm trying to do isn't 'normal'.
> I do understand that most businesses only work with any detail in one year
> at a time.
>
> I got it
>
> That doesn't work for my situation.
>
> I tried to do this planning using 'typical software'. I about went
> crazy when I was
> trying to work looking back at one year, working in the present year
> and needing
> to drop details into the next year. (I need to work more than one year forward
> as well!)
>
> I found some very old software (cal), from the days of Unix V, with its update
> that is itself (ncal) over 10 years old.
>
> This project started when I found that I could get cal to display a
> LARGE amount
> of months except I was limited to a 80 column display. I was moaning
> to a friendof mine one time looking into how I could change the display from 
> an
> 80 column limit to some at least 160 if not 192 columns.  One day he surprised
> me by sending me code which got this idea started. When he found out that
> week numbers were very useful - - - - they were included. He died about 3
> months ago without ever finishing the project.
>
> He liked to write in Perl albeit was comfortable in lots of other languages.
> I had talked to him about learning Python.
> So this project morphed from being in Perl (5) to being in Python.
>
> This existing code already allows me to display lots of months at a time
> with enough months width so that my terminal is 'full'. What's not there is
> the possibility of specifying a starting point to this calendar. At present
> the calendar only works from today (both backward and forward). There
> are also a few small display things I would like to tweak but the bulk of
> the idea works very well.
>
> Maybe I should be learning Perl (7) instead so I could just extend his
> work but Python seems to have more other things that it 'works' on so
> even though this makes for more work I have chosen this direction.
>
> HTH

If you don't need to produce these often, then the fastest method may be
to just build up on a spread sheet, probably less than a half hour of
work if you are at all familiar with what you are doing.

The second method would be to write a program to do this. Maybe use the
'canned' routine as a base for the program, but accept that your actual
desired output is unusual enough it won't be something you can get with
a single call. Maybe accept you can't get exactly what you want, so be
willing to accept something close. Maybe the chart goes from January of
your start year to December of the final year if the library likes doing
a full year at a time.

-- 
Richard Damon

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


[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

2020-08-02 Thread Luciano Ramalho


Luciano Ramalho  added the comment:

The merged PR that fixed https://bugs.python.org/issue40979 also fixes this 
issue.

It is now documented that these protocols are runtime checkable, with caveats.

--

___
Python tracker 

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



[issue40979] typing module docs: keep text, add subsections

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thank you so much for your hard work and flexibility! The chapter is in much 
better shape now.

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



[issue40979] typing module docs: keep text, add subsections

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ab72fdeb82c3ab045b480cd4bb4f928c12653ecb by Luciano Ramalho in 
branch 'master':
bpo-40979: refactored typing.rst; (mostly) same content, new sub-sections and 
ordering (#21574)
https://github.com/python/cpython/commit/ab72fdeb82c3ab045b480cd4bb4f928c12653ecb


--

___
Python tracker 

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



[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Eric V. Smith


Eric V. Smith  added the comment:

As a rule, we don't put a lot of effort into handling malformed pickle input. 
Is this causing some practical problem?

--
nosy: +eric.smith

___
Python tracker 

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



[issue41390] Errors and warnings on generate bytecode files

2020-08-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

You're going to have to ignore that status or skip the offending files.

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



Re: questions re: calendar module

2020-08-02 Thread o1bigtenor
On Sun, Aug 2, 2020 at 2:08 PM Dennis Lee Bieber  wrote:
>
> On Sat, 1 Aug 2020 19:24:41 -0500, o1bigtenor 
> declaimed the following:
>
> >
> >It is very disappointing - - - -suggests that thinking outside the space of
> >one year is somehow deprecated. Frustrated when what you do demands
> >that you think in longer periods of time (and yet have to function within
> >the week as well).
>
> Yet follows what most /print/ calendars contain (though some companies
> put the last four months of the current year in a 4-up page, before doing
> one month per page for the new year). "Daily planner" journals also tend to
> cover just one year, from Jan 1 to Dec 31.
>
> If you are willing to view the calendar in a browser, using
> calendar.HTMLCalendar() may be the fastest way toward what you intend. You
> could start, perhaps, with generating full year calendars (setting the
> width to 12 months), and then package them as rows into an outer table
> (granted, you won't get week numbers this way, but it may be a starting
> point).
> -=-=-=-

I understand that what I'm trying to do isn't 'normal'.
I do understand that most businesses only work with any detail in one year
at a time.

I got it

That doesn't work for my situation.

I tried to do this planning using 'typical software'. I about went
crazy when I was
trying to work looking back at one year, working in the present year
and needing
to drop details into the next year. (I need to work more than one year forward
as well!)

I found some very old software (cal), from the days of Unix V, with its update
that is itself (ncal) over 10 years old.

This project started when I found that I could get cal to display a
LARGE amount
of months except I was limited to a 80 column display. I was moaning
to a friendof mine one time looking into how I could change the display from an
80 column limit to some at least 160 if not 192 columns.  One day he surprised
me by sending me code which got this idea started. When he found out that
week numbers were very useful - - - - they were included. He died about 3
months ago without ever finishing the project.

He liked to write in Perl albeit was comfortable in lots of other languages.
I had talked to him about learning Python.
So this project morphed from being in Perl (5) to being in Python.

This existing code already allows me to display lots of months at a time
with enough months width so that my terminal is 'full'. What's not there is
the possibility of specifying a starting point to this calendar. At present
the calendar only works from today (both backward and forward). There
are also a few small display things I would like to tweak but the bulk of
the idea works very well.

Maybe I should be learning Perl (7) instead so I could just extend his
work but Python seems to have more other things that it 'works' on so
even though this makes for more work I have chosen this direction.

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


[issue26185] zipfile.ZipInfo slots can raise unexpected AttributeError

2020-08-02 Thread Ned Deily


Ned Deily  added the comment:

Fixed in 3.9.0

--
nosy: +ned.deily
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



Re: questions re: calendar module

2020-08-02 Thread o1bigtenor
On Sun, Aug 2, 2020 at 2:28 PM Richard Damon  wrote:
>
> On 8/2/20 12:58 PM, Dennis Lee Bieber wrote:
> >   Yet follows what most /print/ calendars contain (though some companies
> > put the last four months of the current year in a 4-up page, before doing
> > one month per page for the new year). "Daily planner" journals also tend to
> > cover just one year, from Jan 1 to Dec 31.
>
> Actually, now many calendars are 15 or 16 months, starting in September
> or October and go through the following December (maybe with a planning
> calendar page giving a compressed view of the next 4 or 12 months of the
> following year.
>
> There also are 'Academic' calendars that might start in July or August
> and go to maybe the following September
>
Hmm - - - - one of the problems with slicing and dicing on quotes
- - - - stuff gets lost.

I had asked for at least 2.5 years worth of calendar - - - - preferable even
more. A previous iteration of this project which I am using (until either I
can find or make better) is at present sitting with some 60 months of time
showing.

Sorry - - - - even 18 months - - - - well its like stepping into a nuclear
bomb argument with a water pistol.

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


[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Larry Hastings


Change by Larry Hastings :


--
nosy:  -larry

___
Python tracker 

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



[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Guillaume


Guillaume  added the comment:

Updated Components. I believe pickle fit in the Library category. 

Note this was discovered with python 3.8.5

--
components: +Library (Lib) -Argument Clinic

___
Python tracker 

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



[issue41459] pickle.load raises SystemError on malformed input

2020-08-02 Thread Guillaume


New submission from Guillaume :

pickle.load() raises a criptic SystemError with malformed input, whereas I 
would have expected an UnpicklingError. 

"SystemError: deallocated bytearray object has exported buffers"

Because pickle is not meant for use on untrusted input, this likely would not 
be considered a servere issue. 

Reproducing: 

import pickle
f = open("crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa", "rb")
d = pickle.load(f)

--
components: Argument Clinic
files: crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa
messages: 374695
nosy: Guillaume, larry
priority: normal
severity: normal
status: open
title: pickle.load raises SystemError on malformed input
versions: Python 3.8
Added file: 
https://bugs.python.org/file49358/crash-95c0cb965cb66f5eebc778a1d2304eaffb72f1aa

___
Python tracker 

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



Re: Downloading Python

2020-08-02 Thread OmPs
It's quite possible you have a version mismatch. Try installing python 3.8
first.

BtW, before the would you like to check what version python command reports.

Sorry for top post.  I am sending from my phone and bottom post pretty
confusing here.

On Mon, Aug 3, 2020, 00:56 Eryk Sun  wrote:

> On 8/1/20, MRAB  wrote:
> > On 2020-08-01 21:58, Barry wrote:
> >> On 31-7-2020 22:10, Tanmay Shah wrote:
> >>>
> >>> After downloading Python 3.8.5 IDLE, an error message popped up,
> >>> saying the code execution cannot proceed because python38.dll was
> >>> not found. What should I do in order to use the Python interpreter?
> >>
> >> I have never had to reboot windows when installing python.
> >> Was I lucky?
> >
> > No. I've never had a problem with it either.
>
> I don't know what "[a]fter downloading Python 3.8.5 IDLE" means to the
> OP. For a successful installation of Python 3.8 using an "executable"
> or "web-based" installer from python.org [1], the file "python38.dll"
> will be installed in the same directory as python.exe and will thus
> always be found.
>
> [1] https://www.python.org/downloads/release/python-385
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26185] zipfile.ZipInfo slots can raise unexpected AttributeError

2020-08-02 Thread Mickaël Schoentgen

Mickaël Schoentgen  added the comment:

The ticket could be closed, right? The fix was merged quite some time ago.

--
nosy: +Tiger-222

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue41424] [tkinter] Grammatical error in "Packer" docs

2020-08-02 Thread Nathan Maynes


Nathan Maynes  added the comment:

I'd like to create a pull request for this issue. Should be able to complete it 
this evening.

--
nosy: +nmaynes

___
Python tracker 

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



[issue41440] os.cpu_count doesn't work on VxWorks RTOS

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Do you know if any core devs have experience with VxWorks?  It is not even 
listed in https://devguide.python.org/experts/#platforms.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41458] Avoid overflow/underflow in math.prod()

2020-08-02 Thread Raymond Hettinger

New submission from Raymond Hettinger :

For float inputs, the math.prod() function could be made smarter about avoiding 
overflow() and underflow().  That would also improve commutativity as well.

Other tools like math.hypot() already take measures to avoid overflow/underflow 
and to improve commutativity.  This makes them nicer to use than näive 
implementations.

The recipe that I've been using for years is shown below.  It certainly isn't 
the best way, but it is O(n) and always avoids overflow and underflow when 
possible.  It has made for a nice primitive when implementing other functions 
that need to be as robust as possible.  For example, in the quadratic formula, 
the √(b²-4ac) factors to b√(1-4ac/b²) and the rightmost term gets implemented 
in Python as product([4.0, a, c, 1.0/b, 1.0/b]).

>>> from math import prod, fabs
>>> from collections import deque
>>> from itertools import permutations

>>> def product(seq):
s = deque()
for x in seq:
s.appendleft(x) if fabs(x) < 1.0 else s.append(x)
while len(s) > 1:
x = s.popleft() * s.pop()
s.appendleft(x) if fabs(x) < 1.0 else s.append(x)
return s[0] if s else 1.0

>>> data = [2e300, 2e200, 0.5e-150, 0.5e-175]
>>> for factors in permutations(data):
print(product(factors), prod(factors), sep='\t')


1e+175  inf
1.0001e+175 inf
1e+175  inf
1e+175  1e+175
1.0001e+175 inf
1.0001e+175 1.0001e+175
1.0001e+175 inf
1e+175  inf
1.0001e+175 inf
1.0001e+175 1.0001e+175
1e+175  inf
1e+175  1e+175
1e+175  inf
1e+175  1e+175
1.0001e+175 inf
1.0001e+175 1.0001e+175
1e+175  0.0
1.0001e+175 0.0
1.0001e+175 inf
1.0001e+175 1.0001e+175
1e+175  inf
1e+175  1e+175
1.0001e+175 0.0
1e+175  0.0

For math.prod(), I think a better implementation would be to run normally until 
an underflow or overflow is detected, then back up a step and switch-over to 
pairing low and high magnitude values.  Since this is fallback code, it would 
only affect speed to the extent that we test for overflow or underflow at every 
step.  Given how branch prediction works, the extra tests might even be free or 
at least very cheap.

The math module functions usually go the extra mile to be more robust (and 
often faster) than a näive implementation.  These are the primary reasons we 
teach people to prefer sqrt() over x**2, log1p(x) over log(1+x), prod(seq) over 
reduce(mul, seq, 1.0), log2(x) over log(x, 2), fsum(seq) over sum(seq), and 
hypot(x,y) over sqrt(x**2 + y**2).  In each case, the library function is some 
combination of more robust, more accurate, more commutative, and/or faster than 
a user can easily create for themselves.

--
components: Library (Lib)
messages: 374693
nosy: mark.dickinson, pablogsal, rhettinger, tim.peters
priority: normal
severity: normal
status: open
title: Avoid overflow/underflow in math.prod()
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue41439] test_uuid.py and test_ssl.py failure on OSes without os.fork

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Similar issues:
#41440 os.cpu_count
#41442 unix shell
#41443 some posix.x functions

PR 21684 is fine as far as it goes, and I could merge and backport, but I don't 
know about our test policy with respect to need and minimized OSes.  We do not 
put conditions for unsupported oses in production code, but I don't know about 
skips for such systems in tests.

Victor, do you know, or know who would?

--
nosy: +vstinner
title: test_uuid.py and test_ssl.py failures on OS without os.fork -> 
test_uuid.py and test_ssl.py failure on OSes without os.fork

___
Python tracker 

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



Re: questions re: calendar module

2020-08-02 Thread Richard Damon
On 8/2/20 12:58 PM, Dennis Lee Bieber wrote:
>   Yet follows what most /print/ calendars contain (though some companies
> put the last four months of the current year in a 4-up page, before doing
> one month per page for the new year). "Daily planner" journals also tend to
> cover just one year, from Jan 1 to Dec 31.

Actually, now many calendars are 15 or 16 months, starting in September
or October and go through the following December (maybe with a planning
calendar page giving a compressed view of the next 4 or 12 months of the
following year.

There also are 'Academic' calendars that might start in July or August
and go to maybe the following September

-- 
Richard Damon

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


[issue41439] test_uuid.py and test_ssl.py failures on OS without os.fork

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Are this and similar issues theoretical ("if Python were implemented on such 
systems...") or actual ("python is implemented on one such system (VxWorks?) 
and these tests fail").  If the latter, does the test suite pass at least with 
respect to, in this case, os.fork?  I expect that there are other tests that 
depend on os.fork, but maybe they are already guarded.

--
nosy: +terry.reedy

___
Python tracker 

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



Re: Downloading Python

2020-08-02 Thread Eryk Sun
On 8/1/20, MRAB  wrote:
> On 2020-08-01 21:58, Barry wrote:
>> On 31-7-2020 22:10, Tanmay Shah wrote:
>>>
>>> After downloading Python 3.8.5 IDLE, an error message popped up,
>>> saying the code execution cannot proceed because python38.dll was
>>> not found. What should I do in order to use the Python interpreter?
>>
>> I have never had to reboot windows when installing python.
>> Was I lucky?
>
> No. I've never had a problem with it either.

I don't know what "[a]fter downloading Python 3.8.5 IDLE" means to the
OP. For a successful installation of Python 3.8 using an "executable"
or "web-based" installer from python.org [1], the file "python38.dll"
will be installed in the same directory as python.exe and will thus
always be found.

[1] https://www.python.org/downloads/release/python-385
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Issue with Python module downloads from Library for a beginner Python coder.

2020-08-02 Thread Terry Reedy

On 8/2/2020 2:36 AM, Sarvesh Poddar via Python-list wrote:

[I downloaded]
https://mcsp.wartburg.edu/zelle/python/graphics.py)

I have unmangled the traceback and added explanations.


Traceback (most recent call last):
  File "", line 1, in 
    import graphics


You typed this in IDLE Shell in response to the >>> prompt.


  File 
"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 1


This says that you put the file in the same directory as python.exe.  It 
should better be in
".../Lib/site-packages" or in a directory in "/Users/".  None the 
less, the import worked.



    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 
bit (Intel)] on win32
           ^
SyntaxError: invalid syntax


This says that the first line of graphics.py begins with "Python 
3.8.5..."  This is the startup message printed by python.exe when run in 
interactive mode, and by IDLE's interactive Shell.  It is text, not 
python code.  It is not the first line of the file at that link (I 
checked).


Look at the file on your disk and check its first line.  You may have to 
put '%appdata%' in the directory box if the /User//appdata 
directory is hidden on your machine.


  I have installed, uninstalled and then re-installed Python 3.8.5 multiple times but the problem remains.  



I did a thorough internet search and most of them suggested using sys path and 
following is the result,


This suggestion is for when the import fails because the module is not 
found.  In your case, it was found and the import process started.



import sys>>> sys.path['', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\idlelib', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages']



When I write a different line -  (from import graphics *), this is the output:
from graphics import *Traceback (most recent call last):  File "", line 1, in 
    from graphics import *  File 
"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 1    Python 3.8.5 
(tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32           ^SyntaxError: 
invalid syntax


Same bad first line, same error.


--
Terry Jan Reedy


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


[issue41439] test_uuid.py and test_ssl.py failures on OS without os.fork

2020-08-02 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: some test cases in test_uuid.py and test_ssl.py fail on some operating 
systems because of no os.fork support -> test_uuid.py and test_ssl.py failures 
on OS without os.fork

___
Python tracker 

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



[issue7291] urllib2 cannot handle https with proxy requiring auth

2020-08-02 Thread Alexey Namyotkin


Alexey Namyotkin  added the comment:

It has been 5 years, now the urllib3 is actively used, but it also inherited 
this problem: if no authentication data has been received, then the method 
_tunnel raises an exception OSError that does not contain response headers. 
Accordingly, this exception cannot be handled. And perhaps this is an obstacle 
to building a convenient system of authentication on a proxy server in a widely 
used library requests (it would be nice to be able to just provide an argument 
proxy_auth, similar to how it is done for server authorization). Now, if a user 
wants to send a https request through a proxy that requires complex 
authentication (Kerberos, NTLM, Digest, other) using the urllib3, he must first 
send a separate request to the proxy, receive a response, extract the necessary 
data to form the header Proxy-Authorization, then generate this header and pass 
it to the ProxyManager. And if we are talking about Requests, then the 
situation there is worse, because you cannot pass proxy headers directly 
 (https://github.com/psf/requests/issues/2708).
If we were to aim to simplify the authentication procedure on the proxy server 
for the user, then where would we start, do we need to change the http.client 
so that the error returned by the method _tunnel contains headers? Or maybe 
it's not worth changing anything at all and the path with preliminary 
preparation by user of the header Proxy-Authorization is the only correct one? 
Martin Panter, could you also give your opinion? Thank you in advance.

--

___
Python tracker 

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



[issue41425] [tkinter] "Coupling Widget Variables" example missing code

2020-08-02 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Look at the next subsection for example with 1. and 2.

--
nosy: +terry.reedy

___
Python tracker 

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



Re: Non IDE development strategy - what do others do that's fairly simple?

2020-08-02 Thread Chris Green
Cameron Simpson  wrote:
[snip fantastic explanation]

Cameron, thanks for that long and detailed explanation.

-- 
Chris Green
·
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Issue with Python module downloads from Library for a beginner Python coder.

2020-08-02 Thread Bob van der Poel
Do you have tkinter installed? The graphics.py module needs it to run.

On Sat, Aug 1, 2020 at 11:36 PM Sarvesh Poddar via Python-list <
python-list@python.org> wrote:

>  Hi,
> I am currently using Python 3.8.5 with IDLE environment that comes
> pre-installed with the Python application. I am using the book "An
> Introduction to computer science" by John Zelle as my reference.
> The problem I am facing is "There is a python program named "graphics.py"
> that is used as reference in the book and I downloaded the python file from
> internet (link to the file -
> https://mcsp.wartburg.edu/zelle/python/graphics.py). I have kept this
> module in (C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32) and
> this is were my Python files also lie in C drive. The problem is that I am
> not able to import graphics.py file and when I try to do that following is
> the error I receive,
> Traceback (most recent call last):
>   File "", line 1, in import graphics
>   File
> "C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py",
> line 1
> Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926
> 32 bit (Intel)] on win32   ^SyntaxError: invalid syntax
>  I have installed, uninstalled and then re-installed Python 3.8.5 multiple
> times but the problem remains. I did a thorough internet search and most of
> them suggested using sys path and following is the result,
>
> import sys>>> sys.path['',
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\idlelib',
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs',
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib',
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32',
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages']
> When I write a different line -  (from import graphics *), this is the
> output:
> from graphics import *Traceback (most recent call last):  File
> "", line 1, in from graphics import *  File
> "C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py",
> line 1Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC
> v.1926 32 bit (Intel)] on win32   ^SyntaxError: invalid syntax
> Please do let me know if I am missing out something very basic.
> Thanks and I look forward.On Saturday, 1 August, 2020, 07:54:19 am
> IST, boB Stepp  wrote:
>
>  On Thu, Jul 30, 2020 at 9:24 AM Sarvesh Poddar via Python-list
>  wrote:
>
> > I re-installed Python in my Windows system as the earlier one was not
> able to import modules...
>
> You do not provide much detail to diagnose what your problem(s)
> is(are).  By the "earlier one" is it the same version as the one you
> re-installed?  Were you able to run IDLE with the "earlier one"?  By
> not being able to import modules do you mean modules from Python's
> standard library?  Or do you mean installing third party libraries
> using pip?
>
> > ...But now I am not able to open IDLE after multiple tries.
>
> Have you looked in your start menu in the list of installed programs
> for Python?  If it is there did you expand it and see if there is an
> entry for IDLE?  How have you been trying (unsuccessfully) to open
> IDLE?
>
>
> --
> boB
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 

 Listen to my FREE CD at http://www.mellowood.ca/music/cedars 
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: b...@mellowood.ca
WWW:   http://www.mellowood.ca
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue38628] Issue with ctypes in AIX

2020-08-02 Thread David Edelsohn


David Edelsohn  added the comment:

I thought that the ctypes documentation mentioned that Arrays passed by Value 
are converted to Structures.  I cannot find it in the ctypes documentation at 
the moment.  But Modules/_ctypes/stgdict.c has a large comment about passing 
Arrays by Value as Structs.

* See bpo-22273. Arrays are normally treated as pointers, which is
* fine when an array name is being passed as parameter, but not when
* passing structures by value that contain arrays. On 64-bit Linux,
* small structures passed by value are passed in registers, and in
* order to do this, libffi needs to know the true type of the array
* members of structs. Treating them as pointers breaks things.

The comment proceeds to discuss 64-bit Linux, which means x86_64 Linux. Python 
ctypes coerces the array into a structure, which works on x86_64 Linux.  
Something about the libffi descriptor created by Python ctypes does not work 
correctly for AIX, and it may be a fundamental difference in the alignment and 
padding rules for passing Arrays versus Structures.  Python ctypes assumes that 
Arrays and Structures are interchangeable with respect to argument passing.

And, again, the initial example was completely wrong and illegal and not 
expected to work because it created a data object that doesn't match the 
function signature, which happened to behave correctly on x86.  The initial 
example in the bug report repeatedly confuses people because they continually 
try to debug an incorrect use of ctypes.

--

___
Python tracker 

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



Re: questions re: calendar module

2020-08-02 Thread Peter Otten
Richard Damon wrote:

> I would likely just build the formatter to start by assuming 6 week
> months, and then near the end, after stacking the side by side months,
> see if it can be trimmed out (easier to remove at the end then add if
> needed)

If you like some itertools gymnastics: you can format square 
boxes of text with two nested zip_longest():

import itertools

def gen_lines(blurbs, columncount, columnwidth):
first = True
for row in itertools.zip_longest(
*[iter(blurbs)] * columncount,
fillvalue=""
):
if first:
first = False
else:
yield ""
for columns in itertools.zip_longest(
*[blurb for blurb in row],
fillvalue=""
):
yield "  ".join(
column.ljust(columnwidth) for column in columns
).rstrip()

BLURBS = [
"aaa\\naaa",
"\nbb\nbbb\nbb\nb",
"ccc",
"ddd\nddd"
]
BLURBS = [blurb.splitlines() for blurb in BLURBS]

for line in gen_lines(BLURBS, 2, 10):
print(line)
print("\n")
for line in gen_lines(BLURBS, 3, 10):
print(line)
print("\n")

As calendar provides formatted months with TextCalendar.formatmonth() 
you can easily feed that to gen_lines():

import calendar

def monthrange(start, stop):
y, m = start
start = y * 12 + m - 1
y, m = stop
stop = y * 12 + m - 1
for ym0 in range(start, stop):
y, m0 = divmod(ym0, 12)
yield y, m+1

tc = calendar.TextCalendar()
months = (
tc.formatmonth(*month).splitlines() for month in
monthrange((2020, 10), (2021, 3))
)
for line in gen_lines(months, 3, 21):
print(line)

However, I found reusing the building blocks from calendar to add week 
indices harder than expected. I ended up using brute force and am not 
really satisfied with the result. You can have a look:

$ cat print_cal.py
#!/usr/bin/python3
"""Print a calendar with an arbitrary number of months in parallel columns.
"""
import calendar
import datetime
import functools
import itertools


SEP_WIDTH = 4


def get_weeknumber(year, month, day=1):
"""Week of year for date (year, month, day).
"""
return datetime.date(year, month, day).isocalendar()[1]


class MyTextCalendar(calendar.TextCalendar):
"""Tweak TextCalendar to prepend weeks with week number.
"""
month_width = 24

def weeknumber(self, year, month, day=1):
"""Week of year or calendar-specific week index for a given date.
"""
return get_weeknumber(year, month, max(day, 1))

def formatmonthname(self, theyear, themonth, width, withyear=True):
return "   " + super().formatmonthname(
theyear, themonth, width, withyear=withyear
)

def formatweekheader(self, width):
return "   " + super().formatweekheader(width)

def formatweek(self, theweek, width):
week, theweek = theweek
return "%2d " % week + ' '.join(
self.formatday(d, wd, width) for (d, wd) in theweek
)

def monthdays2calendar(self, year, month):
return [
(self.weeknumber(year, month, week[0][0]), week)
for week in super().monthdays2calendar(year, month)
]


class MyIndexedTextCalendar(MyTextCalendar):
"""Replace week number with an index.
"""
def __init__(self, firstweekday=0):
super().__init__(firstweekday)
self.weekindices = itertools.count(1)

@functools.lru_cache(maxsize=1)
def get_index(self, weeknumber):
"""Convert the week number into an index.
"""
return next(self.weekindices)

def weeknumber(self, year, month, day=1):
return self.get_index(super().weeknumber(year, month, day))


def monthindex(year, month):
"""Convert year, month to a single integer.

>>> monthindex(2020, 3)
24242

>>> t = 2021, 7
>>> t == monthtuple(monthindex(*t))
True
"""
return 12 * year + month - 1


def monthtuple(index):
"""Inverse of monthindex().
"""
year, month0 = divmod(index, 12)
return year, month0 + 1


def yearmonth(year_month):
"""Convert -mm to a (year, month) tuple.

>>> yearmonth("2020-03")
(2020, 3)
"""
return tuple(map(int, year_month.split("-")))


def months(first, last):
"""Closed interval of months.

>>> list(months((2020, 3), (2020, 5)))
[(2020, 3), (2020, 4), (2020, 5)]
"""
for monthnum in range(monthindex(*first), monthindex(*last)+1):
yield monthtuple(monthnum)


def dump_calendar(first, last, months_per_row, cal=MyTextCalendar()):
"""Print calendar from `first` month to and including `last` month.

>>> dump_calendar((2020, 11), (2021, 1), 2)
  November 2020   December 2020
   Mo Tu We Th Fr Sa SuMo Tu We Th Fr Sa Su
441 49 1  2  3  4  5  6
45  2  3  4  5  6  7  8 50  7  8  9 10 11 12 13
46  9 10 11 12 13 14 15 51 14 

Re: questions re: calendar module

2020-08-02 Thread Richard Damon
On 8/2/20 7:26 AM, o1bigtenor wrote:
> The differences become very relevant for formatting. A month that has
> 4 weeks takes a different amount of vertical space than a month that
> has 6 weeks.

The only month that has only 4 weeks would be Febuary, on non-lead
years, that starts on Sunday (or whatever you consider the first day of
your week).

Yes, the 5 to 6 variation can cause formatting problems, especially
since the 6 week months are rare enough (only 30 days months beginning
on the last day of the week, or 31 day months beginning on the last 2
days, so around 1 in 5 or so) that you may want to trim them out when
possible.

I would likely just build the formatter to start by assuming 6 week
months, and then near the end, after stacking the side by side months,
see if it can be trimmed out (easier to remove at the end then add if
needed)

-- 
Richard Damon

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


[issue38628] Issue with ctypes in AIX

2020-08-02 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

David, is the issue you mention in your message at 2020-02-05 reproducible with 
valid usage of ctypes (that is, by calling a C function with the correct 
signature)? 

What do you mean with "this is documented in Python ctypes"?

--
nosy: +ronaldoussoren

___
Python tracker 

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



Re: questions re: calendar module

2020-08-02 Thread 2QdxY4RzWzUUiLuE
On 2020-08-02 at 06:26:10 -0500,
o1bigtenor  wrote:

> On Sat, Aug 1, 2020 at 11:33 PM dn via Python-list
>  wrote:

> > The fact that some months have fewer, or more, weeks to include, is
> > largely irrelevant. The solution is a standard "merge" algorithm. (us
> > 'silver surfers' cut our teeth on sorting, searching, and merging as the
> > three pillars of "batch processing").
> 
> The differences become very relevant for formatting. A month that has
> 4 weeks takes a different amount of vertical space than a month that
> has 6 weeks.

Back in high school, we wrote a FORTRAN program to multiply matrixes,
which wasn't too bad, because our FORTRAN library came with a matrix
multiplier.  The real problem was formatting the output.  In FORTRAN.
With crude "graphics" (made from plus signs, minus signs, and upper case
"I"s) for the matrix brackets.  And the multiplication and equality
operators were supposed to be vertically centered in a horizontally
oriented equation.  Don't forget, matrix multiplication usually involves
three differently shaped matrixes.  The equation with the green check
mark on https://www.mathsisfun.com/algebra/matrix-multiplying.html is a
reasonable facsimile of what our output was supposed to look like.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: questions re: calendar module

2020-08-02 Thread o1bigtenor
On Sat, Aug 1, 2020 at 11:33 PM dn via Python-list
 wrote:
>
> On 02/08/2020 12:24, o1bigtenor wrote:
> > On Sat, Aug 1, 2020 at 6:29 PM dn via Python-list
> >  wrote:
> >> On 01/08/2020 23:36, o1bigtenor wrote:
> >>> On Sat, Aug 1, 2020 at 1:29 AM dn via Python-list
> >>> mailto:python-list@python.org>> wrote:
> >>>  On 31/07/2020 02:52, o1bigtenor wrote:
> >>>   > I regularly work in planning through multiple years at once.
> ...
>
> >>> calendar starting
> >>> from a date that is 3 years in time frame.
> >> ...
> >>
> >>> I would like to show something like 2024 through the end of 2028.
> ...
> > It is very disappointing - - - -suggests that thinking outside the space of
> > one year is somehow deprecated. Frustrated when what you do demands
> > that you think in longer periods of time (and yet have to function within
> > the week as well).
>
> I agree - says he who tactically changes his 'events calendar' every
> half-year, to ensure that there is more than a six-month planning
> horizon. Sister-in-Law has just this morning blocked-out dates for
> family gatherings ("you are expected to attend!") for not just
> Christmas/December, but into Jan, Feb, and Easter holidays (Uni
> vacation) next year; because U.David is but a mere-male and needs lots
> of 'extra help'...
> (and because she knows 'the system', and has something similar at home!)
>

(LOL) something like that except what I'm working with also needs the
to the day planning as well as the long term stuff. Did some 'counting'
here. there are from 8 to 14 discrete event times for a group within a
'period' (presently a year but that may change) and there are multiple
groups. The event timing (spacing) is mostly similar. There is also a
need for multi-event (think year) planning as well.
I could see a busy theater organisation doing a similar kind of planning.
>
> >> There are other helper functions. Also, we are invited to sub-class.
> >
> > Hmm - - - will have to investigate that.
>
> I'm thinking that the month function/method might be a better way to go
> (than year-at-a-time).
>
> For visualisation (per next para), have you tried computing a month in
> the REPL and then str.split()-ting the output into separate week-strings?
>
>
> >> Might it be possible to generate multiple year (or month) groups, split
> >> them by line, and then reassemble line-by-line to produce the width and
> >> temporal length required?
> >
> > Likely work well if the months were considered as discrete blocks.
> > Thinking that one could have something like
> >
> > January 20xx  February 20xx
> >Su  Mo  Tu  We  Th  Fr  Sa Su  Mo  Tu  We  Th  Fr  Sa
> > 1  1 2 3455
> >   12
> > 2 6 78 910  11  12   6 3 45 6
> > 7   89
> > 313   14  15   16   17  18  19   710   11  12   13   14  15  16
> > 420   21  22   23   24  25  26   8
> > 527   28  29   30   31
> >
> > It is very useful for me to have the week numbers included. Have
> > learned some fascinating things (some months have 6 weeks in
> > them!) and the joys of formating (grin!).
> >>
> >> What do you think?
>
> I'm no expert with the calendar module, having used it as many times as
> (probably only) once before!
>
> However, skim-reading that page of the docs, I'd say that using the
> class to do the formatting is better than 'reinventing the wheel', and
> thus the question becomes: could the 'standard output' be post-processed
> into the form required?
>
> The outline above (ignoring month/year and day headings) is basically:
>
> weekNR  gap weekNR  month> ...
>
> as far across the page/screen as there is space/per the requirements.
>
> Given that a  seems to be a fixed-length string, then
> you could indeed employ format() or f-strings with formatting.
>
> The fact that some months have fewer, or more, weeks to include, is
> largely irrelevant. The solution is a standard "merge" algorithm. (us
> 'silver surfers' cut our teeth on sorting, searching, and merging as the
> three pillars of "batch processing").

The differences become very relevant for formatting. A month that has
4 weeks takes a different amount of vertical space than a month that
has 6 weeks.
>
> To print across the page/screen, we divide the available number of
> character-columns by the number of columns a single month's data
> requires (plus inter-month spacing) and this gives the maximum number of
> months the can be displayed 'across'.
>
> Dividing that number into the number of months within the period, will
> give the number of month-rows required to 'do the job'.
>
> A month-row could be defined as: 'as many lines as it takes to display
> every week of the month' (plus vertical separation/spacing).
>
> So, now the challenge is to print each output line, combining
> (laterally) all of the relevant data/dates, in such a manner that after
> 

[issue41457] Implement random.shuffled

2020-08-02 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is a duplicate of issue26393 and issue27964.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> random.shuffled

___
Python tracker 

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



[issue41457] Implement random.shuffled

2020-08-02 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +mark.dickinson, rhettinger

___
Python tracker 

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



[issue41457] Implement random.shuffled

2020-08-02 Thread Ram Rachum


Change by Ram Rachum :


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

___
Python tracker 

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



[issue41457] Implement random.shuffled

2020-08-02 Thread Ram Rachum


New submission from Ram Rachum :

Writing the patch now.

Thread: 
https://mail.python.org/archives/list/python-id...@python.org/thread/OHLXVKIBMNSQO6BCFK6LEHSYNXDB6OQJ/

--
components: Library (Lib)
messages: 374683
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Implement random.shuffled
type: enhancement
versions: Python 3.10

___
Python tracker 

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



Re: Pygobject style question

2020-08-02 Thread Cameron Simpson
On 01Aug2020 13:32, Chris Green  wrote:
>Having (after lots of help from here, thank you) finally converted my
>Python 2, gtk 2 program to Python 3 and pygobject gtk 3 I'm left with
>a couple of what might be called style questions.
>
>I guess it's mostly down to what feels right to me but there may be
>good reasons for choosing one way over another and, if so, I'd like to
>know what they are.
>
>So, my original code had:-
>...
>self.buffer = gtk.TextBuffer()
>self.view = gtk.TextView(self.buffer)
>
>This doesn't work in gtk+ 3 (or at least I don't think it does, the
>converter script changed it) and there seem to be several ways of
>doing it now:-
>
>self.buffer = Gtk.TextBuffer()
>self.view = Gtk.TextView(buffer = self.buffer)

I like this first one. It is least verbose, and it makes the buffer 
before it makes the view, which I prefer.

If they are all legal and all correct and equivalent, go with the one 
which is easiest to read.

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


Re: Issue with Python module downloads from Library for a beginner Python coder.

2020-08-02 Thread Cameron Simpson
Diverting replies to tu...@python.org, a better place for all this.

It looks like the error is in graphics.py, not in your file.
Your line:

from graphics import *

is syntacticly correct. Something has mangled the line breaks in your 
traceback, which here appears as:

When I write a different line -  (from import graphics *), this is the 
output:
from graphics import *Traceback (most recent call last):  File 
"", line 1, in     from graphics import *  File 
"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", 
line 1    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) 
[MSC v.1926 32 bit (Intel)] on win32           ^SyntaxError: invalid 
syntax

To me it appears that the syntax error in in graphics.py at line 1. I'd 
normally expect such a traceback to look more like this:

File "", line 1, in 
    from graphics import *
File 
"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 1
     Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 
32 bit (Intel)] on win32
     ^SyntaxError: invalid syntax

In particular, the "^" would point to the place in the code where Python 
_noticed_ the syntax error. Is it possible that graphics.py contains 
that "Python 3.8.5 " text?

So the traceback I've invented above says that _your_ import failed, but 
that was because of a failure in the file you were trying to import.

BTW, it looks to me like your Python programmes (graphics.py and 
whatever other file you might be making) are inside the Python install.  
Normally you'd keep these elsewhere, for example in a folder such as:

C:\Users\sarvesh\my-programmes

Cheers,
Cameron Simpson 

On 02Aug2020 06:36, Sarvesh Poddar  wrote:
>I am currently using Python 3.8.5 with IDLE environment that comes 
>pre-installed with the Python application. I am using the book "An 
>Introduction to computer science" by John Zelle as my reference.
>The problem I am facing is "There is a python program named "graphics.py" that 
>is used as reference in the book and I downloaded the python file from 
>internet (link to the file - 
>https://mcsp.wartburg.edu/zelle/python/graphics.py). I have kept this module 
>in (C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32) and this is 
>were my Python files also lie in C drive. The problem is that I am not able to 
>import graphics.py file and when I try to do that following is the error I 
>receive,
>Traceback (most recent call last):
>  File "", line 1, in     import graphics
>  File 
>"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 
>1
>    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 
>bit (Intel)] on win32           ^SyntaxError: invalid syntax
> I have installed, uninstalled and then re-installed Python 3.8.5 multiple 
>times but the problem remains. I did a thorough internet search and most of 
>them suggested using sys path and following is the result,
>
>import sys>>> sys.path['', 
>'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\idlelib',
> 
>'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
> 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs', 
>'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib', 
>'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32', 
>'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages']
>When I write a different line -  (from import graphics *), this is the output:
>from graphics import *Traceback (most recent call last):  File 
>"", line 1, in     from graphics import *  File 
>"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", 
>line 1    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) 
>[MSC v.1926 32 bit (Intel)] on win32           ^SyntaxError: invalid 
>syntax
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41455] Python Devguide differs from python docs

2020-08-02 Thread Yaroslav


Yaroslav  added the comment:

Here's opened PR. https://github.com/python/cpython/pull/21703

--
nosy:  -python-dev

___
Python tracker 

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



[issue41455] Python Devguide differs from python docs

2020-08-02 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +20846
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21703

___
Python tracker 

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



[issue41455] Python Devguide differs from python docs

2020-08-02 Thread Yaroslav


Yaroslav  added the comment:

As I can see here 
https://github.com/python/devguide/blob/master/garbage_collector.rst#collecting-the-oldest-generation

> the GC only triggers a full collection of the oldest generation if the ratio 
> long_lived_pending / long_lived_total is above a given value (hardwired to 
> 25%)

But in the python docs here 
https://docs.python.org/3.10/library/gc.html#gc.set_threshold

> When the number of allocations minus the number of deallocations exceeds 
> threshold0, collection starts. Initially only generation 0 is examined. If 
> generation 0 has been examined more than threshold1 times since generation 1 
> has been examined, then generation 1 is examined as well. Similarly, 
> threshold2 controls the number of collections of generation 1 before 
> collecting generation 2.

As I can see here: 
https://github.com/python/cpython/blob/master/Modules/gcmodule.c#L1456 the 
first one is correct.

We should probably fix python docs accordingly.

--

___
Python tracker 

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



[issue41395] pickle and pickletools cli interface doesn't close input and output file.

2020-08-02 Thread Amir Mohamadi


Change by Amir Mohamadi :


--
nosy: +Amir
nosy_count: 6.0 -> 7.0
pull_requests: +20845
pull_request: https://github.com/python/cpython/pull/21702

___
Python tracker 

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



[issue41456] loop.run_in_executor creat thread but not destory it after the task run over

2020-08-02 Thread Guo Xiyong


New submission from Guo Xiyong :

code like this:

import asyncio

import time

import threading


def sync_test():
time.sleep(1)

async def run_test():
loop = asyncio.get_event_loop()

for _ in range(10):
# r = await loop.getaddrinfo('wq.io', 443)
# print(r)

loop.run_in_executor(None, sync_test)

for t in threading.enumerate():
print(t)


while True:
await asyncio.sleep(1)


asyncio.run(run_test())


after run, the 10 thread will always exist

--
components: asyncio
messages: 374679
nosy: asvetlov, cielpy, yselivanov
priority: normal
severity: normal
status: open
title: loop.run_in_executor creat thread but not destory it after the task run 
over
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



Re: Issue with Python module downloads from Library for a beginner Python coder.

2020-08-02 Thread Sarvesh Poddar via Python-list
 Hi,
I am currently using Python 3.8.5 with IDLE environment that comes 
pre-installed with the Python application. I am using the book "An Introduction 
to computer science" by John Zelle as my reference.
The problem I am facing is "There is a python program named "graphics.py" that 
is used as reference in the book and I downloaded the python file from internet 
(link to the file - https://mcsp.wartburg.edu/zelle/python/graphics.py). I have 
kept this module in 
(C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32) and this is were 
my Python files also lie in C drive. The problem is that I am not able to 
import graphics.py file and when I try to do that following is the error I 
receive,
Traceback (most recent call last):
  File "", line 1, in     import graphics
  File 
"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 1
    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 
bit (Intel)] on win32           ^SyntaxError: invalid syntax
 I have installed, uninstalled and then re-installed Python 3.8.5 multiple 
times but the problem remains. I did a thorough internet search and most of 
them suggested using sys path and following is the result,

import sys>>> sys.path['', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\Lib\\idlelib',
 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\python38.zip',
 'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\DLLs', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32', 
'C:\\Users\\sarvesh\\AppData\\Local\\Programs\\Python\\Python38-32\\lib\\site-packages']
When I write a different line -  (from import graphics *), this is the output:
from graphics import *Traceback (most recent call last):  File "", 
line 1, in     from graphics import *  File 
"C:\Users\sarvesh\AppData\Local\Programs\Python\Python38-32\graphics.py", line 
1    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 
bit (Intel)] on win32           ^SyntaxError: invalid syntax
Please do let me know if I am missing out something very basic.
Thanks and I look forward.On Saturday, 1 August, 2020, 07:54:19 am IST, boB 
Stepp  wrote:  
 
 On Thu, Jul 30, 2020 at 9:24 AM Sarvesh Poddar via Python-list
 wrote:

> I re-installed Python in my Windows system as the earlier one was not able to 
> import modules...

You do not provide much detail to diagnose what your problem(s)
is(are).  By the "earlier one" is it the same version as the one you
re-installed?  Were you able to run IDLE with the "earlier one"?  By
not being able to import modules do you mean modules from Python's
standard library?  Or do you mean installing third party libraries
using pip?

> ...But now I am not able to open IDLE after multiple tries.

Have you looked in your start menu in the list of installed programs
for Python?  If it is there did you expand it and see if there is an
entry for IDLE?  How have you been trying (unsuccessfully) to open
IDLE?


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


[issue41410] Opening a file in binary mode makes a difference on all platforms in Python 3

2020-08-02 Thread Rishav Kundu


Rishav Kundu  added the comment:

Submitted a PR. Please let me know if I missed something :)

--

___
Python tracker 

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



[issue41410] Opening a file in binary mode makes a difference on all platforms in Python 3

2020-08-02 Thread Rishav Kundu


Change by Rishav Kundu :


--
keywords: +patch
nosy: +xrisk
nosy_count: 3.0 -> 4.0
pull_requests: +20844
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21701

___
Python tracker 

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