[issue46530] `'thread_time'` is missing from `test_get_clock_info`

2022-01-27 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset c27a33132be101e246ae2584f1826477357138d6 by Nikita Sobolev in 
branch 'main':
bpo-46530: add `"thread_time"` to `test_time.test_get_clock_info` (#30913)
https://github.com/python/cpython/commit/c27a33132be101e246ae2584f1826477357138d6


--
nosy: +gvanrossum

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



[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

I
To be clear: I am okay with this patch, just not with making dataclasses
import typing.
-- 
--Guido (mobile)

--

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



[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

Please just don't go there. I beg you. It's not worth it.

--

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



[issue46552] typing: get_type_hints can't handle stringified annotations with leading spaces

2022-01-27 Thread Guido van Rossum


Change by Guido van Rossum :


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

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



[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

It seems acceptable to mypy.

I'm not sure I like the agenda of "moving dataclasses to using typing.py 
introspection tools".

--

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



[issue44791] Substitution of ParamSpec in Concatenate

2022-01-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

Before you start supporting things that contradict PEP 612 this should be 
discussed on typing-sig (or in the python/typing tracker).

Honestly I'd feel more comfortable if there was agreement on typing-sig with 
your previous PRs in this issue as well; "it does not contradict it" is not a 
ringing endorsement. :-)

--

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



[issue46552] typing: get_type_hints can't handle stringified annotations with leading spaces

2022-01-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

We should not accept leading spaces.--
--Guido (mobile)

--

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



[issue46539] typing: forward references don't understand special type forms

2022-01-26 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ced50051bb752a7c1e616f4b0c001f37f0354f32 by Gregory Beauregard in 
branch 'main':
bpo-46539: Pass status of special typeforms to forward references (GH-30926)
https://github.com/python/cpython/commit/ced50051bb752a7c1e616f4b0c001f37f0354f32


--

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



[issue46539] typing: forward references don't understand special type forms

2022-01-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

Agree it's not the same issue, but there's similarity -- both are due to 
putting a stringized annotation (presumably a forward ref) somewhere inside 
another construct. whether it's list["N"] or Annotated["ClassVar[int]"].

--

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



[issue46539] typing: forward references don't understand special type forms

2022-01-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

I wonder if this is at all similar to bpo-41370.

--

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



[issue43853] [sqlite3] Improve sqlite3_value_text() error handling

2022-01-26 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 3eb3b4f270757f66c7fb6dcf5afa416ee1582a4b by Erlend Egeberg 
Aasland in branch 'main':
bpo-43853: Expand test suite for SQLite UDF's (GH-27642)
https://github.com/python/cpython/commit/3eb3b4f270757f66c7fb6dcf5afa416ee1582a4b


--
nosy: +gvanrossum

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yeah, there are no perfect solutions. Please let it go.

--

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

Well that's *always* a problem right? If you take that to the extreme we 
wouldn't need bugfix releases. :-)

Apart from some examples in the 3.5-3.6 timeframe, what makes you think that 
*this* fix *specifically* is going to make more people unhappy than it makes 
happy?

When people complain that they wrote Annotated[ClassVar[int], ...] and are 
disappointed that it doesn't work in a certain old version, you can just tell 
them to use ClassVar[Annotated[int, ...]] which is in no way invalid or 
inferior and works in all versions that support Annotated.

--

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

But it *is* a bugfix.

--

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



[issue41370] PEP 585 and ForwardRef

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

Here's a patch that doesn't do it right but illustrates the point:

diff --git a/Lib/typing.py b/Lib/typing.py
index 972b8ba24b..4616db60c3 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -1807,6 +1807,12 @@ def get_type_hints(obj, globalns=None, localns=None, 
include_extras=False):
 value = type(None)
 if isinstance(value, str):
 value = ForwardRef(value, is_argument=False, is_class=True)
+elif isinstance(value, types.GenericAlias):
+args = tuple(
+ForwardRef(arg) if isinstance(arg, str) else args
+for arg in value.__args__
+)
+value = value.__origin__[(*args,)]
 value = _eval_type(value, base_globals, base_locals)
 hints[name] = value

--

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



[issue41370] PEP 585 and ForwardRef

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

Ah, I see the issue. I stepped through get_type_hints() using pdb, and it does 
have a special case for when it encounters a string: it wraps it in a 
ForwardRef and proceeds from there:

https://github.com/python/cpython/blob/cef0a5458f254c2f8536b928dee25862ca90ffa6/Lib/typing.py#L1806-L1807

But list['N'] isn't a string, so it doesn't trigger this case. If you were to 
use "list[N]" instead, it works:

>>> from typing import get_type_hints
>>> class N:
...   c: "list[N]"
... 
>>> get_type_hints(N)
{'c': list[__main__.N]}
>>>

But I suppose you have a reason you (or your users) don't want to do that.

We could probably add a special case where it checks for types.GenericAlias and 
goes through __args__, replacing strings by ForwardRefs.

But would that be enough? The algorithm would have to recursively dive into 
__args__ to see if there's a string hidden deep inside, e.g. list[tuple[int, 
list["N"]]].

And what if the user writes something hybrid, like List[list["N"]]? What other 
cases would we need to cover?

And can we sell this as a bugfix for 3.10, or will this be a new feature in 
3.11?

How will it interact with from __future__ import annotations?

--

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



[issue41370] PEP 585 and ForwardRef

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

When PEP 585 was discussed and implemented we did not expect people to care as 
much about runtime types as they did.

I already explained that making list['Node'] incorporate a ForwardRef instance 
is unrealistic (we'd have to reimplement ForwardRef in C first).

It might be possible to change get_type_hints() to recognize strings, and 
deprecate ForwardRef altogether. But I suspect that that would break something 
else, since ForwardRef is documented (I had intended it to remain an internal 
detail but somehow it got exposed, I don't recall why).

Please stop asking why the decision was made (it sounds rather 
passive-aggressive to me) and start explaining the problem you are having in a 
way that we can actually start thinking about a solution.

I have boiled down the original example to a slightly simpler one (dataclasses 
are a red herring):

>>> from typing import get_type_hints, List
>>> class N:
...   c1: list["N"]
...   c2: List["N"]
...
>>> N.__annotations__
{'c1': list['N'], 'c2': typing.List[ForwardRef('N')]}
>>> get_type_hints(N)
{'c1': list['N'], 'c2': typing.List[__main__.N]}

The key problem here is that the annotation list['N'] is not expanded to 
list[N]. What can we do to make get_type_hint() produce list[N] instead here?

--

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



[issue41370] PEP 585 and ForwardRef

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

I asked for a brief example that explains your issue to me. Instead you sent me 
links to production code and patches to it. Sorry, but that doesn't help me 
understand your problem. Is there really no way that you can write a little 
story that goes along the lines of

 In our production code, we use the pattern

   foo blah blah:
   spam spam Ham eggs anchovies
   buzz buzz blah get_type_hints buzz buzz

  a lot. As you can see, the get_type_hints call fails
  when we switch from "Ham eggs" to "ham eggs".

--

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



[issue33125] Windows 10 ARM64 platform support

2022-01-25 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -Guido.van.Rossum

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



[issue46519] test_typing failing on branch 3.10

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

Exactly what I just thought. A bit more research might find a buggy assumption 
in the test "framework".

--
nosy: +gvanrossum

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



[issue46396] `Concatenate` should not raise any semantic errors

2022-01-25 Thread Guido van Rossum


Guido van Rossum  added the comment:

No, that would make the behavior normative.

Let sleeping dogs lie.

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

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



[issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

2022-01-24 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

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



[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

2022-01-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

I tried to make the 'FROZEN' variable in freeze_modules.py empty, but it has a 
bunch of places where this is unexpected. Maybe someone can fix that?

--

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



[issue46431] Trouble subclassing ExceptionGroup

2022-01-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

So, a PR with that fix would be nice?

--

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



[issue46396] `Concatenate` should not raise any semantic errors

2022-01-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

"When in doubt, the status quo wins."

Maybe we should just close this and the PR without merging.

--

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



[issue46494] Mention typing_extensions in the typing documentation

2022-01-24 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

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



[issue46476] Not all memory allocated by _Py_Quicken() is released at Python exit

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

> With the current design, it isn't possible though because the code objects 
> are modified in place so if co_quickened is freed the VM still tries to 
> execute the copied instructions.

Or the cleanup code could also restore co_firstinstr and other things that are 
set by quickened (the co_quickened flag and what else?).

Kumar, I'm not sure I follow your concerns about the bootstrap working 
differently on Windows than on Unix. Is the problem that on Unix the bootstrap 
interpreter is linked without deepfreeze.c so there is no definition of the 
symbol _Py_Deepfreeze_Fini? In that case, you can probably just add a dummy one 
to _bootstrap_python.c.

--

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



[issue46471] use global singletons for single byte bytes objects in deepfreeze

2022-01-23 Thread Guido van Rossum


Change by Guido van Rossum :


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

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



[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

@Kumar do you want to tackle this?

--
nosy: +kumaraditya303

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



[issue46491] typing: allow Annotated in outermost scope

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

+1--
--Guido (mobile)

--

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



[issue46471] use global singletons for single byte bytes objects in deepfreeze

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ca78130d7eb5265759697639e42487ec6d0a4caf by Kumar Aditya in 
branch 'main':
bpo-46471: Use single byte singletons (GH-30781)
https://github.com/python/cpython/commit/ca78130d7eb5265759697639e42487ec6d0a4caf


--

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



[issue41682] [Windows] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2022-01-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'm wondering if the test is faulty. It seems to call EventLoop.sendfile() with 
a file that is 8K + 1 byte long,
and the protocol is instructed to close after 1K bytes have been written, but 
it seems to try to send as much of the file as it can.
Could it be that on Win22 the primitive used (TransmitFile) has an internal 
minimum buffer size that exceeds this file size, so the first call sends the 
whole file and there's no error?

@Andrew Svetlov, do you know enough of the internals of this code to validate 
my theory?

--
nosy: +gvanrossum

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



[issue44642] Union of a type and the typing module function

2022-01-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

Do you recommend to just close this as "fixed"?

--

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



[issue46476] Not all memory allocated by _Py_Quicken() is released at Python exit

2022-01-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

> Would it be possible to enhance deepfreeze be produce a list of all 
> (immortal) code objects?

That should be simple. We could see if Kumar is interested.

--
nosy: +kumaraditya303

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



[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

2022-01-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

> Is there a way to disable deepfreeze when building Python?

It looks like this isn't easy, sorry. :-( Adding Christian Heimes in case he 
has a suggestion.

--
nosy: +christian.heimes

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



[issue46476] Not all memory allocated by _Py_Quicken() is released at Python exit

2022-01-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

If any of the immortal, deep-frozen code objects is ever quickened, I suppose 
the quickening data is never freed. But when we finalize and reinitialize, the 
co_quickened flag should remain set, so this would be a one-time leak.

The question is whether the quickening cache points to any objects that *are* 
freed. If it does, that could be bad. If it doesn't, then all we lose is a 
fixed amount of memory (no further leaks if we finalize and initialize the 
runtime repeatedly).

However, if my theory holds, why would valgrind consider the memory leaked? 
(TBH I don't know what valgrind does, so maybe that's not the right question.)

--

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



[issue46431] Trouble subclassing ExceptionGroup

2022-01-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

Is this a matter of adding some documentation showing how it should be done? 
Even if we don't want to encourage such subclassing, we do have APIs to support 
it, and I think we ought to show how to do it, given that you have to 
coordinate a bunch of things.

How feasible is it to improve the error? (If that error is what you always get 
when __init__ and __new__ don't agree, maybe that could be a separate, more 
general issue?)

--

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



[issue46465] test_unittest: TestBreakSignalDefault.testInstallHandler() fails if run after TestBreak

2022-01-22 Thread Guido van Rossum


Guido van Rossum  added the comment:

@kj, are you looking into this?

--

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



[issue43118] inspect.signature() raises RuntimeError on failed to resolve the default argument value

2022-01-22 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 83aef4d34022f293336f606dba8598cc7ac8f9f2 by Miss Islington (bot) 
in branch '3.10':
bpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' 
(GH-30285) (#30765)
https://github.com/python/cpython/commit/83aef4d34022f293336f606dba8598cc7ac8f9f2


--

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



[issue46419] Incomplete Comparison to C++ Methods

2022-01-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

You appear more interested in a discussion of Python semantics than in 
improving the tutorial. I see nothing actionable here.

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

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



[issue46445] Multiple inheritance of TypedDict is not covered in `test_typing`

2022-01-21 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 65b88d5e01c845c0cfa3ff61bc8b2faec8f67a57 by Nikita Sobolev in 
branch 'main':
bpo-46445: Cover multiple inheritance of `TypedDict` in `test_typing` (GH-30719)
https://github.com/python/cpython/commit/65b88d5e01c845c0cfa3ff61bc8b2faec8f67a57


--

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



[issue46396] Typing: test invalid usages of `Concatenate`

2022-01-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

Arguably the runtime should not check for incorrect calls to Concatenate. 
That's the job of static type checkers. So maybe that code could just be 
removed? (We don't bother checking things like list[0] either.)

--

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



[issue43118] inspect.signature() raises RuntimeError on failed to resolve the default argument value

2022-01-21 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 881a763cfe07ef4a5806ec78f13a9bc99e8909dc by Weipeng Hong in 
branch 'main':
bpo-43118: Fix bug in inspect.signature around 'base.__text_signature__' 
(GH-30285)
https://github.com/python/cpython/commit/881a763cfe07ef4a5806ec78f13a9bc99e8909dc


--
nosy: +gvanrossum

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



[issue46419] Incomplete Comparison to C++ Methods

2022-01-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

Just because __init__ is extra weird doesn't mean that other methods aren't 
roughly like C++.

But I can't find the text the OP refers to. Without a specific pointer (at 
least a URL and quoted text) this issue is non-actionable and should probably 
be closed.

--

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



[issue44975] [typing] Runtime protocols with ClassVar data members should support issubclass

2022-01-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

IMO we shouldn't update PEP 544. PEPs reflect the historical proposal, they are 
not documentation for the current state of the interpreter.

--

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



[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

2022-01-21 Thread Guido van Rossum


Guido van Rossum  added the comment:

I was hoping @eric.snow could tell me.

--

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



[issue46449] Deep-freezed modules create inconsistency in sys.gettotalrefcount() (_Py_Reftotal)

2022-01-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

Hm, the deep-frozen objects are statically initialized with a very large 
refcount that isn't accounted for (they are intended to be immortal). It seems 
that Py_Finalize() somehow decrefs those objects. I guess this means we need 
some kind of flag indicating certain objects are immortal (Eric has proposed 
several schemes), then we could just mark these objects as immortal.

This reminds me, since https://github.com/python/cpython/pull/30715 (which I 
merged yesterday) the deep-frozen objects also reference the small ints 
directly, as well as the singleton for b"". Is this even safe across 
Py_Finalize()/Py_Initialize()? If not, we'll need to roll that back as well.

--

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-20 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

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



[issue46429] Merge all deepfrozen files into one

2022-01-20 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset ef3ef6fa43d5cca072eed2a66064e818de583be7 by Kumar Aditya in 
branch 'main':
bpo-46429: Merge all deepfrozen files into one (GH-30572)
https://github.com/python/cpython/commit/ef3ef6fa43d5cca072eed2a66064e818de583be7


--

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



[issue46441] Caret points to wrong line on 'return yield 42' in REPL

2022-01-20 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for the quick fix!

--

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



[issue46443] Deepfreeze use preallocated small ints

2022-01-19 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 194ecc6d44adc1fb39a56ca696418368b69432ce by Kumar Aditya in 
branch 'main':
bpo-46443: deepfreeze: use small ints and singleton zero bytes (GH-30715)
https://github.com/python/cpython/commit/194ecc6d44adc1fb39a56ca696418368b69432ce


--

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



[issue46441] Caret points to wrong line on 'return yield 42' in REPL

2022-01-19 Thread Guido van Rossum


New submission from Guido van Rossum :

This seems to happen in 3.11 in the REPL only.

>>> def f():
...   print(0)
...   return yield 42
  File "", line 3
def f():
^
SyntaxError: invalid syntax

Note that running it from a file gives the expected output:

PS C:\Users\gvanrossum\cpython> py -3.10 .\t.py
  File "C:\Users\gvanrossum\cpython\t.py", line 3
return yield 42
   ^
SyntaxError: invalid syntax

as does the 3.10 REPL:

>>> def f():
...   print(0)
...   return yield 42
  File "", line 3
return yield 42
   ^
SyntaxError: invalid syntax

--
assignee: pablogsal
components: Parser
messages: 410988
nosy: gvanrossum, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Caret points to wrong line on 'return yield 42' in REPL
versions: Python 3.11

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



[issue46437] Non-required `hasattr` checks in `test_typing`

2022-01-19 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 263c0dd16017613c5ea2fbfc270be4de2b41b5ad by Nikita Sobolev in 
branch 'main':
bpo-46437: remove useless `hasattr` from `test_typing` (#30704)
https://github.com/python/cpython/commit/263c0dd16017613c5ea2fbfc270be4de2b41b5ad


--
nosy: +gvanrossum

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-19 Thread Guido van Rossum


Guido van Rossum  added the comment:

Given all this discussion I defer to Serhiy and Inada-San.

On Wed, Jan 19, 2022 at 02:23 Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> I share concerns of Inada-san. I also think that keeping a status quo
> (ignoring the mapping attribute in typing) is the lesser evil. I am not
> sure that exposing this attribute was a good idea. We do not expose
> attributes list and index for list iterators.
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue46399>
> ___
>
-- 
--Guido (mobile)

--

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



[issue46429] Merge all deepfrozen files into one

2022-01-18 Thread Guido van Rossum


New submission from Guido van Rossum :

This saves some space when strings are shared across deep-frozen module.
Kumar measured this at around 0.2 Mbyte.

See discussion https://github.com/faster-cpython/ideas/issues/218

--

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-17 Thread Guido van Rossum


Guido van Rossum  added the comment:

Probably.

On Mon, Jan 17, 2022 at 02:14 Alex Waygood  wrote:

>
> Alex Waygood  added the comment:
>
> Do these changes warrant an entry in "What's New in 3.11"?
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue46399>
> ___
>
-- 
--Guido (mobile)

--

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



[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2022-01-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

[Meta: Why did adding a comment add all those people (back?) to the nosy list?]

--

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



[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-16 Thread Guido van Rossum

Guido van Rossum  added the comment:

Okay, PR welcome.

(Though since this can only work for 3.11+,
maybe typeshed could also be adjusted?
For that you’d have to file a bug there.)

--

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Guido van Rossum

Guido van Rossum  added the comment:

Wasn’t the fix for it also backported?

(Weird that the test wasn’t part of the fix.)

--

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



[issue46345] Add an explicit test for `get_type_hints` for a class field with `None` default

2022-01-12 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 1de60155d5d01be2924e72fb68dd13d4fd00acd7 by Nikita Sobolev in 
branch 'main':
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)
https://github.com/python/cpython/commit/1de60155d5d01be2924e72fb68dd13d4fd00acd7


--

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



[issue46342] Make @final introspectable at runtime

2022-01-12 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 0bbf30e2b910bc9c5899134ae9d73a8df968da35 by Jelle Zijlstra in 
branch 'main':
bpo-46342: make @typing.final introspectable (GH-30530)
https://github.com/python/cpython/commit/0bbf30e2b910bc9c5899134ae9d73a8df968da35


--

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



[issue46348] Modernize `test_typing`

2022-01-12 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset e2a9c8ef09cb7123d6b28852a323e6cc1f878b5b by Nikita Sobolev in 
branch 'main':
bpo-46348: modernize `test_typing` (GH-30547)
https://github.com/python/cpython/commit/e2a9c8ef09cb7123d6b28852a323e6cc1f878b5b


--

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



[issue46303] _Py_stat and _Py_wstat using incorrect type for status argument

2022-01-11 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

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



[issue46346] New compilation warnings on Windows

2022-01-11 Thread Guido van Rossum


New submission from Guido van Rossum :

I am getting these warnings:

C:\Users\gvanrossum\cpython\PC\_testconsole.c(70,38): warning C4013: 
'_Py_get_osfhandle' undefined; assuming extern returnin
g int [C:\Users\gvanrossum\cpython\PCbuild\_testconsole.vcxproj]
C:\Users\gvanrossum\cpython\PC\_testconsole.c(70,1): warning C4047: 
'initializing': 'HANDLE' differs in levels of indirectio
n from 'int' [C:\Users\gvanrossum\cpython\PCbuild\_testconsole.vcxproj]
C:\Users\gvanrossum\cpython\Modules\_tkinter.c(144,37): warning C4013: 
'_Py_stat' undefined; assuming extern returning int [
C:\Users\gvanrossum\cpython\PCbuild\_tkinter.vcxproj]

I noticed that GitHub also was flagging these in unrelated PRs.

--
components: Build, Windows
messages: 410320
nosy: gvanrossum, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: New compilation warnings on Windows
versions: Python 3.11

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



[issue46244] typing._TypeVarLike missing __slots__

2022-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yes.--
--Guido (mobile)

--

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



[issue41987] singledispatchmethod raises an error when relying on a forward declaration

2022-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks for the bisection. It's not surprising that that's the culprit, and in 
other situations that's the right thing to do. I'm not sure how to address this 
without breaking other stuff -- maybe leave the ForwardRef if evaluating it 
doesn't work? But that's likely to have other subtle side effects -- we still 
want simple typos (or other reasons why a reference is legitimately broken) to 
go unchecked. Maybe singledispatch can catch the error and fall back on looking 
at bare __annotations__?

--

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



[issue46162] Make `builtins.property` generic

2022-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

Since the conclusion is that we can't do this without breaking backwards 
compatibility, should we just close this? Or is there still a compromise 
possible?

--

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

Good catch. Do you want to submit a PR? I agree that the repr() could also be 
better (but please only show other values if they differ from the default).

--
versions: +Python 3.11

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



[issue46333] ForwardRef.__eq__ does not respect module parameter

2022-01-10 Thread Guido van Rossum


Change by Guido van Rossum :


--
stage:  -> needs patch

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yup. All better: 
https://speed.python.org/timeline/#/?exe=12=python_startup=1=50=off=on=on

--

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



[issue46148] Optimize pathlib

2022-01-08 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

To close the loop, setuptools 60.4.0 should fix this, see 
https://github.com/pypa/setuptools/pull/3009.

--

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



[issue45661] [meta] Freeze commonly used stdlib modules.

2022-01-07 Thread Guido van Rossum


Guido van Rossum  added the comment:

Deep-freezing is definitely not a miracle cure. We should continue to trim or 
delay unneeded imports (like Christian just did for setuptools' 
_distutils_hack).

What *would* be a miracle cure would be if we could deep-freeze the module 
contents after it has *executed*. But that is much harder in general, since two 
executions (even on the same platform) could result in different module 
contents (e.g. conditionally defining something based on environment contents).

Instagram's Cinder has something that works for this, strict modules 
(https://github.com/facebookincubator/cinder#strict-modules). It is a complex 
system! But if we could do this it could really speed up a lot of imports 
tremendously. (Though still at the cost of binary size increase.)

--

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



[issue41370] PEP 585 and ForwardRef

2022-01-07 Thread Guido van Rossum


Guido van Rossum  added the comment:

Niklas, can you show a brief example showing the issue you're running into? Is 
it just that list["Node"].__args__ is just ("Node",), not 
(ForwardRef("Node"),)? Or is it more complex?

--

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



[issue46263] FreeBSD buildbots cannot compile Python

2022-01-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

IIUC Steve is still on vacation, so we shouldn't wait for him to fix this.

--

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



[issue46263] FreeBSD buildbots cannot compile Python

2022-01-06 Thread Guido van Rossum


Guido van Rossum  added the comment:

Is this under control, or do you still need help with some part? (Are there
two separate issues or not?)--
--Guido (mobile)

--

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



[issue46263] FreeBSD buildbots cannot compile Python

2022-01-04 Thread Guido van Rossum


Change by Guido van Rossum :


--
title: FreeBSL buiildbots cannot compile Python -> FreeBSD buildbots cannot 
compile Python

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2022-01-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

I now agree with Serhiy's plan. We should execute ASAP so people get a chance 
to try this in the next alpha release.

We will still allow instantiating e.g. list[int], right?

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

More data. On my Mac, with SETUPTOOLS_USE_DISTUTILS=stdlib, using -X importtime 
I see the following extra modules being imported:

import time:   278 |278 | types
import time:   112 |112 |   _operator
import time:   419 |531 | operator
import time:   129 |129 | itertools
import time:   325 |325 | keyword
import time:   468 |468 | reprlib
import time:   258 |258 | _collections
import time:   978 |   2156 |   collections
import time:78 | 78 |   _functools
import time:   835 |   3068 | functools
import time:  1359 |   5235 |   enum
import time:   138 |138 | _sre
import time:   497 |497 |   sre_constants
import time:   528 |   1025 | sre_parse
import time:   512 |   1674 |   sre_compile
import time:   109 |109 |   _locale
import time:   886 |886 |   copyreg
import time:   671 |   8574 | re
import time:   471 |471 |   warnings
import time:   330 |801 | importlib
import time:   906 |  10279 |   _distutils_hack

That's around 10 msec, so in the right ballpark.

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'm still wondering why speed.python.org showed such a slowdown, and how we can 
revert that. Here's a new theory.

Thanks to an investigation I did together with Eric, I now suspect that the 
release of setuptools 60.0.0 on Dec 19 is a smoking gun. PyPerformance 
(re)installs the latest versions of pip and setuptools.

Setuptools 60.0 makes a change in the file distutils-precedence.pth that causes 
it (by default) to import something called _distutils_hack and to call its 
add_shim() function. In previous setuptools this was off by default, but in 
60.0 it switched to on. See 
https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v6000

That add_shim() call in turn installs an extra entry in front of sys.meta_path, 
which does a bunch of extra work. See 
https://github.com/pypa/setuptools/blob/main/_distutils_hack/__init__.py

Pablo, can we change the PyPerformance configuration or the script that runs it 
to set and export SETUPTOOLS_USE_DISTUTILS=stdlib, to see whether that affects 
perf at all?

(Note that the code in distutils-precedence.pth is executed by site.py in 
addpackage().)

--

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2022-01-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

Okay, so it is probably here to stay. We could justify it (after the fact :-) 
by saying that you can instantiate list[int], but not Any.

Are there exceptions to that? (I.e. are there other annotation types that have 
isinstance(X, type) return False but can be instantiated, or the other way 
around?)

--

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2022-01-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

So is it too late to change this? This went out with 3.10, Serhiy has argued 
it's a bugfix.

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

"is very very unlike that there is no actual regression"

I presume you meant

"it is very very *likely* that there is no actual regression"

This shouldn't hold up releases, but (having spent months trying to improve 
startup speed) I would still like to get to the bottom of the speed.python.org 
regression.

--
priority: release blocker -> normal

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

I wrote a tiny script that calls compile() on raw bytes read from some source 
file, does this 100 times, and reports the total time. I tested the script with 
Lib/pydoc_data/topics.py (which happens to be the largest source file in the 
CPython repo, but mostly string literals) and with Lib/test/test_socket.py (the 
second-largest file).

I built python.exe on a Mac with PGO/LTO, from "make clean", both before and 
after (at) PR 30177. For both files, the difference between the results is well 
in the noise caused by my machine (I don't have a systematic way to stop 
background jobs). But it's very clear that this PR cannot have been the cause 
of an 85% jump in the time taken by the python_startup benchmark in 
PyPerformance.

For topics.py, the time was around 7.2 msec/compile; for test_socket.py, it was 
around 38. (I am not showing separate before/after numbers because the noise in 
my data really is embarrassing.)

The compilation speed comes down to ~170,000 lines/sec on my machine (an Intel 
Mac from 2019; 2.6 GHz 6-Core Intel Core i7 running macOS Big Sur 11.6.1; it 
has clang 12.0.5).

It must be something weird on the benchmark machines. I suspect that a new 
version of some package was installed in the venv shared by all the benchmarks 
(we are still using PyPerformance 1.0.2) and that affected something, perhaps 
through a .pth file?

--

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



[issue46244] typing._TypeVarLike missing __slots__

2022-01-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

Confirmed about _TypeVarLike. Go ahead and make a PR. Do add a news blurb when 
requested.

Please open separate issues for other such classes, each fix may need to be 
reviewed by a different expert.

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-03 Thread Guido van Rossum


Guido van Rossum  added the comment:

I propose a test: revert the PR and see if speed.Python.org shows a speedup
back to the previous number.--
--Guido (mobile)

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Maybe something unrelated changed on the benchmark machines? (Like installing a 
new version of pyperformance???) Though it happened across both benchmark 
machines. What configuration and flags are being used to run the benchmark 
suite on that machine?

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Maybe it's Linux specific? I managed to run pyperformance and got this:

### python_startup ###
Mean +- std dev: 23.2 ms +- 0.8 ms -> 23.4 ms +- 1.2 ms: 1.01x slower
Not significant

Note, I am not dismissing the report -- in fact it looks quite bad. But I am 
failing to reproduce it, which makes it harder to understand the root cause. :-(

Maybe we can create a microbenchmark for this that just parses a large amount 
of code?

Anyway, here's a random thought about why this might have such a big impact. 
Look at this snippet (found all over the parser.c file):

if (p->level++ == MAXSTACK) {
p->error_indicator = 1;
PyErr_NoMemory();
}
if (p->error_indicator) {
p->level--;
return NULL;
}

This is two "unlikely" branches in a row, and the first sets the variable 
tested by the second. Maybe this causes the processor to stall?

Also, maybe it would be wiser to use ++X instead of X++? (Though a good 
compiler would just change X++ == Y into ++X == Y+1.)

Anyway, without a way to reproduce, there's not much that can be done.

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

So if I understand the speed.python.org results correctly, the time to run 
`python -c pass` went way up, but the time for `python -S -c pass` did not go 
up significantly.

Unfortunately the only machine I have access to is a Mac, and I cannot repro 
this result, using PGO/LTO. Could it be a Linux thing? Or due to something in 
the venv for pyperformance?

Note that I am using a much simpler test script: Tools/scripts/startuptime.py. 
I have not yet succeeded in building and running pyperformance, mostly since 
the Python I build doesn't have SSL configured (I always forget the flag to use 
on my machine) and pyperformance insists on installing a bunch of stuff 
(including new versions of pip and setuptools, it seels).

Can anyone repro the perf regression on their box?

--

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



[issue46110] compile("-"*3000000 + "4", '', mode) causes hard crash

2022-01-02 Thread Guido van Rossum


Guido van Rossum  added the comment:

Let me have a look. May take a day, okay?--
--Guido (mobile)

--

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



[issue44394] [security] CVE-2013-0340 "Billion Laughs" fixed in Expat >=2.4.0: Update vendored copy to expat 2.4.1

2022-01-01 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

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



[issue46195] Annotated and Optional get_type_hints buggy interaction

2021-12-30 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yes, we changed PEP 484 in https://github.com/python/peps/pull/689.

So get_type_hints() should follow suit.

--

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



[issue46191] Conflict between using annotations in singledispatch() and MyPy

2021-12-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

If we allow registering list[int] but give it the same meaning as registering 
plain list (at runtime), that would violate user expectations pretty strongly 
-- for the same reason why we don't allow isinstance(x, list[int]).

If you want stronger checking inside the function you should probably do 
something like

@foo.register
def _(_a: list) -> ...:
a: list[int] = _a
...

That said I don't care enough about singledispatch to argue strongly.

--

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



[issue46195] Annotated and Optional get_type_hints buggy interaction

2021-12-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Could you try with 3.10 and the stdlib typing.Annotated please? There might
be changes (in the past a default of None automatically caused an Optional
to be added, but we changed our minds.--
--Guido (mobile)

--

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



[issue34498] Python 3.7+ break on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2021-12-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Let's close this issue as "won't fix" then. The solution "use 
collections.abc.Sequence" makes sense.

--

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



[issue46191] Conflict between using annotations in singledispatch() and MyPy

2021-12-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

That mypy error is only reported with a certain mypy setting (--strict, or 
probably one of the specific settings that that turns on).

We won't be supporting Sequence[Any] at runtime (because we only support actual 
types), but we should support Sequence, since that *is* an actual type (at 
least collections.abc.Sequence is).

So IMO this is either a problem in mypy (though in that case probably in 
typeshed) or a situation for which the user should just silence mypy (it's not 
perfect and never claimed to be).

But I think there's nothing for us to do in Python itself, so this bug should 
be closed.

--

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



[issue34498] Python 3.7+ break on singledispatch_function.register(pseudo_type), which Python 3.6 accepted

2021-12-28 Thread Guido van Rossum


Guido van Rossum  added the comment:

There's no point in lamenting the compatibility with Python 3.6, it's water 
under the bridge. Dispatching on types like list[int] or types generated by 
NewType is not realistic. Maybe the only thing left to do is to raise an error 
on registration when the type is e.g. list[int]? Currently that passes, but 
then attempting to dispatch on *anything* fails with TypeError: issubclass() 
argument 2 cannot be a parameterized generic

--
nosy: +gvanrossum, serhiy.storchaka

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



[issue46170] Improving the error message when subclassing NewType

2021-12-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

Weird, the docs you cite claims


   # Also does not typecheck
   ProUserId = NewType('ProUserId', UserId)

but when I try it, it works at runtime and passes mypy (even with --strict) and 
also pyright.

So maybe those docs are incorrect? I can't find anything in PEP 484 about this.

In any case I'd drop the newline in the message -- other "Did you mean" errors 
don't have those.

--

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



[issue46170] Improving the error message when subclassing NewType

2021-12-26 Thread Guido van Rossum


Guido van Rossum  added the comment:

Do you have evidence that people make this particular mistake often? And that 
the suggested solution is indeed what they should use? Why would you want to 
subclass UserId?

Do we have examples of other error messages split across two lines like this?

--

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



[issue45665] Problems caused by isinstance(list[int], type) returning True

2021-12-24 Thread Guido van Rossum


Guido van Rossum  added the comment:

See https://github.com/python/mypy/issues/9773#issuecomment-1000975000. I may 
have talked myself into agreeing with Serhiy there! It does seem inconsistent 
that Any is not considered a type but list[int] is:

>>> isinstance(list[int], type)
True
>>> import typing
>>> isinstance(typing.Any, type)

--

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



  1   2   3   4   5   6   7   8   9   10   >