[issue45829] Remove C stack use by specializing BINARY_SUBSCR, STORE_SUBSCR, LOAD_ATTR, and STORE_ATTR

2021-11-18 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

This snippet occurs a couple of times in ceval.c (BINARY_SUBSCR_GETITEM and 
CALL_FUNCTION_PY_SIMPLE):

new_frame->previous = frame;
frame = cframe.current_frame = new_frame;
new_frame->depth = frame->depth + 1;

Maybe I'm reading it wrong, but I think the last line is just setting 
new_frame->depth++, leaving new_frame->depth = 1 instead of 
frame->previous->depth + 1.

I think the second and third lines should be swapped?

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue45841] IDLE fails to save files in macOS 12.0.1 Monterey

2021-11-18 Thread Don Chamberlin


Change by Don Chamberlin :


--
title: IDLE fails to save files in macO -> IDLE fails to save files in macOS 
12.0.1 Monterey

___
Python tracker 

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



[issue45841] IDLE fails to save files in macO

2021-11-18 Thread Don Chamberlin


New submission from Don Chamberlin :

Running Python 3.10.0 on MacOS 12.0.1 (Monterey). Start IDLE app to get an IDLE 
shell. Click File->New File. Edit window appears. Type 
# This is a comment
in the edit window, then click File->Save or command-S.
Error popup appears: "The save file operation failed to connect to the open and 
save panel service." (See attached screenshot.)
Click "OK" on the error popup. 
File is now saved in the Documents folder with name "None".

--
assignee: terry.reedy
components: IDLE
files: IDLE save error.png
messages: 406572
nosy: don.chamberlin, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE fails to save files in macO
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50450/IDLE save error.png

___
Python tracker 

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



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2021-11-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +27866
pull_request: https://github.com/python/cpython/pull/29634

___
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-11-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Paul, should this be closed or do you think there is still a namespace issue to 
be resolved?

--
assignee: rhettinger -> 

___
Python tracker 

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



Re: import question

2021-11-18 Thread Chris Angelico
On Fri, Nov 19, 2021 at 3:00 PM Dan Stromberg  wrote:
>
>
> On Thu, Nov 18, 2021 at 6:19 PM Chris Angelico  wrote:
>>
>> On Fri, Nov 19, 2021 at 11:24 AM Dan Stromberg  wrote:
>> >
>> >
>> > On Thu, Nov 18, 2021 at 12:21 PM Chris Angelico  wrote:
>> >>
>> >> If you're trying to make a Python-in-Python sandbox, I recommend not.
>> >> Instead, use an OS-level sandbox (a chroot, probably some sort of CPU
>> >> usage limiting, etc), and use that to guard the entire Python process.
>> >> Python-in-Python will basically *never* be secure.
>> >
>> >
>> > Good advice to not try to sandbox python.
>> >
>> > But chroot can sometimes be broken out of.  It isn't a cure-all.
>> >
>>
>> That's true, but it's way better than attempting Python-in-Python
>> sandboxing. In any case, all the options worth investigating will be
>> at the OS level.
>>
>> (Or maybe higher, but I can't imagine it being practical to create
>> individual VMs for each client who comes to the web site.)
>
>
> Actually, there are ports of CPython and Micropython that run inside a web 
> browser over WASM.  Going with one of these might be safer.
>

Hmm, interesting point. I'd mentally ruled out the in-browser options
since the performance hit is usually far too costly, but if this is
basically an educational site, it MAY be sufficient (people won't need
spectacular performance when they're just learning the basics).

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


[issue34592] cdll.LoadLibrary allows None as an argument

2021-11-18 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

We do need to document this in ctypes.rst.  Quite a bit of code depends on 
ctypes.CDLL(None) and similar to get at symbols linked into the interpreter or 
already dlopened into the process these days.  It works on Linux; I'm assuming 
it likely does on everything POSIXy.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, gregory.p.smith
stage: resolved -> needs patch
status: closed -> open
versions: +Python 3.11 -Python 2.7, Python 3.4, Python 3.5, Python 3.6, 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: import question

2021-11-18 Thread Dan Stromberg
On Thu, Nov 18, 2021 at 6:19 PM Chris Angelico  wrote:

> On Fri, Nov 19, 2021 at 11:24 AM Dan Stromberg 
> wrote:
> >
> >
> > On Thu, Nov 18, 2021 at 12:21 PM Chris Angelico 
> wrote:
> >>
> >> If you're trying to make a Python-in-Python sandbox, I recommend not.
> >> Instead, use an OS-level sandbox (a chroot, probably some sort of CPU
> >> usage limiting, etc), and use that to guard the entire Python process.
> >> Python-in-Python will basically *never* be secure.
> >
> >
> > Good advice to not try to sandbox python.
> >
> > But chroot can sometimes be broken out of.  It isn't a cure-all.
> >
>
> That's true, but it's way better than attempting Python-in-Python
> sandboxing. In any case, all the options worth investigating will be
> at the OS level.
>
> (Or maybe higher, but I can't imagine it being practical to create
> individual VMs for each client who comes to the web site.)
>

Actually, there are ports of CPython and Micropython that run inside a web
browser over WASM.  Going with one of these might be safer.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-18 Thread MRAB

On 2021-11-19 02:40, 2qdxy4rzwzuui...@potatochowder.com wrote:

On 2021-11-18 at 23:16:32 -0300,
René Silva Valdés  wrote:


Hello, I would like to report the following issue:

Working with floats i noticed that:

int(23.99/12) returns 1, and
int(23.999/12) returns 2

This implies that int() function is rounding ...


It's not int() that's doing the rounding; that second numerator is being
rounded before being divided by 12:

 Python 3.9.7 (default, Oct 10 2021, 15:13:22)
 [GCC 11.1.0] on linux
 Type "help", "copyright", "credits" or "license" for more information.
 >>> 23.999
 24.0
 >>> (23.999).hex()
 '0x1.8p+4'

I think this is a bit clearer because it shows that it's not just being 
rounded for display:


Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 19:00:18) [MSC v.1929 
64 bit (AMD64)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> 23.99 == 24
False
>>> 23.999 == 24
True
--
https://mail.python.org/mailman/listinfo/python-list


Re: Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-18 Thread 2QdxY4RzWzUUiLuE
On 2021-11-18 at 23:16:32 -0300,
René Silva Valdés  wrote:

> Hello, I would like to report the following issue:
> 
> Working with floats i noticed that:
> 
> int(23.99/12) returns 1, and
> int(23.999/12) returns 2
> 
> This implies that int() function is rounding ...

It's not int() that's doing the rounding; that second numerator is being
rounded before being divided by 12:

Python 3.9.7 (default, Oct 10 2021, 15:13:22) 
[GCC 11.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 23.999
24.0
>>> (23.999).hex()
'0x1.8p+4'

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


Unexpected behaviour of math.floor, round and int functions (rounding)

2021-11-18 Thread René Silva Valdés
Hello, I would like to report the following issue:

Working with floats i noticed that:

int(23.99/12) returns 1, and
int(23.999/12) returns 2

This implies that int() function is rounding, which doesn't appear to be
expected (documentation doesn't say anything about it). Looking further i
noticed that

0.5+0.49994 returns 1. This seems to be related to double
numbers' operations in C language, where 0.49994 is the
greatest floating-point value less than 0.5. Counting on this several
examples can be deduced, like:

round(0+0.49994) returns 0, and
round(1+0.49994) returns 2

This seems to be a known issue in Java (see reference)


Reference:

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6430675

I hope this information is helpful, thanks in advance for reading this,

Kind regards,

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


Re: import question

2021-11-18 Thread Chris Angelico
On Fri, Nov 19, 2021 at 11:24 AM Dan Stromberg  wrote:
>
>
> On Thu, Nov 18, 2021 at 12:21 PM Chris Angelico  wrote:
>>
>> If you're trying to make a Python-in-Python sandbox, I recommend not.
>> Instead, use an OS-level sandbox (a chroot, probably some sort of CPU
>> usage limiting, etc), and use that to guard the entire Python process.
>> Python-in-Python will basically *never* be secure.
>
>
> Good advice to not try to sandbox python.
>
> But chroot can sometimes be broken out of.  It isn't a cure-all.
>

That's true, but it's way better than attempting Python-in-Python
sandboxing. In any case, all the options worth investigating will be
at the OS level.

(Or maybe higher, but I can't imagine it being practical to create
individual VMs for each client who comes to the web site.)

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


Re: several issues with pyinstaller on Windows 10

2021-11-18 Thread Eryk Sun
On 11/18/21, Ulli Horlacher  wrote:
>
> P:\W10\dist>argv a b
> The process cannot access the file because it is being used by another
> process.

Try searching for open handles for "argv.exe" using Sysinternals
Process Explorer [1]. Terminate the offending process.

Since you're inexperienced with Windows, here's a brief explanation of
ERROR_SHARING_VIOLATION (32).

File objects that are opened for filesystem files have a
read-write-delete sharing mode if the open requests any
read-write-delete data access, but not if the open only has metadata
access (e.g. timestamps, ID, attributes, extended attributes,
security). Note that delete access includes the right to rename a
file.

The share mode flags and associated data access rights are as follows:

FILE_SHARE_READ
- FILE_READ_DATA | FILE_EXECUTE
FILE_SHARE_WRITE
- FILE_WRITE_DATA | FILE_APPEND_DATA
FILE_SHARE_DELETE
- DELETE

For example, if an existing open for a file has any data access and
doesn't share read access, then trying to open the file with execute
access will fail as a sharing violation. The security context of the
open request doesn't matter. For example, SYSTEM and administrators
aren't privileged to bypass the sharing mode. It can only be bypassed
from the kernel.

Unfortunately the system error message for ERROR_SHARING_VIOLATION is
misleading. The sharing mode has nothing to do with processes. It's
strictly a function of the File objects that are opened for the file.

Python's open() and os.open() functions share read and write access,
but they do not share delete access. For example, overlapping calls to
open('spam.txt', 'w') are allowed. For os.stat(), the share mode of
existing opens doesn't matter because it opens the file with metadata
access only.

Sharing data access can get messy. Each open has its own file pointer
in the associated OS file object. For example, say an open writes 10
bytes and flushes the buffer. Then a second open(..., 'w') call
overwrites the file, truncating it to 0 bytes. When the original open
writes to the file again, the OS will back fill the file with 10 null
bytes.

Windows also provides byte-range shared and exclusive locking that can
exceed the current size of the file. A byte-range lock doesn't prevent
opening the file with read, write, or delete access, and it doesn't
prevent deleting the file. It causes write or read-write operations on
the range to fail with ERROR_LOCK_VIOLATION (33).

> win32ctypes.pywin32.pywintypes.error: (110, 'EndUpdateResourceW',
> 'The system cannot open the device or file specified.')

This is likely due to a sharing violation. EndUpdateResourceW() [2]
requires exclusive access to the target file. If its internal open
fails for any reason, it maps all errors to this generic
ERROR_OPEN_FAILED (110) error code.

---
[1] https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer
[2] 
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-endupdateresourcew
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45840] Improve cross-references in the data model documentation

2021-11-18 Thread Alex Waygood


Change by Alex Waygood :


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

___
Python tracker 

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



Re: import question

2021-11-18 Thread Grant Edwards
On 2021-11-17, lucas  wrote:

> are there any other ways to import a module or package other then
> the "import" or "from...import..." statements?  i ask because i'm
> allowing programming on my web2py website and i don't want any
> accessing packages like os or sys.

Safely allowing people to enter/upload and then execute Python code is
very difficult. From my brief research into that question a little
while (a year or two) ago, the answer was that can't really be done in
any general way. IIRC, some promising work was done in PyPy to address
this problem, but the sandbox stuff never got moved to Py3?

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


[issue45840] Improve cross-references in the data model documentation

2021-11-18 Thread Alex Waygood


Change by Alex Waygood :


--
type:  -> behavior

___
Python tracker 

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



[issue45840] Improve cross-references in the data model documentation

2021-11-18 Thread Alex Waygood


New submission from Alex Waygood :

The documentation for the data model has a lot of cross-references to other 
parts of the data model. However, often these cross-references do not have 
proper hyperlinks online, as :meth:`__iter__` is used (for example), instead of 
:meth:`~object.__iter__`. The documentation would be much more readable and 
navigable if this were fixed.

--
assignee: docs@python
components: Documentation
messages: 406569
nosy: AlexWaygood, docs@python
priority: normal
severity: normal
status: open
title: Improve cross-references in the data model documentation
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



Re: import question

2021-11-18 Thread Dan Stromberg
On Thu, Nov 18, 2021 at 12:21 PM Chris Angelico  wrote:

> If you're trying to make a Python-in-Python sandbox, I recommend not.
> Instead, use an OS-level sandbox (a chroot, probably some sort of CPU
> usage limiting, etc), and use that to guard the entire Python process.
> Python-in-Python will basically *never* be secure.
>

Good advice to not try to sandbox python.

But chroot can sometimes be broken out of.  It isn't a cure-all.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45839] python3 executable is able to install pandas

2021-11-18 Thread Eric V. Smith

Eric V. Smith  added the comment:

Please provide information about the system you’re running on. Also, tell us 
how Python was installed. 

I assume the title should be “… is unable to install …”.

--
nosy: +eric.smith

___
Python tracker 

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



[issue10483] http.server - what is executable on Windows

2021-11-18 Thread STINNER Victor


STINNER Victor  added the comment:

> I got the impression that most core developers used Unix-variants for their 
> development, and likely most CGI users as well, and that Windows use of CGI 
> just wasn't a priority for anyone in the core team.

Core devs are volunteers who are free to pick what they like the most. There 
are few core devs who use Python on Windows, whereas they are many Python users 
on Windows.

If you are able to split your enhancements as small PRs, I may be able to have 
a look. We do run our test suite on Windows. If each enhancement has a related 
test valided on Windows, it's ok.


> Deprecation would certainly be a disservice to the community, as CGI is 
the only (as far as I know) universal service available on pretty much 
all web server implementations.

The other question is not if CGI is useful or not, but if it should be 
maintained inside the stdlib, or on PyPI. Well, it's not exclusive :-) It's 
possible to have a more complete implementation on PyPI under a different name.

--

___
Python tracker 

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



Re: How to support annotations for a custom type in a C extension?

2021-11-18 Thread Marco Sulla
It works. Thanks a lot.

On Sun, 19 Sept 2021 at 19:23, Serhiy Storchaka  wrote:
>
> 19.09.21 05:59, MRAB пише:
> > On 2021-09-18 16:09, Serhiy Storchaka wrote:
> >> "(PyCFunction)" is redundant, Py_GenericAlias already has the right
> >> type. Overuse of casting to PyCFunction can hide actual bugs.
> >>
> > I borrowed that from listobject.c, which does have the cast.
>
> Fixed. https://github.com/python/cpython/pull/28450
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45839] python3 executable is able to install pandas

2021-11-18 Thread Muhammad Irfan Asghar


New submission from Muhammad Irfan Asghar :

pip3.10 install pandas
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed 
certificate in certificate chain (_ssl.c:997)'))': /simple/pandas/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed 
certificate in certificate chain (_ssl.c:997)'))': /simple/pandas/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed 
certificate in certificate chain (_ssl.c:997)'))': /simple/pandas/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed 
certificate in certificate chain (_ssl.c:997)'))': /simple/pandas/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, 
status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed 
certificate in certificate chain (_ssl.c:997)'))': /simple/pandas/
Could not fetch URL https://pypi.org/simple/pandas/: There was a problem 
confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): 
Max retries exceeded with url: /simple/pandas/ (Caused by 
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: self signed certificate in certificate chain 
(_ssl.c:997)'))) - skipping
ERROR: Could not find a version that satisfies the requirement pandas (from 
versions: none)
ERROR: No matching distribution found for pandas
Could not fetch URL https://pypi.org/simple/pip/: There was a problem 
confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): 
Max retries exceeded with url: /simple/pip/ (Caused by 
SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: self signed certificate in certificate chain 
(_ssl.c:997)'))) - skipping

--
components: Extension Modules
messages: 406566
nosy: mirfanasghar
priority: normal
severity: normal
status: open
title: python3 executable is able to install pandas
type: security
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



[issue45788] Doc sys.prefix lib & include directories on Windows and Mac

2021-11-18 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue45788] Doc sys.prefix lib & include directories on Windows and Mac

2021-11-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 2a630e716e488ac420d308736568829f76e388a3 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-45788: Link sys.prefix doc to 'Installation paths' (GH-29606)
https://github.com/python/cpython/commit/2a630e716e488ac420d308736568829f76e388a3


--

___
Python tracker 

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



[issue45788] Doc sys.prefix lib & include directories on Windows and Mac

2021-11-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset c06c7c489a82b2db023bb947f0c4d21ad93b8308 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-45788: Link sys.prefix doc to 'Installation paths' (GH-29606) 
(GH-29632)
https://github.com/python/cpython/commit/c06c7c489a82b2db023bb947f0c4d21ad93b8308


--

___
Python tracker 

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



[issue10483] http.server - what is executable on Windows

2021-11-18 Thread Glenn Linderman

Glenn Linderman  added the comment:

On 11/18/2021 7:36 AM, STINNER Victor wrote:
> STINNER Victor  added the comment:
>
> I searched for open issues which contain "cgi" in their title. I found 43 
> open issues. The oldest is 101 months ago.
>
> In 10 years, Lib/cgi.py got 43 commits. Only 13 commits in the last 5 years 
> (since 2016-01-01).
>
> It seems like the cgi module is not really maintained anymore. One option is 
> to do nothing: I guess that the most basic features continue to work.
I got the definite feeling 10 years ago that CGI wasn't being 
maintained, at least for Windows use, and that's why I forked it for 
private use and enhancement.  Nothing in the interim has made me change 
my mind, and your statistics support that.  I got the impression that 
most core developers used Unix-variants for their development, and 
likely most CGI users as well, and that Windows use of CGI just wasn't a 
priority for anyone in the core team.  But it has been useful for me, 
and if a little work were put into supporting it, I suspect it could be 
useful to others as well. But as a lowly non-core user unfamiliar with 
the ever-changing processes for submitting patches, I felt rather 
ignored (which apparently isn't an uncommon issue for users like me), 
but neither did I have the time to invest to learn the submission 
protocols, much less to advance to core development status, so I 
realized that it was partly my fault as well.

> Another option is to start deprecating all code related to CGI in the stdlib.
>
> While CGI is not "commonly" used, it seems like it remains popular for 
> specific usages. So I don't think that it's time to deprecate it :-)

Deprecation would certainly be a disservice to the community, as CGI is 
the only (as far as I know) universal service available on pretty much 
all web server implementations.  There are probably better interfaces to 
user-supplied code on many web servers, but the ones I've heard about 
are not as universal, and not as simple for users to implement.

--

___
Python tracker 

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



[issue10483] http.server - what is executable on Windows

2021-11-18 Thread Ethan Furman


Change by Ethan Furman :


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



Re: import question

2021-11-18 Thread Chris Angelico
On Fri, Nov 19, 2021 at 7:09 AM lucas  wrote:
>
> hello one and all,
>
> are there any other ways to import a module or package other then the 
> "import" or "from...import..." statements?  i ask because i'm allowing 
> programming on my web2py website and i don't want any accessing packages like 
> os or sys.
>
> thank you in advance and have a great day, lucas
>

Yes, there are many. For starters, the importlib module can do
anything that importing can do, as can the __import__ function. Plus,
with Python code, you could open the file, read from it, and exec it.
There are myriad ways to fetch up code, and it's even possible to
break out of a sandbox without ever using a single underscore.

If you're trying to make a Python-in-Python sandbox, I recommend not.
Instead, use an OS-level sandbox (a chroot, probably some sort of CPU
usage limiting, etc), and use that to guard the entire Python process.
Python-in-Python will basically *never* be secure.

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


[issue45788] Doc sys.prefix lib & include directories on Windows and Mac

2021-11-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27864
pull_request: https://github.com/python/cpython/pull/29632

___
Python tracker 

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



[issue45788] Doc sys.prefix lib & include directories on Windows and Mac

2021-11-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 4575c01b750cd26377e803247c38d65dad15e26a by Terry Jan Reedy in 
branch 'main':
bpo-45788: Link sys.prefix doc to 'Installation paths' (#29606)
https://github.com/python/cpython/commit/4575c01b750cd26377e803247c38d65dad15e26a


--

___
Python tracker 

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



[issue45788] Doc sys.prefix lib & include directories on Windows and Mac

2021-11-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +27863
pull_request: https://github.com/python/cpython/pull/29631

___
Python tracker 

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



several issues with pyinstaller on Windows 10

2021-11-18 Thread Ulli Horlacher
On Windows 10 I have installed:

P:\W10>python --version
Python 3.10.0

P:\W10>pyinstaller --version
4.7

I can compile a VERY simple Python program:

P:\W10>type argv.pv
#!/usr/bin/python3

import sys

for a in sys.argv: print("["+a+"]")


P:\W10>pyinstaller.exe --onefile tcpbm.py

But I can run it only once:

P:\W10\dist>argv a b
[dist\argv]
[a]
[b]

P:\W10\dist>argv a b
The process cannot access the file because it is being used by another process.

P:\W10\dist>argv 1 2 zzz
The process cannot access the file because it is being used by another process.


Compiling a little more complex program (with net IO) fails:

P:\W10>pyinstaller.exe --onefile tcpbm.py
140 INFO: PyInstaller: 4.7
140 INFO: Python: 3.10.0
171 INFO: Platform: Windows-10-10.0.19041-SP0
171 INFO: wrote P:\W10\tcpbm.spec
171 INFO: UPX is not available.
203 INFO: Extending PYTHONPATH with paths
['P:\\W10']
531 INFO: checking Analysis
547 INFO: Building Analysis because Analysis-00.toc is non existent
547 INFO: Initializing module dependency graph...
562 INFO: Caching module graph hooks...
593 INFO: Analyzing base_library.zip ...
4656 INFO: Processing pre-find module path hook distutils from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
4656 INFO: distutils: retargeting to non-venv dir 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib'
5781 INFO: Caching module dependency graph...
6031 INFO: running Analysis Analysis-00.toc
6031 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of 
final executable
  required by C:\Users\admin\AppData\Local\Programs\Python\Python310\python.exe
6187 INFO: Analyzing P:\W10\tcpbm.py
6250 INFO: Processing module hooks...
6250 INFO: Loading module hook 'hook-difflib.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6250 INFO: Loading module hook 'hook-distutils.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6250 INFO: Loading module hook 'hook-distutils.util.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6250 INFO: Loading module hook 'hook-encodings.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6390 INFO: Loading module hook 'hook-heapq.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6390 INFO: Loading module hook 'hook-lib2to3.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6484 INFO: Loading module hook 'hook-multiprocessing.util.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6484 INFO: Loading module hook 'hook-pickle.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6484 INFO: Loading module hook 'hook-sysconfig.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6484 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6500 INFO: Loading module hook 'hook-xml.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6546 INFO: Loading module hook 'hook-_tkinter.py' from 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks'...
6734 INFO: checking Tree
6734 INFO: Building Tree because Tree-00.toc is non existent
6749 INFO: Building Tree Tree-00.toc
6890 INFO: checking Tree
6890 INFO: Building Tree because Tree-01.toc is non existent
6890 INFO: Building Tree Tree-01.toc
7031 INFO: checking Tree
7031 INFO: Building Tree because Tree-02.toc is non existent
7031 INFO: Building Tree Tree-02.toc
7062 INFO: Looking for ctypes DLLs
7078 INFO: Analyzing run-time hooks ...
7093 INFO: Including run-time hook 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py'
7093 INFO: Including run-time hook 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
7109 INFO: Including run-time hook 
'C:\\Users\\admin\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
7109 INFO: Looking for dynamic libraries
7546 INFO: Looking for eggs
7546 INFO: Using Python library
C:\Users\admin\AppData\Local\Programs\Python\Python310\python310.dll
7562 INFO: Found binding redirects:
[]
7562 INFO: Warnings written to P:\W10\build\tcpbm\warn-tcpbm.txt

import question

2021-11-18 Thread lucas
hello one and all,

are there any other ways to import a module or package other then the "import" 
or "from...import..." statements?  i ask because i'm allowing programming on my 
web2py website and i don't want any accessing packages like os or sys.

thank you in advance and have a great day, lucas
-- 
https://mail.python.org/mailman/listinfo/python-list


news to me today: RIP Aahz

2021-11-18 Thread Eli the Bearded
Aahz, co-author of Python for Dummies with Stef Maruch, recently passed
away.

Tiny death notice (with name typo) from the wilds of the Internet:

http://file770.com/pixel-scroll-10-15-21-i-know-what-pixel-you-scrolled-last-summer/

(12) AAHZ MARUCH (1967-2021). [Item by James Davis Nicoll.] Python
programmer, whose fannish activities date back at least as far as
classic USENET (alt.poly and other groups), died October 14
following several years of ill health. Survived by partner Steph
Maruch.

Editor's postscript: Alan Prince Winston earlier this year described
him as "an unstoppable-seeming guy" who "became a contra and square
dance caller and choreographer despite really severe hearing
impairment."

I met Aahz once. He always wanted to be a mononym person, and used his
partner's surname only reluctantly.

Elijah
--
Aahz's rule6 website seems to be held by a squatter now

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


[issue45837] Fix turtle deprecations

2021-11-18 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


--
pull_requests: +27862
pull_request: https://github.com/python/cpython/pull/29630

___
Python tracker 

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



[issue45837] Fix turtle deprecations

2021-11-18 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


--
pull_requests: +27861
pull_request: https://github.com/python/cpython/pull/29629

___
Python tracker 

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



[issue45838] Incorrect line numbers in GDB Python backtraces [3.9]

2021-11-18 Thread Sam Gross


Change by Sam Gross :


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

___
Python tracker 

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



Re: get_axes not present?

2021-11-18 Thread Michael Torrie
On 11/18/21 10:54 AM, Mahmood Naderan via Python-list wrote:
> As you can see I put the result of plot() to ax1 and then use some functions, 
> e.g. set_ylabel().

And what is the result of plot()?  Is it a valid object, or is it None?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45711] Simplify the interpreter's (type, val, tb) exception representation

2021-11-18 Thread Irit Katriel


Change by Irit Katriel :


--
pull_requests: +27859
pull_request: https://github.com/python/cpython/pull/29627

___
Python tracker 

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



[issue40059] Provide a toml module in the standard library

2021-11-18 Thread Brett Cannon

Brett Cannon  added the comment:

> Hopefully tomli being less than a year old should not be a blocker, after 
> all, TOML v1.0.0 is itself less than a year old.

It's actually rather important as the semantics of how things work will 
effectively be locked in once a module is added to the stdlib, so we need to be 
careful. Plus had you asked this question less than a year go the answer would 
have been pypi.org/p/toml and now you're suggesting something different, so the 
year matters. 

--

___
Python tracker 

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



[issue45834] Move runtime except: check to the parser

2021-11-18 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue45838] Incorrect line numbers in GDB Python backtraces [3.9]

2021-11-18 Thread Sam Gross


New submission from Sam Gross :

Starting in Python 3.6 the line numbers table contains a *signed* byte 
indicating line delta. The calculation in Tools/gdb/libpython.py was not 
updated to handle signed bytes leading to incorrect line numbers when running 
"py-bt" (or printing frames) in GDB.

This issue does not exist in Python 3.10 or later because line number table was 
changed (and libpython.py was updated) in GH-23113.

--
components: Demos and Tools
messages: 406560
nosy: colesbury
priority: normal
severity: normal
status: open
title: Incorrect line numbers in GDB Python backtraces [3.9]
type: behavior
versions: 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



[issue45640] Production tokens are not clickable

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:

We won't be backporting this to 3.9 due to `make suspicious` being faulty on 
this version. More details on GH-29623.

So this is fixed on 3.10 and 3.11. Thanks, Arthur! ✨  ✨

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

___
Python tracker 

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



Re: get_axes not present?

2021-11-18 Thread Mahmood Naderan via Python-list
>It's not saying get_axes doesn't exist because of version skew, it's
>saying that the object returned by the call to the left of it
>(get_figure()) returned None, and None doesn't have methods
>
>Something isn't set up right, but you'll have to trace that through.



Do you think the following statement is correct?

ax1 = row.plot( fontsize=font_size, 
    linewidth=line_width, 
    markersize=marker_size, 
    marker='o', 
    title='Raw values', 
    label=cnt, 
    ax=axes[0] )
ax1.set_ylabel( yax_label, fontsize=font_size )


As you can see I put the result of plot() to ax1 and then use some functions, 
e.g. set_ylabel().

On the other hand, I have specified `label` and `ax` in plot(), too.



Regards,
Mahmood

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


[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 591bf416090fb00795eed51f6863e3c5d9036c89 by Miss Islington (bot) 
in branch '3.9':
[3.9] [doc] bpo-45680: Disambiguate ``__getitem__`` and ``__class_getitem__`` 
in the  data model (GH-29389) (GH-29619)
https://github.com/python/cpython/commit/591bf416090fb00795eed51f6863e3c5d9036c89


--

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset fde9f61e70bc38850783c81bf7c80c764ba6d9fa by Miss Islington (bot) 
in branch '3.10':
[3.10] [doc] bpo-45680: Disambiguate ``__getitem__`` and ``__class_getitem__`` 
in the  data model (GH-29389) (GH-29620)
https://github.com/python/cpython/commit/fde9f61e70bc38850783c81bf7c80c764ba6d9fa


--

___
Python tracker 

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



[issue45795] urllib http client vulnerable to DOS attack

2021-11-18 Thread Muhammad Farhan


Muhammad Farhan  added the comment:

Maximum time in seconds that you allow the whole operation to take. This is 
useful for preventing your batch jobs from hanging for hours due to slow 
networks or links going down. Since 7.32.0, this option accepts decimal values, 
but the actual timeout will decrease in accuracy as the specified timeout 
increases in decimal precision.

If this option is used several times, the last one will be used.

Examples:

 curl --max-time 10 https://example.com
 curl --max-time 2.92 https://example.com

Ref: 
https://curl.se/docs/manpage.html#-m

--

___
Python tracker 

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



[issue10483] http.server - what is executable on Windows

2021-11-18 Thread mike mcleod


mike mcleod  added the comment:

Hi Victor,

Ok I'll do that.

Regards,
Mike

On Thu, 18 Nov 2021 at 15:36, STINNER Victor  wrote:

>
> STINNER Victor  added the comment:
>
> I searched for open issues which contain "cgi" in their title. I found 43
> open issues. The oldest is 101 months ago.
>
> In 10 years, Lib/cgi.py got 43 commits. Only 13 commits in the last 5
> years (since 2016-01-01).
>
> It seems like the cgi module is not really maintained anymore. One option
> is to do nothing: I guess that the most basic features continue to work.
> Another option is to start deprecating all code related to CGI in the
> stdlib.
>
> While CGI is not "commonly" used, it seems like it remains popular for
> specific usages. So I don't think that it's time to deprecate it :-)
>
>
> > You can for sure make a pull request and see if a core dev will review
> and merge it
>
> Yep, just do that ;-) So far, nobody proposed a PR to fix this issue.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue45640] Production tokens are not clickable

2021-11-18 Thread Łukasz Langa

Change by Łukasz Langa :


--
pull_requests: +27857
pull_request: https://github.com/python/cpython/pull/29623

___
Python tracker 

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



[issue45640] Production tokens are not clickable

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 252d83cbf1bf0a6ac22a1347e760cd3e551bb834 by Miss Islington (bot) 
in branch '3.10':
bpo-45640: [docs] Tokens are now clickable (GH-29260) (GH-29621)
https://github.com/python/cpython/commit/252d83cbf1bf0a6ac22a1347e760cd3e551bb834


--

___
Python tracker 

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



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Sam! ✨  ✨

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



[issue44959] EXT_SUFFIX is missing '.sl' on HP-UX

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 6d66de97f814fb504296c153957d87e49993f8ec by Miss Islington (bot) 
in branch '3.10':
bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX 
(GH-27857) (GH-29152)
https://github.com/python/cpython/commit/6d66de97f814fb504296c153957d87e49993f8ec


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45736] 2to3 does not support integer division fixing

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:

We don't accept new features for 3.10 anymore, and since 2to3 is deprecated, we 
won't be updating it with new fixers and so on. It is pending removal in Python 
3.13.

Sorry, I understand this is a bummer but this part of Python hasn't seen 
serious development for the past few years and its parser is incompatible with 
modern 3.9+ code.

--
nosy: +lukasz.langa
resolution:  -> wont fix
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



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread miss-islington


miss-islington  added the comment:


New changeset 9450c751cc2053b1c2e03ec92ed822a41223b142 by Miss Islington (bot) 
in branch '3.9':
bpo-45835: Fix race condition in test_queue (GH-29601)
https://github.com/python/cpython/commit/9450c751cc2053b1c2e03ec92ed822a41223b142


--

___
Python tracker 

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



[issue45701] Add tuple tests to `functools.lru_cache`

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 0df5d31ac7b32d3b948952c834783cd357fa3e22 by Miss Islington (bot) 
in branch '3.10':
bpo-45701:  Improve documentation for *typed* parameter (GH-29498) (GH-29509)
https://github.com/python/cpython/commit/0df5d31ac7b32d3b948952c834783cd357fa3e22


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45836] unittest.TestCase.assertWarns raises RuntimeEror if sys.modules changes size (Python 3.9)

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:

Thanks, Dennis! ✨  ✨

--
nosy: +lukasz.langa
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



[issue29620] unittest.TestCase.assertWarns raises RuntimeEror if sys.modules changes size

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 71d842b9c1e9d86ede449783e630b7a768b579d6 by Miss Islington (bot) 
in branch '3.9':
bpo-29620: iterate over a copy of sys.modules (GH-4800) (GH-29605)
https://github.com/python/cpython/commit/71d842b9c1e9d86ede449783e630b7a768b579d6


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45795] urllib http client vulnerable to DOS attack

2021-11-18 Thread Christian Heimes


Christian Heimes  added the comment:

Please don't post screenshots. Screenshots are neither accessible nor 
searchable. It's better to link to documentation and copy the relevant 
sentences here.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue45640] Production tokens are not clickable

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 32959108f9c543e3cb9f2b68bbc782bddded6f42 by Arthur Milchior in 
branch 'main':
bpo-45640: [docs] Tokens are now clickable (GH-29260)
https://github.com/python/cpython/commit/32959108f9c543e3cb9f2b68bbc782bddded6f42


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45640] Production tokens are not clickable

2021-11-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +27856
pull_request: https://github.com/python/cpython/pull/29621

___
Python tracker 

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



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 5cf05c71d13a4b4a94cc77da4214ee2f0b9c7de7 by Miss Islington (bot) 
in branch '3.10':
bpo-45835: Fix race condition in test_queue (GH-29601) (GH-29612)
https://github.com/python/cpython/commit/5cf05c71d13a4b4a94cc77da4214ee2f0b9c7de7


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45775] Implementation of colorsys.rgb_to_yuv and vice versa

2021-11-18 Thread STINNER Victor


STINNER Victor  added the comment:

The GIMP image editor uses https://gegl.org/babl/ which supports tons of 
formats and supports color spaces, ICC profiles, etc.

I would also prefer to keep colorsys simple and so not support ICC profiles for 
example.

YUV is a common color encoding system. It's used by the JPEG image format and 
MPEG video format for example.
https://en.wikipedia.org/wiki/YUV

In terms of complexity and maintenance burden, supporting YUV (PR 29512) sounds 
reasonable me.

If colorsys is limited to RGB/HLS/HSV, I'm not sure if it is useful. Nowadays, 
there are more color formats which are getting popular. If they are not 
supported, maybe it's better to just remove the module. I don't know.

Well, I don't have a strong opinion on adding YUV support or not.

--

___
Python tracker 

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



Re: get_axes not present?

2021-11-18 Thread Mats Wichmann

On 11/18/21 02:49, Mahmood Naderan via Python-list wrote:


   File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 903, in _get_subplots
     ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, 
Subplot)
AttributeError: 'NoneType' object has no attribute 'get_axes'




I guess there is a mismatch between versions. Is there any workaround for that?


It's not saying get_axes doesn't exist because of version skew, it's 
saying that the object returned by the call to the left of it 
(get_figure()) returned None, and None doesn't have methods


Something isn't set up right, but you'll have to trace that through.

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


[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 31b3a70edb1216bdc8fab3b2eafd8ddb00487f41 by Alex Waygood in 
branch 'main':
[doc] bpo-45680: Disambiguate ``__getitem__`` and ``__class_getitem__`` in the  
data model (GH-29389)
https://github.com/python/cpython/commit/31b3a70edb1216bdc8fab3b2eafd8ddb00487f41


--

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2021-11-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27855
pull_request: https://github.com/python/cpython/pull/29620

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2021-11-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27854
pull_request: https://github.com/python/cpython/pull/29619

___
Python tracker 

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



Re: Advantages of Default Factory in Dataclasses

2021-11-18 Thread David Lowry-Duda
On Tue, Nov 16, 2021 at 06:24:43PM -0500, Alan Bawden wrote:
>```python
>def add_to(elem, inlist=[]):
>inlist.append(elem)
>return inlist
> 
>list1 = add_to(1)
>list2 = add_to(2)
>print(list1)  # prints [1]
>print(list2)  # prints [1, 2], potentially confusing
>```
> 
> Not only does it not print what "most people" expect.  It also doesn't
> print what _you_ expect!  (But you made your point.)

Haha, you're right. I would guess that I reordered the statements when I 
quickly checked this in the interpreter. But indeed, both list1 and 
list2 point to inlist, and thus are the same. Whoops!

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


[issue10483] http.server - what is executable on Windows

2021-11-18 Thread STINNER Victor


STINNER Victor  added the comment:

I searched for open issues which contain "cgi" in their title. I found 43 open 
issues. The oldest is 101 months ago.

In 10 years, Lib/cgi.py got 43 commits. Only 13 commits in the last 5 years 
(since 2016-01-01).

It seems like the cgi module is not really maintained anymore. One option is to 
do nothing: I guess that the most basic features continue to work. Another 
option is to start deprecating all code related to CGI in the stdlib.

While CGI is not "commonly" used, it seems like it remains popular for specific 
usages. So I don't think that it's time to deprecate it :-)


> You can for sure make a pull request and see if a core dev will review and 
> merge it

Yep, just do that ;-) So far, nobody proposed a PR to fix this issue.

--

___
Python tracker 

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



[issue45775] Implementation of colorsys.rgb_to_yuv and vice versa

2021-11-18 Thread Petr Viktorin


Petr Viktorin  added the comment:

I argued for keeping colorsys: RGB/HLS/HSV are useful in several fields. 
Colorsys is a nice low-power battery to have around for e.g. picking a color 
for highlighting any kind of output.

YIQ is the odd one out: it describes actual color, rather than instructions for 
a monitor. I think that if you need YIQ, YUV, CMYK, sRGB, XYZ or Lab, you 
should reach for a more specialized library. In other words, I don't see YIQ as 
an example to be followed.

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue10483] http.server - what is executable on Windows

2021-11-18 Thread STINNER Victor


STINNER Victor  added the comment:

> I have put the question on Discuss and wait for (any) responses,

Link to the discussion:
https://discuss.python.org/t/issue-10483-http-server-what-is-executable-on-windows/11856

--
nosy: +vstinner

___
Python tracker 

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



[issue45837] Fix turtle deprecations

2021-11-18 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c94664c262bddbff4604795d46ecd0935402df8e by Hugo van Kemenade in 
branch 'main':
bpo-45837: Properly deprecate turtle.RawTurtle.settiltangle (GH-29618)
https://github.com/python/cpython/commit/c94664c262bddbff4604795d46ecd0935402df8e


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue45795] urllib http client vulnerable to DOS attack

2021-11-18 Thread Muhammad Farhan


Muhammad Farhan  added the comment:

So, the idea is to make timeout for the whole operation and it should not reset 
in any case.

--

___
Python tracker 

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



[Python-announce] SCons 4.3.0 released

2021-11-18 Thread Bill Deegan
A new SCons release, 4.3.0, is now available
on the SCons download page:

  https://scons.org/pages/download.html


NOTE: 4.3.0 now requires Python 3.6.0 and above. Python 3.5.x is no longer
supported

Here is a summary of the changes since 4.2.0:

NEW FUNCTIONALITY
-

- Ninja - Added ninja API 'NINJA_FORCE_SCONS_BUILD' to force a node to
callback to scons.
- Add support for Visual Studio 2022.

DEPRECATED FUNCTIONALITY


- The qt tool, which targets Qt version 3, is deprecated. Qt3 has been
unsupported by
  upstream for many years.  Qt4 and Qt5 tools are available from
scons-contrib.

CHANGED/ENHANCED EXISTING FUNCTIONALITY
---

- Ninja - Expanded ninja Mkdir to also support Mkdir actions.
- Further PCH updates. It's now recommended that env['PCH'] should always
be a File node.
  Either via return value from env.PCH() or by explicitly using
File('StdAfx.pch').
- Change SCons.Platform.win32.get_architecture() to return
platform.platform() when run in an
  environment where neither: PROCESSOR_ARCHITEW6432 nor
PROCESSOR_ARCHITECTURE is set.
  This should fix platform tests which started failing when
HOST_OS/HOST_ARCH changes
  introduced by Aaron Franke (listed below) were merged.
- The Java tool now accepts more versions (up to 17.0), and is better
  able to detect the many builds of OpenJDK available since it became
  designated the reference Java implementation.

FIXES
-

- Fix reproducible builds. Restore logic respecting SOURCE_DATE_EPOCH when
set.
- Small fix to ensure CLVar default value is an empty list.
  See MongoDB bug report: https://jira.mongodb.org/browse/SERVER-59656
  Code contributed by MongoDB.
- Ninja - Fix ninja tool to never use for_sig substitution because ninja
does not use signatures. This
  issue affected CommandGeneratorAction function actions specifically.
- Fix PCH not being evaluated by subst() where necessary.
- Fix issue #4021.  Change the way subst() is used in Textfile() to not
evaluate '$$(' -> '$',
  but instead it should yield '$('.
- Ninja - Fix command line escaping for ninja dollar sign escape. Without
escaping ninja properly,
- Fix MSVS tests (vs-N.N-exec.py) for MSVS 6.0, 7.0, and 7.1 (import
missing module).
- Fix command line escaping for ninja dollar sign escape. Without escaping
ninja properly,
  the ninja file scons regenerate and callback invocations will lose the $
characters used in
  the scons command line which ninja uses itself for escaping. For Example:
  scons BUILD=xyz OTHERVAR=$BUILD
  Prior to this fix, it would cause ninja to fail to escape the dollar
sign, leading to the
  single dollar sign being used as a ninja escape character in the ninja
file.
- Ninja - Fixed an issue where if you control-c and/or killed ninja while
it was running scons to regenerate
  build.ninja you would end up with no build.ninja file and have to rerun
scons from scratch.
  Code contributed by MongoDB.

DEVELOPMENT
---

- Added --no-ignore-skips to runtest.py. Changed default to ignore skips
when setting
  runtest.py's exit status. Previously would exit 2 if any tests were
skipped.
  Now will only exit 2 if user specifies --no-ignore-skips and some tests
were skipped.

Thanks to the following contributors listed below for their contributions
to this release.
==
.. code-block:: text

git shortlog --no-merges -ns 4.2.0..HEAD
47  Mats Wichmann
46  William Deegan
14  Jacob Cassagnol
11  Daniel Moody
 8  Ryan Egesdahl
 5  Joseph Brill
 4  Omar Polo
 2  Brian Quistorff
 1  Aaron Franke
___
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


[issue45837] Fix turtle deprecations

2021-11-18 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


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

___
Python tracker 

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



[issue45837] Fix turtle deprecations

2021-11-18 Thread Hugo van Kemenade


New submission from Hugo van Kemenade :

turtle's settiltangle was deprecated in Python 3.1:

"Deprecated since version 3.1."

https://docs.python.org/3.10/library/turtle.html#turtle.settiltangle says of 
settiltangle:


And the reason:

"`Turtle.tiltangle()` has been enhanced in functionality: it now can be used to 
get or set the tiltangle. `Turtle.settiltangle()` has been deprecated."

https://docs.python.org/3.10/library/turtle.html#changes-since-python-3-0


However, in docstrings, tiltangle was accidentally marked as deprecated:

"Deprecated since Python 3.1"

https://github.com/python/cpython/blob/v3.10.0/Lib/turtle.py#L2880


Neither tiltangle nor settiltangle raise DeprecationWarnings.


So let's:

* Correct tiltangle's docstring to say it's not really deprecated
* Update settiltangle's docstring to say it is deprecated
* Add a DeprecationWarning to settiltangle
* Internally call self.tiltangle instead of self.settiltangle


BPO references:

2009 https://bugs.python.org/issue5923 - settiltangle originally deprecated, 
with rationale.

2010 https://bugs.python.org/issue7888 - the mixup was discovered and 
apparently corrected in py3k and release31-maint. I've not done the SCM 
archaeology to discover why this regressed.

2020 https://bugs.python.org/issue41165 - both mentioned as deprecated, mixup 
not noted.

--
components: Library (Lib)
messages: 406536
nosy: hugovk
priority: normal
severity: normal
status: open
title: Fix turtle deprecations
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



[issue45573] Use pkg-config autoconf macros to detect flags for Modules/Setup

2021-11-18 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset e4bb22fabbea72776b377733047e0f32e0388059 by Christian Heimes in 
branch 'main':
bpo-45573: Add Modules/Setup.stdlib with conditional modules (GH-29615)
https://github.com/python/cpython/commit/e4bb22fabbea72776b377733047e0f32e0388059


--

___
Python tracker 

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



[issue45831] _Py_DumpASCII() writes characters one by one leading to corrupted tracebacks

2021-11-18 Thread STINNER Victor

STINNER Victor  added the comment:

> Thanks, Victor! ✨  ✨

I'm curious to know if the traceback became a little more readable than  
msg406480 with this minor enhancement ;-)

--

___
Python tracker 

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



[issue42540] Debug pymalloc crash when using os.fork() [regression]

2021-11-18 Thread STINNER Victor


STINNER Victor  added the comment:

Do you think that it would be worth it to dump the memory allocation when a 
Fatal Python error related to a memory error is triggered?

--

___
Python tracker 

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



[issue45573] Use pkg-config autoconf macros to detect flags for Modules/Setup

2021-11-18 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27852
pull_request: https://github.com/python/cpython/pull/29616

___
Python tracker 

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



[issue45795] urllib http client vulnerable to DOS attack

2021-11-18 Thread Muhammad Farhan


Muhammad Farhan  added the comment:

See the max_time.png and curl.png

--
Added file: https://bugs.python.org/file50449/curl.png

___
Python tracker 

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



[issue45795] urllib http client vulnerable to DOS attack

2021-11-18 Thread Muhammad Farhan


Muhammad Farhan  added the comment:

Yes, other clients like curl does not reset the timeout

See the attached screenshots for references.

--
Added file: https://bugs.python.org/file50448/max_time.png

___
Python tracker 

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



[issue45573] Use pkg-config autoconf macros to detect flags for Modules/Setup

2021-11-18 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27851
pull_request: https://github.com/python/cpython/pull/29615

___
Python tracker 

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



[issue45829] Remove C stack use by specializing BINARY_SUBSCR, STORE_SUBSCR, LOAD_ATTR, and STORE_ATTR

2021-11-18 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 21fa7a3e8f99a1a32467f85c877e40cbdafa9da7 by Mark Shannon in 
branch 'main':
bpo-45829: Specialize BINARY_SUBSCR for __getitem__ implemented in Python. 
(GH-29592)
https://github.com/python/cpython/commit/21fa7a3e8f99a1a32467f85c877e40cbdafa9da7


--

___
Python tracker 

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



[issue45512] [sqlite3] simplify "isolation level"

2021-11-18 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

Thanks for reviews and improvements, Dong-hee :)

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



[issue45834] Move runtime except: check to the parser

2021-11-18 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Fantastic point, Irit! Will try to make s prototype this week

--

___
Python tracker 

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



[issue45573] Use pkg-config autoconf macros to detect flags for Modules/Setup

2021-11-18 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 5275e59c0c1b26226608e6c7c2548c26192d6575 by Christian Heimes in 
branch 'main':
bpo-45573: check for ossaudiodev in configure (GH-29614)
https://github.com/python/cpython/commit/5275e59c0c1b26226608e6c7c2548c26192d6575


--

___
Python tracker 

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



get_axes not present?

2021-11-18 Thread Mahmood Naderan via Python-list
Hi
I am using the following versions


>>> import matplotlib
>>> print(matplotlib. __version__)
3.3.4
>>> import pandas as pd
>>> print(pd.__version__)
1.2.3
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=8, micro=10, releaselevel='final', serial=0)



In my code, I use axes in Pandas plot() like this (note that I omit some 
variables in this snippet to highlight the problem):



def plot_dataframe(df, cnt, axes):
    plt.subplot(2, 1, 1)
    ax1 = row.plot( fontsize=font_size, linewidth=line_width, 
markersize=marker_size, marker='o', title='Raw values', label=cnt, ax=axes[0] )



def plot_kernels(my_dict2):
    fig,axes = plt.subplots(2,1, figsize=(20, 15))
    should_plot = plot_dataframe(df, cnt, axes=axes)
    for ax in axes:
    ax.legend()
    plt.show()



However, I get this error:


Traceback (most recent call last):
  File "process_csv.py", line 174, in 
    plot_kernels( my_dict2 )
  File "process_csv.py", line 62, in plot_kernels
    should_plot = plot_dataframe(df, cnt, axes=axes)
  File "process_csv.py", line 34, in plot_dataframe
    ax1 = row.plot( fontsize=font_size, linewidth=line_width, 
markersize=marker_size, marker='o', title='Raw values', label=cnt, ax=axes[0] )
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_core.py", 
line 955, in __call__
    return plot_backend.plot(data, kind=kind, **kwargs)
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/__init__.py",
 line 61, in plot
    plot_obj.generate()
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 283, in generate
    self._adorn_subplots()
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 483, in _adorn_subplots
    all_axes = self._get_subplots()
  File 
"/home/mahmood/.local/lib/python3.8/site-packages/pandas/plotting/_matplotlib/core.py",
 line 903, in _get_subplots
    ax for ax in self.axes[0].get_figure().get_axes() if isinstance(ax, Subplot)
AttributeError: 'NoneType' object has no attribute 'get_axes'




I guess there is a mismatch between versions. Is there any workaround for that?




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


[issue45832] Misleading membersip expression documentation

2021-11-18 Thread Harald Husum


Harald Husum  added the comment:

I am realising that me not knowing about the hash invariance is likely a 
symptom of something I have in common with most Python users, but not with 
Python maintainers: Having access to a powerful ecosystem, we mostly get our 
classes from 3rd parties, rather than implement them ourselves. When I do 
define my own classes, I usually don't have to touch the `__hash__` or `__eq__` 
implementations, since I am either subclassing, making a plain dataclass, or 
leaning on `attrs` to help me out. I think it is telling that even the pandas 
core devs are able to mess this up, and it suggests to me that this invariance 
isn't emphasised enough.

Here's a go at specifying what I mean with a backlink:

"""
For sequence container types such as list, tuple, or collections.deque,
the expression `x in y` is equivalent to `any(x is e or x == e for e in y)`.
For container that use hashing, such as dict, set, or frozenset, 
the same equivalence holds, assuming the [hash 
invariance](https://docs.python.org/3/glossary.html#term-hashable).
"""

I just derived this more or less directly from Hettinger's formulation. It 
could probably be made clearer.

I am realising that this, (famous, it seems), hash invariance isn't defined in 
isolation anywhere, making it slightly hard to link to. Any better suggestions 
than the glossary entry for hashable, which has the definition included? To me, 
it seems that such a fundamental assumption/convention/requirement, that isn't 
automatically enforced, should be as easy as possible to point to.

In my search for the definition (prompted by Hettinger) i discovered more 
surprised, by the way.

Surprise 1:
https://docs.python.org/3/library/collections.abc.html?highlight=hashable#collections.abc.Hashable

> ABC for classes that provide the __hash__() method.

Having now discovered the mentioned invariance, I am surprised this isn't 
explicitly formulated (and implemented? haven't checked) as:

"""
ABC for classes that provide the __hash__() and __eq__() methods.
"""

I also think this docstring deserves a backlink to the invariance definition, 
given it's importance, and how easy it is to shoot yourself in the foot. The 
current formulation of this docstring actually reflected what I (naively) 
assumed it meant to be hashable, suggesting this is the place in the docs I got 
my understanding of the term from.

Surprise 2:
https://docs.python.org/3/reference/expressions.html?highlight=hashable#value-comparisons

> The `hash()` result should be consistent with equality. Objects that are 
> equal should either have the same hash value, or be marked as unhashable.

I appreciate that this is mentioned in this section (I was hoping to find it). 
But it feels like a reiteration of the definition of the invariant, and could 
thus be replaced with a backlink, like suggested above. I'd much rather see the 
text real estate be used for a motivating statement (you do't want weird 
behaviour in sets and dicts), and a reminder of the importance of checking the 
__hash__ implementation if you are modifying the __eq__ implementation, in, 
say, some subclass.

Surprise 3:
https://docs.python.org/3/reference/datamodel.html#object.__eq__

> See the paragraph on __hash__() for some important notes on creating hashable 
> objects which support custom comparison operations and are usable as 
> dictionary keys.

Another case of the invariance being mentioned (I appreciate it), but in a way 
where it isn't directly evident that extreme care should be taken when 
modifying an __eq__ implementation. Perhaps another case where the invariance 
should be referred to by link, and the text should focus on the consequences of 
breaking it.

Surprise 4:
https://docs.python.org/3/reference/datamodel.html#object.__hash__

Another definition-in-passing of the invariance:

> The only required property is that objects which compare equal have the same 
> hash value.

Also replaceable by backlink?

There after follows descriptions of some, (in hindsight very important), 
protection mechanisms.

> User-defined classes have __eq__() and __hash__() methods by default; with 
> them, all objects compare unequal (except with themselves) and x.__hash__() 
> returns an appropriate value such that x == y implies both that x is y and 
> hash(x) == hash(y).

> A class that overrides __eq__() and does not define __hash__() will have its 
> __hash__() implicitly set to None.

But yet again, without some motivating statement for why we care about the 
invariance, all of this seems, well, surprising and weird.

Surprise 5:
https://docs.python.org/3/library/functions.html#hash

Perhaps another location where a backlink would be in order, although not sure 
in this case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 

[issue1778410] removeTest() method patch for unittest.TestSuite

2021-11-18 Thread Irit Katriel

Irit Katriel  added the comment:

I agree with Michael that it’s better not to include the test in the first 
place. This issue was abandoned 8 years ago, closing now.

--
nosy: +iritkatriel
resolution:  -> rejected
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



[issue45510] Specialize BINARY_SUBTRACT

2021-11-18 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you Mark!

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



[issue45510] Specialize BINARY_SUBTRACT

2021-11-18 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 345ba3f080c140dee3102f472bc166c2db191bcc by Dong-hee Na in branch 
'main':
bpo-45510: Specialize BINARY_SUBTRACT (GH-29523)
https://github.com/python/cpython/commit/345ba3f080c140dee3102f472bc166c2db191bcc


--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue45512] [sqlite3] simplify "isolation level"

2021-11-18 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 0920b61a0cb30128287ebafab1df8cad3a3dffdb by Erlend Egeberg 
Aasland in branch 'main':
bpo-45512: Use Argument Clinic to set sqlite3 isolation level (GH-29593)
https://github.com/python/cpython/commit/0920b61a0cb30128287ebafab1df8cad3a3dffdb


--

___
Python tracker 

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



[issue45573] Use pkg-config autoconf macros to detect flags for Modules/Setup

2021-11-18 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +27850
pull_request: https://github.com/python/cpython/pull/29614

___
Python tracker 

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



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset df3e53d86b2ad67da9ac2b5a3f56257d1f394982 by Sam Gross in branch 
'main':
bpo-45835: Fix race condition in test_queue (#29601)
https://github.com/python/cpython/commit/df3e53d86b2ad67da9ac2b5a3f56257d1f394982


--
nosy: +pitrou

___
Python tracker 

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



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27849
pull_request: https://github.com/python/cpython/pull/29613

___
Python tracker 

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



[issue45835] Race condition in test_queue can lead to test failures

2021-11-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +27848
pull_request: https://github.com/python/cpython/pull/29612

___
Python tracker 

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



[issue45573] Use pkg-config autoconf macros to detect flags for Modules/Setup

2021-11-18 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 25ecc040d007a55e4b5c30fa739054b52c1aacac by Christian Heimes in 
branch 'main':
bpo-45573: Introduce extension module flags in Makefile (GH-29594)
https://github.com/python/cpython/commit/25ecc040d007a55e4b5c30fa739054b52c1aacac


--

___
Python tracker 

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