[issue45735] Promise the long-time truth that `args=list` works

2022-01-27 Thread Charlie Zhao


Change by Charlie Zhao :


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

___
Python tracker 

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



[issue42238] Deprecate suspicious.py?

2022-01-27 Thread Julien Palard


Change by Julien Palard :


--
pull_requests: +29160
pull_request: https://github.com/python/cpython/pull/30981

___
Python tracker 

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



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-27 Thread Dennis Sweeney

Dennis Sweeney  added the comment:

Why? Callee-borrowing-from-caller is the established norm across the C API. You 
mention use-after-free, but can you elaborate on how that can happen in 
practice?

https://docs.python.org/3/extending/extending.html?highlight=borrowed#ownership-rules
 says:

"""When you pass an object reference into another function, in general, the 
function borrows the reference from you — if it needs to store it, it will use 
Py_INCREF() to become an independent owner."""

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue25948] Invalid MIME encoding generated by email.mime (line too long)

2022-01-27 Thread jiahua wang


Change by jiahua wang :


--
keywords: +patch
nosy: +wangjiahua
nosy_count: 3.0 -> 4.0
pull_requests: +29159
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30980

___
Python tracker 

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



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-27 Thread Maxwell Bernstein


Change by Maxwell Bernstein :


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

___
Python tracker 

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



[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-01-27 Thread Maxwell Bernstein


New submission from Maxwell Bernstein :

Currently the descriptor (self) argument to __get__ is passed borrowed, since 
_PyType_LookupId returns a borrowed reference (see _PyObject_LookupSpecial and 
lookup_maybe_method in Objects/typeobject.c). This should instead own the 
reference.

--
messages: 411978
nosy: tekknolagi
priority: normal
severity: normal
status: open
title: Descriptor resolution should own arguments passed to descriptors
versions: Python 3.10, Python 3.11, Python 3.8, Python 3.9

___
Python tracker 

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



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

2022-01-27 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



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

2022-01-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29157
pull_request: https://github.com/python/cpython/pull/30978

___
Python tracker 

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



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

2022-01-27 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Thank you!

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



[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 

___
___
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-27 Thread Kumar Aditya


Kumar Aditya  added the comment:

Christian's solution seems better to me so I'll close my PR. Christian would 
you like to create a PR for it ?

--

___
Python tracker 

___
___
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-27 Thread Kumar Aditya


Kumar Aditya  added the comment:

I created a PR https://github.com/python/cpython/pull/30976 which adjusts 
_Py_RefTotal and refcnt of immortal codeobjects to account for 
Py_INCREF/Py_DECREF on codeobjects. With that patch refcnt is 8 and increases 
by 8 with each initialization of Python.

--

___
Python tracker 

___
___
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-27 Thread Kumar Aditya


Change by Kumar Aditya :


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

___
Python tracker 

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



[issue46560] ParamSpec: Typo in doc string

2022-01-27 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for noticing! Would you like to submit a PR to fix it?

--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue46454] '0 -> /dev/null' is lost

2022-01-27 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue46454] '0 -> /dev/null' is lost

2022-01-27 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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

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



[issue46558] Quadratic time internal base conversions

2022-01-27 Thread Tim Peters


Tim Peters  added the comment:

Changed the code so that inner() only references one of the O(log log n) powers 
of 2 we actually precomputed (it could get lost before if `lo` was non-zero but 
within `n` had at least one leading zero bit - now we _pass_ the conceptual 
width instead of computing it on the fly).

--
Added file: https://bugs.python.org/file50595/todecstr.py

___
Python tracker 

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



[issue46560] ParamSpec: Typo in doc string

2022-01-27 Thread Evan


New submission from Evan :

Apologies if this is pedantic; in the typing.py file the ParamSpec's doc string 
says:

"They are only valid when used in ``Concatenate``,
or s the first argument to ``Callable``"

I believe it should be:

"They are only valid when used in ``Concatenate``,
or as the first argument to ``Callable``"

s -> as

--
messages: 411970
nosy: ESchalton
priority: normal
severity: normal
status: open
title: ParamSpec: Typo in doc string
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



[issue46558] Quadratic time internal base conversions

2022-01-27 Thread Tim Peters


Tim Peters  added the comment:

Dennis, partly, although that was more aimed at speeding division, while the 
approach here doesn't use division at all.

However, thinking about it, the implementation I attached doesn't actually for 
many cases (it doesn't build as much of the power tree in advance as may be 
needed). Which I missed because all the test cases I tried had mountains of 
trailing 0 or 1 bits, not mixtures.

So I'm closing this anyway, at least until I can dream up an approach that 
always works. Thanks!

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

___
Python tracker 

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



[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-27 Thread Keelung Yang


Keelung Yang  added the comment:

@barneygale,
This is for simplifying code and improve readability, since `Readability 
counts` in The Zen of Python.

Users needn't two lines code to append a file. And there is a minimal modifying 
to reach it.

If inexperienced users are falling into the hole, just let them in and then 
learned sth. Because they will go out of the hole sooner or later. 

And finally, two lines cann't prevent them from falling into the hole.

--

___
Python tracker 

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



[issue46559] base64 documentation is out-dated; altchars has to have the exact length of 2.

2022-01-27 Thread hello world


New submission from hello world :

According to the documentation of base64 
(https://docs.python.org/3/library/base64.html),

> Optional altchars must be a bytes-like object of at least length 2 
> (additional characters are ignored) which specifies an alternative alphabet 
> for the + and / characters.

but this explanation is out-dated.

Actually this had been correct until the commit 
`4581ae5fa2450db3f00384e4b2e86654605100d4` was made for cpython in "2007".
(Thus, the explanation has been incorrect for about 15 years.)

The current implementation requires the length of `altchars` to be exactly two, 
as explicitly written in the comment:

> Optional altchars should be a byte string of length 2 which specifies an 
> alternative alphabet for the '+' and '/' characters.

and the corresponding assertion is:

> assert len(altchars) == 2, repr(altchars)

--
assignee: docs@python
components: Documentation
messages: 411967
nosy: docs@python, qp3839
priority: normal
severity: normal
status: open
title: base64 documentation is out-dated; altchars has to have the exact length 
of 2.
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



[issue46548] macOS installers cannot be signed on Monterey

2022-01-27 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
nosy: +ned.deily

___
Python tracker 

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



[issue46558] Quadratic time internal base conversions

2022-01-27 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Is this similar to https://bugs.python.org/issue3451 ?

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue43536] 3.9.2 --without-pymalloc --with-pydebug --with-valgrind: test failed: test_posix

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

Without the test output, we cannot investigate the issue. I close it.

--
nosy: +vstinner
resolution:  -> out of date
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



[issue40077] Convert static types to heap types: use PyType_FromSpec()

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-23769 "valgrind reports leaks for test_zipimport" as duplicate of 
this issue. At exit, Python doesn't clear the static types of the _collections, 
itertools and _struct extensions:

* itertools.accumulate
* itertools.combinations
* itertools.combinations_with_replacement
* itertools.cycle
* itertools.dropwhile
* itertools.takewhile
* itertools.islice
* itertools.starmap
* itertools.chain
* itertools.compress
* itertools.filterfalse
* itertools.count
* itertools.zip_longest
* itertools.pairwise
* itertools.permutations
* itertools.product
* itertools.repeat
* itertools.groupby
* itertools._grouper
* itertools._tee
* itertools._tee_dataobject
* collections.deque
* _collections._deque_iterator
* _collections._deque_reverse_iterator
* _collections._tuplegetter
* _struct.Struct
* _struct.unpack_iterator

See: https://bugs.python.org/issue23769#msg411963

--

___
Python tracker 

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



[issue23769] valgrind reports leaks for test_zipimport

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

> valgrind reports leaks for test_zipimport

It's not strictly a memory leak: running the same code multiple time doesn't 
leak memory. It's just that Python allocates memory once and never releases it 
(doesn't releast it at exit).

---

leak4.py: Updated and simplified script.

If the code is run 10 times, it doesn't leak. With 1, 10 or 100 loops 
(LOOPS=100), Python still says the same at exit:

$ ./python -I -X showrefcount leak4.py 
[1574 refs, 664 blocks]

Using cannot_deallocate2.patch of bpo-46417, I can see that multiple static 
types are not cleared at Python exit:
---
Cannot deallocate type 'Exception': it still has subclasses
* error
Cannot deallocate type 'BaseException': it still has subclasses
* Exception
Cannot deallocate type 'dict': it still has subclasses
* collections.defaultdict
Cannot deallocate type 'object': it still has subclasses
* dict
* BaseException
* itertools.accumulate
* itertools.combinations
* itertools.combinations_with_replacement
* itertools.cycle
* itertools.dropwhile
* itertools.takewhile
* itertools.islice
* itertools.starmap
* itertools.chain
* itertools.compress
* itertools.filterfalse
* itertools.count
* itertools.zip_longest
* itertools.pairwise
* itertools.permutations
* itertools.product
* itertools.repeat
* itertools.groupby
* itertools._grouper
* itertools._tee
* itertools._tee_dataobject
* collections.deque
* _collections._deque_iterator
* _collections._deque_reverse_iterator
* _collections._tuplegetter
* _struct.Struct
* _struct.unpack_iterator
---

The _collections, itertools and _struct extensions implement types as static 
types which are not cleared at Python exit. It explains why Python says that 
there are still 664 memory blocks allocated at Python exit (664 blocks).

I consider that this issue is a duplicate of bpo-40077.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Convert static types to heap types: use PyType_FromSpec()
Added file: https://bugs.python.org/file50594/leak4.py

___
Python tracker 

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



[issue46558] Quadratic time internal base conversions

2022-01-27 Thread Tim Peters


New submission from Tim Peters :

Our internal base conversion algorithms between power-of-2 and non-power-of-2 
bases are quadratic time, and that's been annoying forever ;-) This applies to 
int<->str and int<->decimal.Decimal conversions. Sometimes the conversion is 
implicit, like when comparing an int to a Decimal.

For example:

>>> a = 1 << 10 # yup! a billion and one bits
>>> s = str(a)

I gave up after waiting for over 8 hours, and the computation apparently can't 
be interrupted.

In contrast, using the function in the attached todecstr.py gets the result in 
under a minute:

>>> a = 1 << 10
>>> s = todecstr(a)
>>> len(s)
301029996

That builds an equal decimal.Decimal in a "clever" recursive way, and then just 
applies str to _that_.

That's actually a best case for the function, which gets major benefit from the 
mountains of trailing 0 bits. A worst case is all 1-bits, but that still 
finishes in under 5 minutes:

>>> a = 1 << 10
>>> s2 = todecstr(a - 1)
>>> len(s2)
301029996
>>> s[-10:], s2[-10:]
('1787109376', '1787109375')

A similar kind of function could certainly be written to convert from Decimal 
to int much faster, but it would probably be less effective. These things avoid 
explicit division entirely, but fat multiplies are key, and Decimal implements 
a fancier * algorithm than Karatsuba.

Not for the faint of heart ;-)

--
components: Interpreter Core
files: todecstr.py
messages: 411962
nosy: tim.peters
priority: normal
severity: normal
status: open
title: Quadratic time internal base conversions
type: performance
Added file: https://bugs.python.org/file50593/todecstr.py

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-35774 as a duplicate of this issue.

--

___
Python tracker 

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



[issue35774] ASAN, memory leak

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

> 1. Run python
> 2. Ctrl + D

It seems like this scenario has recently been fixed in bpo-1635741:

$ ./python -I -X showrefcount 
Python 3.11.0a4+ (heads/main:18ea973c21, Jan 28 2022, 01:38:10) [GCC 11.2.1 
20211203 (Red Hat 11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[-4 refs, 1 blocks]

If you still see memory leaks in Python 3.11, please better describe what you 
do to "Run python" and open a new issue ;-)

--
nosy: +vstinner
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Py_Finalize() doesn't clear all Python objects at exit

___
Python tracker 

___
___
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 Gregory Beauregard


Gregory Beauregard  added the comment:

I think I miscommunicated my intent with sentence placement. I already posted 
the thoughts I referred to; they're just my concluding opinion on the technical 
merit of using get_type_hints in dataclasses to solve the Annotated problem: 
https://bugs.python.org/msg411945

In any case, I apologize for the faux pas and I'll be careful in the future.

I dug up the issue where pyright was changed (to allow bare ClassVar) that has 
an argument for not allowing it to be bare: 
https://github.com/microsoft/pyright/issues/2377

--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

Raymond:
> Is the subinterpreters work still on hold pending a PEP?

While sub-interpreters is one motivation to convert static types to heap types, 
it's not the only one.

IMO it's better to use the "embedded Python" use case to justify these changes, 
since embedding Python is non controversial and is already widely used.

For me, another motivation (related to embedded Python) is to release all 
memory in Py_Finalized(): see bpo-1635741. While this main issues is now 
closed, Python still leaks memory when you import C extensions using static 
types: see bpo-40077.

--

Hai Shi proposed to add a PyStructSequence_FromModuleAndDesc() function but 
right now, I'm not sure which C extension requires to retrieve a module state 
from a structseq object. Usually, structseq types have no method. So I don't 
see the need to reopen the issue.

I just wanted to comment this closed issue ;-)

--

___
Python tracker 

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



[issue45113] [subinterpreters][C API] Add a new function to create PyStructSequence from Heap.

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

Quick update on this closed issue.

I landed on this issue from Erlend's SC request: 
https://github.com/python/steering-council/issues/99

> Oh! I assumed this bug wasn't resolved, but it is -- in bpo-34784. Sorry, I 
> should have checked!

Yes, there is the PyStructSequence_NewType() function which exists since 2010 
(PEP 384 implementation: commit 4d0d471a8031de90a2b1ce99c4ac4780e60b3bc9).

I recently added _PyStructSequence_NewType() to the internal C API to pass 
flags like Py_TPFLAGS_DISALLOW_INSTANTIATION. I modified signal, _curses, time 
and _thread modules to use it.

On the other side, I added _PyStructSequence_FiniType() to clear a static 
structseq (bpo-46417).

--
nosy: +vstinner

___
Python tracker 

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



[issue46557] Logging captured warnings with a format string unnecessarily groups warnings together

2022-01-27 Thread Michael P. Nitowski


Michael P. Nitowski  added the comment:

Of course, here's an example script to reproduce:

```
import logging
import warnings

import sentry_sdk
from sentry_sdk.integrations.logging import LoggingIntegration

logging.captureWarnings(True)

sentry_logging = LoggingIntegration(
level=logging.INFO,
event_level=logging.WARNING
)

sentry_sdk.init(
"",
traces_sample_rate=1.0,
integrations=[
LoggingIntegration(
level=logging.INFO,
event_level=logging.WARNING
)
]
)

warnings.warn("A warning")
warnings.warn("Another warning")
```

I attached a file of what it looks like in the Sentry UI. Notice both warnings 
under the same issue. When logging warnings directly with the logging module, 
each message arrives as a separate issue. These warnings from the warnings 
module are both grouped together under the same issue since Sentry groups all 
logs with the same format string together.

--
Added file: https://bugs.python.org/file50592/Screen Shot 2022-01-27 at 8.09.37 
PM.png

___
Python tracker 

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

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread miss-islington


miss-islington  added the comment:


New changeset 8cd82461f9bb17381bf9d09989daea316c609cd5 by Miss Islington (bot) 
in branch '3.9':
bpo-46542: test_json uses support.infinite_recursion() (GH-30972)
https://github.com/python/cpython/commit/8cd82461f9bb17381bf9d09989daea316c609cd5


--

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

IIRC, Carl got a lot of benefit out of reordering the opcodes in the main loop 
to put the most common ones at the top.  I don't know if that is still relevant 
or whether computed gotos, when enabled, change that calculus.

--

___
Python tracker 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread miss-islington


miss-islington  added the comment:


New changeset 20f53136679e260466a765de5befa3b9db396c9e by Miss Islington (bot) 
in branch '3.10':
bpo-46542: test_json uses support.infinite_recursion() (GH-30972)
https://github.com/python/cpython/commit/20f53136679e260466a765de5befa3b9db396c9e


--

___
Python tracker 

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



[issue46557] Logging captured warnings with a format string unnecessarily groups warnings together

2022-01-27 Thread Michael P. Nitowski


Change by Michael P. Nitowski :


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

___
Python tracker 

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



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-27 Thread Tim Peters


Tim Peters  added the comment:

I only merged the split-off PR that added new remainder-only functions. Still 
thinking about the `1 << n` and `2**n` one.

--
assignee:  -> tim.peters
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



[issue46557] Logging captured warnings with a format string unnecessarily groups warnings together

2022-01-27 Thread Eric V. Smith


Eric V. Smith  added the comment:

Could you give an example of the problem?

--
nosy: +eric.smith

___
Python tracker 

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



[issue46407] optimizing `1 << n` or `2 ** n` and modulo-only operations

2022-01-27 Thread Tim Peters


Tim Peters  added the comment:


New changeset f10dafc430279b4e6cf5b981ae3d1d76e8f431ad by Crowthebird in branch 
'main':
bpo-46407: Optimizing some modulo operations (GH-30653)
https://github.com/python/cpython/commit/f10dafc430279b4e6cf5b981ae3d1d76e8f431ad


--

___
Python tracker 

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



[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-27 Thread Eric V. Smith


Eric V. Smith  added the comment:

I was hoping to wait until the PEP 649 / PEP 563 thing was decided. But I 
realize that no matter how that turns out, there will be a need to deal with 
string annotations.

So I think I'm okay with the regex changes. Personally, I think we should 
remove support for leading spaces and should remove the tests, too. I guess 
there's some argument that there should be a deprecation period, I think it's 
just invalid syntax and shouldn't be supported.

Go ahead and put together a PR.

--

___
Python tracker 

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



[issue46557] Logging captured warnings with a format string unnecessarily groups warnings together

2022-01-27 Thread Michael P. Nitowski


New submission from Michael P. Nitowski :

Systems that aggregate logs like Sentry will group all captured warnings under 
the same event which makes it difficult to assess common warnings

--
components: Library (Lib)
messages: 411947
nosy: mnito
priority: normal
severity: normal
status: open
title: Logging captured warnings with a format string unnecessarily groups 
warnings together
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29153
pull_request: https://github.com/python/cpython/pull/30974

___
Python tracker 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e7a6285f1be18992191599792524d3aa6aedfa55 by Victor Stinner in 
branch 'main':
bpo-46542: test_json uses support.infinite_recursion() (GH-30972)
https://github.com/python/cpython/commit/e7a6285f1be18992191599792524d3aa6aedfa55


--

___
Python tracker 

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



[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-27 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

Hi Eric,

to follow up on https://bugs.python.org/msg411943

I'm currently a bit negative on moving to get_type_hints, even though I got it 
working for the test suite. I think your worries with nesting are well placed, 
particularly with namespaces and such.

In that vein, I suggest we move forward with patching the existing 
implementation with the discussed regex restrictions. I'm not sure if you want 
to remove the test cases with leading spaces; it seems not too important.

While we're there I found a bug in the test suite, a missing comma that can be 
fixed at the same time:
https://github.com/python/cpython/blob/b1a3446f077b7d56b89f55d98dadb8018986a3e5/Lib/test/test_dataclasses.py#L3080

Do you have any other concerns before I take a stab at this?

--

___
Python tracker 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

I managed to reproduce the test_json crash on the "Fedora Stable ppc64le" 
buildbot using clang. Commands:
---
./configure --with-pydebug CC=clang
make -j10
./python -m test -v test_json
---

I wrote GH-30972 to fix it.

--

___
Python tracker 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

___
___
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 Gregory Beauregard


Gregory Beauregard  added the comment:

It's acceptable to mypy, and pyright added support a few months ago when I made 
an issue and Eric Traut discovered this pattern in the wild too.

Some of the other type checkers (pyre) still error I believe. My feeling is 
that since this has apparently become used in practice we should fix the 
runtime error for when it's stringified, but we don't necessarily need to 
prescribe that it's a legal type annotation for type checkers (?). If I was 
prescribing how to use ClassVar in a vacuum, I don't see any good typing reason 
we should prohibit this.

re: moving dataclasses: I'm not sure either! I'm trying to look into the issues 
it brings up in practice to weigh against the difficulties of maintaining the 
existing bespoke introspection implementation and the problems it has (dealing 
with stringified annotations, supporting renaming the Annotated symbol).

I made an implementation that fully moves dataclasses over to using 
`get_type_hints` (and got all the tests to pass), but my feeling right now is 
that a few issues are too serious for it to be viable:

1) the namespaces are a mess, and issues like 
https://github.com/python/typing/issues/508 don't have a solution at the moment
2) get_type_hints paints a wide brush on the entire class when it raises for 
errors, so it's not very viable to deal with non-typing non-Annotated[] 
annotations as a one-off

There's also nontechnical issues, like the potential politics of making 
dataclasses always import typing. I'll be updating bpo-46511 later with 
thoughts.

--

___
Python tracker 

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



[issue31582] Add _pth breadcrumb to sys.path documentation

2022-01-27 Thread Steve Dower


Steve Dower  added the comment:

I think we need somewhere in the documentation to explain how the initial 
import path is calculated, in terms useful for an end user (rather than what's 
in getpath.py, which is for developers).

Right now, I'm not sure there's a good place for it. There's a Windows-specific 
page with some detail, but we probably need something more generic. Probably it 
belongs under Doc/using/cmdline.rst (the environment variables section there is 
tempting, but I expect those would be updated to point to an easier to follow 
explanation. We'd also point to it from sys.path.

Without adding the new section, there isn't really anywhere sensible to mention 
it.

--

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Brandt Bucher


Brandt Bucher  added the comment:

> I did an experiment to double the number of instructions.

Were the extra instructions just NOPs, or were they actually doing any work?

If they were NOPs, then presumably those numbers tell us more about the 
overhead of dispatch and cache pressure than anything else.

--

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Mark Shannon


Mark Shannon  added the comment:

Timings for individual instructions are a bit meaningless, as out-of-order 
execution and speculation on modern CPUs makes it hard to pin down the timing 
of anything.

I did an experiment to double the number of instructions. It slowed things down 
by ~10%, so increasing the number of instructions by 1% would be expected to 
result in a slowdown of 0.1%.

In other words, this is going to make little or no difference to performance. 
It does make things cleaner and simpler though, which has its own benefits.

--

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 18ea973c21ee4a6adc26be41027881043fa498eb by Victor Stinner in 
branch 'main':
bpo-40170: Remove PyHeapType_GET_MEMBERS() macro (GH-30942)
https://github.com/python/cpython/commit/18ea973c21ee4a6adc26be41027881043fa498eb


--

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Brandt Bucher


Brandt Bucher  added the comment:

In a typical run of the pyperformance benchmark suite, rotations account for a 
bit over 1% of all instructions executed.

I don't have timings for individual instructions, unfortunately.

--

___
Python tracker 

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



[issue46556] pathlib.Path.__enter__() should emit DeprecationWarning

2022-01-27 Thread Barney Gale


Change by Barney Gale :


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

___
Python tracker 

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



[issue39682] pathlib.Path objects can be used as context managers

2022-01-27 Thread Barney Gale


Change by Barney Gale :


--
pull_requests: +29150
pull_request: https://github.com/python/cpython/pull/30971

___
Python tracker 

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

Very interesting.  Do we have any current (or even cutting edge, i.e. 3.11) 
timings for individual instructions?  Or a breakdown of how frequently 
different instructions are invoked?  I remember Carl Shapiro presenting his 
findings here several years ago (I think in the penultimate in-person Language 
Summit).

--

___
Python tracker 

___
___
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-27 Thread Alex Waygood


Change by Alex Waygood :


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



[issue44791] Substitution of ParamSpec in Concatenate

2022-01-27 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +sobolevn

___
Python tracker 

___
___
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 Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood

___
Python tracker 

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



[issue46556] pathlib.Path.__enter__() should emit DeprecationWarning

2022-01-27 Thread Barney Gale


New submission from Barney Gale :

In Python 3.9 / issue39682 we made Path.__exit__() a no-op, and added a comment 
in the code mentioning that it should be deprecated in future. The future is 
here, so let's deprecate it.

--
components: Library (Lib)
messages: 411936
nosy: barneygale
priority: normal
severity: normal
status: open
title: pathlib.Path.__enter__() should emit DeprecationWarning
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



[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 

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



[issue46542] test_json and test_lib2to3 crash on s390x Fedora Clang 3.x buildbot

2022-01-27 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

The issue seems to be affecting also the PPC64LE Fedora Rawhide Clang 3.x and 
PPC64LE Fedora Stable Clang 3.x

--
nosy: +cstratak

___
Python tracker 

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

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

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



[issue46528] Simplify the VM's stack manipulations

2022-01-27 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29148
pull_request: https://github.com/python/cpython/pull/30970

___
Python tracker 

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



[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-27 Thread Barney Gale


Barney Gale  added the comment:

>From https://stackoverflow.com/a/68969892

> I think a major reason why pathlib.Path objects don't (and, indeed,
> shouldn't) have a append_text method is because it creates a hole for
> inexperienced users to fall into, which is a huge sin in API design.

> Specifically, the hole I'm referring to is using append_text on the
> same file repeatedly in a loop. Because you're continually opening
> and closing the file, it is slow. Plus, doing so many unnecessary
> writes is probably not great for the health of your hard drive.

> Worse, because the program will actually behave correctly (e.g. the
> file will have the contents they intended), they may not even notice
> anything is wrong, because they don't necessarily have a mental gauge
> on how long writing to a file "should" take.

Most of the time you don't need an 'append' mode. And when you do, most
of the time you'll need to append multiple times, in which case
`path.open('a')` is a much better bet.

--
nosy: +barneygale

___
Python tracker 

___
___
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 Alex Waygood


Alex Waygood  added the comment:

I agree with Jelle and Guido

--

___
Python tracker 

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



[issue46555] Unicode-mangled names refer inconsistently to constants

2022-01-27 Thread Kodiologist

New submission from Kodiologist :

I'm not sure if this is a bug, but it certainly surprised me. Most reserved 
words, when Unicode-mangled, as in "핕핖핗", act like ordinary identifiers (see 
e.g. bpo-46520). `True`, `False`, and `None` are weird in that Unicode-mangled 
versions of them refer to those same constants initially, but can take on their 
own identity as variables if assigned to:

Python 3.9.7 (default, Sep 10 2021, 14:59:43) 
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 핋핣핦핖
True
>>> True = 0
  File "", line 1
True = 0
^
SyntaxError: cannot assign to True
>>> 핋핣핦핖 = 0
>>> True
True
>>> 핋핣핦핖
0

I think that `핋핣핦핖 = 1` should probably be forbidden. The fact that `핋핣핦핖` 
doesn't always mean the same thing as `True` seems to break the rule in PEP 
3131 that "comparison of identifiers is based on NFKC".

--
messages: 411930
nosy: Kodiologist
priority: normal
severity: normal
status: open
title: Unicode-mangled names refer inconsistently to constants
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-27 Thread Keelung Yang


Change by Keelung Yang :


--
components: +Library (Lib)
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



[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-27 Thread Keelung Yang


New submission from Keelung Yang :

Three reasons to improve issue 35095: Implement pathlib.Path.append_bytes and 
pathlib.Path.append_text

1. If I want to append text to log at each startup(before calling basicConfig), 
there is no simple way to do this.

2. Adding append keyword is better then adding new APIs.

3. From stackoverflow: How does this make the classes clean? They already 
contain the write_* methods which are just not flexible enough. If the methods 
(or classes) are not dirty how would e.g. adding an optional parameter 
append=False to them make them dirty? 
https://stackoverflow.com/questions/57296168/pathlib-path-write-text-in-append-mode

So, this patch is just an implementation of discussions in above stackoverflow 
link.

--
files: add-append-arg-to-path.write.patch
keywords: patch
messages: 411929
nosy: keelung-yang
priority: normal
severity: normal
status: open
title: Add append keyword argument to Path.write_text() and Path.write_bytes()
Added file: https://bugs.python.org/file50591/add-append-arg-to-path.write.patch

___
Python tracker 

___
___
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 Gregory Beauregard


Gregory Beauregard  added the comment:

I'm drafting an implementation for the purpose of investigating performance 
right now; I will share when ready.

--

___
Python tracker 

___
___
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 Eric V. Smith


Eric V. Smith  added the comment:

dataclasses is no doubt too lenient. But it's just trying to accept valid 
strings that look like ClassVar. Way back when this was initially implemented, 
we decided that calling get_type_hints would be too expensive for every 
dataclass, and would also neccesitate importing typing, which we didn't want to 
require.

I think someone needs to do an analysis of how expensive it would be for 
dataclasses to import typing and to call get_type_hints. Perhaps we'd make a 
different decision today.

--

___
Python tracker 

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


Serhiy Storchaka  added the comment:

PR 27518 fixes a substitution of a ParamSpec variable with a Concatenate nad a 
list of types. It is not specified explicitly in PEP 612, but it does not 
contradict it.

PR 30969 makes an ellipsis be valid as the last argument of Concatenate to fix 
a substitution of a ParamSpec variable with an ellipsis. It contradicts with 
PEP 612 which allows only a ParamSpec variable there.

--

___
Python tracker 

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

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


Change by Serhiy Storchaka :


--
pull_requests: +29147
pull_request: https://github.com/python/cpython/pull/30969

___
Python tracker 

___
___
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 Gregory Beauregard


Change by Gregory Beauregard :


--
nosy: +GBeauregard

___
Python tracker 

___
___
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 Gregory Beauregard


Change by Gregory Beauregard :


--
type:  -> behavior

___
Python tracker 

___
___
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 Gregory Beauregard


Change by Gregory Beauregard :


--
nosy: +AlexWaygood, sobolevn -GBeauregard

___
Python tracker 

___
___
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 Gregory Beauregard


Gregory Beauregard  added the comment:

I think this is needed for moving dataclasses to using typing.py introspection 
tools to be viable.

--

___
Python tracker 

___
___
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 Gregory Beauregard


New submission from Gregory Beauregard :

```
class C:
a: "ClassVar"

get_type_hints(C, globals())  # TypeError: Plain typing.ClassVar is not valid 
as type argument
```

A stringified lone ClassVar raises at runtime, but this pattern is tested for 
in dataclasses unit tests and used in the wild. The PEP is not clear that it 
should or should not be used with arguments, and it works fine when not 
stringified.

The fix for this is trivial and I can submit a patch if there's agreement.

--
components: Library (Lib)
messages: 411923
nosy: GBeauregard, Jelle Zijlstra, eric.smith, gvanrossum, kj
priority: normal
severity: normal
status: open
title: typing: get_type_hints on stringified lone ClassVar raises TypeError
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



[issue46186] replace `io.IncrementalNewlineDecoder` with non incremental newline decoders

2022-01-27 Thread Guo Ci Teo


Guo Ci Teo  added the comment:

The old code has an incorrect usage of `io.IncrementalNewlineDecoder`. Since 
the `decode` method is called only once, is it the final call and needs the 
`final=True` argument as documented in 
https://docs.python.org/dev/library/codecs.html#codecs.IncrementalDecoder.decode

It happens that in those cases, the results are correct in spite of the 
incorrect usage.

--

___
Python tracker 

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



[issue45476] [C API] PEP 674: Disallow using macros (Py_TYPE and Py_SIZE) as l-value

2022-01-27 Thread STINNER Victor


Change by STINNER Victor :


--
title: [C API] PEP 674: Disallow using macros as l-value -> [C API] PEP 674: 
Disallow using macros (Py_TYPE and Py_SIZE) as l-value

___
Python tracker 

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



[issue45476] [C API] PEP 674: Disallow using macros as l-value

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

> * zodbpickle-2.2.0: src/zodbpickle/_pickle_33.c

Technically, zodbpickle works on Python 3.11 and is not impacted by the 
Py_SIZE() change.

_pickle_33.c redefines the Py_SIZE() macro to continue using as an l-value:
https://github.com/zopefoundation/zodbpickle/commit/8d99afcea980fc7bb2ef38aadf53300e08fc4318

I proposed a PR to use Py_SET_SIZE() explicitly:
https://github.com/zopefoundation/zodbpickle/pull/64

--

___
Python tracker 

___
___
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 Eric V. Smith


Eric V. Smith  added the comment:

The dataclasses tests were in fact just added for completeness. I'd be okay 
with changing dataclasses to reject leading spaces.

--

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0575551f69ba9c999835bfb176a543d468083c03 by Victor Stinner in 
branch 'main':
bpo-40170: Move _Py_GetAllocatedBlocks() to pycore_pymem.h (GH-30943)
https://github.com/python/cpython/commit/0575551f69ba9c999835bfb176a543d468083c03


--

___
Python tracker 

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:

I close the issue. I cleared most static types at exit. Following work can be 
done in bpo-40077 or other issues.

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-27 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6c6a153dee132116611f2d5df0689a5a605f62b6 by Victor Stinner in 
branch 'main':
bpo-46417: signal: move siginfo_type to the module state (GH-30964)
https://github.com/python/cpython/commit/6c6a153dee132116611f2d5df0689a5a605f62b6


--

___
Python tracker 

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



[issue42982] Update suggested number of iterations for pbkdf2_hmac()

2022-01-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29146
pull_request: https://github.com/python/cpython/pull/30968

___
Python tracker 

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



[issue42982] Update suggested number of iterations for pbkdf2_hmac()

2022-01-27 Thread miss-islington


miss-islington  added the comment:


New changeset ace0aa2a2793ba4a2b03e56c4ec375c5470edee8 by Gregory P. Smith in 
branch 'main':
bpo-42982: update pbkdf2 example & add another link (GH-30966)
https://github.com/python/cpython/commit/ace0aa2a2793ba4a2b03e56c4ec375c5470edee8


--

___
Python tracker 

___
___
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 Jelle Zijlstra


Change by Jelle Zijlstra :


--
nosy: +AlexWaygood, gvanrossum, kj, sobolevn

___
Python tracker 

___
___
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 Jelle Zijlstra


Jelle Zijlstra  added the comment:

I vote we don't change this. PEP 484 says:

> The string literal should contain a valid Python expression (i.e., 
> compile(lit, '', 'eval') should be a valid code object) and it should 
> evaluate without errors once the module has been fully loaded. 

But compile() fails for leading whitespace.

I also don't see a real use case for this. The dataclasses tests were 
presumably just added for completeness. If there's evidence this is a common 
pattern in the wild maybe we can reconsider.

--

___
Python tracker 

___
___
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 Gregory Beauregard


New submission from Gregory Beauregard :

```
class C:
a: " ClassVar[int]" = 3
get_type_hints(C, globals())  # SyntaxError: Forward reference must be an 
expression -- got ' ClassVar[int]'

```

I discovered while investigating the viability of moving dataclasses.py to 
using typing.py's internal type introspection tools that it can't handle 
stringified annotations with leading spaces.

This is covered in dataclasses unit tests: 
https://github.com/python/cpython/blob/26b0482393a313e3bda364a35e7417e9db52c1c4/Lib/test/test_dataclasses.py#L3033
The relevant failing code in typing.py is here: 
https://github.com/python/cpython/blob/26b0482393a313e3bda364a35e7417e9db52c1c4/Lib/typing.py#L671

Leading spaces are treated like indention so there's a syntax error.

This would be trivial to fix by adding an lstrip() to the compilation code, but 
it's not clear to me this should be considered a bug. Should this be left 
as-is, or changed? I'm happy to submit a patch if there's agreement it's a bug.

--
components: Library (Lib)
messages: 411914
nosy: GBeauregard, Jelle Zijlstra, eric.smith
priority: normal
severity: normal
status: open
title: typing: get_type_hints can't handle stringified annotations with leading 
spaces
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



[issue42982] Update suggested number of iterations for pbkdf2_hmac()

2022-01-27 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +29145
pull_request: https://github.com/python/cpython/pull/30966

___
Python tracker 

___
___
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-27 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 26b0482393a313e3bda364a35e7417e9db52c1c4 by Christian Heimes in 
branch 'main':
bpo-46476: Simplify and fix _PyStaticCode_Dealloc (GH-30965)
https://github.com/python/cpython/commit/26b0482393a313e3bda364a35e7417e9db52c1c4


--

___
Python tracker 

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



[issue46166] Get "self" args or non-null co_varnames from frame object with C-API

2022-01-27 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +3.11regression
nosy: +gregory.p.smith
priority: normal -> high

___
Python tracker 

___
___
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-27 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes
nosy_count: 6.0 -> 7.0
pull_requests: +29144
pull_request: https://github.com/python/cpython/pull/30965

___
Python tracker 

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



[issue44734] turtle: tests for Vec2D.__abs__ are too strict

2022-01-27 Thread Mark Dickinson


Mark Dickinson  added the comment:

Sorry again, all; I failed to read everything that was going on here. The test 
*wasn't* failing with the hypot-based version of Vec2D.__abs__ that's in the 
main branch; only with the "**0.5"-based version that was still in the older 
branches. Please ignore this and the previous two messages ...

--

___
Python tracker 

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



  1   2   >