[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 090e5c4b946b28f50fce445916c5d3ec45c8f45f by Serhiy Storchaka in 
branch 'main':
bpo-46820: Fix a SyntaxError in a numeric literal followed by "not in" 
(GH-31479)
https://github.com/python/cpython/commit/090e5c4b946b28f50fce445916c5d3ec45c8f45f


--

___
Python tracker 

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +29623
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31493

___
Python tracker 

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



[issue37355] SSLSocket.read does a GIL round-trip for every 16KB TLS record

2022-02-21 Thread Safihre


Change by Safihre :


--
pull_requests: +29622
pull_request: https://github.com/python/cpython/pull/31492

___
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-02-21 Thread Spencer Brown


Spencer Brown  added the comment:

Had a potential thought. Since the only situation we care about is overload 
being used on function definitions in lexical order, valid calls are only that 
on definitions with ascending co_firstlineno counts. Expanding on Jelle's 
solution, the overload() decorator could compare the current function's line 
number to the first in the list, and if it's <= clear out the list (we're 
re-defining). Then repeated re-definitions wouldn't duplicate overloads. 

The other change I'd suggest is to make get_overloads_for() first check 
__overloads__, then only if not present pop from the _overloads dict and assign 
to that attribute. That way if code calls get_overloads_for() at least once, 
the function will be referring to the actual overloads created at the same 
time. It'd also get garbage collected then when the function dies. It also 
means you could manually assign to add overloads to any callable.

--

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo


Eddie Elizondo  added the comment:

It seems that we are back on track with perf being back to neutral!

I've created 4 new PRs. Each with an optimization applied on top of the 
baseline introduction of instance immortalization.

The main PR 19474 currently stands at around 4%, after rebasing past Eric's PR 
30928 it went down to 3%.

This is the list of optimizations that I used to get some performance back:
* Immortalizing Interned Strings (PR 31488): 1% regression
* Immortalizing Runtime Heap After Startup (PR 31489): 0% regression
* Immortalizing Modules After Import (PR 31490): 1% regression
* Combined Optimizations (PR 31491): 0% improvement

All the PRs contain the results of the pyperformance benchmarks and they should 
each stand on their own in case we want to go for a subset of these 
optimizations rather than all of them. Make sure to look at each PR to read the 
implementation details.

For testing, in every PR I made sure all the tests were passing on my local 
environment. Though I do expect some failures happening in non-linux 
environments. I'll be fixing these over the next couple of days.

--

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Inada Naoki


Inada Naoki  added the comment:

All of these optimizations should be disabled by default.

* It will cause leak when Python is embedded.
* Even for python command, it will break __del__ and weakref callbacks.

--

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo


Change by Eddie Elizondo :


--
pull_requests: +29621
pull_request: https://github.com/python/cpython/pull/31491

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo


Change by Eddie Elizondo :


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

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo


Change by Eddie Elizondo :


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

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting and immortal objects

2022-02-21 Thread Eddie Elizondo


Change by Eddie Elizondo :


--
pull_requests: +29618
pull_request: https://github.com/python/cpython/pull/31488

___
Python tracker 

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



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode

2022-02-21 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
Python tracker 

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



[issue46823] Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode

2022-02-21 Thread Dennis Sweeney


New submission from Dennis Sweeney :

See https://github.com/faster-cpython/ideas/discussions/291

--
messages: 413692
nosy: Dennis Sweeney
priority: normal
severity: normal
status: open
title: Add LOAD_FAST__LOAD_ATTR_INSTACE_VALUE combined opcode

___
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-21 Thread Neil Girdhar


Neil Girdhar  added the comment:

@Raymond yeah I've been thinking about this some more, and there's no way to 
have a "top level" method with the dataclass decorator.

I think I will make a case to have a class version of dataclasses that works 
with inheritance.  Class versions of dataclasses are used in some places like 
here: https://github.com/google/flax/blob/main/flax/struct.py#L184
They just call dataclass on the class in __init_subclass__.

If we had something like this in the standard library, then you could put your 
empty __post_init__ in that class.  You could also make __init__ call super so 
that mixins would be initialized (right now the collider pattern you showed 
also breaks if B is not a dataclass, and has a non-trivial __init__).

--

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


Raymond Hettinger  added the comment:

Note that adding an empty __post_init__ method would be a breaking change.  The 
following prints out 'B' then 'C'.  But if class A adds an empty __post_init__, 
then 'B' never gets printed.  The arrangement relies on class A being a 
passthrough to class B.

from dataclasses import dataclass

@dataclass
class A:
pass

@dataclass
class B:
def __post_init__(self):
print('B')

@dataclass
class C(A, B):
def __post_init__(self):
super().__post_init__()
print('C')

c = C()

--

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +29615, 29616
pull_request: https://github.com/python/cpython/pull/31487

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-21 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -29614

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-21 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue46606] Large C stack usage of os.getgroups() and os.setgroups()

2022-02-21 Thread Inada Naoki


Change by Inada Naoki :


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



[issue46606] Large C stack usage of os.getgroups() and os.setgroups()

2022-02-21 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 74127b89a8224d021fc76f679422b76510844ff9 by Inada Naoki in branch 
'main':
bpo-46606: Reduce stack usage of getgroups and setgroups (GH-31073)
https://github.com/python/cpython/commit/74127b89a8224d021fc76f679422b76510844ff9


--

___
Python tracker 

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



[issue46794] Please update bundled libexpat to 2.4.6 with security fixes (5 CVEs)

2022-02-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
assignee:  -> corona10
nosy: +corona10

___
Python tracker 

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



[issue46771] Add some form of cancel scopes

2022-02-21 Thread Tin Tvrtković

Change by Tin Tvrtković :


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

___
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-21 Thread Ka-Ping Yee


Ka-Ping Yee  added the comment:

Hmm, interesting.  I wasn't involved in writing the `follow_wrapper_chains` 
feature, so I don't know why it's there.  I wonder if some digging through the 
revision history of `functools.py` and `inspect.py` would yield insight.

--

___
Python tracker 

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



[issue46822] test_create_server_ssl_over_ssl attempts to listen on 0.0.0.0

2022-02-21 Thread Steve Dower


New submission from Steve Dower :

This causes a failure on one of my test machines where the firewall settings 
forbid it.

However, the test itself seems designed to only listen on localhost. Even 
tracing all call through socket, I don't see when or where it is attempting to 
listen on 0.0.0.0, and yet TCP Monitor (and my firewall) claim that it is.

This seems to be fairly recent, though I haven't done a bisect yet. Anyone have 
any ideas?

--
components: Tests, Windows, asyncio
messages: 413687
nosy: asvetlov, paul.moore, steve.dower, tim.golden, yselivanov, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: test_create_server_ssl_over_ssl attempts to listen on 0.0.0.0
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue46814] Documentation for constructing abstract base classes is misleading

2022-02-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

FWIW, I’m only -0 on this.   It is also perfectly reasonable to say that a 
class is abstract if and only if there is at least one remaining abstract 
method.  After 15 years though, I’m inclined to say that the status quo wins.

--

___
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-02-21 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

I'm OK with not fully supporting overloads created in nested functions; that's 
a pretty marginal use case. But it's true that my proposed implementation would 
create a memory leak if someone does do that. I don't immediately see a way to 
fix that with weakrefs. Maybe we need to put something in the defining 
namespace, as Raymond suggested.

--

___
Python tracker 

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



[issue46725] Unpacking without parentheses is allowed since 3.9

2022-02-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
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-02-21 Thread Spencer Brown


Spencer Brown  added the comment:

I'm not sure a get_overloads() function potentially called after the fact would 
fully work - there's the tricky case of nested functions, where the overload 
list would need to be somehow cleared to ensure every instantiation doesn't 
endlessly append to the same list. It's probably also desirable to weakref it 
(or make it an attribute) so they can be decrefed if the function isn't being 
used.

--
nosy: +Spencer Brown

___
Python tracker 

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



[issue46814] Documentation for constructing abstract base classes is misleading

2022-02-21 Thread Alex Waygood


Change by Alex Waygood :


--
title: Documentation for constructin abstract base classes is misleading -> 
Documentation for constructing abstract base classes is misleading

___
Python tracker 

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



[issue46814] Documentation for constructin abstract base classes is misleading

2022-02-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

An analogy may help.  Release managers must check the list of release blockers 
and stop if the list is non-empty.  If no release blockers were ever filed, the 
release blockers list is empty, but it still exists and its definition hasn't 
changed.

The test is_blocked(blockers) tells us whether the list is non-empty.  It 
doesn't redefine what it means to be a blockers list.

--

___
Python tracker 

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



[issue46814] Documentation for constructin abstract base classes is misleading

2022-02-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

To me, this looks like a way too extensive edit jsut to emphasize a corner case 
that rarely arises in practice.   It bends over backwards to force an awkward 
definition regarding what an ABC really is.

A more minimal edit is to just note that inspect.isabstract() returns true if a 
class inherits from ABC and has at least one remaining abstractmethod.  

That tells the truth without having to redefine an ABC.  And it matches the 
spirit of the ABC mechanism.  At no point does ABCMeta ever require that any 
class in the chain must have ever defined an abstractmethod.  Instead, its only 
rule is that if there is least one remaining abstractmethod, it will refuse to 
instantiate.  Roughly:

  if any(getattr(meth, '__isabstractmethod__', False) for meth in meths):
 raise TypeError("Can't instantiate")
  instantiate(cls)

Note, any() defaults to False if there are no inputs and that the actual C code 
works the same way.  Even if a class never defines any abstractmethods, this 
test still occurs.  For an empty ABC, it just happens to always succeed in 
instantiating because there is no work left to be done.

Worldviews aside, I don't think it helpful to users to everywhere rewrite what 
it means to be an ABC just to make it match the output of inspect.isabstract() 
which is just short for inspect.has_abstract_methods_remaining().

Guido, any thoughts?

--
nosy: +gvanrossum, rhettinger

___
Python tracker 

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



[issue46232] Client certificates with UniqueIdentifier in the subject break ssl.peer_certificate()

2022-02-21 Thread Ned Deily


Change by Ned Deily :


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

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-21 Thread Cooper Lees


Cooper Lees  added the comment:

Totally agree with your example use case. There you have a chance for it being 
useful under certain conditions. In that example there is a passed argument.  
In my example there is no passed argument. Thus, I believe that this will 
generally always be developer error, again, unless I'm missing something here.

My main suggestion here is to just error/warn when no argument at all is passed 
to `contextlib.suppress` and this this context is *never* a chance of it being 
useful. If someone passes None or an empty `Sequence` (or anything non truthy) 
I propose we stay behaving the same as today.

Please feel free to edit the title if that's not clear enough etc.

--

___
Python tracker 

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



[issue46798] xml.etree.ElementTree: get() doesn't return default value, always ATTLIST value

2022-02-21 Thread Ned Deily


Change by Ned Deily :


--
nosy: +eli.bendersky, scoder

___
Python tracker 

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



[issue46789] Restore caching of externals on Windows buildbots

2022-02-21 Thread Steve Dower


Steve Dower  added the comment:

> one option would be to enhance PCbuild/get_external.py to add support 
for a cache directory.

It should already have this support - set the EXTERNALS_DIR environment 
variable before building. I use this in my own builds.

Though if there are specific platforms worth integrating with, this 
could no doubt be further improved.

--

___
Python tracker 

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



[issue45390] asyncio.Task doesn't propagate CancelledError() exception correctly.

2022-02-21 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 4140bcb1cd76dec5cf8d398f4d0e86c438c987d0 by Andrew Svetlov in 
branch 'main':
bpo-45390: Propagate CancelledError's message from cancelled task to its 
awaiter (GH-31383)
https://github.com/python/cpython/commit/4140bcb1cd76dec5cf8d398f4d0e86c438c987d0


--

___
Python tracker 

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



[issue45641] Error In opening a file through tkinter on macOS Monterey

2022-02-21 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -29607

___
Python tracker 

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



[issue46786] embed, source, track, wbr HTML elements not considered empty

2022-02-21 Thread Ned Deily


Change by Ned Deily :


--
nosy: +eli.bendersky, scoder

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


Change by Dong-hee Na :


--
pull_requests: +29611
pull_request: https://github.com/python/cpython/pull/31475

___
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-02-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

Sounds good to me. (I don’t care what happens at runtime but I want to
support the folks who do.)--
--Guido (mobile)

--

___
Python tracker 

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



[issue41028] Move docs.python.org language and version switcher out of cpython

2022-02-21 Thread Ned Deily


Change by Ned Deily :


--
stage: commit 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



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

2022-02-21 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

I made a similar suggestion in issue46821 (thanks Alex for pointing me to this 
older issue):

Currently, the implementation of @overload 
(https://github.com/python/cpython/blob/59585d6b2ea50d7bc3a9b336da5bde61367f527c/Lib/typing.py#L2211)
 simply returns a dummy function and throws away the decorated function. This 
makes it virtually impossible for type checkers using the runtime function 
object to find overloads specified at runtime.

In pyanalyze, I worked around this by providing a custom @overload decorator, 
working something like this:

_overloads: dict[str, list[Callable]] = {}

def _get_key(func: Callable) -> str:
return f"{func.__module__}.{func.__qualname__}"

def overload(func):
key = _get_key(func)
_overloads.setdefault(key, []).append(func)
return _overload_dummy

def get_overloads_for(func):
key = _get_key(func)
return _overloads.get(key, [])

A full implementation will need more error handling.

I'd like to add something like this to typing.py so that other tools can also 
use this information.

---

With my suggested solution, help() would need to call 
typing.get_overloads_for() to get any overloads for the function. Unlike 
Raymond's suggestion, we would not need to change the function creation 
machinery.

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46821] Introspection support for typing.overload

2022-02-21 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks! Closing this as a duplicate.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Improve help() by making typing.overload() information 
accessible at runtime

___
Python tracker 

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



[issue46821] Introspection support for typing.overload

2022-02-21 Thread Alex Waygood


Alex Waygood  added the comment:

Discussion of similar ideas in Issue45100

--

___
Python tracker 

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue33601] [doc] Py_UTF8Mode is not documented

2022-02-21 Thread Vidhya


Vidhya  added the comment:

[Entry level contributor seeking guidance]The rst file is updated in this pull 
request:
 https://github.com/python/cpython/pull/31480

Unable to update GitHub PR in the issue. Getting the following error "Edit 
Error: GitHub PR already added to issue"

--

___
Python tracker 

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



[issue33601] [doc] Py_UTF8Mode is not documented

2022-02-21 Thread Vidhya


Change by Vidhya :


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

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread Ned Deily


Ned Deily  added the comment:


New changeset d4f5bb912e67299b59b814b89a5afd9a8821a14e by Miss Islington (bot) 
in branch '3.7':
bpo-46811: Make test suite support Expat >=2.4.5 (GH-31453) (GH-31471)
https://github.com/python/cpython/commit/d4f5bb912e67299b59b814b89a5afd9a8821a14e


--
nosy: +ned.deily

___
Python tracker 

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Good catch. Thank you for your report Patrick.

--
stage: patch review -> 

___
Python tracker 

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



[issue46821] Introspection support for typing.overload

2022-02-21 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :

Currently, the implementation of @overload 
(https://github.com/python/cpython/blob/59585d6b2ea50d7bc3a9b336da5bde61367f527c/Lib/typing.py#L2211)
 simply returns a dummy function and throws away the decorated function. This 
makes it virtually impossible for type checkers using the runtime function 
object to find overloads specified at runtime.

In pyanalyze, I worked around this by providing a custom @overload decorator, 
working something like this:

_overloads: dict[str, list[Callable]] = {}

def _get_key(func: Callable) -> str:
return f"{func.__module__}.{func.__qualname__}"

def overload(func):
key = _get_key(func)
_overloads.setdefault(key, []).append(func)
return _overload_dummy

def get_overloads_for(func):
key = _get_key(func)
return _overloads.get(key, [])

A full implementation will need more error handling.

I'd like to add something like this to typing.py so that other tools can also 
use this information.

--
assignee: Jelle Zijlstra
components: Library (Lib)
messages: 413671
nosy: AlexWaygood, Jelle Zijlstra, gvanrossum, kj, sobolevn
priority: normal
severity: normal
status: open
title: Introspection support for typing.overload
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



[issue45641] Error In opening a file through tkinter on macOS Monterey

2022-02-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +29607
pull_request: https://github.com/python/cpython/pull/31475

___
Python tracker 

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



[issue46400] Please update bundled libexpat to 2.4.4 with security fixes (CVE-2021-45960)

2022-02-21 Thread Ned Deily


Ned Deily  added the comment:


New changeset 5fdacac8cecb123ae12669ceb3504b2f41075c20 by Dong-hee Na in branch 
'3.7':
bpo-46400: Update libexpat from 2.4.1 to 2.4.4 (GH-31022) (GH-31298)
https://github.com/python/cpython/commit/5fdacac8cecb123ae12669ceb3504b2f41075c20


--

___
Python tracker 

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



[issue46400] Please update bundled libexpat to 2.4.4 with security fixes (CVE-2021-45960)

2022-02-21 Thread Ned Deily


Change by Ned Deily :


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



[issue46784] Duplicated symbols when linking embedded Python with libexpat

2022-02-21 Thread Ned Deily


Ned Deily  added the comment:


New changeset 61f3c308e435c5294e674ef59fed1d51f47e0089 by Miss Islington (bot) 
in branch '3.7':
bpo-46784: Add newly exported expat symbols to the namespace. (GH-31397) 
(GH-31418)
https://github.com/python/cpython/commit/61f3c308e435c5294e674ef59fed1d51f47e0089


--
nosy: +ned.deily

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-21 Thread Zachary Ware


Zachary Ware  added the comment:

I'm -1 on this suggestion; consider the following:

```
exceptions_to_suppress = []
if some_condition:
exceptions_to_suppress.append(ValueError)

with contextlib.suppress(*exceptions_to_suppress):
do_a_thing()
```

This seems a reasonable case to support and would require quite some gymnastics 
to continue supporting while also warning on an empty set.

--
nosy: +ncoghlan, yselivanov, zach.ware

___
Python tracker 

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



[issue46329] Split up the CALL_NO_KW and CALL_KW instructions.

2022-02-21 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 59585d6b2ea50d7bc3a9b336da5bde61367f527c by Mark Shannon in 
branch 'main':
bpo-46329: Streamline calling sequence a bit. (GH-31465)
https://github.com/python/cpython/commit/59585d6b2ea50d7bc3a9b336da5bde61367f527c


--

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2022-02-21 Thread Ned Deily


Ned Deily  added the comment:


New changeset 7a5850987010ca5cb0f1e2844cfe183935916e7e by Ned Deily in branch 
'3.7':
bpo-45618: Fix documentation build by pinning Docutils version to 0.17.1 
(GH-31476)
https://github.com/python/cpython/commit/7a5850987010ca5cb0f1e2844cfe183935916e7e


--

___
Python tracker 

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46820] SyntaxError on `1not in...`

2022-02-21 Thread Patrick Reader


New submission from Patrick Reader :

The following code gives a SyntaxError in 3.10, but used to work fine before (I 
have tested it in 2.7, 3.8, 3.9):

1not in [2, 3]

It seems to be only the `not in` syntax which is affected; all other keywords 
still work correctly:

1in [2, 3]
1or 2
1and 2
1if 1else 1
1is 1

I know this syntax is deprecated in 3.10 (bpo43833), but it still needs to work 
for now, so that old code written like this can keep working.

--
components: Parser
messages: 413664
nosy: lys.nikolaou, pablogsal, pxeger
priority: normal
severity: normal
status: open
title: SyntaxError on `1not in...`
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue45618] Documentation builds fail with Sphinx 3.2.1

2022-02-21 Thread Ned Deily


Change by Ned Deily :


--
pull_requests: +29606
pull_request: https://github.com/python/cpython/pull/31476

___
Python tracker 

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



[issue46819] Add an Error / Exception / Warning when contextlib.suppress() is entered with no specified exception(s) to suppress

2022-02-21 Thread Cooper Lees


New submission from Cooper Lees :

Today if you enter a `contextlib.suppress()` context and specify no exceptions 
there is no error or warning (I didn't check pywarnings to be fair). Isn't this 
a useless context then? If not, please explain why and close.

If it is, I'd love to discuss possibly raising a new NoSupressionError or at 
least a warning to let people know they executing an unneeded context.

Example code that 3.11 does not error on:

```python
cooper@home1:~$ python3.11
Python 3.11.0a5+ (main, Feb 21 2022, 08:52:10) [GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import contextlib
>>> with contextlib.suppress():
...   print("Foo")
...
Foo
```

This was reported to `flake8-bugbear` and if this is not accepted I may accept 
adding this to the linter. But feel this could be fixable in cpython itself.

--
components: Library (Lib)
messages: 413663
nosy: cooperlees
priority: normal
severity: normal
status: open
title: Add an Error / Exception / Warning when contextlib.suppress() is entered 
with no specified exception(s) to suppress
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



[issue46818] Proper way to inherit from collections.abc.Coroutine

2022-02-21 Thread Kristiyan Kanchev


Kristiyan Kanchev  added the comment:

Hello Andrew, 

I'm sorry for using the bug tracker, but I wasn't sure whether posting on 
StackOverflow (is this the appropriate Q site?) will attract the attention of 
the right people.

Although I see you marked this as Closed, I'll be very pleased if you'd 
elaborate on why I don't need send/throw/close methods since they are 
"mandatory" from collections.abc.Coroutine. Are you suggesting that I need to 
just inherit from Awaitable? 

As a matter of fact, I'm writing in the bug tracker because I think that there 
is a potential for a change -- maybe just in the documentation. I struggle to 
find an example on how to implement a Coroutine class, and I believe this will 
be valuable to others, too. While reading the documentation of 
collections.abc.Coroutine one have an impression that he/she would have to 
return an Iterator from __await__() and then outer coroutines will call 
send/throw/close methods of the derived collections.abc.Coroutine class, but 
this is not the case. One have to dive deep into Python internals to grasp why 
Iterator should be returned and how outer coroutines interact with it.

Moreover, there are several cross-referencing PEPs that explain yield, yield 
from, await but none of them has an example of how to construct a Coroutine 
from a class. Explanation and examples are always concerned with `yield` and 
its suspension property is presented as implementation detail.

--

___
Python tracker 

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



[issue45641] Error In opening a file through tkinter on macOS Monterey

2022-02-21 Thread Ned Deily


Change by Ned Deily :


--
pull_requests:  -29603

___
Python tracker 

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



[issue46732] Builtin __bool__ docstrings are wrong

2022-02-21 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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



[issue46732] Builtin __bool__ docstrings are wrong

2022-02-21 Thread miss-islington


miss-islington  added the comment:


New changeset 8eb18d842c37c37c1f9316c7e171aad36e875b9a by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-46732: fix __bool__ docstring (GH-31301) (GH-31474)
https://github.com/python/cpython/commit/8eb18d842c37c37c1f9316c7e171aad36e875b9a


--

___
Python tracker 

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



[issue46732] Builtin __bool__ docstrings are wrong

2022-02-21 Thread miss-islington


miss-islington  added the comment:


New changeset c596ecbf821843de0e044f0d4da34c6b49a06907 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-46732: fix __bool__ docstring (GH-31301) (GH-31473)
https://github.com/python/cpython/commit/c596ecbf821843de0e044f0d4da34c6b49a06907


--

___
Python tracker 

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



[issue46804] spam

2022-02-21 Thread Mark Dickinson

Change by Mark Dickinson :


--
title: Yaytext.net - Tạo văn bản chữ kiểu, kí tự đặc biệt độc đáo -> spam

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 336a916f75642dfe2d87e237981686051d5d51f8 by Miss Islington (bot) 
in branch '3.9':
bpo-46811: Make test suite support Expat >=2.4.5 (GH-31453) (GH-31469)
https://github.com/python/cpython/commit/336a916f75642dfe2d87e237981686051d5d51f8


--

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 7da97f61816f3cadaa6788804b22a2434b40e8c5 by Miss Islington (bot) 
in branch '3.10':
bpo-46811: Make test suite support Expat >=2.4.5 (GH-31453) (GH-31472)
https://github.com/python/cpython/commit/7da97f61816f3cadaa6788804b22a2434b40e8c5


--

___
Python tracker 

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



[issue46818] Proper way to inherit from collections.abc.Coroutine

2022-02-21 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

You don't need send()/throw()/close() methods.
aiohttp had them to work with Python 3.5

P.S. Please don't use the bug tracker as Q site.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue46732] Builtin __bool__ docstrings are wrong

2022-02-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29605
pull_request: https://github.com/python/cpython/pull/31474

___
Python tracker 

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



[issue46732] Builtin __bool__ docstrings are wrong

2022-02-21 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45641] Error In opening a file through tkinter on macOS Monterey

2022-02-21 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10
nosy_count: 7.0 -> 8.0
pull_requests: +29603
pull_request: https://github.com/python/cpython/pull/31475

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29602
pull_request: https://github.com/python/cpython/pull/31472

___
Python tracker 

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



[issue46400] Please update bundled libexpat to 2.4.4 with security fixes (CVE-2021-45960)

2022-02-21 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c60414de7cefd092643ba200c2c045da1569c391 by Dong-hee Na in branch 
'3.8':
bpo-46400: Update libexpat from 2.4.1 to 2.4.4 (GH-31022) (GH-31297)
https://github.com/python/cpython/commit/c60414de7cefd092643ba200c2c045da1569c391


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue46789] Restore caching of externals on Windows buildbots

2022-02-21 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

> Would it be possible to create a download cache somewhere outside the Python 
> source tree, so "git clean -fdx" would not remove this cache?

I was thinking of locating it next to the checkout directory.  The
current structure is:

[worker root]
-- [builder root]
 [checkout]

I propose to add the externals directory within the builder root, so
each branch would still have a unique copy.

--
nosy: +jeremy.kloth

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29601
pull_request: https://github.com/python/cpython/pull/31471

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29600
pull_request: https://github.com/python/cpython/pull/31470

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46811] Test suite needs adjustments for Expat >=2.4.5

2022-02-21 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 2cae93832f46b245847bdc252456ddf7742ef45e by Sebastian Pipping in 
branch 'main':
bpo-46811: Make test suite support Expat >=2.4.5 (GH-31453)
https://github.com/python/cpython/commit/2cae93832f46b245847bdc252456ddf7742ef45e


--
nosy: +lukasz.langa

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


Dong-hee Na  added the comment:


New changeset 2b86616456629e11de33629da1bb732f033c436e by Dong-hee Na in branch 
'main':
bpo-46541: Remove usage of _Py_IDENTIFIER from pyexpat (GH-31468)
https://github.com/python/cpython/commit/2b86616456629e11de33629da1bb732f033c436e


--

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


Change by Dong-hee Na :


--
pull_requests: +29598
pull_request: https://github.com/python/cpython/pull/31468

___
Python tracker 

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



[issue46799] ShareableList memory bloat and performance improvement

2022-02-21 Thread Ting-Che Lin


Change by Ting-Che Lin :


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

___
Python tracker 

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



[issue46818] Proper way to inherit from collections.abc.Coroutine

2022-02-21 Thread Kristiyan


New submission from Kristiyan :

Hello,

Last several days I'm trying to implement an async "opener" object that can be 
used as Coroutine as well as an AsyncContextManager (eg. work with `await 
obj.open()` and `async with obj.open()`). I've researched several 
implementations from various python packages such as:
1. aiofiles: 
https://github.com/Tinche/aiofiles/blob/master/src/aiofiles/base.py#L28
2. aiohttp: 
https://github.com/aio-libs/aiohttp/blob/master/aiohttp/client.py#L1082

Unlike these libs though, I want my implementation to return a custom object 
that is a wrapper around the object returned from the underlying module I'm 
hiding. 

Example:
I want to implement a DataFeeder interface that has a single method `open()`. 
Sub-classes of this interface will support, for example, opening an file using 
aiofiles package. So,
AsyncFileDataFeeder.open() will call `aiofiles.open()`, but instead of 
returning "file-handle" from aiofiles, I want to return a custom Feed class 
that implements some more methods for reading -- for example:

async with async_data_feeder.open() as feed:
  async for chunk in feed.iter_chunked():
...

To support that I'm returning an instance of the following class from 
DataFeeder.open():

class ContextOpener(
Coroutine[Any, Any, Feed],
AbstractAsyncContextManager[Feed],
):
__slots__ = ("_wrapped_coro", "_feed_cls", "_feed")

def __init__(self, opener_coro: Coroutine, feed_cls: Type[Feed]):
self._wrapped_coro = opener_coro
self._feed_cls = feed_cls

self._feed: Any = None

def __await__(self) -> Generator[Any, Any, Feed]:
print("in await", locals())
handle = yield from self._wrapped_coro.__await__()
return self._feed_cls(handle)

def send(self, value: Any) -> Any:
print("in send", locals())
return self._wrapped_coro.send(value)

def throw(self, *args, **kwargs) -> Any:
print("in throw", locals())
return self._wrapped_coro.throw(*args, **kwargs)

def close(self) -> None:
print("in close", locals())
self._wrapped_coro.close()

async def __aenter__(self) -> feeds.Feed:
handle = await self._wrapped_coro
self._feed = self._feed_cls(handle)
return self._feed

async def __aexit__(
self,
exc_type: Optional[Type[BaseException]],
exc: Optional[BaseException],
tb: Optional[TracebackType],
) -> None:
await self._feed.close()
self._feed = None


This code actually works! But I've noticed that when calling `await 
DataFeeder.open()` the event loop never calls my `send()` method.

if __name__ == "__main__":
async def open_test():
await asyncio.sleep(1)
return 1

async def main():
c = ContextOpener(open_test(), feeds.AsyncFileFeed)
ret = await c
print("Finish:", ret, ret._handle)

The output:
in await {'self': <__main__.ContextOpener object at 0x11099cd10>}
Finish:  1

>From then on a great thinking and reading on the Internet happened, trying to 
>explain to myself how exactly coroutines are working. I suspect that the 
>ContextOpener.__await__ is returning a generator instance and from then on, 
>outer coroutines (eg. main in this case) are calling send()/throw()/close() on 
>THAT generator, not on the ContextOpener "coroutine".
The only way to make Python call ContextOpener send() method (and friends) is 
when ContextOpener is the outermost coroutine that is communicating directly 
with the event loop:

ret = asyncio.run(ContextOpener(open_test(), feeds.AsyncFileFeed))
print("Finish:", ret)

Output:
in send {'self': <__main__.ContextOpener object at 0x10dcf47c0>, 'value': None}
in send {'self': <__main__.ContextOpener object at 0x10dcf47c0>, 'value': None}
Finish: 1

However, now I see that I have an error in my implementation that was hidden 
before: my send() method implementation is not complete because StopIteration 
case is not handled and returns 1, instead of Feed object.

Since __await__() should return iterator (by PEP492) I can't figure out a way 
to implement what I want unless making my coroutine class an iterator itself 
(actually generator) by returning `self` from __await__ and add __iter__ and 
__next__ methods:

def __await__(self):
return self

def __iter__(self):
return self

def __next__(self):
return self.send(None)

Is this the proper way to make a Coroutine out of a collections.abc.Coroutine? 
Why is then the documentation not explicitly saying that a Coroutine should 
inherit from collections.abc.Generator?

I see this as very common misconception since every such "ContextManager" 
similar to ContextOpener from 3rd party packages (like the aforementioned two, 
aiofiles and aiohttp, but there are others as well) is subclassing 
collections.abc.Coroutine and implements send(), throw() and close() methods 
that are not actually being called. I suspect, the authors of 

[issue46817] Add a line-start table to the code object.

2022-02-21 Thread Mark Shannon


New submission from Mark Shannon :

Computing whether an instruction is the first on a line (for tracing) in the 
interpreter is complicated and slow. Doing it in the compiler should be simpler 
and has no runtime cost.

Currently we decide if the current instruction is the first on a line, by using 
the `co_lines` table, but if the previous instruction executed was a jump from 
the same line over a block of instructions with different line number(s) then 
we can get this wrong.

This doesn't seem to a problem now, but could be with either: 
Specialization of FOR_ITER inlining generators, or
Compiler improvements leading to different code layout.


The table is only one bit per instruction, so shouldn't be a problem in terms 
of space.

--
components: Interpreter Core
messages: 413651
nosy: Mark.Shannon, iritkatriel
priority: normal
severity: normal
status: open
title: Add a line-start table to the code object.
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue46789] Restore caching of externals on Windows buildbots

2022-02-21 Thread STINNER Victor


STINNER Victor  added the comment:

Would it be possible to create a download cache somewhere outside the Python 
source tree, so "git clean -fdx" would not remove this cache?

Some CIs implement such cache. Does buildbot have helpers for that?

buildbot provides for example:

* LRUCache: https://docs.buildbot.net/2.4.0/full.html#module-buildbot.util.lru
* State: https://docs.buildbot.net/2.4.0/full.html#keeping-state
* Server cache: https://docs.buildbot.net/2.4.0/full.html#caches

In this case, one option would be to enhance PCbuild/get_external.py to add 
support for a cache directory.

--

___
Python tracker 

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



[issue42752] multiprocessing Queue leaks a file descriptor associated with the pipe writer (#33081 still a problem)

2022-02-21 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue46716] regrtest didn't respect the timeout when running test_subprocess on AMD64 Windows11 3.x

2022-02-21 Thread STINNER Victor


STINNER Victor  added the comment:

> It does seem that only the Windows Popen._wait() cannot handle negative 
> timeout values, so the fix should be as simple as coercing the timeout values 
> to >= 0.

Oh. This function should maybe raise an exception if the timeout is negative, 
and ther caller must replace negative timeout with zero.

> A judicious use of prints in subprocess.py, reveals that the timeout passed 
> to wait() ends up being negative.  That value, once cast to a DWORD, 
> ultimately causes a very long wait (0xfff2, in my testing).

This sounds dangerous and must be fixed. Python must not convert negative 
values to very large positive values.

--

___
Python tracker 

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



[issue43974] Define Py_BUILD_CORE_MODULE in extensions instead of setup.py and Modules/Setup

2022-02-21 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue34990] year 2038 problem in compileall.py

2022-02-21 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue33601] [doc] Py_UTF8Mode is not documented

2022-02-21 Thread STINNER Victor


STINNER Victor  added the comment:

> [Entry level contributor seeking guidance]The PR on this issue looks closed. 
> I worked on this and attaching the updated html file.

Hi. You should update Doc/c-api/init.rst. Not the generated HTML page.

--

___
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-21 Thread Eryk Sun


Eryk Sun  added the comment:

> pathlib does not allow to distinguish "path" from "path/".

os.path.normpath() and os.path.abspath() don't retain a trailing slash -- or a 
leading dot component for that matter. Are you referring to os.path.join()? For 
example:

>>> os.path.join('./spam', 'eggs/')
'./spam/eggs/'
>>> os.path.normpath('./spam/eggs/')
'spam/eggs'
>>> PurePath('./spam') / PurePath('eggs/')
PurePosixPath('spam/eggs')

A leading dot component is significant in a context that searches a set of 
paths -- usually PATH. A trailing slash is significant in a context that has to 
distinguish a device or file path from a directory path, of which there are 
several cases in Windows.

I think it's a deficiency in pathlib that it lacks a way to require 
conservative normalization in these cases. Path and PurePath objects could gain 
a keyword-only parameter, and internal attribute if needed, that enables a more 
conservative normalization.

--

___
Python tracker 

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



[issue46796] Simplify handling of removed parameter "loop" in asyncio

2022-02-21 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



[issue46796] Simplify handling of removed parameter "loop" in asyncio

2022-02-21 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset 195a46d6ffd4cec6c5fb69c5890f8b1758ac91ca by Serhiy Storchaka in 
branch 'main':
bpo-46796: Simplify handling of removed parameter "loop" in asyncio (GH-31431)
https://github.com/python/cpython/commit/195a46d6ffd4cec6c5fb69c5890f8b1758ac91ca


--

___
Python tracker 

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



[issue46816] Remove declarations for non-__STDC__ compilers

2022-02-21 Thread Oleg Iarygin


Change by Oleg Iarygin :


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

___
Python tracker 

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



[issue46816] Remove declarations for non-__STDC__ compilers

2022-02-21 Thread Oleg Iarygin


New submission from Oleg Iarygin :

Currently, Python code contains two places where presence of __STDC__ is 
checked:

- Include/internal/pycore_pymath.h:12
- Python/errors.c:13

These checks are used to add extern functions missing in non-standard versions 
of math.h.

However, after Python switched to C99, there is a guarantee that every compiler 
conforms to ISO C so checks of __STDC__ have no sense anymore.

Note, that:

- errors.c check was added by 53e8d44 on 9 Mar 1995
- pycore_pymath.h check was initially added into Objects/floatobject.c by 
eddc144 on 20 Nov 2003 then moved to pycore_pymath by 53876d9.

--
components: Interpreter Core
messages: 413645
nosy: arhadthedev
priority: normal
severity: normal
status: open
title: Remove declarations for non-__STDC__ compilers
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



[issue46329] Split up the CALL_NO_KW and CALL_KW instructions.

2022-02-21 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +29595
pull_request: https://github.com/python/cpython/pull/31465

___
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-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

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

pathlib does not allow to distinguish "path" from "path/".

--

___
Python tracker 

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



[issue46815] Extra `DeprecationWarning` when running `lib2to3` tests

2022-02-21 Thread Nikita Sobolev


Change by Nikita Sobolev :


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

___
Python tracker 

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



[issue46815] Extra `DeprecationWarning` when running `lib2to3` tests

2022-02-21 Thread Nikita Sobolev

New submission from Nikita Sobolev :

I first noticed it in the buildbot logs:

```
0:24:42 load avg: 3.87 [430/431/1] test_lib2to3 passed (1 min 38 sec)
:2: DeprecationWarning: lib2to3 package is deprecated and may not be 
able to parse Python 3.10+
```

But, it also happens locally:

```
» ./python.exe Lib/test/test_lib2to3.py
/Users/sobolev/Desktop/cpython/Lib/unittest/loader.py:350: DeprecationWarning: 
lib2to3 package is deprecated and may not be able to parse Python 3.10+
  __import__(name)
Refactor file: /Users/sobolev/Desktop/cpython/Lib/lib2to3/refactor.py
```

After my patch it is gone:

```
» ./python.exe Lib/test/test_lib2to3.py
Refactor file: /Users/sobolev/Desktop/cpython/Lib/lib2to3/refactor.py
```

--
components: Tests
messages: 413643
nosy: Jelle Zijlstra, benjamin.peterson, lukasz.langa, sobolevn
priority: normal
severity: normal
status: open
title: Extra `DeprecationWarning` when running `lib2to3` tests
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



  1   2   >