[issue45620] A misleading url in 'Floating Point Arithmetic' page

2021-10-26 Thread Sonia


New submission from Sonia :

The url of [The Perils of Floating Point](http://www.lahey.com/float.htm) seems 
a bit weird in the page https://docs.python.org/3/tutorial/floatingpoint.html. 
It redirects me to a webpage that sells dugs. Not sure if the resource was 
meant to find this: 
http://www.stat.cmu.edu/~brian/711/week03/perils-of-floating-point.pdf

--
messages: 405070
nosy: hanhantw
priority: normal
severity: normal
status: open
title: A misleading url in 'Floating Point Arithmetic' page
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



[issue44828] tkinter.filedialog linked with Tk 8.6.11 crashes on macOS 12 Monterey, breaking IDLE saves

2021-10-26 Thread Ned Deily


Change by Ned Deily :


--
assignee: terry.reedy -> ned.deily

___
Python tracker 

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



[issue44828] tkinter.filedialog linked with Tk 8.6.11 crashes on macOS 12 Monterey, breaking IDLE saves

2021-10-26 Thread Ned Deily


Ned Deily  added the comment:

Marc, thanks for providing the patch for Tk. There are some issues with it, 
though, at least when used with IDLE. I built a Python 3.10.0+ universal2 
installer, like what we provide on python.org, with just the updated Tk and 
tested it on macOS 10.9, 10.13, 10.14, 10.15, 11 and 12.

First, and most important, there seems to be a typo in the fix that causes the 
dialog panel to break on macOS 10.14: 

-   if ([NSApp macOSVersion] > 101400) {
+   if ( osVersion >= 101400 && osVersion < 12) {

That ">=" should be just an ">" as before, I think. At least, making that 
change unbreaks 10.14.

Second, while the filedialog panel now works on macOS 12 (Monterey) with the 
patch, there are some side effects, at least when using CMD-S (Save) in a new 
IDLE edit window. After pressing CMD-S, some small object appears on the screen 
very briefly (too quickly for me to recognize what it is) and then the expected 
Save filedialog panel appears; however, unlike on all the other operating 
system levels tested, the keyboard focus is not on the filename text field in 
the panel. So when the user starts typing the file name, nothing happens until 
they do something, like clicking on the file name field, to manually move the 
keyboard focus to that field. I think most users would find that confusing. I 
don't know if there's any way to change that, either in Tk, tkinter, or IDLE. 
But it does seem to be a regression. The same binaries work fine on all of the 
other macOS versions I tested.

Any ideas?

(Although it's not an IDLE bug, I've added IDLE to the components list since it 
is impacted by this issue.)

--
assignee:  -> terry.reedy
components: +IDLE
nosy: +lukasz.langa, pablogsal, terry.reedy
priority: normal -> release blocker
title: Using tkinter.filedialog crashes on macOS Python 3.9.6 -> 
tkinter.filedialog linked with Tk 8.6.11 crashes on macOS 12 Monterey, breaking 
IDLE saves
versions: +Python 3.11, Python 3.9

___
Python tracker 

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



Re: Create a contact book

2021-10-26 Thread dn via Python-list
On 27/10/2021 04.16, Avi Gross via Python-list wrote:
> Chris,
> 
> I think it is time someone set up a business where they do the homework for
> people for a mere $1,000 or so per hour. Anonymously, of course. And we can
> refer requests for free homework advice there.
> 
> Maybe the answer to this request is to suggest they use FACEBOOK which
> seemingly keeps you in contact and lets you add friends and view them 
> 
> On Tue, Oct 26, 2021 at 5:30 PM anders Limpan  wrote:
>>
>> i would like to create a contact book were you can keep track of your 
>> friends. With this contact book you will both be able to add friends 
>> and view which friends that you have added. anyone interested in 
>> helping me out with this one ?=)
>>
> 
> Here at Homeworks Anonymous, the first step is admitting that what you have
> is a homework problem. :) This isn't a project, this is something you're
> doing for a course, and it's not really fair to pretend otherwise :)
> 
> ChrisA


It's a balancing-act:
- on the one hand writing (their) code is not helping a trainee to learn
(and certainly not in the manner the trainer intended)
- on the other, we should try to welcome and encourage new-comers to our
list/the Python eco-system.

That said, I've often recommended folk switch/also subscribe to the
Tutor list, but can't say if many actually did.


"Essay Mills" are back in the news in the UK with a proposal to make
them completely illegal. The Times Educational Supplement printed an
article two~three weeks ago
(https://www.timeshighereducation.com/student/advice/tempted-pay-your-essays-here-are-six-reasons-not
- likely behind a pay-wall - if so, apologies).

The author identified six reasons for not using an Essay Mill:
(the labels are his, the summaries beyond them are mine)


1 Harsh penalties - if caught

2. Fool no more - plagiarism software these days is not only comparing
'this work' with others' assignment returns, but this with your other
submissions, ie noting if your personal writing style changes!

3. Career impact - how it impacts employment (possibilities) if such is
either on your record or becomes evident later

4. On the record - if the 'mill' has your record, what if they're
hacked? Do they have better security than the many organisations which
have been breached?

5. No guarantee of anonymity - your shadow-author will have a 'hold'
over you, forever

6. Bribery - perhaps that essay should be about blackmail, how it could
start, and what might be its effects?

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


[issue45618] Documentation builds fail with Sphinx 3.2.1

2021-10-26 Thread Ned Deily


Change by Ned Deily :


--
nosy: +lukasz.langa, mdk, pablogsal
priority: normal -> release blocker
versions: +Python 3.9

___
Python tracker 

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



[issue45619] Mentioning structural pattern matching in the list of binding

2021-10-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks!

--
nosy: +gvanrossum

___
Python tracker 

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



[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-26 Thread Eryk Sun


Eryk Sun  added the comment:

> '\r' is not handled, though it is documented that it 
> should be supported.

Where is it documented that sys.stdin uses universal newlines mode? The newline 
behavior isn't documented in the sys module [1], though it should be. It's hard 
coded in create_stdio() in Python/pylifecycle.c [2]. In Windows it uses 
universal-translated mode. On all other platforms, it uses "\n", which includes 
"\r\n" but not "\r".

---
[1] https://docs.python.org/3/library/sys.html#sys.stdin
[2] https://github.com/python/cpython/blob/v3.10.0/Python/pylifecycle.c#L2216

--
nosy: +eryksun

___
Python tracker 

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



[issue45619] Mentioning structural pattern matching in the list of binding

2021-10-26 Thread Arthur Milchior


Change by Arthur Milchior :


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

___
Python tracker 

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



[issue45619] Mentioning structural pattern matching in the list of binding

2021-10-26 Thread Arthur Milchior


New submission from Arthur Milchior :

https://docs.python.org/3/reference/executionmodel.html list all of the way a 
variable may be bound. However, it seems that it was not updated. Indeed, 
structural pattern matching in 3.10 also allows to bind a variable and is not 
mentionned.

As a related issue, the sentence is far too long and really would need to be 
broken down. At the very least, the special case "and targets that are 
identifiers if" is not clear, it is not indicated whether this case extends to 
the end of the sentence or is just local

--
assignee: docs@python
components: Documentation
messages: 405066
nosy: Arthur-Milchior, docs@python
priority: normal
severity: normal
status: open
title: Mentioning structural pattern matching in the list of binding
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue45616] Python Launcher Matches 3.10 instead of 3.1

2021-10-26 Thread Yu Liu


Yu Liu  added the comment:

Had a quick look at the launcher file. Maybe something like this?

diff --git a/PC/launcher.c b/PC/launcher.c
index fbfb49a..a965a9d 100644
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -542,7 +542,7 @@ find_python_by_version(wchar_t const * wanted_ver)
 }
 for (i = 0; i < num_installed_pythons; i++, ip++) {
 n = wcslen(ip->version);
-if (n > wlen)
+if (n != wlen)
 n = wlen;
 if ((wcsncmp(ip->version, wanted_ver, n) == 0) &&
 /* bits == 0 => don't care */

--
nosy: +yuliu2016

___
Python tracker 

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



[issue45616] Python Launcher Matches 3.10 instead of 3.1

2021-10-26 Thread Yu Liu


Yu Liu  added the comment:

Had a quick look in the launcher file. Maybe something like this?

diff --git a/PC/launcher.c b/PC/launcher.c
index fbfb49a..a965a9d 100644
--- a/PC/launcher.c
+++ b/PC/launcher.c
@@ -542,7 +542,7 @@ find_python_by_version(wchar_t const * wanted_ver)
 }
 for (i = 0; i < num_installed_pythons; i++, ip++) {
 n = wcslen(ip->version);
-if (n > wlen)
+if (n != wlen)
 n = wlen;
 if ((wcsncmp(ip->version, wanted_ver, n) == 0) &&
 /* bits == 0 => don't care */

--
nosy: +yuliu2016

___
Python tracker 

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



Re: The task is to invent names for things

2021-10-26 Thread David L Neil via Python-list
On 27/10/2021 12.29, Stefan Ram wrote:
> dn  writes:
>> On 27/10/2021 11.16, Stefan Ram wrote:
>>> The Mental Game of Python - Raymond Hettinger (PyBay 2019)
>>> |  "The computer gives us words that do ### things.
> ...
>> Alternately, if your question was to identify the mumbled word, it is
>> (seemed to me to be) "does".
> 
>   Thanks!
> 
>   Yes, my question was about the word at the place of the
>   "###". It does not even seem mumbled to me, but pronounced
>   with certainty and intention. That's why it makes me wonder.
>   As if there was a term "does things".

That is a colloquialism:
- my computer does things
- my program[me] does stuff

The "stuff" is something of a euphemism. In our profession, I would
suggest it is used to avoid detail, eg as a 'signal' to a non-IT person
that a more detailed answer would likely bore, or 'go over your head'.
In PM-circles we identify the beginning and end of a project - the rest
of the project plan 'stuff', is known as 'the miracle that happens in
the middle'. Want more detail? Do we have more detail? What do I know?

If a dog owner said: "my dog does things" it would again be a euphemism,
but in this case employed to avoid saying something distasteful, ie that
the puppy is not (yet) house-trained.


That said, I suspect if you tried to use it in an English
(language/literature) essay, the teacher/prof would take exception to
such informality, and demand a 'better' noun!


Believe it or not, my second trainee-discussion of the day included a
question similarly-worded: 'why does the computer/interpreter/run-time
do these things?'.

Rather than 'literature', I taught this guy one of my favorite
excursions into the world of poetry (the specific type of poetic stuff
is "doggerel"):

I really hate this dumb* machine,
I wish that they would sell it.
It never does quite what I want,
but only what I tell it!

* you might regard this word as a euphemism for another


Upon which note, and your observation that I am no English-major, it's
probably time we went to do things...
-- 
Regards =dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42738] subprocess: don't close all file descriptors by default (close_fds=False)

2021-10-26 Thread Richard Xia


Richard Xia  added the comment:

I'd like to provide another, non-performance-related use case for changing the 
default value of Popen's close_fds parameters back to False.

In some scenarios, a (non-Python) parent process may want its descendant 
processes to inherit a particular file descriptor and for each descendant 
process to pass on that file descriptor its own children. In this scenario, a 
Python program may just be an intermediate script that calls out to multiple 
subprocesses, and closing the inheritable file descriptors by default would 
interfere with the parent process's ability to pass on that file descriptor to 
descendants.

As a concrete example, we have a (non-Python) build system and task runner that 
orchestrates many tasks to run in parallel. Some of those tasks end up invoking 
Python scripts that use subprocess.run() to run other programs. Our task runner 
intentionally passes an inheritable file descriptor that is unique to each task 
as a form of a keep-alive token; if the child processes continue to pass 
inheritable file descriptors to their children, then we can determine whether 
all of the processes spawned from a task have terminated by checking whither 
the last open handle to that file descriptor has been closed. This is 
particularly important when a processes exits before its children, sometimes 
uncleanly due to being force killed by the system or by a user.

In our use case, Python's default value of close_fds=True interferes with our 
tracking scheme, since it prevents Python's subprocesses from inheriting that 
file descriptor, even though that file descriptor has intentionally been made 
inheritable.

While we are able to work around the issue by explicitly setting 
close_fds=False in as much of our Python code as possible, it's difficult to 
enforce this globally since we have many small Python scripts. We also have no 
control over any third party libraries that may possibly call Popen.

Regarding security, PEP 446 already makes it so that any files opened from 
within a Python program are non-inheritable by default, which I agree is a good 
default. One can make the argument that it's not Python's job to enforce a 
security policy on file descriptors that a Python process has inherited from a 
parent process, since Python cannot distinguish from descriptors that were 
accidentally or intentionally inherited.

--
nosy: +richardxia

___
Python tracker 

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



Re: The task is to invent names for things

2021-10-26 Thread Chris Angelico
On Wed, Oct 27, 2021 at 10:16 AM dn via Python-list
 wrote:
> Programmers of the world unite!
> You have nothing to lose but your 0
> - or your 1

Many operations in computing are fully reversible. After you do
something, you can undo it. After you assign, you can unassign. And
after you ite, you can unite!

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


Re: The task is to invent names for things

2021-10-26 Thread dn via Python-list
On 27/10/2021 11.21, Stefan Ram wrote:
> r...@zedat.fu-berlin.de (Stefan Ram) writes:
>> The Mental Game of Python - Raymond Hettinger (PyBay 2019)
>> |What daddy does is make new words to make computers easier to use."
> 
>   BTW: It now also reminds me of:
> 
> |What I Do
> |
> |I build paradigms.
> |I work on complex ideas and make up words for them.
> |It is the only way.
> |
> Ted Nelson (1937-) in 1998 or earlier
> 
>   , which might precede Raymonds talk.


Indeed, this is how we 'invent' jargon - a short-cut to enable
subject-specialists (SMEs) to inter-communicate succinctly or more
accurately.


What really gets me into 'grumpy old man' mode, is the predilection for
our TV folk to imitate their foreign peers, or to use their own
jargon/slang in a public forum. Over the decades of my career I've
listened (as politely as possible) to so many (so, so, many)
ordinary-folk complaining that we computer-guys talk gobbledegook, and
need to down-shift and explain things in ordinary language. Sometimes
this is valid - there is no point in talking to my neighbors about
"ternary operators" and certainly "walrus" would create complete
misunderstanding. However, a public broadcaster to think it acceptable
to use such (of their) terms as "presser" (Press Briefing, or is it
Press Release?), only goes to show that IT people (without specific
training in (public) communication) aren't 'that bad' after all!


Programmers of the world unite!
You have nothing to lose but your 0
- or your 1

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


Re: The task is to invent names for things

2021-10-26 Thread dn via Python-list
On 27/10/2021 11.16, Stefan Ram wrote:
> dn  writes:
>> Some time ago I watched a video of a Raymond Hettinger talk. In it he
>> recounted answering his son's question of 'what do you do, Dad?'
> 
> The Mental Game of Python - Raymond Hettinger (PyBay 2019)
> 
>   Around minute 21, Raymond says:
> 
> |I often, doo, uh, try to describe, uh, computer programming,
> |uh, to kids.
> |
> |How many of you can tell, uh, uh, a child what a, uh, a
> |software engineer does?
> |
> |At least one man, uh, uh, can. - One man who has.
> |
> |Here's my explanation:
> |  "The computer gives us words that do ### things.
> |  What daddy does is make new words to make computers easier to use."
> 
>   . An awesome explanation!
> 
>   But please help me to understand the word marked "###" above!

That was quick. Thank you!
(and yes, I had "Bay Piggies" in my head, but after starting to re-watch
that video, moved-on because the agenda didn't seem to match)

OTOH it is not exactly as I remember (which may say more about me!).
Perhaps he re-used the story elsewhere - I shall investigate further...

Meantime, the tape will reinforce a 'learning-opportunity' for a certain
trainee and his 'algebraic habit'...


Your question:

Firstly, Raymond often needs to "er" in order to let his mind catch-up
with his words. A lot of us do this, not because we've forgotten what to
say, but because we're also listening, in QA-mode as it were, and
sometimes question our choice of words - ah, back to names/words again!

In this case, I'll suggest that he was already struggling with the
subject of the sentence - is he talking about 'a programmer' talking to
a child, or his own situation in-conversation with his son?

Secondly, there is the issue of singular/plural forms - especially when
formulating the sentence's object - or final clause. Thus, do I use the
singular "does" because "computer" is singular, or should it be the
plural "do" because "words" is plural?

His first choice was grammatically-correct. Think of the pause as
running pytest prior to further execution...

Alternately, if your question was to identify the mumbled word, it is
(seemed to me to be) "does".


Thanks again!
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45586] Use starred expressions in subscripts

2021-10-26 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Yes, I don't believe the PEP is suggesting any changes to list.__getitem__. If 
you want to suggest such enhancements, I would suggest first sending a message 
to the python-ideas mailing list or on discuss.python.org.

--

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2021-10-26 Thread Maciej Olko


Change by Maciej Olko :


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

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2021-10-26 Thread Maciej Olko


Maciej Olko  added the comment:

The pin can be removed after bumping Sphinx to at least 3.5.4, which introduced 
upper limit for docutils version.

https://github.com/sphinx-doc/sphinx/commit/9263eea38379822e053c67ad1d17036d724c5e41

--

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2021-10-26 Thread Maciej Olko


Change by Maciej Olko :


--
versions: +Python 3.11

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2021-10-26 Thread Maciej Olko


Change by Maciej Olko :


--
versions:  -Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



How to store the result of df.count() as a new dataframe in Pandas?

2021-10-26 Thread Shaozhong SHI
Hello,

The result of df.count() appears to be a series object.  How to store the
result of df.count() as a new dataframe in Pandas?

That is data anyhow.

Regards,

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


[issue45618] Documentation builds fail with Sphinx 3.2.1

2021-10-26 Thread Maciej Olko

New submission from Maciej Olko :

Since the release of Docutils 0.18 today building Python documentation fails.

In CPython repository we have Sphinx pinned to 3.2.1, which has too loose 
requirement for Docutils version in install_requires – docutils>=0.12.

Example of failing build: 
https://github.com/python/python-docs-pl/runs/4009459257.

My suggestion is to pin down docutils in docs requirements.

--
assignee: docs@python
components: Documentation
messages: 405060
nosy: Maciej Olko, docs@python
priority: normal
severity: normal
status: open
title: Documentation builds fail with Sphinx 3.2.1
type: crash
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue40915] multiple problems with mmap.resize() in Windows

2021-10-26 Thread Tim Golden


Change by Tim Golden :


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



[issue40915] multiple problems with mmap.resize() in Windows

2021-10-26 Thread Tim Golden


Tim Golden  added the comment:


New changeset aea5ecc458084e01534ea6a11f4181f369869082 by Tim Golden in branch 
'main':
bpo-40915: Fix mmap resize bugs on Windows (GH-29213)
https://github.com/python/cpython/commit/aea5ecc458084e01534ea6a11f4181f369869082


--

___
Python tracker 

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



The task is to invent names for things

2021-10-26 Thread dn via Python-list
Some time ago I watched a video of a Raymond Hettinger talk. In it he
recounted answering his son's question of 'what do you do, Dad?' by
suggesting that programmers spend much?most of their time thinking of
names - and good names are better than "n = name", etc. This theme
developed throughout the talk.

Have searched, but been unable to re-locate this video. Do you recall
the talk? Please advise its URL...
-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue42260] [C API] Add _PyInterpreterState_SetConfig(): reconfigure an interpreter

2021-10-26 Thread Steve Dower


Change by Steve Dower :


--
pull_requests:  -27312

___
Python tracker 

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



[issue44828] Using tkinter.filedialog crashes on macOS Python 3.9.6

2021-10-26 Thread lance robotson


lance robotson  added the comment:

This issue is happening for me in with my installation of python 3.10 running 
the release version of mac os monterey 12.0.1 running on an intel mac, I 
noticed this behavior trying to open or save files in IDLE.

--
nosy: +robotson

___
Python tracker 

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



[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-26 Thread Kelly Brazil


Change by Kelly Brazil :


--
components: +Library (Lib)

___
Python tracker 

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



[issue45504] [argparse] Entering a partial config_parser flag works with subparsers

2021-10-26 Thread paul j3


Change by paul j3 :


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



[issue45617] sys.stdin does not iterate correctly on '\r' line separator

2021-10-26 Thread Kelly Brazil


New submission from Kelly Brazil :

When iterating on sys.stdin lines, '\r\n' and '\n' are handled correctly, but 
'\r' is not handled, though it is documented that it should be supported.

Example code:
import sys

for line in sys.stdin:
print(repr(line))

Results in Python 3.8.9:
$ echo -e 'line1\nline2\nline3' | python3 linetest.py 
'line1\n'
'line2\n'
'line3\n'

$ echo -e 'line1\r\nline2\r\nline3' | python3 linetest.py 
'line1\r\n'
'line2\r\n'
'line3\n'

$ echo -e 'line1\rline2\rline3' | python3 linetest.py 
'line1\rline2\rline3\n'

--
messages: 405057
nosy: kbrazil
priority: normal
severity: normal
status: open
title: sys.stdin does not iterate correctly on '\r' line separator
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-26 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 26.10.2021 20:47, Marc-Andre Lemburg wrote:
>> Brett removed a lot of stuff in 01cf4fb9c1aa567484c2ffb1b11f9b3fe9949b05 to 
>> make the file more readable. I removed unnecessary -D, -I, and -L to make 
>> the file even more readable. You can pass custom flags to ./configure.
> 
> Could Brett or you please add those notes back ? There's no other place
> where such details are documented. We've lost important information and
> I would like to get this back into Setup and ideally add more
> information to make it easier for users or admins to customize
> their build.

I could also edit the file and add those back, after you're done
with the refactoring.

--

___
Python tracker 

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



Re: Create a contact book

2021-10-26 Thread Tim Chase
On 2021-10-25 22:40, anders Limpan wrote:
> i would like to create a contact book were you can keep track of
> your friends. With this contact book you will both be able to add
> friends and view which friends that you have added. anyone
> interested in helping me out with this one ?=) --

Python provides the shelve module for just this sort of thing:

  import shelve

  class Contact:
  def __init__(self, name):
  self.name = name
  self.address = ""
  self.phone = ""

  with shelve.open("contacts") as db:
  dave =  Contact("Dave Smith")
  dave.address = "123 Main St\nAnytown, NY 12345"
  dave.phone = "800-555-1212"
  db["dave"] = dave
  ellen = Contact("Ellen Waite")
  ellen.phone = "+1234567890"
  db["ellen"] = ellen

Then at some future point you can use

  with shelve.open("contacts") as db:
  dave = db["dave"]
  print(f"Dave lives at {dave.address}")
  ellen = db["ellen"]
  print(f"Ellen's phonenumber is {ellen.phonenumber}")

I'll leave to you the details of implementing an actual address-book
out of these parts.  Be sure to read the docs for the shelve module

  https://docs.python.org/3/library/shelve.html 

including the various security warnings and caveats.

-tkc




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


[issue45548] Update Modules/Setup

2021-10-26 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 26.10.2021 19:42, Christian Heimes wrote:
> 
> Brett removed a lot of stuff in 01cf4fb9c1aa567484c2ffb1b11f9b3fe9949b05 to 
> make the file more readable. I removed unnecessary -D, -I, and -L to make the 
> file even more readable. You can pass custom flags to ./configure.

Could Brett or you please add those notes back ? There's no other place
where such details are documented. We've lost important information and
I would like to get this back into Setup and ideally add more
information to make it easier for users or admins to customize
their build.

Regarding the -I and -L flags, my question was whether these are
now added elsewhere, since the code would not compile without
e.g. -I$(srcdir)/Include/internal.

I've gone through the Makefile and found that these are already
added via PY_CFLAGS_NODIST, so they are indeed not needed in Setup.
That's great :-)

Please be careful when moving e.g. -I or -L options which point to
non-Python directories. If such options get moved into e.g.
PY_CFLAGS_NODIST, there's no way to override them via options
given in Setup.

Having the -D defined in the relevant code is a lot better. Thanks
for that :-)

> Setup should not be edited by hand. Customizations go to Setup.local.

Editing Setup.local instead of Setup is not documented anywhere ?!
Both files are read, so I guess it's not all that relevant which
of the two are edited.

--

___
Python tracker 

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



[issue42367] Restore os.makedirs ability to apply mode to all directories created

2021-10-26 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
versions: +Python 3.11 -Python 3.10

___
Python tracker 

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



[issue45616] Python Launcher Matches 3.10 instead of 3.1

2021-10-26 Thread Gabe R.


New submission from Gabe R.  :

I have both Python 3.1-64 and 3.10-64 installed on the same Windows machine. If 
I attempt to launch Python 3.1 using the command `py -3.1-64`, the launcher 
incorrectly starts Python 3.10.

--
components: Windows
messages: 405054
nosy: Marsfan, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python Launcher Matches 3.10 instead of 3.1
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



matrix row comparison and fetch data with numpy

2021-10-26 Thread variety jones
I have 2 matrix with , M and M' , The M' matrix is the result of calculation 
"order preserving" of the matrix M  so i will explain more by examples , so 
here is the matrix M : 

M= np.array([
[15,4,-1,9,10,7],
[-4,2,29,11,98,5],
[101,24,3,19,77,53],
[0,88,34,62,13,-9],
[52,93,44,46,24,125],
[0,17,26,8,87,0],
[103,19,52,173,66,24],
[26,78,123,-5,13,41]
])

so lets take the row L1 from the matrix M so the smallest integer is  - 1 so we 
take the position of -1 from the matrix M which is in the column C3 and write 1 
in L1 of the matrix M', and here we go for the other numbers we compare them 
and take the right order , in case of similarity we give them the same order , 
this part is looking fine i write a program who take a matrix and calculate the 
order preserving of it and show the results in the second matrix , here is my 
code :
https://pastebin.com/jpaZfVsB



so the second step is , We will take the columns similar to X% from the matrix 
M'

In this case there are two conditions : X% = 100% similar
The number of minimum similar columns  : 푁푏푟푒 푐표푙 푚푖푛=2

so from the matrix M' we will compare row by row : L1 to L2 , L2 to L 3 until 
we find similar rows and here is the results : 
Seed1= {L1 l2 c2 c4 c6}
Seed2= {L1 l3 c1 c3 c5}
Seed3={L3 l6 c2 c4 c5}
Seed4={L4l6 c3 c6}
Seed5= {L7 l8 c3 c5 c6}
In order to build a bi-group , We must combine the seeds with each other: we 
will unite the rows of the seed and the intersection of the columns of the seed 
By respecting: 푁푏푟푒 푐표푙 푚푖푛 = 2 
the final results :
Bi-groupe 1={L1 l2 l3 l6 c2 c4}
Bi-groupe2={L1 l3 l7 l8 c3 c5}
Bi-groupe  3={L4 l6 l7 l8 c3 c6}

i just want a function or  away to figured out the seeds by rows comparison  
and show the bi-groupe results 

Many Thanks

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


Re: Create a contact book

2021-10-26 Thread Christian Gollwitzer

Am 26.10.21 um 07:40 schrieb anders Limpan:

i would like to create a contact book were you can keep track of your friends. 
With this contact book you will both be able to add friends and view which 
friends that you have added. anyone interested in helping me out with this one 
?=)


Here is how to do it: https://facebook.com/


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


RE: New assignmens ...

2021-10-26 Thread Schachner, Joseph
Why force unpacking?   Why not assign a tuple?  That would look like a simple 
assignment: x := (alpha, beta, gamma)
And you could access x[0],  x[1] and x[2].

I think asking := to support x, y := alpha, beta  is a request to address an 
unnecessary, easily worked around, issue.  And as previously pointed out you 
can still just use = .

--- Joseph S.


Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Chris Angelico  
Sent: Monday, October 25, 2021 6:25 PM
To: Python 
Subject: Re: New assignmens ...

On Tue, Oct 26, 2021 at 9:19 AM dn via Python-list  
wrote:
> Back on-topic, I am slightly curious:-
>
> aside from 'starting small' with an option to widen/'open-up' later, 
> is there a particular reason why 'the walrus' has not been made 
> available (could not be ...?) for use with object-attributes?

I can't think of any other reasons. But the one you cite is quite an important 
one. In order to get real-world usage examples, the feature was rolled out in 
the restricted form, because threads like this are
*exactly* how the value can be judged. So I do not in any way regret that 
assignment expressions were accepted in their current form, but also, don't be 
afraid to propose an opening up of the syntax. Be specific, and cite usage 
examples that would benefit.

TBH, I don't think there's a lot of value in multiple-assignment, since it has 
a number of annoying conflicts of syntax and few viable use-cases. But if you 
have great examples of "x.y :=" or "x[y] :=", then by all means, post on 
python-ideas to propose widening the scope.

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


[issue45548] Update Modules/Setup

2021-10-26 Thread Christian Heimes


Christian Heimes  added the comment:

Brett removed a lot of stuff in 01cf4fb9c1aa567484c2ffb1b11f9b3fe9949b05 to 
make the file more readable. I removed unnecessary -D, -I, and -L to make the 
file even more readable. You can pass custom flags to ./configure.

Setup should not be edited by hand. Customizations go to Setup.local.

--

___
Python tracker 

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



[issue45545] chdir __exit__ is not safe

2021-10-26 Thread Jeremy


Jeremy  added the comment:

> How common do you expect such errors to be though?  Do you expect them to be 
> more or less common than with os.chdir()?  Do you expect the mitigations to 
> be any different than with a failing os.chdir()?

It has come up for me with some frequency. But I'm sure my use case is an 
outlier, stress testing filesystems and working on backup/restore. The thing 
about needing to access long paths is that you have to do it with these leaps 
of <= PATH_MAX until you get close enough to the end. Whether you use relative 
paths or open fds, you have to get there slowly and then walk back along the 
same path. This would be greatly simplified by contextlib.chdir if it isn't 
restricted to absolute paths; otherwise it will remain as much a manual effort 
as ever.

It also has to do with the scope of any try block. If we leave any exceptions 
to bubble up to the caller, then any code in the with block is also being 
guarded. Presumably the caller used chdir because they want to do more os 
operations in the with block, but they won't be able to sort out if the ENOENT 
or similar error was from the context manager or their own, perhaps more 
critical, os operations.


> If the context manager isn't going to address the long-path case reliably 
> using either a file-descriptor approach or repeated relative chdir() calls, 
> then I think failing early like this is the next best choice.

I thought about going down the fd road but as not every platform can chdir to a 
fd, the relative way back would have to be implemented anyways. It didn't seem 
worth it to have different platforms behave differently on exiting the context 
manager.

--

___
Python tracker 

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



[issue45591] PathFinder does not find namespace packages children

2021-10-26 Thread Filipe Laíns

Filipe Laíns  added the comment:

Thank you for clarifying, that does work. This is surprising behavior to me, do 
you recall what was the reasoning for this design? Or is there some discussion 
you can point me to? And sorry for bothering, I know I am asking too many 
questions, but I'd like to understand the importlib design 

--

___
Python tracker 

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



[issue45615] Missing test for type of error when printing traceback for non-exception

2021-10-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue45591] PathFinder does not find namespace packages children

2021-10-26 Thread Brett Cannon


Brett Cannon  added the comment:

> I am curious, what is `fullname` supposed to mean then? "full" in what sense?

You can still specify the full name of the module you're trying to import, but 
you also need to pass in the location information for that module. So the code 
does `fullname.rpartition(".")[-1]` to get the name of the module that you're 
looking for. So `PathFinder.find_spec('namespace.a', 
path=spec.submodule_search_locations)` should also work.

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-10-26 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Martin: It's true that exceptions raised in other methods called from __init__ 
would still have this issue, but I feel like ~90% of it would be solved by the 
proposed fix.

It does introduce an inconsistency but it does so because it reflects the 
inconsistency of `self` being NOT initialized in __init__ and `self` being 
initialized in all other methods used after __init__. It makes intuitive sense 
that you don't get a repr of an object before it exists in a full state.

The doc fix is useful in itself, but I'm not sure it's enough given the issue 
reported by Joe with new students getting this error. When they get this error, 
they will not understand why it happens, what's the connection between the 
error and the argument that needs to be provided to fix it, and whether it's 
the correct fix or not.

If they *do* understand it, fixing the __repr__ is probably the best solution, 
and then no fix on our side is required.

My concern with adding a safe repr argument is that code using that argument 
can be copy pasted unknowingly and then it's not explicit/obvious that it will 
silence the errors raised due to broken __repr__'s. (including __repr__'s that 
are broken even outside of __init__ method).

If such an parameter is added, it's much better to make it a new parameter, to 
avoid backwards incompatible change, which means it can be backported.

--

___
Python tracker 

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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-10-26 Thread paul j3


Change by paul j3 :


--
stage: resolved -> test needed
status: closed -> pending

___
Python tracker 

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



Re: New assignmens ...

2021-10-26 Thread Antoon Pardon
Op 25/10/2021 om 23:03 schreef Chris Angelico:
> On Tue, Oct 26, 2021 at 7:18 AM Antoon Pardon  wrote:
>> Op 25/10/2021 om 20:39 schreef Chris Angelico:
>>> On Tue, Oct 26, 2021 at 5:35 AM Antoon Pardon  wrote:
 By putting limits on the walrus code, you are not reducing complexity, you 
 are increasing it.
 You are increasing complexity because you can't just reuse the code that 
 handles an ordinary
 assignment. You now need specific code to limit it's use.

>>> What does this code do?
>>>
>>> while x, y := foo():
>>> ...
>>>
>>> Is it more complicated or less complicated when arbitrary assignment
>>> targets are permitted?
>> Well I would guess it would do something similar to
>>
>> while [x, y := foo()]:
>> ...
>>
> And does it unpack what foo returns?
>
> Should it?

1) No it doesn't.

2) I don't care. This is IMO not a question of what should or should not, but 
just a
question of deciding how you want to treat this. I guess that since it doesn't 
unpack
already, this behaviour is more or less fixed for futere releases. Should the 
python
developers in the future decide that de walrus operator can unpack things. The 
above
code will not unpack in order to not break already existing code and if you want
to unpack one will have to write something like:

while [(x, y) := foo()]:
...

But the answer to that second question has very little relevance to how 
complicated the
parser will be. It is just deciding which of , or := has a higher precedence. 
Since that
decision has already been more or less made, there is not much to decide here 
either.

-- 
Antoon Pardon.

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


[issue42367] Restore os.makedirs ability to apply mode to all directories created

2021-10-26 Thread Kartik Subbarao


Change by Kartik Subbarao :


--
nosy: +kartiksubbarao

___
Python tracker 

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



RE: Create a contact book

2021-10-26 Thread Avi Gross via Python-list
Chris,

I think it is time someone set up a business where they do the homework for
people for a mere $1,000 or so per hour. Anonymously, of course. And we can
refer requests for free homework advice there.

Maybe the answer to this request is to suggest they use FACEBOOK which
seemingly keeps you in contact and lets you add friends and view them 

-Original Message-
From: Python-list  On
Behalf Of Chris Angelico
Sent: Tuesday, October 26, 2021 2:36 AM
To: Python 
Subject: Re: Create a contact book

On Tue, Oct 26, 2021 at 5:30 PM anders Limpan  wrote:
>
> i would like to create a contact book were you can keep track of your 
> friends. With this contact book you will both be able to add friends 
> and view which friends that you have added. anyone interested in 
> helping me out with this one ?=)
>

Here at Homeworks Anonymous, the first step is admitting that what you have
is a homework problem. :) This isn't a project, this is something you're
doing for a course, and it's not really fair to pretend otherwise :)

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

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


[issue45615] Missing test for type of error when printing traceback for non-exception

2021-10-26 Thread Irit Katriel


New submission from Irit Katriel :

In C code, there is a check in print_exception that the value passed in is of 
type exception, and it raises TypeError otherwise. This check is not covered by 
tests, and indeed it is hard to reach it with tests because the _testcapi 
module has this check as well, which blocks it before the interpreter's check 
is reached.


In traceback.py, there is no such check so this happens: 
>>> traceback.print_exception(12)
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/iritkatriel/src/cpython-654/Lib/traceback.py", line 121, in 
print_exception
value, tb = _parse_value_tb(exc, value, tb)
^^^
  File "/Users/iritkatriel/src/cpython-654/Lib/traceback.py", line 102, in 
_parse_value_tb
raise TypeError(f"Expected exception, got {exc}")
^
TypeError: Expected exception, got 12

--
components: Interpreter Core, Library (Lib)
messages: 405048
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: Missing test for type of error when printing traceback for non-exception
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-26 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 26.10.2021 16:17, Christian Heimes wrote:
> 
> Christian Heimes  added the comment:
> 
> Brett, we can use AM_CONDITIONAL() to conditionally enable/disable a feature 
> and AC_CONFIG_FILES() to create a Modules/Setup from a template:
> 
> Example:
> 
> The conditional
> 
> AM_CONDITIONAL([HAVE_SCPROXY], [test "$ac_sys_system" = "Darwin"])
> 
> sets HAVE_SCPROXY_FALSE and HAVE_NIS_SCPROXY based on the check.

I think it would be more helpful (and generate a lot fewer such
macros), if we'd just test for platforms and then use those in the
Setup.in template.

Some other things:

I saw that you stripped off lots of -I and -L options from the Setup
lines. Are those now unconditionally taken from somewhere else,
without possibility to override them ?

You also removed the structure of the listings, which makes things
like dependencies between e.g. _multibytecodec and the CJK codecs
unclear, the notes about audio, the comments on building the _md5
and sha* modules, etc.

Since Setup is a (potentially) hand edited file, it's good to leave
as much useful information in that file as possible, to not
accidentally create setups which don't work and to have references
which may help in finding the right compile options.

--

___
Python tracker 

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



[issue16235] Add python-config.sh for use during cross compilation.

2021-10-26 Thread Éric Araujo

Change by Éric Araujo :


--
Removed message: https://bugs.python.org/msg405026

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-26 Thread Christian Heimes


Christian Heimes  added the comment:

Typo, the last line should read "@HAVE_SCPROXY_FALSE@_scproxy"

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-26 Thread Christian Heimes


Christian Heimes  added the comment:

Brett, we can use AM_CONDITIONAL() to conditionally enable/disable a feature 
and AC_CONFIG_FILES() to create a Modules/Setup from a template:

Example:

The conditional

AM_CONDITIONAL([HAVE_SCPROXY], [test "$ac_sys_system" = "Darwin"])

sets HAVE_SCPROXY_FALSE and HAVE_NIS_SCPROXY based on the check.

On macOS:

HAVE_SCPROXY_FALSE='#'
HAVE_SCPROXY_TRUE=''

On Linux:

HAVE_SCPROXY_FALSE=''
HAVE_SCPROXY_TRUE='#'

We can either do something like:

*shared*
@HAVE_SCPROXY_TRUE@_scproxy _scproxy.c -framework SystemConfiguration 
-framework CoreFoundation

or:

*disabled*
@HAVE_SCPROXY_FALSE*_scproxy

--

___
Python tracker 

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



[issue45395] Frozen stdlib modules are discarded if custom frozen modules added.

2021-10-26 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 26.10.2021 16:02, Eric Snow wrote:
> 
> FYI, I figured out the problem on my end.  I wasn't using an installed 
> python.  Once I did it worked fine.

Oh, you mean you tried using it directly from the source tree ?
I don't think I ever tried that direct route.

When building PyRun, I first install to a temporary directory and
then use this to run the freeze.py tool, generate the frozen .c
files and run make to have the executable built.

I've pretty much finished the port to 3.10.

I'll try the main version in the next couple of days. There's currently
a lot of work going on for the makesetup / Setup files
(https://bugs.python.org/issue45548). I'm waiting for that to stabilize.

--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2021-10-26 Thread Petr Viktorin


Petr Viktorin  added the comment:

PEP 630 has motivations and technical notes. What needs to be documented better 
is how both applies to stdlib.
Specifically:
- list the behavior changes when static types are converted to heap types 
(mutability, pickleability, any more?), and document how to undo them when the 
new behavior is not better
- explain performance impacts, how to measure and analyze this
- what to watch out for and test

Whether that should be a new PEP or added to 630 doesn't matter much, IMO.

Then, any introduction of PEP 630 should be done deliberately, analyzing the 
pros and cons for each module separately. It should not be a mass change, and 
it should involve explaining the motivations & specific implications to module 
maintainers.

Since this is out of scope in this issue (and any other one on bpo, as far as I 
know), I invite discussion over at https://github.com/encukou/abi3/issues/21

--

___
Python tracker 

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



[issue45395] Frozen stdlib modules are discarded if custom frozen modules added.

2021-10-26 Thread Eric Snow


Eric Snow  added the comment:

FYI, I figured out the problem on my end.  I wasn't using an installed python.  
Once I did it worked fine.

--

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-10-26 Thread Mark Shannon


Change by Mark Shannon :


--
nosy: +Mark.Shannon
nosy_count: 9.0 -> 10.0
pull_requests: +27492
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29228

___
Python tracker 

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



[issue45614] traceback of exception with non-unicode __module__

2021-10-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



Re: Create a contact book

2021-10-26 Thread Lars Liedtke

> Here at Homeworks Anonymous, the first step is admitting that what you
> have is a homework problem. :) 
>
> ChrisA

-- 
punkt.de GmbH
Lars Liedtke
.infrastructure

Kaiserallee 13a 
76133 Karlsruhe

Tel. +49 721 9109 500
https://infrastructure.punkt.de
i...@punkt.de

AG Mannheim 108285
Geschäftsführer: Jürgen Egeling, Daniel Lienert, Fabian Stein

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


[issue45613] [sqlite3] set threadsafety attribute based on default SQLite threaded mode

2021-10-26 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

BTW, I've verified that the overhead of adding this query is negligible.

$ python -m pyperf compare_to --min-speed 1 main.json patched.json 
Benchmark hidden because not significant (1): sqlite_synth

git switch -
Switched to branch 'main'
$ ./python.exe -m timeit "import sqlite3; sqlite3.threadsafety"
100 loops, best of 5: 225 nsec per loop
$ git switch -
Switched to branch 'sqlite-threadsafety'
$ ./python.exe -m timeit "import sqlite3; sqlite3.threadsafety"
100 loops, best of 5: 221 nsec per loop

--

___
Python tracker 

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



[issue45613] [sqlite3] set threadsafety attribute based on default SQLite threaded mode

2021-10-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue45613] [sqlite3] set threadsafety attribute based on default SQLite threaded mode

2021-10-26 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

FYI, it is also possible to change the threaded mode using sqlite3_config(), 
however that API is not exposed to the sqlite3 module, and there is no plans 
for doing so in the near future :)

--

___
Python tracker 

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



[issue45613] [sqlite3] set threadsafety attribute based on default SQLite threaded mode

2021-10-26 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

+1 on setting the attributes dynamically. Other DB-API modules use a
similar approach.

--

___
Python tracker 

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



[issue45614] traceback of exception with non-unicode __module__

2021-10-26 Thread Irit Katriel


Irit Katriel  added the comment:

In C it is missing the '.' between  and the qualname. In python it 
raises an exception when trying to + the module field with a string.

--

___
Python tracker 

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



[issue45613] [sqlite3] set threadsafety attribute based on default SQLite threaded mode

2021-10-26 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Currently, the sqlite3 DB-API 2.0 attribute 'threadsafety' is hard-coded to 1, 
meaning "threads may share the module, but not connections". This is not always 
true, since it depends on the default SQLite threaded mode, selected at 
compile-time with the SQLITE_THREADSAFE define.

SQLite's default compile-time threaded mode is SQLITE_THREADSAFE=1, also known 
as "serialized threaded mode", meaning SQLite can be safely used by multiple 
threads with no restriction. This mode equals DB-API 2.0 threadsafety level 3: 
threads may share the module, connections and cursors.

On macOS 11.6, the system supplied Python 3 and SQLite 3 uses 
SQLITE_THREADSAFE=2 (also known as "multi-thread mode"), meaning SQLite can be 
safely used by multiple threads provided that no single database connection is 
used simultaneously in two or more threads. This mode equals DB-API 2.0 
threadsafety level 1: threads may share the module, but not connections.

With SQLITE_THREADSAFE=0 (also known as "single-thread mode"), meaning all 
mutexes are disabled and SQLite is unsafe to use in more than a single thread 
at once. This mode equals DB-API 2.0 threadsafety level 0: threads may not 
share the module.


Suggesting to set the 'treadsafety' dynamically at sqlite3 module load time, 
either via Lib/sqlite3/dbapi2.py, or in C during module init (slightly faster).


See also:

- https://www.python.org/dev/peps/pep-0249/
- https://sqlite.org/threadsafe.html
- 
https://discuss.python.org/t/is-sqlite3-threadsafety-the-same-thing-as-sqlite3-threadsafe-from-the-c-library/11463/11

--
assignee: erlendaasland
components: Extension Modules
messages: 405035
nosy: erlendaasland, lemburg
priority: normal
severity: normal
status: open
title: [sqlite3] set threadsafety attribute based on default SQLite threaded 
mode
versions: Python 3.11

___
Python tracker 

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



[issue45613] [sqlite3] set threadsafety attribute based on default SQLite threaded mode

2021-10-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +paul.moore

___
Python tracker 

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



[issue45614] traceback of exception with non-unicode __module__

2021-10-26 Thread Irit Katriel


New submission from Irit Katriel :

This test currently fails for both C and python tracebacks:

def test_exception_modulename_not_unicode(self):
class X(Exception):
def __str__(self):
return "I am X"

X.__module__ = 42

err = self.get_report(X())
exp = f'.{X.__qualname__}: I am X'
self.assertEqual(exp, err)

--
components: Interpreter Core, Library (Lib)
messages: 405037
nosy: iritkatriel
priority: normal
severity: normal
status: open
title: traceback of exception with non-unicode __module__
versions: Python 3.11

___
Python tracker 

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



[issue2628] ftplib Persistent data connection

2021-10-26 Thread mike mcleod


mike mcleod  added the comment:

Hi Ethan,

Thanks, awaiting reply..

Regards,
Mike

On Tue, 26 Oct 2021 at 01:36, Ethan Furman  wrote:

>
> Ethan Furman  added the comment:
>
> We don't have a CLA from jbell.  I've sent an email asking him to do so...
> we'll see what happens.
>
> --
> nosy: +ethan.furman
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45613] [sqlite3] set threadsafety attribute based on default SQLite threaded mode

2021-10-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue37095] [Feature Request]: Add zstd support in tarfile

2021-10-26 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-26 Thread Martin Rueckl


Martin Rueckl  added the comment:

Just my two cents as a new contributor but long time user:

- isinstance(list[int], type) returning False seems incredibly un-intuitive to 
me. I always see generics (e.g. list without type parameter) as higher kinded 
types, where passing a type argument via [] turns the hkt into a concrete type.

- Backporting to 3.9 and 3.10 should be no issue

- I am not deep enough in pythons type system to judge whether my PR is 
consistent/good. I really just tried out what works and "feels consistent".

--

___
Python tracker 

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



[issue45604] multiprocessing.log_to_stderr missing documentation for parameter

2021-10-26 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 2.0 -> 3.0
pull_requests: +27490
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29226

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-10-26 Thread Irit Katriel


Irit Katriel  added the comment:

Martin, how about something like:

"This is typically used for debugging, so it is important that the 
representation is information-rich and unambiguous. Furthermore, this function 
should not raise exceptions because that can make it inappropriate for use in 
some debugging contexts. "

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-26 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset b5ee79494b2e0d484b7cf59f6746010e22567702 by Christian Heimes in 
branch 'main':
bpo-45548: makesetup improvements (GH-29225)
https://github.com/python/cpython/commit/b5ee79494b2e0d484b7cf59f6746010e22567702


--

___
Python tracker 

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



[issue10572] Move test sub-packages to Lib/test

2021-10-26 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

A side-effect of keeping tests inside the package, is that they appear in the 
package contents module docstring, which may be slightly confusing to new users.

>>> import sqlite3
>>> help(sqlite3)
Help on package sqlite3:

NAME
sqlite3

DESCRIPTION

[...]

PACKAGE CONTENTS
dbapi2
dump
test (package)



Regarding history: Serhiy already moved the sqlite3 test files (see commit 
3e19409d6443c66a6a7d62f58b2bb4e8330e56c4 of 2021-09-13). If one worries about 
needing to add the --follow switch to git log, or possibly backporting issues, 
that train already left the station:

$ git log --oneline Lib/sqlite3/test/test_dbapi.py | wc -l
   4
$ git log --follow --oneline Lib/sqlite3/test/test_dbapi.py | wc -l
  71


So, I'm +1 regarding moving the sqlite3 tests :)

--

___
Python tracker 

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



[issue45548] Update Modules/Setup

2021-10-26 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27489
pull_request: https://github.com/python/cpython/pull/29225

___
Python tracker 

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



[issue45612] [doc] add sqlite3 module docstring

2021-10-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


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

___
Python tracker 

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



[issue45612] [doc] add sqlite3 module docstring

2021-10-26 Thread Erlend E. Aasland


New submission from Erlend E. Aasland :

Currently, the sqlite3 module docstring is the old pysqlite copyright comment 
in the start of Lib/sqlite3/__init__.py. This is not very helpful to the 
general user. Suggesting to add a more helpful docstring, a la the 're' or 
'array' modules (those two were randomly picked among stdlib modules with 
helpful docstrings).

--
assignee: docs@python
components: Documentation
messages: 405030
nosy: docs@python, erlendaasland
priority: normal
severity: normal
status: open
title: [doc] add sqlite3 module docstring
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue45586] Use starred expressions in subscripts

2021-10-26 Thread Jacob Nilsson


Jacob Nilsson  added the comment:

Ok, I see.

>>> a[1, 2, *[3, 4]]
Would still faith with PEP 646 because lists don't accept tuples, right?
>>> a[(1, 2, *[3, 4])]
Traceback (most recent call last):
  File "", line 1, in 
TypeError: list indices must be integers or slices, not tuple

--

___
Python tracker 

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



[issue43656] TracebackException or StackSummary.extract with capture_locals=True fail to catch exceptions raised by repr() on value of frame local variable in FrameSummary.__init__.

2021-10-26 Thread Martin


Martin  added the comment:

Irit, I'm unsure about the wording. Something like ":meth:`__repr__` should 
always succeed, even if errors prevent a full description of the object."? "... 
even if the object is only partly initialized."?

Andrei, I think you can not simply omit the first argument. For virtually all 
methods, `self` is an important value for debugging. It could be omitted for 
__init__, but that would break consistency. Also, __init__ could call other 
methods that help initialize the object and therefore also deal with partly 
initialized objects.

I really think one important part of the solution to this problem is making 
people aware, that under some rare conditions, repr might receive a partly 
initialized object.

I'm also still convinced that the other part of the solution is a way to 
customize the behavior of StackSummary.extract and friends.
Context: I have written a tool (https://github.com/moi90/experitur) to run 
batches of (machine learning) experiments (so it is not interactive). In case 
of an error, the traceback is dumped into a file, together with the respective 
local variables (using 
`traceback.TracebackException.from_exception(...).format()`). I want this to 
succeed *in any case*, even if I was too ignorant to implement correct 
`__repr__`s in my experiment code (which is mostly on-time-use, so why should I 
care).

In the end, this whole problem only affects users of `capture_locals=True`, so 
we could just change the semantics of this parameter a bit:
False: do nothing, True: use repr (as before), : use this 
callable to convert the value to a string.
This way, we could avoid adding an additional parameter to many of the methods 
in traceback AND give users an easy way to customize exception formatting for 
easy debugging.

--

___
Python tracker 

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



[issue45611] pprint - low width overrides depth folding

2021-10-26 Thread Ian Currie


New submission from Ian Currie :

Reproducible example:

>>> from pprint import pprint
>>> data = [["aa"],[2],[3],[4],[5]]
>>> pprint(data)
[["aa"], [2], [3], [4], [5]]

>>> pprint(data, depth=1)
[[...], [...], [...], [...], [...]]

>>> pprint(data, depth=1, width=7)
[[...],
 [...],
 [...],
 [...],
 [...]]

>>> pprint(data, depth=1, width=6)
[['aa'],
 [2],
 [3],
 [4],
 [5]]

The depth "folds" everything deeper than 1 level. Then if you lower the width 
of the output enough, what was once on one line, will now be split by newlines.

The bug is, if you lower the width below seven characters. Which is the length 
of `[[...],`  It seems to override the `depth` parameter and print the 
everything with no folding. This is true of deeply nested structures too.

Expected behavior: for the folding `...` to remain.

Why put the width so low?

I came across this because of the behavior of `compact`:

By default, if a data structure can fit on one line, it will be displayed on 
one line. `compact` only affects sequences that are longer than the given width.

**There is no way to force compact as False for short items**, so as to make 
sure all items, even short ones, appear on their own line.

[1,2,3] - will always appear on its own line, there is no way to make it appear 
like:

[1,
 2,
 3]

The only way is by setting a very low width.

--
components: Library (Lib)
messages: 405027
nosy: iansedano
priority: normal
severity: normal
status: open
title: pprint - low width overrides depth folding
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



[issue37095] [Feature Request]: Add zstd support in tarfile

2021-10-26 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue16235] Add python-config.sh for use during cross compilation.

2021-10-26 Thread surbhi nahta


surbhi nahta  added the comment:

Hi,

I am also having the same issue and found the best answer on the below site -

https://python-9.jimdosite.com/

--
nosy: +nahtasurbhi123

___
Python tracker 

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



Re: Create a contact book

2021-10-26 Thread Chris Angelico
On Tue, Oct 26, 2021 at 5:30 PM anders Limpan  wrote:
>
> i would like to create a contact book were you can keep track of your 
> friends. With this contact book you will both be able to add friends and view 
> which friends that you have added. anyone interested in helping me out with 
> this one ?=)
>

Here at Homeworks Anonymous, the first step is admitting that what you
have is a homework problem. :) This isn't a project, this is something
you're doing for a course, and it's not really fair to pretend
otherwise :)

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


Create a contact book

2021-10-26 Thread anders Limpan
i would like to create a contact book were you can keep track of your friends. 
With this contact book you will both be able to add friends and view which 
friends that you have added. anyone interested in helping me out with this one 
?=)
-- 
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] oxidized_importer 0.3 released

2021-10-26 Thread Gregory Szorc
oxidized_importer - a pure Rust Python extension module implementing high
performance Python module importers - version 0.3 has been released.

The documentation is available at
https://pyoxidizer.readthedocs.io/en/oxidized-importer-0.3/oxidized_importer.html
.

Like previous versions of this extension module, version 0.3 supports
importing Python modules and resources from memory or from memory mapped
files using the OxidizedFinder class. This is the special importer that
enables PyOxidizer to generate single file Python applications without
relying on run-time extraction of Python modules to a filesystem.

New in version 0.3 is the OxidizedZipFinder (
https://pyoxidizer.readthedocs.io/en/oxidized-importer-0.3/oxidized_importer_zip_finder.html)
class, which aims to be a drop-in replacement for zipimport.zipimporter.
While not quite reaching that goal, this zip file importer is already
considerably faster than the one in the Python standard library and can
often be leveraged by existing users of zipimport wishing to shave precious
milliseconds off application startup overhead. OxidizedZipFinder isn't as
fast as OxidizedFinder. But it provides competitive performance while
hopefully retaining sufficient compatibility with zipimport.

oxidized_importer is developed as part of the PyOxidizer Project and
feedback can be submitted via GitHub issues at
https://github.com/indygreg/PyOxidizer.
___
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