[issue45792] contextvars.Token has wrong module name in Sphinx's objects.inv

2021-11-11 Thread Hynek Schlawack


New submission from Hynek Schlawack :

Doc/library/contextvars.rst defines a module using `.. module:: contextvars` 
which means that all defined symbols are automatically part of the contextvars 
module.

The docs added in https://github.com/python/cpython/pull/5685 however 
explicitly use `.. class:: contextvars.Token` instead of just `.. class:: 
Token` which means that the recorded intersphinx symbol is 
`contextvars.contextvars.Token`. I have noticed this because sphinx couldn't 
find `contextvars.Token` in structlog's docs.

AFAICT, this only affects contextvars.Token.

--
assignee: hynek
components: Documentation
messages: 406192
nosy: hynek, yselivanov
priority: low
severity: normal
stage: needs patch
status: open
title: contextvars.Token has wrong module name in Sphinx's objects.inv
type: enhancement
versions: Python 3.10, Python 3.11, 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



[issue45791] __instancecheck__ being checked of type(cls) instead of cls

2021-11-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that the code is correct, and the documentation is not complete. As in 
most (but not all) cases of dunder methods it is looked up in a class, ignoring 
instance attributes.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45789] Python execution broken after update via Windows Store

2021-11-11 Thread Eryk Sun


Eryk Sun  added the comment:

>  It fails with "The system cannot find the file 
>  C:\Users\\AppData\Local\Microsoft\WindowsApps\python3.9.exe."

The shell's CreateProcessW() call failed with ERROR_FILE_NOT_FOUND (2). The 
file exists, but it's probably a broken appexec link. I'm attaching a script 
that displays the contents of an appexec link. For example, here's the working 
"python3.9.exe" link:

C:\>read_appexec.py "%LocalAppData%\Microsoft\WindowsApps\python3.9.exe"
Version: 3
Package ID: PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0
Entry Point: PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0!Python
App Type: 0
Target Path:
C:\Program 
Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2288.0_x64__qbz5n2kfra8p0\python3.9.exe

---

> The executable in Program Files cannot be launched except in a few
> oddly specific circumstances.

The SYSTEM, LOCAL SERVICE, and NETWORK SERVICE accounts can directly execute 
the real executable. For standard users, however, a conditional access control 
entry is set in the file's permissions that allows execute access only if the 
accessing security context has the app's WIN://SYSAPPID, such as 
"PYTHONSOFTWAREFOUNDATION.PYTHON.3.9_QBZ5N2KFRA8P0". When CreateProcessW() 
spawns an app from an appexec link, it adds the required WIN://SYSAPPID to a 
new token that gets created for the process. The app itself can thus directly 
load and execute binary images (EXEs, DLLs) from its installation directory 
under "%ProgramFiles%\WindowsApps".

--
nosy: +eryksun
Added file: https://bugs.python.org/file50434/read_appexec.py

___
Python tracker 

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



[issue42109] Use hypothesis for testing the standard library, falling back to stubs

2021-11-11 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

I've recently had [1] reported, which makes https://bugs.python.org/issue45738 
the *third* parser bug [2] that Hypothesmith caught after release, and the 
second in a stable version - so I'll be maintaining a workaround for some time.

I remain happy to help run these tests upstream where they would impact fewer 
people.


[1] https://github.com/Zac-HD/hypothesmith/issues/16 and 
https://github.com/psf/black/pull/2592#issuecomment-966745240
[2] following https://bugs.python.org/issue42218 and 
https://bugs.python.org/issue40661

--

___
Python tracker 

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



[issue45738] 3.11 exec raises SystemError instead of SyntaxError on char after line continuation

2021-11-11 Thread Zac Hatfield-Dodds


Zac Hatfield-Dodds  added the comment:

It looks like this also affects Python 3.9.8, which makes me very suspicious of 
https://bugs.python.org/issue45494 as the probable cause.

See https://github.com/Zac-HD/hypothesmith/issues/16 and 
https://github.com/psf/black/pull/2592#issuecomment-966745240 for reports.

--
nosy: +Zac Hatfield-Dodds
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



[issue45791] __instancecheck__ being checked of type(cls) instead of cls

2021-11-11 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Per PEP 3119, "Overloading works as follows: The call isinstance(x, C) first 
checks whether C.__instancecheck__ exists, and if so, calls 
C.__instancecheck__(x) instead of its normal implementation."

However, this doesn't work because the isinstance() has a bug introduced in 
Python 3.1 and no one ever noticed.

In abstract.c::object_recursive_isinstance(), we have:

PyObject *checker = _PyObject_LookupSpecial(cls, ___instancecheck__);

However, that function expects an instance as an argument rather than a class.

Calling typeobject.c::_PyObject_LookupSpecial() runs:

res = _PyType_LookupId(Py_TYPE(self), attrid);

Note, the Py_TYPE(self) is intended to move up from an instance to a class, but 
we're already started with a class, so it moves to the metaclass instead.

This code was correct when originally implemented but it did not have tests:

if (name == NULL) {
name = PyString_InternFromString("__instancecheck__");
if (name == NULL)
return -1;
}
checker = PyObject_GetAttr(cls, name);
if (checker == NULL && PyErr_Occurred())
PyErr_Clear();


--- Demonstration code ---

class C:
def __instancecheck__(self, inst):
raise RuntimeError(f'{self=}  {inst=}')


class P:
def __instancecheck__(self, inst):
raise RuntimeError(f'{self=}  {inst=}')


class C(P):
pass

>>> isinstance(C(), P)# Incorrectly fails to invoke __instancecheck__
True

>>> isinstance(C(), P())  # Incorrectly invokes __instancecheck__
Traceback (most recent call last):
  File "", line 1, in 
isinstance(C(), P())
  File "", line 3, in __instancecheck__
raise RuntimeError(f'{self=}  {inst=}')
RuntimeError: self=<__main__.P object at 0x107586c80>  inst=<__main__.C object 
at 0x107587100>

--
components: Interpreter Core
messages: 406187
nosy: rhettinger
priority: normal
severity: normal
status: open
title: __instancecheck__ being checked of type(cls) instead of cls
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



[issue45636] Merge BINARY_*/INPLACE_* into BINARY_OP

2021-11-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +27782
pull_request: https://github.com/python/cpython/pull/29532

___
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-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27781
pull_request: https://github.com/python/cpython/pull/29531

___
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-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27780
pull_request: https://github.com/python/cpython/pull/29530

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


Raymond Hettinger  added the comment:


New changeset 807f839bbfd5805fb76eb3436c9252a0441296eb by Raymond Hettinger in 
branch 'main':
bpo-45235:  Revert an argparse bugfix that caused a regression (GH-29525)
https://github.com/python/cpython/commit/807f839bbfd5805fb76eb3436c9252a0441296eb


--

___
Python tracker 

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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2021-11-11 Thread Rodrigo


Change by Rodrigo :


--
keywords: +patch
nosy: +rtobar
nosy_count: 2.0 -> 3.0
pull_requests: +27779
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29529

___
Python tracker 

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



[issue45790] Inaccurate phrasing in extending/newtypes_tutorial

2021-11-11 Thread Rodrigo Tobar


New submission from Rodrigo Tobar :

In `extending/newtypes_tutorial.rst` the following phrase appears:


"[...], containing a pointer to a type object and a reference count (these can 
be accessed using the macros :c:macro:`Py_REFCNT` and c:macro:`Py_TYPE` 
respectively)."

I believe it should read "using the macros :c:macro:`Py_TYPE` and 
c:macro:`Py_REFCNT` respectively" to follow the same order in which the fields 
are described.

I'll put forward a patch. It seems this phrase goes way back a few python 
versions, but I'm tagging 3.11 here only.

--
assignee: docs@python
components: Documentation
messages: 406185
nosy: docs@python, rtobar2
priority: normal
severity: normal
status: open
title: Inaccurate phrasing in extending/newtypes_tutorial
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



[issue45582] Rewrite getpath.c in Python

2021-11-11 Thread Eric Snow


Eric Snow  added the comment:

On Thu, Nov 11, 2021 at 6:27 PM Steve Dower  wrote:
> rather than streamline anything by changing it (yet). We can do those once we 
> know we've got something working.

+1

--

___
Python tracker 

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



[issue45582] Rewrite getpath.c in Python

2021-11-11 Thread Steve Dower


Steve Dower  added the comment:

I'm expecting another dumb error (on my part) or two in the PR, but I'm very 
close to having this working.

Reviews would be appreciated! Bear in mind that I'm trying to match the current 
(quirky) behaviour, rather than streamline anything by changing it (yet). We 
can do those once we know we've got something working.

--

___
Python tracker 

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



[issue45054] json module should issue warning about duplicate keys

2021-11-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Another good option would be to use typed dict like `mydict : dict[int,str] = 
{}`; and use typed values when populating the dict; this way a type checker 
will warn you of inconsistent key types.

--

___
Python tracker 

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



[issue45054] json module should issue warning about duplicate keys

2021-11-11 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

In general this sounds reasonable; - but a couple of thoughts / comments:

- If you have a dict with mixed numbers in str format and in number format 
(i.e. ints as numbers and ints as strings in your case), you are creating 
problems in many potential places. The core of the problem is logically 
inconsistent keys rather than the step of conversion to JSON. So the most 
useful place for warning would be when adding a new key, but that wouldn't be 
practical.

- Even if something is to be done at conversion to JSON, it's not clear if it 
should be a warning (would that be enough when the conversion is a logical 
bug?), or it should be some kind of strict=True mode that raises a ValueError?

--
nosy: +andrei.avk

___
Python tracker 

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



[issue45789] Python execution broken after update via Windows Store

2021-11-11 Thread Steve Dower


Steve Dower  added the comment:

Can you look in your %LocalAppData%\Microsoft\WindowsApps folder and see 
if the python*.exe files are there? You should be able to double-click 
them to launch them.

That folder should be on your PATH so that they work everywhere, and it 
should reflect what you see in Manage App Execution Aliases. If it 
doesn't, that's a Windows bug, and I'll need as much detail as we can 
get to reproduce and report it to them.

--

___
Python tracker 

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



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

2021-11-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher
nosy_count: 4.0 -> 5.0
pull_requests: +27778
pull_request: https://github.com/python/cpython/pull/29528

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2021-11-11 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset a89bbde83fe7f8cc347341e7ec57cda3ba312530 by Brandt Bucher in 
branch '3.10':
[3.10] bpo-45773: Stop "optimizing" certain jump patterns (GH-29526)
https://github.com/python/cpython/commit/a89bbde83fe7f8cc347341e7ec57cda3ba312530


--

___
Python tracker 

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



[issue45789] Python execution broken after update via Windows Store

2021-11-11 Thread firewave


firewave  added the comment:

I checked them and they look fine. I have Python 3.10 installed as well so the 
non-suffix and "3" suffix-only executable refer to that. All the "3.9" suffix 
ones point to the "Python 3.9" entries and are enabled.

--

___
Python tracker 

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



[issue45783] test_freeze fails if a file is removed

2021-11-11 Thread Eric Snow


Change by Eric Snow :


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

___
Python tracker 

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



[issue45789] Python execution broken after update via Windows Store

2021-11-11 Thread Steve Dower


Steve Dower  added the comment:

If you open "Manage app execution aliases", do you see the entries for Python? 
I've heard that they sometimes switch themselves off during updates, but nobody 
seems to know why. Even if not, disabling and re-enabling them may help.

The executable in Program Files cannot be launched except in a few oddly 
specific circumstances. I've spoken to the team responsible and they consider 
this part of the feature, so the execution aliases mentioned above are the way 
to go (these live in your own AppData folder - check sys.executable once you 
get it going again).

--

___
Python tracker 

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



[issue45789] Python execution broken after update via Windows Store

2021-11-11 Thread firewave


New submission from firewave :

I have Python 3.9 installed from the Windows Store and use it in CMake scripts.

After the recent update to 3.92288.0 Python executions suddenly started failing 
with "Access is denied". I assumed I was using a wrong or cached path but that 
didn't turn out to be the case.

It did find the executable in the (apparently) correct folder "C:/Program 
Files/WindowsApps/PythonSoftwareFoundation.Python.3.9_3.9.2288.0_x64__qbz5n2kfra8p0/python3.9.exe".

I tried running that via the command-line and it failed with "Access is 
denied." as well. It appears to be related to "C:/Program Files/WindowsApps" 
requiring Administrator permissions.

Also just running "python3.9.exe" (which exists in the PATH) no longer works. 
It fails with "The system cannot find the file 
C:\Users\\AppData\Local\Microsoft\WindowsApps\python3.9.exe."

So it seems the update messed something up.

I had Python 3.9 installed and working fine for some version now. I ran into 
something similar in the past and had to uninstall and install it again to fix 
the problem.

I am using Windows 10 Version 21H1 (OS Build 19043.1348).

--
components: Windows
messages: 406176
nosy: firewave, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python execution broken after update via Windows Store
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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Only 3.9 needs an expedited rerelease.

--

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2021-11-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +27776
pull_request: https://github.com/python/cpython/pull/29526

___
Python tracker 

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



[issue45773] Compiler hangs during jump elimination

2021-11-11 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 27b69e60daa7b191ee6bc76fb6d5fb7d793062ab by Brandt Bucher in 
branch 'main':
bpo-45773: Stop "optimizing" certain jump patterns (GH-29505)
https://github.com/python/cpython/commit/27b69e60daa7b191ee6bc76fb6d5fb7d793062ab


--

___
Python tracker 

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



[issue28533] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

> One concern I have is when users follow internet examples and look out
for these modules or examples.

There is an option: keep removed modules but replace each module content
with 'raise ImportError("Please use  instead")' stub.
The actual module removal can be postponed for years until most internet
resources reflect this fact.

On Thu, Nov 11, 2021 at 8:43 PM Senthil Kumaran 
wrote:

>
> Senthil Kumaran  added the comment:
>
> +1 to these modules removal.
>
> One concern I have is when users follow internet examples and look out for
> these modules or examples.
>
> What is the best way to show them the modern usage?
>
> - Should Python docs show some example snippet of the most common usage of
> aiosmtpd ?
> - Echo server / client using asyncio.
>
> A stdlib page dedicated to removal, and showing examples using these
> modules, especially aiostmpd as it is not a part of stdlib, might be a good
> idea.
>
> --
> nosy: +orsenthil
>
> ___
> Python tracker 
> 
> ___
>

--

___
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-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The next bugfixe release of 3.10 is the 6th of December

--

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


Raymond Hettinger  added the comment:

How long until the next bugfix releases for 3.9 and 3.10?  To avoid further 
snowballing, it would be great to have this reversion pushed out soonish.

--
nosy: +pablogsal
priority: normal -> high

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


Change by Raymond Hettinger :


--
pull_requests: +27775
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/29525

___
Python tracker 

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



[issue28533] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

+1 to these modules removal.

One concern I have is when users follow internet examples and look out for 
these modules or examples.

What is the best way to show them the modern usage? 

- Should Python docs show some example snippet of the most common usage of 
aiosmtpd ?
- Echo server / client using asyncio.

A stdlib page dedicated to removal, and showing examples using these modules, 
especially aiostmpd as it is not a part of stdlib, might be a good idea.

--
nosy: +orsenthil

___
Python tracker 

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



[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-11 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It usually isn't wise to be preachy in the docs, but we could add a suggestion 
that proportional=True be used only when (0, 0) is known to be in the dataset 
and when it is in the same neighborhood as the other data points.  A reasonable 
cross-check would be to verify than a plain OLS regression would produce an 
intercept near zero.

linear_regression(hours_since_poll_started, number_of_respondents, 
proportional=True)

--

___
Python tracker 

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



[issue45788] sys.prefix include directory on Windows

2021-11-11 Thread Catherine Holloway


New submission from Catherine Holloway :

On the page:

https://docs.python.org/3.10/library/sys.html#sys.prefix

the text says

The main collection of Python library modules is installed in the directory 
prefix/lib/pythonX.Y while the platform independent header files (all except 
pyconfig.h) are stored in prefix/include/pythonX.Y, where X.Y is the version 
number of Python, for example 3.2.

However, this seems to only be true on *nix systems. On Windows, the lib and 
header files are just in prefix/lib and prefix/include. Maybe the text should 
be changed to say:

On linux, the main collection of Python library modules is installed in the 
directory prefix/lib/pythonX.Y while the platform independent header files (all 
except pyconfig.h) are stored in prefix/include/pythonX.Y, where X.Y is the 
version number of Python, for example 3.2. On Winodws, there are in prefix/lib 
and prefix/includes.

--
assignee: docs@python
components: Documentation
messages: 406168
nosy: CatherineH, docs@python
priority: normal
severity: normal
status: open
title: sys.prefix include directory on Windows
type: enhancement
versions: Python 3.10, 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



[issue45510] Specialize BINARY_SUBTRACT

2021-11-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue45753] Further speed up Python-to-Python calls.

2021-11-11 Thread Brandt Bucher


Change by Brandt Bucher :


--
nosy: +brandtbucher

___
Python tracker 

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



[issue45787] HOWTO for socket programming and select documentation contradict

2021-11-11 Thread Alex Waygood

New submission from Alex Waygood :

The HOWTO for socket programming in Python 
(https://docs.python.org/3/howto/sockets.html#non-blocking sockets) includes 
the following lines (using triple-quotes here to indicate multiline quotes from 
the docs):

"""
The major mechanical difference [between blocking and non-blocking sockets] is 
that [for non-blocking sockets] send, recv, connect and accept can return 
without having done anything. You have (of course) a number of choices. You can 
check return code and error codes and generally drive yourself crazy. If you 
don’t believe me, try it sometime. Your app will grow large, buggy and suck 
CPU. So let’s skip the brain-dead solutions and do it right.

Use select.
"""

However, if you go to the documentation for the select module 
(https://docs.python.org/3/library/select html), it pointedly tells you at the 
top *not* to do exactly what the socket HOWTO tells you to do:

"""
Note The selectors module allows high-level and efficient I/O multiplexing, 
built upon the select module primitives. Users are encouraged to use the 
selectors module instead, unless they want precise control over the OS-level 
primitives used.
"""

--
assignee: docs@python
components: Documentation
messages: 406167
nosy: AlexWaygood, docs@python, giampaolo.rodola, neologix
priority: normal
severity: normal
status: open
title: HOWTO for socket programming and select documentation contradict
type: behavior
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



[issue45753] Further speed up Python-to-Python calls.

2021-11-11 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +27774
pull_request: https://github.com/python/cpython/pull/29524

___
Python tracker 

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



[issue45786] Avoid allocating when exiting frame; it may be unsafe.

2021-11-11 Thread Mark Shannon


Mark Shannon  added the comment:

Ok, so it is not as bad as I thought.

A failed allocation might leave us with an invalid frameobject, though. So it 
is still worth fixing.

--

___
Python tracker 

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



[issue45786] Avoid allocating when exiting frame; it may be unsafe.

2021-11-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Allocating memory can invoke GC

Technically, only allocating objects can trigger GC (specifically initializing 
them). All the malloc APIs don't currently call the GC by themselves.

--

___
Python tracker 

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



[issue45783] test_freeze fails if a file is removed

2021-11-11 Thread Eric Snow


Eric Snow  added the comment:

Thanks for the report, Petr!  I'll take a look.

--
assignee:  -> eric.snow
components: +Tests
stage:  -> needs patch

___
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-11 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +27773
pull_request: https://github.com/python/cpython/pull/29523

___
Python tracker 

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



[issue45786] Avoid allocating when exiting frame; it may be unsafe.

2021-11-11 Thread Mark Shannon


New submission from Mark Shannon :

We exiting a frame (returning from a Python function) we have to release the 
stack allocated frame. If a heap-allocated frame object exists, we need to copy 
the contents of the (stack) frame into the frame object.
However, this involves allocating memory for the copy. Allocating memory can 
invoke GC, causing arbitrary code to be run, or the allocation can fail. Either 
leaves us in a precarious state, which may be unsafe.

I haven't been able to produce a crash, but I'm not sure that there isn't a 
potential crash lurking there either.

The fix is fairly simple. Allocate space for the copy of the frame at the end 
of the frame object. Then we need to copy the data, space will have already 
been allocated, and nothing can fail.

Since, in theory, heap-allocated frames are relatively rare, the extra memory 
used won't be an issue.

--
assignee: Mark.Shannon
components: Interpreter Core
keywords: 3.11regression
messages: 406163
nosy: Mark.Shannon, pablogsal
priority: normal
severity: normal
status: open
title: Avoid allocating when exiting frame; it may be unsafe.
type: crash
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



[issue45783] test_freeze fails if a file is removed

2021-11-11 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +hroncok

___
Python tracker 

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



[issue26651] Deprecate register_adapter() and register_converter() in sqlite3

2021-11-11 Thread Kevin


Change by Kevin :


--
nosy: +Strongbeard

___
Python tracker 

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



[issue45784] spam

2021-11-11 Thread Mark Dickinson


Change by Mark Dickinson :


--
title: SAP HANA Training in Chennai -> spam

___
Python tracker 

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



[issue45784] SAP HANA Training in Chennai

2021-11-11 Thread Mark Dickinson


Change by Mark Dickinson :


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

___
Python tracker 

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



[issue45696] "Deep-freeze": skip the marshal step by generating C code

2021-11-11 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 2.0 -> 3.0
pull_requests: +27772
pull_request: https://github.com/python/cpython/pull/29522

___
Python tracker 

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



[issue45785] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue28533] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

I announced my plan to remove the 3 modules on python-dev:
https://mail.python.org/archives/list/python-...@python.org/thread/LZOOLX5EKOITW55TW7JQYKLXJUPCAJB4/

--

___
Python tracker 

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



[issue28533] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

Since Christian Heimes decided to mark my issue bpo-45785 "Remove asyncore, 
asynchat and smtpd modules" as a duplicate of this issue, I changed this issue 
title to "Remove asyncore, asynchat and smtpd modules".

--
title: Replace asyncore/asynchat/smptd in tests -> Remove asyncore, asynchat 
and smtpd modules

___
Python tracker 

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



[issue28533] Replace asyncore/asynchat/smptd in tests

2021-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 29521 to remove the asyncore, asynchat and smtpd modules.

> libregrtest/save_env.py only checks that asyncore.socket_map is not modified, 
> we can keep it until asyncore is really removed.

I chose to remove it instead of my PR.

> test_support.py only tests that it's possible to have a "clean" import of 
> asyncore, it can be easily be replaced later.

This code has been removed in the meanwhile.

> But then a lot of code starts with to fail -Werror.

While tests using asyncore, asynchat and smtpd have been modified to catch the 
DeprecationWarning warning, I chose to remove this warning in my PR, since I 
made the 3 modules private. I don't think that test.support private modules 
must emit deprecation warnings.

> So the first step is to decide if it's ok to remove smtpd right now.

IMO it's ok to remove it since it is deprecated since Python 3.6.

> asyncore, asynchat and smtpd are all deprecated now, for removal in 3.12.

Did you see an explicit mention of Python 3.12? I only saw mention of "Python 
3.6" which is the version when the 3 modules were deprecated.

--

___
Python tracker 

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



[issue28533] Replace asyncore/asynchat/smptd in tests

2021-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

I forgot about this issue and I created a duplicate: bpo-45785. Copy of my 
messages.

I propose to remove asyncore, asynchat and smtpd modules from the Python 
standard library to remove the Python maintenance burden. These modules are 
deprecated since Python 3.6.

--

The asyncore module is a very old module of the Python stdlib for asynchronous 
programming, usually to handle network sockets concurrently. It's a common 
event loop, but its design has many flaws.

The asyncio module was added to Python 3.4 with a well designed architecture. 
Twisted developers who have like 10 to 20 years of experience in asynchronous 
programming helped to design the asyncio API.

By design, asyncio doesn't have flaws which would be really hard to fix in 
asyncore and asynchat.

It was decided to start deprecating the asyncore and asynchat module in Python 
3.6 released in 2016, 5 years ago. Open issues in asyncore and asynchat have 
been closed as "wont fix" because the module is deprecated. The two modules are 
basically no longer maintained.

Documentation:

* https://docs.python.org/dev/library/asyncore.html
* https://docs.python.org/dev/library/asynchat.html

I propose to remove the two modules right now in the Python stdlib. They were 
removed for 4 Python releases (3.6-3.10), it's long enough to respect the PEP 
387. The PEP requires 2 Python releases at least before considering removing 
code.

Since there are still 7 tests of the Python test suite still uses asyncore and 
asynchat, I propose to move these modules in Lib/test/ directory and make them 
private:

* Rename Lib/asyncore.py to Lib/test/support/_asyncore.py
* Rename Lib/asynchat.py to Lib/test/support/_asynchat.py

Projects using asyncore and asynchat should use asyncio. If someone really 
wants to continue using asyncore and asynchat, it's trivial to copy asyncore.py 
and asynchat.py in their project, and maintain these files on their side.

--

About the smtpd module, it is also deprecated since Python 3.6 (deprecated for 
4 Python releases). It's used by a single test (test_logging). I also propose 
to remove it from the stdlib.

I proposed to rename Lib/smtpd.py to Lib/test/support/_smtpd.py.

Projects using smtpd can consider using aiosmtpd which is based on asyncio:
https://aiosmtpd.readthedocs.io/

Or again, they can copy Python 3.10 smtpd.py in their project and maintain this 
file on their side.

--

Ah, a DeprecationWarning warning is only emitted at runtime since Python 3.10. 
What's New in Python 3.10:

"asynchat, asyncore, smtpd: These modules have been marked as deprecated in 
their module documentation since Python 3.6.  An import-time DeprecationWarning 
has now been added to all three of these modules."

https://docs.python.org/dev/whatsnew/3.10.html#asynchat-asyncore-smtpd

--

___
Python tracker 

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



[issue28533] Replace asyncore/asynchat/smptd in tests

2021-11-11 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45785] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread Christian Heimes


Christian Heimes  added the comment:

+1

This bug is kind of a duplicate of #28533.

A year ago Kyle worked on a patch. You can find their work at 
https://github.com/aeros/cpython/tree/remove-asycore-asynchat-smtpd

--
nosy: +christian.heimes
superseder:  -> Replace asyncore/asynchat/smptd in tests

___
Python tracker 

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



[issue45785] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

Ah, a DeprecationWarning warning is only emitted at runtime since Python 3.10. 
What's New in Python 3.10:

"asynchat, asyncore, smtpd: These modules have been marked as deprecated in 
their module documentation since Python 3.6.  An import-time DeprecationWarning 
has now been added to all three of these modules."

https://docs.python.org/dev/whatsnew/3.10.html#asynchat-asyncore-smtpd

--

___
Python tracker 

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



[issue45785] Remove asyncore, asynchat and smtpd modules

2021-11-11 Thread STINNER Victor


New submission from STINNER Victor :

I propose to remove asyncore, asynchat and smtpd modules from the Python 
standard library to remove the Python maintenance burden. These modules are 
deprecated since Python 3.6.

--

The asyncore module is a very old module of the Python stdlib for asynchronous 
programming, usually to handle network sockets concurrently. It's a common 
event loop, but its design has many flaws.

The asyncio module was added to Python 3.4 with a well designed architecture. 
Twisted developers who have like 10 to 20 years of experience in asynchronous 
programming helped to design the asyncio API.

By design, asyncio doesn't have flaws which would be really hard to fix in 
asyncore and asynchat.

It was decided to start deprecating the asyncore and asynchat module in Python 
3.6 released in 2016, 5 years ago. Open issues in asyncore and asynchat have 
been closed as "wont fix" because the module is deprecated. The two modules are 
basically no longer maintained.

Documentation:

* https://docs.python.org/dev/library/asyncore.html
* https://docs.python.org/dev/library/asynchat.html

I propose to remove the two modules right now in the Python stdlib. They were 
removed for 4 Python releases (3.6-3.10), it's long enough to respect the PEP 
387. The PEP requires 2 Python releases at least before considering removing 
code.

Since there are still 7 tests of the Python test suite still uses asyncore and 
asynchat, I propose to move these modules in Lib/test/ directory and make them 
private:

* Rename Lib/asyncore.py to Lib/test/support/_asyncore.py
* Rename Lib/asynchat.py to Lib/test/support/_asynchat.py

Projects using asyncore and asynchat should use asyncio. If someone really 
wants to continue using asyncore and asynchat, it's trivial to copy asyncore.py 
and asynchat.py in their project, and maintain these files on their side.

--

About the smtpd module, it is also deprecated since Python 3.6 (deprecated for 
4 Python releases). It's used by a single test (test_logging). I also propose 
to remove it from the stdlib.

I proposed to rename Lib/smtpd.py to Lib/test/support/_smtpd.py.

Projects using smtpd can consider using aiosmtpd which is based on asyncio:
https://aiosmtpd.readthedocs.io/

Or again, they can copy Python 3.10 smtpd.py in their project and maintain this 
file on their side.

--
components: Library (Lib)
messages: 406156
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove asyncore, asynchat and smtpd modules
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



[issue45779] multiprocessing initializer error with CPython 3.9.6 on Apple Silicon

2021-11-11 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Please include reproducer code in the issue itself, not on some external side.

That said, the error you're getting is related to the start method used by 
multiprocessing. On Linux the start method is fork, on macOS (and Windows) the 
start method is spawn.  The latter requires that data that's passed to the 
subprocess can be pickled.

We use the "spawn" method on macOS because forking without calling execv is 
unsafe on macOS when higher level system APIs are used.

--
nosy: +ronaldoussoren
resolution:  -> not a bug
stage:  -> resolved
status: open -> pending

___
Python tracker 

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



[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-11-11 Thread Tom Pohl


Change by Tom Pohl :


--
nosy:  -tom.pohl

___
Python tracker 

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



[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

I don't think that urllib.request is a great library. There are better 
replacements like https://www.python-httpx.org/ or 
https://urllib3.readthedocs.io/

urllib.request API is not great and it doesn't support HTTP2 (nor HTTP3).

--
nosy: +vstinner

___
Python tracker 

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



[issue45784] SAP HANA Training in Chennai

2021-11-11 Thread Steven D'Aprano


Change by Steven D'Aprano :


--
resolution:  -> not a bug
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



[issue45782] Bug in struct.pack

2021-11-11 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The behaviour is correct. You have tripped over the ASCII representation of 
bytes. In ASCII, 119 (or in hex, 0x77) is displayed as 'w'.

>>> b'\x77\x00\x00\x00'
b'w\x00\x00\x00'

--
nosy: +steven.daprano
resolution:  -> not a bug
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



[issue45784] SAP HANA Training in Chennai

2021-11-11 Thread Pavithra


New submission from Pavithra :

SAP MM Training in Chennai
SAP SD Training in Chennai
SAP FICO Training in Chennai
SAP ARIBA Training in Chennai
SAP ABAP Training in Chennai
SAP HR Training in Chennai
SAP HANA Training in Chennai

--
messages: 406152
nosy: Pavithra
priority: normal
severity: normal
status: open
title: SAP HANA Training in Chennai
type: security

___
Python tracker 

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



[issue45783] test_freeze fails if a file is removed

2021-11-11 Thread Petr Viktorin


New submission from Petr Viktorin :

In Fedora, we remove the bundled wheels; pip & co. are supplied (and kept 
updated) by the system. I believe this is good practice.

However, removing any file from the CPython source checkout makes test_freeze 
fail:

Traceback (most recent call last):
  File 
"/builddir/build/BUILD/Python-3.11.0a2/Lib/test/test_tools/test_freeze.py", 
line 25, in test_freeze_simple_script
outdir, scriptfile, python = helper.prepare(script)
 ^^
  File "/builddir/build/BUILD/Python-3.11.0a2/Tools/freeze/test/freeze.py", 
line 144, in prepare
git_copy_repo(srcdir, SRCDIR)
^
  File "/builddir/build/BUILD/Python-3.11.0a2/Tools/freeze/test/freeze.py", 
line 97, in git_copy_repo
shutil.copy2(srcfile, dstfile)
^^
  File "/builddir/build/BUILD/Python-3.11.0a2/Lib/shutil.py", line 436, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
^^^
  File "/builddir/build/BUILD/Python-3.11.0a2/Lib/shutil.py", line 256, in 
copyfile
with open(src, 'rb') as fsrc:
 ^^^
FileNotFoundError: [Errno 2] No such file or directory: 
'/builddir/build/BUILD/Python-3.11.0a2/Lib/ensurepip/_bundled/pip-21.2.4-py3-none-any.whl'


It looks like this test is recreating uncommited modifications, is it OK to 
change it to support deletions as well?
Also, `git status --porcelain` should be used to get the output in a stable 
format.

--
messages: 406151
nosy: eric.snow, petr.viktorin
priority: normal
severity: normal
status: open
title: test_freeze fails if a file is removed
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



[issue45782] Bug in struct.pack

2021-11-11 Thread Terje Myklebust


New submission from Terje Myklebust :

>>> struct.pack("i", 119) 
b'w\x00\x00\x00'

"w" in a binary value?

>>> struct.pack("I", 116) 
b't\x00\x00\x00'

"t" in a binary value?

--
messages: 406150
nosy: terje.myklebust123
priority: normal
severity: normal
status: open
title: Bug in struct.pack
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue45781] Deleting __debug__ should be an SyntaxError

2021-11-11 Thread Carl Friedrich Bolz-Tereick


New submission from Carl Friedrich Bolz-Tereick :

Right now, deleting __debug__ is not prevented:

>>> def f():
... del __debug__
... 

Of course actually executing it doesn't work:

>>> del __debug__
Traceback (most recent call last):
  File "", line 1, in 
NameError: name '__debug__' is not defined


Compare with assigning to __debug__:

>>> def f():
... __debug__ = 1
... 
  File "", line 2
SyntaxError: cannot assign to __debug__

--
messages: 406149
nosy: Carl.Friedrich.Bolz
priority: normal
severity: normal
status: open
title: Deleting __debug__ should be an SyntaxError

___
Python tracker 

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