[issue30267] Deprecate os.path.commonprefix

2022-02-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For now, there are three uses of commonprefix() in the stdlib:

1. In urllib.request it causes a security issue (see issue46756). commonpath() 
or just str.startswith() should be used instead.

2. In lib2to3.main. The code contains a workaround around commonprefix(). It 
could be simplified by using commonpath().

3. In unittest.util. This is the only correct use of commonprefix(). It cannot 
be replaced by commonpath().

I think that we should add commonprefix() in the string module (or maybe in a 
new module for operations on sequences), deprecate os.path.commonprefix() in 
documentation only, several versions later add a deprecation warning in 
os.path.commonprefix(), and several versions later remove 
os.path.commonprefix().

--

___
Python tracker 

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



[issue46730] Please consider mentioning property without setter when an attribute can't be set

2022-02-15 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Thanks for the PR!

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



[issue46730] Please consider mentioning property without setter when an attribute can't be set

2022-02-15 Thread Dennis Sweeney


[issue46766] Add a class for file operations so a syntax such as open("file.img", File.Write | File.Binary | File.Disk) is possible.

2022-02-15 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I'm sorry, I don't see why you think this will improve code readability. I also 
expect it will be harder to teach than the current code.

open("file.img", "wb") just needs the user to learn about reading and writing 
files, and the difference between binary and text files. It works the same way 
in probably dozens of different languages.

open("file.img", File.Write | File.Binary | File.Disk) needs the beginner to 
learn the same details, *plus* they have to learn about this mystery File 
object, classes, dot notation, `|` the bitwise-or operator, and how to import 
File from the io module.

My guess is that File.Write etc are just enums equivalent to strings 'w' and 
'b', but what's File.Disk?

What else does this File object do?

--
nosy: +steven.daprano

___
Python tracker 

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



[issue46766] Add a class for file operations so a syntax such as open("file.img", File.Write | File.Binary | File.Disk) is possible.

2022-02-15 Thread Isaac Johnson


Change by Isaac Johnson :


--
type:  -> enhancement

___
Python tracker 

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



[issue46766] Add a class for file operations so a syntax such as open("file.img", File.Write | File.Binary | File.Disk) is possible.

2022-02-15 Thread Isaac Johnson


Isaac Johnson  added the comment:

I'm currently working on implementing this. It will probably be a few weeks.

--

___
Python tracker 

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



[issue46766] Add a class for file operations so a syntax such as open("file.img", File.Write | File.Binary | File.Disk) is possible.

2022-02-15 Thread Isaac Johnson


New submission from Isaac Johnson :

I think it would be great for something like this to be with the IO module. It 
will improve code readability.

--
components: Library (Lib)
messages: 413315
nosy: isaacsjohnson22
priority: normal
severity: normal
status: open
title: Add a class for file operations so a syntax such as open("file.img", 
File.Write | File.Binary | File.Disk) is possible.
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



[issue46337] urllib.parse: Allow more flexibility in schemes and URL resolution behavior

2022-02-15 Thread karl


karl  added the comment:

Just to note that there is a maintained list of officially accepted schemes at 
IANA.
https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml

In addition there is a list of unofficial schemes on wikipedia 
https://en.wikipedia.org/wiki/List_of_URI_schemes#Unofficial_but_common_URI_schemes

--
nosy: +karlcow

___
Python tracker 

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



[issue46764] Wrapping a bound method with a @classmethod no longer works

2022-02-15 Thread Michael J. Sullivan


Change by Michael J. Sullivan :


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

___
Python tracker 

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



[issue46765] Replace Locally Cached Strings with Statically Initialized Objects

2022-02-15 Thread Eric Snow


Change by Eric Snow :


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

___
Python tracker 

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



[issue46765] Replace Locally Cached Strings with Statically Initialized Objects

2022-02-15 Thread Eric Snow


New submission from Eric Snow :

This removes a number of static variables and is a little more efficient.

--
assignee: eric.snow
components: Interpreter Core
messages: 413313
nosy: eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: Replace Locally Cached Strings with Statically Initialized Objects
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



[issue46764] Wrapping a bound method with a @classmethod no longer works

2022-02-15 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +rhettinger
type:  -> behavior

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-15 Thread Eric Snow


Eric Snow  added the comment:


New changeset 4d8a515d193a4c9f3844704f974ddb870d7ee383 by Eric Snow in branch 
'main':
bpo-46541: Scan Fewer Files in generate_global_objects.py (gh-31364)
https://github.com/python/cpython/commit/4d8a515d193a4c9f3844704f974ddb870d7ee383


--

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-15 Thread Eric Snow


Eric Snow  added the comment:


New changeset 6c8958948666403f2370ca7b4c0a52b2010ec16d by Eric Snow in branch 
'main':
bpo-46541: Drop the check for orphaned global strings. (gh-31363)
https://github.com/python/cpython/commit/6c8958948666403f2370ca7b4c0a52b2010ec16d


--

___
Python tracker 

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



[issue46738] Allow http.server to emit HTML 5

2022-02-15 Thread Martin Panter


Change by Martin Panter :


--
superseder:  -> Generate HTML 5 with SimpleHTTPRequestHandler.list_directory

___
Python tracker 

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



[issue46764] Wrapping a bound method with a @classmethod no longer works

2022-02-15 Thread Michael J. Sullivan


New submission from Michael J. Sullivan :

class A:
def foo(self, cls): return 1

class B: pass

class B:
bar = classmethod(A().foo)

B.bar()


In Python 3.8 and prior, this worked. Since Python 3.9, it produces "TypeError: 
A.foo() missing 1 required positional argument: 'cls'"

I tracked it down, and the issue was introduced by 
https://github.com/python/cpython/pull/8405/files, which makes classmethod's 
tp_descr_get invoke its argument tp_descr_get when present instead of calling 
PyMethod_New. That this was a semantics change that could break existing code 
may have been missed (though it is a fairly obscure such change).

The reason it breaks this case in particular of bound methods, though, is that 
bound methods have a tp_descr_get that does nothing (increfs the method and 
then returns it). Dropping that tp_descr_get fixes this issue and doesn't 
introduce any test failures. Not sure if there is some potential downstream 
breakage of that?

(This issue was originally reported to me by Jared Hance)

--
components: Interpreter Core
messages: 413310
nosy: msullivan
priority: normal
severity: normal
status: open
title: Wrapping a bound method with a @classmethod no longer works
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



[issue46763] os.path.samefile incorrect results for shadow copies

2022-02-15 Thread Nick Venenga


Nick Venenga  added the comment:

This script can reproduce the issue. 

The computer must be a Windows computer with volume shadow copy service enabled
The computer must have shadow storage added to the drive being used
This script changes the host machine by creating a shadow copy (permissions to 
create shadow copies are required)

--
Added file: https://bugs.python.org/file50626/shadow-repro.py

___
Python tracker 

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



[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-15 Thread Eryk Sun


Eryk Sun  added the comment:

> I'm planning to learn more heavily on posixpath + ntpath in 
> pathlib once bpo-44136 is done. I think that would be a good 
> time to introduce is_mount() support on Windows.

In the long run, it would be better to migrate the implementations in the other 
direction. Rewrite genericpath, ntpath, posixpath, and parts of shutil to use 
PurePath and Path objects. Using path objects instead of generic strings should 
improve the implementation of os.path and shutil, in addition to ensuring 
consistency with pathlib. However, that's a long-term goal that doesn't 
preclude using os.path and shutil as needed now, such as relying on 
os.path.ismount().

--

___
Python tracker 

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



[issue46763] os.path.samefile incorrect results for shadow copies

2022-02-15 Thread Nick Venenga


New submission from Nick Venenga :

shutil.copy fails to copy a file from a shadow copy back to its original file 
since os.path.samefile returns True. os.path.samefile doesn't reliably detect 
these files are different since it relies on ino which is the same for both 
files

>>> sc = 
>>> pathlib.Path('//?/GLOBALROOT/Device/HarddiskVolumeShadowCopy3/test.file')
>>> o = pathlib.Path("V:/test.file")
>>> os.path.samefile(sc, o)
True
>>> os.stat(sc)
os.stat_result(st_mode=33206, st_ino=3458764513820579328, st_dev=1792739134, 
st_nlink=1, st_uid=0, st_gid=0, st_size=1, st_atime=1644973968, 
st_mtime=1644974052, st_ctime=1644973968)
>>> os.stat(o)
os.stat_result(st_mode=33206, st_ino=3458764513820579328, st_dev=1792739134, 
st_nlink=1, st_uid=0, st_gid=0, st_size=2, st_atime=1644973968, 
st_mtime=1644974300, st_ctime=1644973968)
>>> open(sc, "r").read()
'1'
>>> open(o, "r").read()
'12'

In the above example, you can see the shadow copy file and the original file. 
Their mode and ino are the same, but their modified time and contents are 
different

--
components: Windows
messages: 413307
nosy: nijave, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.path.samefile incorrect results for shadow copies
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



[issue46762] assertion failure in f-string parsing Parser/string_parser.c

2022-02-15 Thread Eric V. Smith


Change by Eric V. Smith :


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

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-15 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +29514
pull_request: https://github.com/python/cpython/pull/31364

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-15 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +29513
pull_request: https://github.com/python/cpython/pull/31363

___
Python tracker 

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



[issue46752] Introduce task groups to asyncio and change task cancellation semantics

2022-02-15 Thread Guido van Rossum


Guido van Rossum  added the comment:

Remaining TODO list:

- Add a test showing the need for the .uncancel() call in __aexit__()
  (currently on line 97). Dropping that line does not cause any tests
  to fail.
- Ensure the taskgroup tests are run with the C and Python Task
  implementations.
- Rename tests to have meaningful names.
- I have a few ideas for minor cleanups that I will do later.
- Documentation and What's New entry (in a separate PR, probably).
- Update the docs in a few places to de-prioritize asyncio.gather()
  and steer people towards TaskGroups.

(We could also add something like Trio's cancel scopes, e.g. based on
Andrew Svetlov's async-timeout, which has a mature API.
But that should be a separate bpo issue.)

--

___
Python tracker 

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



[issue46752] Introduce task groups to asyncio and change task cancellation semantics

2022-02-15 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 602630ac1855e38ef06361c68f6e216375a06180 by Guido van Rossum in 
branch 'main':
bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270)
https://github.com/python/cpython/commit/602630ac1855e38ef06361c68f6e216375a06180


--

___
Python tracker 

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



[issue46737] Default to the standard normal distribution

2022-02-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue44445] Add `site-include` install scheme path in sysconfig

2022-02-15 Thread Stefano Rivera


Change by Stefano Rivera :


--
nosy: +stefanor

___
Python tracker 

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



[issue46737] Default to the standard normal distribution

2022-02-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 08ec80113b3b7f7a9eaa3d217494536b63305181 by Zackery Spytz in 
branch 'main':
bpo-46737: Add default arguments to random.gauss and normalvariate (GH-31360)
https://github.com/python/cpython/commit/08ec80113b3b7f7a9eaa3d217494536b63305181


--

___
Python tracker 

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



[issue43976] Allow Python distributors to add custom site install schemes

2022-02-15 Thread Stefano Rivera


Change by Stefano Rivera :


--
nosy: +stefanor

___
Python tracker 

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



[issue46762] assertion failure in f-string parsing Parser/string_parser.c

2022-02-15 Thread Eric V. Smith


Eric V. Smith  added the comment:

Good catch! I'll have a patch tonight.

--

___
Python tracker 

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



[issue46762] assertion failure in f-string parsing Parser/string_parser.c

2022-02-15 Thread Ammar Askar


New submission from Ammar Askar :

Similar to https://bugs.python.org/issue46503 found by the ast.literal_eval 
fuzzer

```
>>> f'{<'
python: Parser/string_parser.c:346: fstring_compile_expr: Assertion `*expr_end 
== '}' || *expr_end == '!' || *expr_end == ':' || *expr_end == '='' failed.
[1]14060 abort  ./python
```

--
assignee: eric.smith
components: Parser
messages: 413302
nosy: ammar2, eric.smith, gregory.p.smith, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: assertion failure in f-string parsing Parser/string_parser.c
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



[issue46738] Allow http.server to emit HTML 5

2022-02-15 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Looks like this is a duplicate of issue46736. Seems like a good idea though!

--
nosy: +Jelle Zijlstra
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



[issue46318] asyncio and ssl: ResourceWarning: unclosed transport

2022-02-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Please check against the latest master.
It has rewritten SSL protocol implementation borrowed from uvloop.
See #44011 for details

--

___
Python tracker 

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



[issue46761] functools.update_wrapper breaks the signature of functools.partial objects

2022-02-15 Thread Larry Hastings


New submission from Larry Hastings :

It's considered good hygiene to use functools.update_wrapper() to make your 
wrapped functions look like the original.  However, when using 
functools.partial() to pre-supply arguments to a function, if you then call 
functools.update_wrapper() to update that partial object, inspect.signature() 
returns the *original* function's signature, not the *wrapped* function's 
signature.

To be precise: if you wrap a function with functools.partial() to pre-provide 
arguments, then immediately call inspect.signature() on that partial object, it 
returns the correct signature with the pre-filled parameters removed.  If you 
then call functools.update_wrapper() to update the partial from the original 
function, inspect.signature() now returns the *wrong* signature. 

I looked into it a little.  The specific thing changing inspect.signature()'s 
behavior is the '__wrapped__' attribute added by functools.update_wrapper().  
By default inspect.signature() will unwrap partial objects, but only if it has 
a '__wrapped__' attribute.

This all looks pretty deliberate.  And it seems like there was some thought 
given to this wrinkle; inspect.signature() takes a "follow_wrapper_chains" 
parameter the user can supply to control this behavior.  But the default is 
True, meaning that by default it unwraps partial objects if they have a 
'__wrapped__'.

I admit I don't have any context for this.  Why do we want inspect.signature() 
to return the wrong signature by default?

--
components: Library (Lib)
files: update_wrapper.breaks.partial.signature.test.py
messages: 413299
nosy: larry
priority: normal
severity: normal
stage: test needed
status: open
title: functools.update_wrapper breaks the signature of functools.partial 
objects
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9
Added file: 
https://bugs.python.org/file50625/update_wrapper.breaks.partial.signature.test.py

___
Python tracker 

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



[issue46760] test_dis should test the dis module, not everything else

2022-02-15 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46733] pathlib.Path methods can raise NotImplementedError

2022-02-15 Thread Barney Gale


Barney Gale  added the comment:

I'm planning to learn more heavily on posixpath + ntpath in pathlib once 
bpo-44136 is done. I think that would be a good time to introduce is_mount() 
support on Windows.

--

___
Python tracker 

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



[issue46741] Docstring for asyncio.protocols.BufferedProtocol appears out of date

2022-02-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue46741] Docstring for asyncio.protocols.BufferedProtocol appears out of date

2022-02-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 72c46462aa9fd0a69317917ba127e62f94ce08d7 by Miss Islington (bot) 
in branch '3.10':
bpo-46741: Update `asyncio.protocols.BufferedProtocol` docstring (GH-31327) 
(GH-31362)
https://github.com/python/cpython/commit/72c46462aa9fd0a69317917ba127e62f94ce08d7


--

___
Python tracker 

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



[issue46741] Docstring for asyncio.protocols.BufferedProtocol appears out of date

2022-02-15 Thread miss-islington


miss-islington  added the comment:


New changeset c292118ef3528df85a9d76ad21029009b560b088 by Miss Islington (bot) 
in branch '3.9':
bpo-46741: Update `asyncio.protocols.BufferedProtocol` docstring (31327)
https://github.com/python/cpython/commit/c292118ef3528df85a9d76ad21029009b560b088


--

___
Python tracker 

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



[issue46741] Docstring for asyncio.protocols.BufferedProtocol appears out of date

2022-02-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29512
pull_request: https://github.com/python/cpython/pull/31362

___
Python tracker 

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



[issue46741] Docstring for asyncio.protocols.BufferedProtocol appears out of date

2022-02-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 1d81fdc4c004511c25f74db0e04ddbbb8a04ce6d by Alex Waygood in 
branch 'main':
bpo-46741: Update `asyncio.protocols.BufferedProtocol` docstring (31327)
https://github.com/python/cpython/commit/1d81fdc4c004511c25f74db0e04ddbbb8a04ce6d


--

___
Python tracker 

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



[issue46741] Docstring for asyncio.protocols.BufferedProtocol appears out of date

2022-02-15 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46744] installers on ARM64 suggest wrong folders

2022-02-15 Thread Steve Dower


Steve Dower  added the comment:

Yeah, currently the only detection that happens is OS version, and just 
so we can block (or at least log) users who are trying to install on 
supported versions. The install directories are unconditional.

Any dynamic detection code would have to go into 
Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp and would 
update variables defined in Tools/msi/bundle/bundle.wxs. If you find the 
code for getting the ProgramFiles(Arm) directory, you'll see an example 
(which is probably the right one to update to handle the range of 
platforms).

However, I think we should consider the 32/64-bit install directory 
names to be a compatibility concern, and shouldn't modify them generally 
out of some kind of sense of "fairness". If it's trivial and safe to 
detect 64-bit running on ARM64 (which, as you say, it ought to be), then 
we can update its directory name there by default.

We should probably also display a notice in the installer when 
installing the Intel builds on ARM. The 64-bit version is fine, but the 
32-bit version has issues, and my experience so far is that the native 
build is significantly faster than both. We can do that another time though.

--

___
Python tracker 

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



[issue46737] Default to the standard normal distribution

2022-02-15 Thread Zackery Spytz


Zackery Spytz  added the comment:

I have created a patch for this issue.  Please consider having a look.

--

___
Python tracker 

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



[issue46737] Default to the standard normal distribution

2022-02-15 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 2.0 -> 3.0
pull_requests: +29510
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31360

___
Python tracker 

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



[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-15 Thread Vidhya


Vidhya  added the comment:

Thanks.
A pull request is created at https://github.com/python/cpython/pull/31359.

--

___
Python tracker 

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



[issue20923] [doc] Explain ConfigParser 'valid section name' and .SECTCRE

2022-02-15 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 10.0 -> 11.0
pull_requests: +29509
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/31359

___
Python tracker 

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



[issue46760] test_dis should test the dis module, not everything else

2022-02-15 Thread Mark Shannon


New submission from Mark Shannon :



This is getting really annoying.
It takes longer to fix all the heavily coupled and poorly written tests in 
test_dis than to make the real changes.

Tiny changes in the calling sequence, or reordering CFGs, cause huge diffs in 
the test_dis module.
No one ever checks these changes, they are just noise.

I've put this under "enhancement" as there is no "wastes a huge amount of time" 
category.



The test_dis should not:

Contain offsets; they turn one line diffs into 100 line diffs
Contain tests for the compiler; they belong elsewhere.
Contain big strings; write proper tests not just regex matches.
Tests for Instruction should should not depend on the compiler output; create 
the bytecode directly.


This is not a new problem, but it does seem to be getting progressively worse.

A lot of the irritation stems from
https://github.com/python/cpython/commit/b39fd0c9b8dc6683924205265ff43cc597d1dfb9
although the tests from before that still hardcode offsets.

--
components: Tests
messages: 413291
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: test_dis should test the dis module, not everything else
type: enhancement

___
Python tracker 

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread DongGeon Lee


DongGeon Lee  added the comment:

My pleasure :)

--

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-15 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +29508
pull_request: https://github.com/python/cpython/pull/31358

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
priority: critical -> normal

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The code had landed.
Need a follow-up PR with documentation update (mention new ssl_shutdown_timeout 
arguments)

--

___
Python tracker 

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



[issue44011] Borrow asyncio ssl implementation from uvloop

2022-02-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 13c10bfb777483c7b02877aab029345a056b809c by Kumar Aditya in 
branch 'main':
bpo-44011: New asyncio ssl implementation (#31275)
https://github.com/python/cpython/commit/13c10bfb777483c7b02877aab029345a056b809c


--

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-15 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you DongGeon :)

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset ad47db34be23c5cd75ed5d5c220d4b56a9b5683c by DongGeon Lee in 
branch '3.9':
[3.9] bpo-46728: fix docstring of combinations_with_replacement for consistency 
(GH-31293). (GH-31356)
https://github.com/python/cpython/commit/ad47db34be23c5cd75ed5d5c220d4b56a9b5683c


--

___
Python tracker 

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



[issue46759] sys.excepthook documentation doesn't mention that it isn't called for SystemExit

2022-02-15 Thread Colin Watson


Change by Colin Watson :


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

___
Python tracker 

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



[issue46759] sys.excepthook documentation doesn't mention that it isn't called for SystemExit

2022-02-15 Thread Colin Watson


New submission from Colin Watson :

In https://bugs.debian.org/1005803, Matthew Vernon reports that the library 
documentation for sys.excepthook doesn't mention the detail that that 
sys.excepthook isn't called for uncaught SystemExit exceptions, although 
help(sys) does mention this.

(He also mentions that help(sys.excepthook) doesn't mention this.  I think this 
would make less sense, since that gets the docstring of a particular 
implementation of an excepthook - on a given system it might not be Python's 
built-in version, for instance.  But adding information to the main library 
documentation seems reasonable.)

--
assignee: docs@python
components: Documentation
messages: 413285
nosy: cjwatson, docs@python
priority: normal
severity: normal
status: open
title: sys.excepthook documentation doesn't mention that it isn't called for 
SystemExit
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



[issue46758] Incorrect behaviour creating a Structure with ctypes.c_bool bitfields

2022-02-15 Thread SIGSEG V


New submission from SIGSEG V :

Setting/getting values in a Structure containing multiple c_bool bitfields like:
_fields_ = [
  ('one', c_bool, 1),
  ('two', c_bool, 1),
  ]
results in an unexpected behavior.
Setting any one of these fields to `True` results in ALL of these fields being 
set to `True` (i.e.: setting `struct.one` to `True` causes both `struct.one` as 
well as `struct.two` to be set to `True`.
This also results in the binary representation of the struct to be incorrect. 
The only possible outcomes for `bytes(struct)` are `b'\x00` and `b'\x01'`

Expected behavior should be that when setting `struct.one` only sets the 
desired field.
This is achievable when defining the same Structure with `c_byte` rather than 
`c_bool`.
When defining the struct like:
_fields_ = [
  ('one', c_byte, 1),
  ('two', c_byte, 1),
  ]
setting `struct.one` only affects `struct.one` and not `struct.two`.
The binary representation of the structure is also correct. When setting 
`struct.two` to `True`, `bytes(struct)` returns `b'\x02'` (aka. 0b10).

I've attached a Minimal Runnable Example that hopefully helps outline the issue.

--
components: Windows, ctypes
files: mre.py
messages: 413284
nosy: dudenwatschn, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Incorrect behaviour creating a Structure with ctypes.c_bool bitfields
type: behavior
versions: Python 3.10, Python 3.9
Added file: https://bugs.python.org/file50624/mre.py

___
Python tracker 

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eric.smith

___
Python tracker 

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



[issue46757] dataclasses should define an empty __post_init__

2022-02-15 Thread Neil Girdhar


New submission from Neil Girdhar :

When defining a dataclass, it's possible to define a post-init (__post_init__) 
method to, for example, verify contracts.

Sometimes, when you inherit from another dataclass, that dataclass has its own 
post-init method.  If you want that method to also do its checks, you need to 
explicitly call it with super.  However, if that method doesn't exist calling 
it with super will crash.

Since you don't know whether your superclasses implement post-init or not, 
you're forced to check if the superclass has one or not, and call it if it does.

Essentially, post-init implements an "augmenting pattern" like __init__, 
___enter__, __exit__, __array_finalize__, etc.  All such methods define an 
empty method at the top level so that child classes can safely call super.

Please consider adding such an empty method to dataclasses so that children who 
implement __post_init__ can safely call super.

--
components: Library (Lib)
messages: 413283
nosy: NeilGirdhar
priority: normal
severity: normal
status: open
title: dataclasses should define an empty __post_init__

___
Python tracker 

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset ac55cea3cbee4d40cf7320bd691f5327cff30f13 by DongGeon Lee in 
branch '3.10':
[3.10] bpo-46728: fix docstring of combinations_with_replacement for 
consistency (GH-31293) (GH-31350)
https://github.com/python/cpython/commit/ac55cea3cbee4d40cf7320bd691f5327cff30f13


--

___
Python tracker 

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread DongGeon Lee


Change by DongGeon Lee :


--
pull_requests: +29506
pull_request: https://github.com/python/cpython/pull/31356

___
Python tracker 

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



[issue46755] QueueHandler logs stack_info twice

2022-02-15 Thread Erik Montnemery


Change by Erik Montnemery :


--
keywords: +patch
nosy: +emontnemery
nosy_count: 1.0 -> 2.0
pull_requests: +29504
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31355

___
Python tracker 

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



[issue31084] QueueHandler not formatting messages

2022-02-15 Thread Erik Montnemery


Change by Erik Montnemery :


--
nosy: +emontnemery
nosy_count: 2.0 -> 3.0
pull_requests: +29505
pull_request: https://github.com/python/cpython/pull/31355

___
Python tracker 

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread Dong-hee Na


Dong-hee Na  added the comment:

@LeeDongGeon1996

Please send the backported patch to 3.9 also

--

___
Python tracker 

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread Dong-hee Na


Change by Dong-hee Na :


--
versions:  -Python 3.7, Python 3.8

___
Python tracker 

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



[issue46724] Odd Bytecode Generation in 3.10

2022-02-15 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +29503
pull_request: https://github.com/python/cpython/pull/31354

___
Python tracker 

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



[issue46756] Incorrect authorization check in urllib.request

2022-02-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
title: Incorrect -> Incorrect authorization check in urllib.request

___
Python tracker 

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



[issue46756] Incorrect

2022-02-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue46756] Incorrect

2022-02-15 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There is an error in determining a sub-URI in the urllib.request module. Due to 
it, if the user is authorized for example.org/foo, it gets also access to 
example.org/foobar.

--
components: Library (Lib)
messages: 413280
nosy: orsenthil, serhiy.storchaka
priority: high
severity: normal
status: open
title: Incorrect
type: security
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



[issue46724] Odd Bytecode Generation in 3.10

2022-02-15 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +29501
pull_request: https://github.com/python/cpython/pull/31352

___
Python tracker 

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



[issue46541] Replace _Py_IDENTIFIER() with statically initialized objects.

2022-02-15 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland
nosy_count: 5.0 -> 6.0
pull_requests: +29500
pull_request: https://github.com/python/cpython/pull/31351

___
Python tracker 

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



[issue46724] Odd Bytecode Generation in 3.10

2022-02-15 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 3be1a443ca8e7d4ba85f95b78df5c4122cae9ede by Mark Shannon in 
branch 'main':
bpo-46724: Use `JUMP_ABSOLUTE` for all backward jumps. (GH-31326)
https://github.com/python/cpython/commit/3be1a443ca8e7d4ba85f95b78df5c4122cae9ede


--

___
Python tracker 

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



[issue46728] Docstring of combinations_with_replacement for consistency

2022-02-15 Thread DongGeon Lee


Change by DongGeon Lee :


--
pull_requests: +29499
pull_request: https://github.com/python/cpython/pull/31350

___
Python tracker 

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



[issue46755] QueueHandler logs stack_info twice

2022-02-15 Thread Erik Montnemery


New submission from Erik Montnemery :

logging.handlers.QueueHandler logs stack twice when stack_info=True:

>>> import logging
>>> from logging.handlers import QueueHandler, QueueListener
>>> from queue import Queue
>>> q = Queue()
>>> logging.getLogger().addHandler(QueueHandler(q))
>>> listener = QueueListener(q, logging.StreamHandler())
>>> listener.start()
>>> _LOGGER.error("Hello", stack_info=True)
Hello
Stack (most recent call last):
  File "", line 1, in 
Stack (most recent call last):
  File "", line 1, in 


Reproduced on CPython 3.9.9, but the code is unchanged in 3.10 and 3.11, so the 
issue should exist there too.

Patching QueueHandler.prepare() to set stack_info to None seems to fix this:

diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index d42c48de5f..7cd5646d85 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -1452,6 +1452,7 @@ def prepare(self, record):
 record.args = None
 record.exc_info = None
 record.exc_text = None
+record.stack_info = None
 return record

 def emit(self, record):

Related issue: Issue34334, with patch 
https://github.com/python/cpython/pull/9537

--
components: Library (Lib)
messages: 413278
nosy: erik.montnemery
priority: normal
severity: normal
status: open
title: QueueHandler logs stack_info twice
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