[issue32658] Metacharacter (\) documentation suggestion

2022-03-28 Thread Stanley


Stanley  added the comment:

Mike, are you still working on this issue?

--
nosy: +slateny

___
Python tracker 

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



[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior

2022-03-28 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for the patch!

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

___
Python tracker 

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



[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior

2022-03-28 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 604d003ab4d1084ef828ebca1b28f2bf1b93c744 by Jelle Zijlstra in 
branch '3.10':
[3.10] bpo-28516: document contextlib.ExitStack.__enter__ behavior (GH-31636) 
(GH-32171)
https://github.com/python/cpython/commit/604d003ab4d1084ef828ebca1b28f2bf1b93c744


--

___
Python tracker 

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



[issue39971] [doc] Error in functional how-to example

2022-03-28 Thread Stanley


Change by Stanley :


--
keywords: +patch
nosy: +slateny
nosy_count: 4.0 -> 5.0
pull_requests: +30250
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/32172

___
Python tracker 

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



[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior

2022-03-28 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
pull_requests: +30249
pull_request: https://github.com/python/cpython/pull/32171

___
Python tracker 

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



[issue47053] Reduce de-optimization in BINARY_OP_INPLACE_ADD_UNICODE

2022-03-28 Thread Dennis Sweeney


Dennis Sweeney  added the comment:


New changeset 788154919c2d843a0a995994bf2aed2d074761ec by Dennis Sweeney in 
branch 'main':
bpo-47053: Refactor BINARY_OP_INPLACE_ADD_UNICODE (GH-32122)
https://github.com/python/cpython/commit/788154919c2d843a0a995994bf2aed2d074761ec


--

___
Python tracker 

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



[issue47031] math.nan should note that NANs do not compare equal to anything

2022-03-28 Thread Charlie Zhao


Change by Charlie Zhao :


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

___
Python tracker 

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



[issue47125] Explore hashlib use of the Windows Crypto API NG

2022-03-28 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



[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett


Peter Lovett  added the comment:

Thanks Eric.

--

___
Python tracker 

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



[issue47135] Allow decimal.localcontext to accept keyword arguments to set context attributes

2022-03-28 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

Yes, they should update Python. A lot of work went in to fixing these issues, 
and won't be backported.

--
resolution:  -> out of date
stage: needs patch -> 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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread miss-islington


miss-islington  added the comment:


New changeset d2c6a4428d52c108f4b06dcd1bb86023541c60ce by Miss Islington (bot) 
in branch '3.9':
bpo-47138: Ensure Windows docs build uses the same pinned version as other 
platforms (GH-32161)
https://github.com/python/cpython/commit/d2c6a4428d52c108f4b06dcd1bb86023541c60ce


--

___
Python tracker 

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



[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett


Peter Lovett  added the comment:

I'm not getting the problem on 3.9.7 on Windows. 
Did get it on 3.7 (3.7.11?) on a different Windows machine last week.
Not getting the problem on 3.10.4

The wrong line number is a problem for IDLE's syntax highlighter, that marks 
the first line as a Syntax Error, even if that line is a comment. 

This is an issue for ArcGIS Pro users, which is (I think) currently shipping 
with Python 3.7.11, so those users may come across it. Best solution would be 
for Esri to update their Python version to something newer.
https://support.esri.com/en/technical-article/13224

--

___
Python tracker 

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



[issue31140] Insufficient error message with incorrect formated string literal

2022-03-28 Thread Peter Lovett


Change by Peter Lovett :


--
nosy: +PeterL777

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-28 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
resolution:  -> fixed

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30247
pull_request: https://github.com/python/cpython/pull/32169

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30246
pull_request: https://github.com/python/cpython/pull/32168

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +30245
pull_request: https://github.com/python/cpython/pull/32167

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 0dfabf9b4a58b835b61fc3d17784d4746f677e56 by Steve Dower in branch 
'3.10':
bpo-47138: Ensure Windows docs build uses the same pinned version as other 
platforms (GH-32161)
https://github.com/python/cpython/commit/0dfabf9b4a58b835b61fc3d17784d4746f677e56


--

___
Python tracker 

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



[issue47143] Add types.copy_class() which updates closures

2022-03-28 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

I mean that the code sample above from attrs doesn't properly update the 
closure for wrapped methods, such as those created by @functools.cache, or any 
other arbitrary decorator that creates a wrapper function.

Example (with Python 3.9.4 and attrs 21.4.0):

% cat attrslots.py 
import attr
import functools


class Base:
@classmethod
def f(cls):
return 3


@attr.s(slots=True)
class Child(Base):
x: int

@classmethod
@functools.cache
def f(cls):
return super().f() + 1


print(Child.f())
% python attrslots.py 
Traceback (most recent call last):
  File "/Users/jelle/py/pyanalyze/samples/attrslots.py", line 21, in 
print(Child.f())
  File "/Users/jelle/py/pyanalyze/samples/attrslots.py", line 18, in f
return super().f() + 1
TypeError: super(type, obj): obj must be an instance or subtype of type


If we provide a `types.copy_class()`, it should handle this case correctly.

--

___
Python tracker 

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



[issue47143] Add types.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

Jelle Zijlstra:
> I believe the attrs code wouldn't work if a method is decorated with a 
> decorator that wraps the original function, such as @functools.cache.

What do you mean by "wouldn't work"? Do you mean that the semantics of 
"copy_class()" should be better defined? Currently, copy.deepcopy(MyClass) 
doesn't copy the class at all, it returns the class unmodified :-)

@functools.cache is designed for unbound methods.

Example:
---
import attr
import functools

@attr.s(slots=True)
class A:
@staticmethod
@functools.cache
def incr(x):
return x + 1

@staticmethod
@functools.lru_cache
def incr_lru(x):
return x + 1

obj = A()
print(obj.incr(1))
print(obj.incr_lru(2))
---

Output (current Python main branch, attrs 21.4.0):
---
2
3
---

@attr.s(slots=True) copies a class but then drops the original class. It 
doesn't create two classes which share methods, functools caches, etc.

--

___
Python tracker 

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



[issue47143] Add types.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

The stdlib types module looks like a better place for such new function, rather 
than the functools module.

The types module documentation starts with: "This module defines utility 
functions to assist in dynamic creation of new types."
https://docs.python.org/3/library/types.html

--
title: Add functools.copy_class() which updates closures -> Add 
types.copy_class() which updates closures

___
Python tracker 

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



[issue46566] Support -3.11-arm64 in py.exe launcher

2022-03-28 Thread Steve Dower


Steve Dower  added the comment:

It's in! Any new issues probably won't be found until the next release, so I'll 
close this and we can open new bugs.

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



[issue46566] Support -3.11-arm64 in py.exe launcher

2022-03-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset bad86a621af61f383b9f06fe4a08f66245df99e2 by Steve Dower in branch 
'main':
bpo-46566: Add new py.exe launcher implementation (GH-32062)
https://github.com/python/cpython/commit/bad86a621af61f383b9f06fe4a08f66245df99e2


--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

I believe the attrs code wouldn't work if a method is decorated with a 
decorator that wraps the original function, such as @functools.cache.

--
nosy: +JelleZijlstra

___
Python tracker 

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



[issue41571] Implement thread-related commands in pdb

2022-03-28 Thread Cebtenzzre


Change by Cebtenzzre :


--
nosy: +cebtenzzre

___
Python tracker 

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



[issue45099] asyncio.Task's documentation says that loop arg is removed when it's not

2022-03-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
versions: +Python 3.11, Python 3.9

___
Python tracker 

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



[issue45099] asyncio.Task's documentation says that loop arg is removed when it's not

2022-03-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue45100] Improve help() by making typing.overload() information accessible at runtime

2022-03-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

Looks like there may be a new plan where we solve a smaller problem (overloads) 
in the context of typing only.

--

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2022-03-28 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue47137] MemoryError in codeop.compile_command

2022-03-28 Thread Eric V. Smith


Change by Eric V. Smith :


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

___
Python tracker 

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



[issue43323] UnicodeEncodeError: surrogates not allowed when parsing invalid charset

2022-03-28 Thread John Paul Adrian Glaubitz


John Paul Adrian Glaubitz  added the comment:

> Awesome, thanks! I'll give it a try later today or tomorrow.

I have applied the patch and the problem seems to have been fixed. \o/

--

___
Python tracker 

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



[issue47137] MemoryError in codeop.compile_command

2022-03-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> I suspect backporting the fix to older versions won't be possible.

Yeah, very much the case unfortunately

--

___
Python tracker 

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



[issue39805] Copying functions doesn't actually copy them

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-47143 "Add functools.copy_class() which updates closures".

--
nosy: +vstinner

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2022-03-28 Thread miss-islington


miss-islington  added the comment:


New changeset 2bcbc3113dee6c35631595ec0d5ee3a8dd2a2ddd by Miss Islington (bot) 
in branch '3.10':
bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)
https://github.com/python/cpython/commit/2bcbc3113dee6c35631595ec0d5ee3a8dd2a2ddd


--

___
Python tracker 

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



[issue29270] ctypes: fail to create a _ctypes._SimpleCData subclass using a closure like calling super() without arguments

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

CreateSwappedType() is an helper function used by the _ctypes.PyCSimpleType 
type. Python script reproducing this ctypes bug:
---
class PyCSimpleType(type):
def __new__(cls, name, bases, dct):
print(f"PyCSimpleType: create {name} class")
cell = dct.get('__classcell__', None)
# type.__new__() sets __classcell__
x = super().__new__(cls, name, bases, dct)
if cell is not None:
print(f"PyCSimpleType: after first type.__new__() call: 
__classcell__={cell.cell_contents}")

name2 = name + "_Swapped"
dct2 = dict(dct, __qualname__=name2)
# Calling type.__new__() again with the same cell object overrides
# __classcell__
x.__ctype_be__ = super().__new__(cls, name2, bases, dct2)
if cell is not None:
print(f"PyCSimpleType: after second type.__new__() call: 
__classcell__={cell.cell_contents}")

return x

class BaseItem:
pass

class Item(BaseItem, metaclass=PyCSimpleType):
def get_class(self):
# get '__class__' to create a closure
return __class__

# Alternative to create a closure:
#def __repr__(self):
#return super().__repr__()
---

Output:
---
PyCSimpleType: create Item class
PyCSimpleType: after first type.__new__() call: __classcell__=
PyCSimpleType: after second type.__new__() call: __classcell__=
Traceback (most recent call last):
  File "meta.py", line 23, in 
class Item(BaseItem, metaclass=PyCSimpleType):
TypeError: __class__ set to  defining 'Item' as 

---

It's not a bug in Python types, but a bug specific to the _ctypes.PyCSimpleType 
type which prevents creating subclasses which use closures ("__class__", 
"super()", etc.).

--
nosy: +vstinner
title: super call in ctypes subclass fails -> ctypes: fail to create a 
_ctypes._SimpleCData subclass using a closure like calling super() without 
arguments
versions: +Python 3.11 -Python 3.8

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2022-03-28 Thread miss-islington


miss-islington  added the comment:


New changeset f84fb55659079bbc99d4cd0441dc13ab07ac3dcf by Miss Islington (bot) 
in branch '3.9':
bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)
https://github.com/python/cpython/commit/f84fb55659079bbc99d4cd0441dc13ab07ac3dcf


--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

Note: Implementing a metaclass in Python is hard, it's easy to mess up with 
closures: see bpo-29270 "ctypes: fail to create a _ctypes._SimpleCData subclass 
using a closure like calling super() without arguments". type.__new__() is 
called twice on the same type dict, and the second call overrides the 
__classcell__ cell value.

--

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2022-03-28 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +30242
pull_request: https://github.com/python/cpython/pull/32164

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2022-03-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30243
pull_request: https://github.com/python/cpython/pull/32165

___
Python tracker 

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



[issue27929] asyncio.AbstractEventLoop.sock_connect broken for AF_BLUETOOTH

2022-03-28 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 5c30388f3c586ba2f33e349e22e5949cb92de621 by Vincent Bernat in 
branch 'main':
bpo-27929: resolve names only for AF_INET/AF_INET6 with asyncio (GH-32131)
https://github.com/python/cpython/commit/5c30388f3c586ba2f33e349e22e5949cb92de621


--

___
Python tracker 

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



[issue47129] Improve errors messages in f-string syntax errors

2022-03-28 Thread Maciej Górski

Maciej Górski  added the comment:

Thanks for helping me with my very first python contribution! @eric.smith 
@lys.nikolaou

--

___
Python tracker 

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



[issue47129] Improve errors messages in f-string syntax errors

2022-03-28 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks, @macgors!

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

___
Python tracker 

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



[issue47129] Improve errors messages in f-string syntax errors

2022-03-28 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 7b44ade018cfe6f54002a3cee43e8aa415d4d635 by Maciej Górski in 
branch 'main':
bpo-47129: Add more informative messages to f-string syntax errors (32127)
https://github.com/python/cpython/commit/7b44ade018cfe6f54002a3cee43e8aa415d4d635


--

___
Python tracker 

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



[issue47137] MemoryError in codeop.compile_command

2022-03-28 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +pablogsal
title: MemoryError -> MemoryError in codeop.compile_command
versions: +Python 3.8

___
Python tracker 

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



[issue47146] PR check "Check if generated files are up to date" failing intermittently

2022-03-28 Thread Eric Snow


Eric Snow  added the comment:

Looks like that fixed it, per https://github.com/python/cpython/pull/32134.

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-28 Thread Irit Katriel


Irit Katriel  added the comment:

Thank you, Serhiy!

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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-28 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 15ba8167d78f9e66bd5b07c4e5cbb0463460310a by Irit Katriel in 
branch 'main':
bpo-26120: make pydoc exclude __future__ imports from the data block of the 
module (GH-30888)
https://github.com/python/cpython/commit/15ba8167d78f9e66bd5b07c4e5cbb0463460310a


--

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +30241
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/32163

___
Python tracker 

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



[issue47146] PR check "Check if generated files are up to date" failing intermittently

2022-03-28 Thread Eric Snow


Eric Snow  added the comment:


New changeset 4c116f716bd1c174d6530b9a7a5ed3863927a109 by Eric Snow in branch 
'main':
bpo-47146: Eliminate a race between make regen-deepfreeze and make 
regen-global-objects. (gh-32162)
https://github.com/python/cpython/commit/4c116f716bd1c174d6530b9a7a5ed3863927a109


--

___
Python tracker 

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



[issue45953] Statically allocate interpreter states as much as possible.

2022-03-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

I used 9 in deepfreeze.py to signify "immortal object". It has been 
copied by others (small integers are essentially immortal too). I wasn't too 
sure that the refcount wouldn't go below zero if the interpreter is repeatedly 
finalized and reinitialized. Once we have official immortal objects (see PEP 
683) we should switch to that.

Since you seem to be challenging the value of 9, my question to you is, 
why do you care what the refcount of 1 is?

--

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Steve Dower


Steve Dower  added the comment:


New changeset 295114dcd32b3aad5453e5e15e9e1befa0e5ca01 by Steve Dower in branch 
'main':
bpo-47138: Ensure Windows docs build uses the same pinned version as other 
platforms (GH-32161)
https://github.com/python/cpython/commit/295114dcd32b3aad5453e5e15e9e1befa0e5ca01


--

___
Python tracker 

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



[issue47146] PR check "Check if generated files are up to date" failing intermittently

2022-03-28 Thread Eric Snow


Change by Eric Snow :


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

___
Python tracker 

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



[issue45953] Statically allocate interpreter states as much as possible.

2022-03-28 Thread Julien Palard


Julien Palard  added the comment:

Hum, and why 9? I am probably missing something obvious but 1 should be 
enough to ensure the value never hits 0. Except for refcount bugs obviously, 
but I don't think this is the right reason?

--

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Steve Dower


Change by Steve Dower :


--
nosy: +steve.dower
nosy_count: 4.0 -> 5.0
pull_requests: +30239
status: pending -> open
pull_request: https://github.com/python/cpython/pull/32161

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-28 Thread Gregory P. Smith


Gregory P. Smith  added the comment:


New changeset dae09c2b819c2683ad870733451c050b59c3eb93 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866) 
(GH-32140) (GH-32156)
https://github.com/python/cpython/commit/dae09c2b819c2683ad870733451c050b59c3eb93


--

___
Python tracker 

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



[issue4833] Explicit directories for zipfiles

2022-03-28 Thread Ethan Furman


Change by Ethan Furman :


--
nosy: +ethan.furman
versions: +Python 3.11 -Python 3.4

___
Python tracker 

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



[issue47147] Allow `return yield from`

2022-03-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

In general, anything changing the python syntax needs to be discussed in the 
mailing lists and it may likely need a PEP as well, even if is minor. This is 
because this has consequences rippling the whole ecosystem, from IDEs to other 
parsers and this need to be discussed, and communicated in a better forum than 
this.

--

___
Python tracker 

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



[issue47147] Allow `return yield from`

2022-03-28 Thread Patrick Reader


Patrick Reader  added the comment:

Ok, will do, but what is the bar for a feature to need to go to the mailing 
lists first? I thought as this was a relatively minor one it wouldn't need to. 
Is it just because it's an actual syntax change?

--

___
Python tracker 

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



[issue43818] Email does not apply policy to multipart messages with defects

2022-03-28 Thread Martin Dengler


Martin Dengler  added the comment:

Possible related to https://github.com/python/cpython/pull/32137 and 
https://bugs.python.org/issue43323

--

___
Python tracker 

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



[issue4833] Explicit directories for zipfiles

2022-03-28 Thread Sam Ezeh


Sam Ezeh  added the comment:

I've submitted the above patch. I created the ZipFile.mkdir function, created 
the necessary tests and wrote the documentation.

I think it is ready for review.

--
Added file: https://bugs.python.org/file50705/sam_ezeh.patch

___
Python tracker 

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



[issue4833] Explicit directories for zipfiles

2022-03-28 Thread Sam Ezeh


Change by Sam Ezeh :


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

___
Python tracker 

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



[issue43224] Add support for PEP 646

2022-03-28 Thread Matthew Rahtz


Change by Matthew Rahtz :


--
pull_requests: +30237
pull_request: https://github.com/python/cpython/pull/32159

___
Python tracker 

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



[issue28516] contextlib.ExitStack.__enter__ has trivial but undocumented behavior

2022-03-28 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 1e3132b1c3ebff8d28a6dd353bf217cb97c41e81 by Miss Islington (bot) 
in branch '3.9':
bpo-28516: document contextlib.ExitStack.__enter__ behavior (GH-31636) 
(GH-32145)
https://github.com/python/cpython/commit/1e3132b1c3ebff8d28a6dd353bf217cb97c41e81


--

___
Python tracker 

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



[issue47146] PR check "Check if generated files are up to date" failing intermittently

2022-03-28 Thread Eric Snow


Eric Snow  added the comment:

There's probably something racy with make.

See: 
https://github.com/python/cpython/runs/5712538599?check_suite_focus=true#step:10:1147

--

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-28 Thread miss-islington


miss-islington  added the comment:


New changeset 5944807b09717d43bb017f700e8c451dd07199ed by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-44493: Add missing terminated NUL in sockaddr_un's length (GH-26866) 
(GH-32140)
https://github.com/python/cpython/commit/5944807b09717d43bb017f700e8c451dd07199ed


--

___
Python tracker 

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



[issue44493] Missing terminated NUL in the length of sockaddr_un

2022-03-28 Thread miss-islington


Change by miss-islington :


--
pull_requests: +30236
pull_request: https://github.com/python/cpython/pull/32156

___
Python tracker 

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



[issue45100] Improve help() by making typing.overload() information accessible at runtime

2022-03-28 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue47147] Allow `return yield from`

2022-03-28 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Please, submit an email to python-ideas or python-dev first as this need to be 
discussed in the mailing lists.

--

___
Python tracker 

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



[issue47147] Allow `return yield from`

2022-03-28 Thread Patrick Reader


New submission from Patrick Reader :

I would like to be able to use a `yield from` expression in a `return` 
statement without parentheses, as a small quality of life tweak, i.e.:

return yield from gen

instead of

return (yield from gen)

I think this makes sense, since `yield from` can be used on the right-hand-side 
of an assignment, which accepts any expression, and so should `return`.

Here is a medium-sized real-world example of where I'm using this, where it 
would be nice to allow `return yield from`: 
https://gist.github.com/pxeger/48f97484364bf0b43dee974a8f0f4265

--
components: Parser
messages: 416198
nosy: lys.nikolaou, pablogsal, pxeger
priority: normal
severity: normal
status: open
title: Allow `return yield from`
type: enhancement

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Ned Deily


Ned Deily  added the comment:

Thanks, everyone! Merged for 3.10.5, 3.9.13, and 3.7.14. I'll leave the issue 
in pending state until merged for 3.8.14.

--
resolution:  -> fixed
stage: patch review -> 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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Ned Deily


Ned Deily  added the comment:


New changeset 25c40bd994aa0da75283c5efdd71ba26c734b67e by Hugo van Kemenade in 
branch '3.9':
bpo-47138: Fix documentation build by pinning Jinja version to 3.0.3 (GH-32153)
https://github.com/python/cpython/commit/25c40bd994aa0da75283c5efdd71ba26c734b67e


--

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Ned Deily


Ned Deily  added the comment:


New changeset 9194a7b8990a0feec1209b1e5694df3bf42906d8 by Hugo van Kemenade in 
branch '3.10':
bpo-47138: Fix documentation build by pinning Jinja version to 3.0.3 (GH-32154)
https://github.com/python/cpython/commit/9194a7b8990a0feec1209b1e5694df3bf42906d8


--

___
Python tracker 

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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Ned Deily


Ned Deily  added the comment:


New changeset 25f00bfb264a3197ac91c41cdec15036fd8401f1 by m-aciek in branch 
'3.7':
bpo-47138: Fix documentation build by pinning Jinja version to 3.0.3 (GH-32111)
https://github.com/python/cpython/commit/25f00bfb264a3197ac91c41cdec15036fd8401f1


--

___
Python tracker 

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



[issue47146] PR check "Check if generated files are up to date" failing intermittently

2022-03-28 Thread Eric Snow


New submission from Eric Snow :

The "Check if generated files are up to date" GitHub check for PRs has been 
failing recently.  It may also impact local usage of "make regen-all".

Example: https://github.com/python/cpython/runs/5719012664

This may be related to gh-32061.

--
assignee: eric.snow
components: Build
messages: 416193
nosy: Mark.Shannon, brandtbucher, eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: PR check "Check if generated files are up to date" failing intermittently
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



[issue26120] pydoc: move __future__ imports out of the DATA block

2022-03-28 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Module objects are not shown in the help unless they are submodules of the 
specified module, even if they are imported with the star import. With this 
precedence I think it is okay to exclude the __future__ annotations as well.

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

> The same problem exists at the function level: see bpo-39805: "Copying 
> functions doesn't actually copy them".

See also bpo-14369 "make function __closure__ writable".

--

___
Python tracker 

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



[issue14369] make function __closure__ writable

2022-03-28 Thread STINNER Victor


Change by STINNER Victor :


--
title: make __closure__ writable -> make function __closure__ writable

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

bpo-32176 "Zero argument super is broken in 3.6 for methods with a hacked 
__class__ cell" added test_code.test_closure_injection() and fixed the 
CO_NOFREE flag in the code object constructor (types.CodeType).

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

> If I understand correctly, a cell content can be modified since Python 3.7: 
> since commit 64505a1f6c0af4574e17e823b27ffe24eca44df5 of bpo-30486

Moreover, it's possible to create a cell object since Python 3.8, commit 
df8d2cde63c865446468351f8f648e1c7bd45109 of bpo-35911.

--
nosy: +pitrou

___
Python tracker 

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



[issue47144] Allow setting __classcell__

2022-03-28 Thread Douglas Raillard


Douglas Raillard  added the comment:

EDIT: empty_list() is a class method of List, not ContainerBase

--

___
Python tracker 

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



[issue47144] Allow setting __classcell__

2022-03-28 Thread Douglas Raillard


Douglas Raillard  added the comment:

> Would bpo-47143 "Add functools.copy_class() which updates closures" solve 
> your use case?

This looks like a similar issue indeed. If I'm able to copy a class "cleanly" 
(as defined in this other thread), that may solve the problem (hard to tell 
precisely until trying it though, the devil is in the details).

> Would you elaborate your use case?

As you probably expect, it's a relatively tricky metaprogramming bit of code. 
It's implementing something akin to higher kinded types, similar in spirit to 
the following example where you can have e.g. containers that "know" the item 
type they contain:

class ContainerBase:
ITEM = None

@classmethod
def apply(cls, typ):
...


@classmethod
def empty_list(cls):
...
  
class List(ContainerBase):
pass

class ListOfInt(List.apply(int)):
pass

The goal is to allow "ListOfInt" to define custom methods if we want in its 
body.

"ListOfInt" cannot return instances of itself [1] so I'm trying to "cherry 
pick" its method and graft them onto the type that is actually instantiated.

[1] We e.g. want to create an empty list of the right type. "List" already 
provides the method for such factory, but it will not return an actual instance 
of ListOfInt, since it does not even know this class exists. What it will use 
is an internal type that it created using the "ITEM" class attribute in e.g. 
List.__init_subclass__, and that is what will get instantiated. This "internal 
class" could still be customized by ListOfInt to have some custom methods 
though, which is what I'm trying to achieve.

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

See also the types.new_class() function:
https://docs.python.org/dev/library/types.html#types.new_class

Oh, I didn't know this function!

--

___
Python tracker 

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



[issue29944] Argumentless super() fails in classes constructed with type()

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-47143 "Add functools.copy_class() which updates closures".

--
nosy: +vstinner

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

> * old fixed attrs issue: https://github.com/python-attrs/attrs/issues/102
> * attrs issue with Python 3.11: 
> https://github.com/python-attrs/attrs/issues/907
> * dataclasses issues with slots=True: https://bugs.python.org/issue46404

Similar bug without attrs nor dataclasses: bpo-29944 "Argumentless super() 
fails in classes constructed with type()".

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

The same problem exists at the function level: see bpo-39805: "Copying 
functions doesn't actually copy them".

For example, copy.deepcopy(func) returns func unchanged if it's a function.

Example:
---
import copy

def make_closure():
closure = []
def append(value):
closure.append(value)
return append, closure

func, closure = make_closure()
func(1)
func2 = copy.deepcopy(func)
func2(2)
print(func2 is func)
print(closure)
---

Output:
---
True
[1, 2]
---

--

___
Python tracker 

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



[issue47145] Improve graphlib.TopologicalSort by removing the prepare step

2022-03-28 Thread Larry Hastings


New submission from Larry Hastings :

I've maintained my own topological sort class for a while now.  The API I came 
up with (or was it Tim and I?) was adopted for graphlib.TopologicalSort().  
Some of my method names are slightly different, but the APIs are so similar, I 
can do a little renaming and run Lib/test/test_graphlib using my 
implementation.  (For clarity I'm going to write the rest of this issue using 
the names from graphlib.)

Recently I made an improvement to my version: it no longer has the modal 
behavior where there's a "before prepare" phase where you add nodes and an 
"after prepare" phase where you can call get_ready and done.

Instead, in my new and improved version the graph is always maintained in a 
"ready" state.  You can call add, get_ready, and done in any order, as much as 
you like.  prepare doesn't do anything besides the cycle check--but read on!

This approach required tweaking some semantics behind the scenes.  My graph 
object now maintains an internal "dirty" flag.  It's set to True after any 
edges are added, and only gets cleared after checking for cycles.  prepare runs 
this cycle check, but get_ready *also* runs this cycle check.  (Though in both 
cases, only when the dirty flag is set, of course.)  In theory this means you 
no longer need the prepare call.  However, it's still useful, because you can 
call it to check for a CycleError.

So, on the one hand, this means that get_ready can throw a CycleError, which it 
never did before.  On the other hand, it won't throw for existing users of the 
library, because they never add edges after their prepare call.  So this 
semantic change shouldn't break existing users, assuming they're not misusing 
the existing API.

Another wrinkle: adding a dependency on a node that's already been handed out 
by get_ready (but hasn't been returned by done) is ignored.  Again, not 
something existing users of graphlib can do, so this shouldn't break code.

There's one final semantic change I made worth knowing about: when you return a 
node via done, the graph simply forgets about it.  This means you could add it 
a second time (!) and it could go for a complete ride through the graph again, 
wh!  This also means that when all nodes have been returned by done, the 
graph is essentially returned to its initial pristine state.  This too seems 
completely harmless, because with the existing library it's illegal to add 
nodes to a graph after calling prepare, so nobody's doing it, so it won't break 
any code.

I'm happy to contribute my version.  But I was lazy and didn't worry about 
speed or memory implementation; it's strewn with sets and things.  I figured I 
could always optimize it later.  But "later" could become "now" if we were 
interested in trying to merge this behavior into Python's graphlib.

Interested?

--
assignee: larry
components: Library (Lib)
messages: 416182
nosy: eric.smith, larry, pablogsal, tim.peters
priority: normal
severity: normal
stage: needs patch
status: open
title: Improve graphlib.TopologicalSort by removing the prepare step
type: enhancement
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



[issue47125] Explore hashlib use of the Windows Crypto API NG

2022-03-28 Thread Steve Dower


Steve Dower  added the comment:

Did a basic test (with timeit and a work-internal library I already have) and 
the native functionality is *slightly* faster than OpenSSL.

But I think it's worthwhile anyway, to help reduce our dependency on OpenSSL.

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

In the Python C API, PEP 384 added PyType_FromSpec(). There is also 
PyStructSequence_NewType(). PEP 3121 proposed PyType_Copy() but it was never 
implemented: see bpo-3760. But in C, closures are implemented using a module 
state, or previously using a global or static variable: cell objects are not 
used for types implemented in C.

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

If I understand correctly, a cell content can be modified since Python 3.7: 
since commit 64505a1f6c0af4574e17e823b27ffe24eca44df5 of bpo-30486:

bpo-30486: Allow setting cell value (#1840)

Antoine Pitrou created bpo-30486 for cloudpickle:

"There are use cases for setting a cell value.  One such use case is for 
(un)pickling recursive closures (see heroic workaround here: 
https://github.com/cloudpipe/cloudpickle/pull/90/files#diff-d2a3618afedd4e124c532151eedbae09R74
 ).  Other use cases may include tinkering around and general education value."

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

More recent copy.copy() change: commit 5c1c3b4f197c57952760be37d77d73669284a607 
of bpo-11480:

Issue #11480: Fixed copy.copy to work with classes with custom metaclasses.

+try:
+issc = issubclass(cls, type)
+except TypeError: # cls is not a class
+issc = False
+if issc:
+# treat it as a regular class:
+return _copy_immutable(x)

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

pickle.dump(x) checks if x is a type since commit 
f048a8f6d79173cc1da1bf12c60ae06fea36762c (March 2002) of bpo-494904:

Pickler.save(): Fix for SF bug #494904: Cannot pickle a class with a
metaclass, reported by Dan Parisien.

+if issubclass(t, TypeType):
+self.save_global(object)
+return

Followed by a minor fix: commit 85ee491b3af3e1c124522249a52443b4d8c34c88 of 
bpo-502085:

Don't die when issubclass(t, TypeType) fails.


-if issubclass(t, TypeType):
+try:
+issc = issubclass(t, TypeType)
+except TypeError: # t is not a class
+issc = 0

copy.deepcopy(x) returns x if it's a type since commit 
11ade1ddc053dcec884e2431b55fb1c1727c65d7 (June 2002) of bpo-560794.

SF patch 560794 (Greg Chapman): deepcopy can't handle custom
metaclasses.

 try:
-copier = x.__deepcopy__
-except AttributeError:
+issc = issubclass(type(x), type)
+except TypeError:
+issc = 0
+if issc:
+y = _deepcopy_dispatch[type](x, memo)
+else:
 (...)

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

The pickle module doesn't copy a type but gets it from its module. The Python 
implementation is pickle._Pickler.save_type() which calls 
pickle._Pickler.save_global().

The cloudpickle module doesn't copy types neither: same behavior than pickle.

Example:
---
import pickle
import pickletools

class A:
pass

data = pickle.dumps(A)
pickletools.dis(data)
---

Output:
---
0: \x80 PROTO  4
2: \x95 FRAME  18
   11: \x8c SHORT_BINUNICODE '__main__'
   21: \x94 MEMOIZE(as 0)
   22: \x8c SHORT_BINUNICODE 'A'
   25: \x94 MEMOIZE(as 1)
   26: \x93 STACK_GLOBAL
   27: \x94 MEMOIZE(as 2)
   28: .STOP
highest protocol among opcodes = 4
---

In short, it's implemented as:

getattr(__import__('__main__'), 'A')

--

___
Python tracker 

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



[issue47143] Add functools.copy_class() which updates closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like the copy module doesn't support copying a class. 
copy.deepcopy(cls) doesn't copy a class but returns its argument, the class 
unchanged.

--

___
Python tracker 

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



[issue46404] RFE: @dataclasses.dataclass(slots=True) doesn't support methods using closures

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-45520: "Frozen dataclass deep copy doesn't work with __slots__" 
which is related but a different issue.

--

___
Python tracker 

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



[issue47144] Allow setting __classcell__

2022-03-28 Thread STINNER Victor


STINNER Victor  added the comment:

> This is unfortunate as there is a use-case for such trickery: if the method 
> of a class A are only used to be grafted onto another class B (monkey 
> patching), A.__classcell__ should be set to B so that super() works as 
> expected.

Would you elaborate your use case?

Would bpo-47143 "Add functools.copy_class() which updates closures" solve your 
use case?

--
nosy: +vstinner

___
Python tracker 

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



[issue47144] Allow setting __classcell__

2022-03-28 Thread Douglas Raillard


New submission from Douglas Raillard :

The cell object __classcell__ currently cannot be set by code invoked by 
metaclass.__new__. Attempts to do so will be caught by builtin___build_class__ 
in bltimodule.c:

} else {
const char *msg =
"__class__ set to %.200R defining %.200R as %.200R";
PyErr_Format(PyExc_TypeError, msg, cell_cls, name, cls);
}

This is unfortunate as there is a use-case for such trickery: if the method of 
a class A are only used to be grafted onto another class B (monkey patching), 
A.__classcell__ should be set to B so that super() works as expected.

This can be useful in contexts where e.g. A.__new__ returns instances of B. B 
is not necessarily something under direct user control (it can be dynamically 
created by inheriting from a "template"), so A would be a better place for 
users to define custom method.

--
components: Interpreter Core
messages: 416172
nosy: douglas-raillard-arm
priority: normal
severity: normal
status: open
title: Allow setting __classcell__
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



[issue47138] Pin Jinja2 to fix docs build

2022-03-28 Thread Hugo van Kemenade


Hugo van Kemenade  added the comment:

I cherry picked Maciej's 3.8 commit into 3.9 and 3.10 PRs:

3.9: https://github.com/python/cpython/pull/32153
3.10: https://github.com/python/cpython/pull/32154

And marking this issue as not relevant to 3.11; instead I bumped the Sphinx 
version in bpo-47126 / gh-32124 as it's directly relevant there.

Thanks!

--
title: Bump Sphinx or pin Jinja2 to fix docs build -> Pin Jinja2 to fix docs 
build
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



[issue47138] Bump Sphinx or pin Jinja2 to fix docs build

2022-03-28 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


--
pull_requests: +30234
pull_request: https://github.com/python/cpython/pull/32153

___
Python tracker 

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



[issue47138] Bump Sphinx or pin Jinja2 to fix docs build

2022-03-28 Thread Hugo van Kemenade


Change by Hugo van Kemenade :


--
pull_requests: +30235
pull_request: https://github.com/python/cpython/pull/32154

___
Python tracker 

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



  1   2   >