[issue45441] Some links in the document is changed

2021-10-12 Thread jiahua wang


Change by jiahua wang :


--
assignee: docs@python
components: Documentation
nosy: 180909, docs@python
priority: normal
pull_requests: 27191
severity: normal
status: open
title: Some links in the document is changed
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



[issue42253] xml.dom.minidom.rst missing standalone documentation

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 3d7009e88e0ae516b10d8d3d402cc66e86fb631e by Miss Islington (bot) 
in branch '3.10':
bpo-42253: Update xml.dom.minidom.rst (GH-23126) (GH-28874)
https://github.com/python/cpython/commit/3d7009e88e0ae516b10d8d3d402cc66e86fb631e


--

___
Python tracker 

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



[issue42253] xml.dom.minidom.rst missing standalone documentation

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 23528905d48ddfe74a75af2152e96c04b77bf314 by Miss Islington (bot) 
in branch '3.9':
bpo-42253: Update xml.dom.minidom.rst (GH-23126) (GH-28875)
https://github.com/python/cpython/commit/23528905d48ddfe74a75af2152e96c04b77bf314


--

___
Python tracker 

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset faa87f7f3b60f79b9018aaef0efa5e00d82b817b by Miss Islington (bot) 
in branch '3.9':
bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28873)
https://github.com/python/cpython/commit/faa87f7f3b60f79b9018aaef0efa5e00d82b817b


--

___
Python tracker 

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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 47a50fe16f9f074d3e6aa85e76502955ed40 by Miss Islington (bot) 
in branch '3.10':
bpo-45401: Fix a resource warning in test_logging (GH-28864) (GH-28872)
https://github.com/python/cpython/commit/47a50fe16f9f074d3e6aa85e76502955ed40


--

___
Python tracker 

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



[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-10-12 Thread Randolf Scholz


Randolf Scholz  added the comment:

@Alex Regarding my proposal, the crucial part is the desiderata, not the hacked 
up implementation I presented.

And I really believe that at least that part I got hopefully right. After all, 
what does `@classmethod` functionally do? It makes the first argument of the 
function receive the class type instead of the object instance and makes it 
possible to call it directly from the class without instantiating it. I would 
still expect `MyClass.__dict__["themethod"]` to behave, as an object, much the 
same, regardless if it was decorated with `@classmethod` or not.

Regarding code breakage - yes that is a problem, but code is already broken and 
imo Python needs to make a big decision going forward: 

1. Embrace decorator chaining and try hard to make it work universally (which 
afaik was never intended originally when decorators were first introduced). As 
a mathematician I would love this, also adding `@` as a general purpose 
function composition operator would add quite some useful functional 
programming aspects to python.
2. Revert changes from 3.9 and generally discourage decorator chaining.

At this point however I want to emphasize that I am neither a CS major nor a 
python expert (I only started working with the language 3 years ago), so take 
everything I say as what it is - the opinion of some random stranger from the 
internet (:

--

___
Python tracker 

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50348/bench_no_args_inline.py

___
Python tracker 

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50347/bench_no_args.patch

___
Python tracker 

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50349/bench_no_args_public.py

___
Python tracker 

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Jeff Allen


Jeff Allen  added the comment:

I'm interested in Thomas' reasons, but here are some of mine (as far as I 
understand things):

1. It is specific to one interpreter implemented in C, equipped with a GIL, and 
on certain assumptions about the byte code interpreter and the implementation 
of built-ins, that may not hold long-term. 

2. In x = L[i], the index and assignment are distinct actions (in today's byte 
code), allowing L or i to change before x is assigned. This applies to multiple 
other of the examples.

3. A compiler (even a CPU) is free to re-order operations and cache values in 
unguessable ways, on the assumption of a single thread.

4. Code written on these principals is fragile. It only takes the replacement 
of a built-in with sub-class redefining __getitem__ (to support some worthy aim 
elsewhere in the code) to invalidate it.

5. sort() is not atomic if an element is of a type that overrides comparison in 
Python. (Nor is modifying a dictionary if __hash__ or __eq__ are redefined.)
 

If you want retain the question, with a better answer, the last sentence is 
good: "When in doubt, use a mutex!", accompanied by "Always be in doubt."

--
nosy: +jeff.allen

___
Python tracker 

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Thomas Grainger


Thomas Grainger  added the comment:

it's as part of this discussion in 
https://mail.python.org/archives/list/python-...@python.org/thread/ABR2L6BENNA6UPSPKV474HCS4LWT26GY/#IAOCDDCJ653NBED3G2J2YBWD7HHPFHT6
 and others in #python-dev 

specifically 
https://github.com/python/cpython/blob/2f92e2a590f0e5d2d3093549f5af9a4a1889eb5a/Objects/dictobject.c#L2582-L2586

regarding if any of the items are builtins or not: the faq entry lists (L, L1, 
L2 are lists, D, D1, D2 are dicts, x, y are objects, i, j are ints) so I read 
that to mean x and y are user defined objects with user defined comparison and 
equality methods

--

___
Python tracker 

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I'm also surprised to learn that `L.sort()` and `D1.update(D2)` are supposed to 
be atomic. They certainly are not in the general case.

Remember, any Python code can release the GIL (because the GIL is released 
periodically in the interpreter loop). Any DECREF can also release the GIL 
(because it may trigger the execution of arbitrary destructors). This restricts 
a lot which operations can be safely considered atomic.

--
nosy: +pablogsal, pitrou, serhiy.storchaka
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



[issue45401] logging TimedRotatingFileHandler must not rename devices like /dev/null

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for the fixes Vinay and Serhiy!

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

___
Python tracker 

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



[issue20692] Tutorial and FAQ: how to call a method on an int

2021-10-12 Thread za


za  added the comment:

I've included `doc1.patch` in the github PR 
https://github.com/python/cpython/pull/28818

Should I add the other patch as well to make this move forward?

--

___
Python tracker 

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



[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-12 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thanks, guys!

--

___
Python tracker 

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



[issue45416] "loop argument must agree with lock" instantiating asyncio.Condition

2021-10-12 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue27928] Add hashlib.scrypt

2021-10-12 Thread Christian Heimes


Change by Christian Heimes :


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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2021-10-12 Thread Christian Heimes


Change by Christian Heimes :


--
resolution:  -> fixed
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



[issue42253] xml.dom.minidom.rst missing standalone documentation

2021-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue45413] Add install scheme for virtual environments

2021-10-12 Thread Petr Viktorin


Petr Viktorin  added the comment:

Starting out with just "venv" doesn't mean we can't add "posix_venv"/"nt_venv" 
later (if e.g. someone needs to install into a filesystem for another platform).

--
nosy: +petr.viktorin

___
Python tracker 

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



[issue45441] Some links in the document is changed

2021-10-12 Thread miss-islington


Change by miss-islington :


--
keywords: +patch
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +27192
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28901

___
Python tracker 

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



[issue45441] Some links in the document is changed

2021-10-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27193
pull_request: https://github.com/python/cpython/pull/28902

___
Python tracker 

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



[issue45441] Some links in the document is changed

2021-10-12 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :


New changeset b37dc9b3bc9575adc039c6093c643b7ae5e917e1 by 180909 in branch 
'main':
bpo-45441: Update some moved URLs in documentation (GH-28861)
https://github.com/python/cpython/commit/b37dc9b3bc9575adc039c6093c643b7ae5e917e1


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue45442] Update `Virtual Environment` tutorial

2021-10-12 Thread Shivnaren Srinivasan

New submission from Shivnaren Srinivasan :

Priority: Low

The Virtual Environment tutorial page 
(https://docs.python.org/3/tutorial/venv.html) doesn't specify how we can 
revert, or deactivate the `venv`.

This is quite a popular question on SO:
https://stackoverflow.com/questions/990754/how-to-leave-exit-deactivate-a-python-virtualenv

``deactivate`` worked for me—this could be added to the docs?

Happy to submit a PR.

--
assignee: docs@python
components: Documentation
messages: 403722
nosy: docs@python, shivnaren
priority: normal
severity: normal
status: open
title: Update `Virtual Environment` tutorial
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, 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



[issue45443] 'ThreadPoolExecutor' object has no attribute 'map'

2021-10-12 Thread Zohim Chandani


New submission from Zohim Chandani :

import concurrent.futures 
import time 


start = time.perf_counter()

def do_something(seconds):
print(f'sleeping for {seconds}s ... ')
time.sleep(seconds)
return f'done sleeping {seconds} '


with concurrent.futures.ThreadPoolExecutor() as executor: 

secs = [5,4,3,2,1]

results = executor.map(do_something, secs)

for result in results: 
print(result)




finish = time.perf_counter()

print(f'finished in {round(finish-start, 2)} seconds')



The above code yields an attribute error whereas it used to execute perfectly 
before. Did the method get removed?

--
messages: 403723
nosy: zohim
priority: normal
severity: normal
status: open
title: 'ThreadPoolExecutor' object has no attribute 'map'
type: crash
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



[issue45442] Update `Virtual Environment` tutorial

2021-10-12 Thread Shivnaren Srinivasan


Shivnaren Srinivasan  added the comment:

In the same vein, the specified script for windows is the old .bat file, though 
PowerShell is now the preferred shell (and for which a .ps1 script is generated 
in the venv directory).

We could make the .ps1 the default, and specify the .bat as an alternative?

--
type: enhancement -> 

___
Python tracker 

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Jeff makes an excellent point about the docs failing to distinguish 
between language guarantees, implementation guarantees, and things which 
are merely true sometimes.

On the other hand, we only need document what is true *now*, not what 
may be true in some long distant future.

On Tue, Oct 12, 2021 at 07:42:07AM +, Jeff Allen wrote:

> 2. In x = L[i], the index and assignment are distinct actions (in 
> today's byte code), allowing L or i to change before x is assigned.

Does that matter though? I think that's a distinction that makes no 
difference.

We know that another thread could change the L or the i before the 
assignment, if they are global. But once the L[i] lookup has occurred, 
it doesn't matter if they change. It's not going to affect what value 
gets bound to the x.

So in a practical sense, we can say that once the lookup L[i] has 
occurred, the binding might as well be atomic. I think that's what the 
entry is trying to say. Have I missed something?

> 3. A compiler (even a CPU) is free to re-order operations and cache 
> values in unguessable ways, on the assumption of a single thread.

The CPU doesn't operate at the level of Python byte code though, and 
there are limits to what the compiler will do. It's not going to reorder 
things in ways that change the semantics of the code (that would be a 
compiler bug). Its not going to reorder this code:

x = 1
print(x)
x = 2

so that "2" gets printed. So I don't see that this objection is 
relevant.

> 4. Code written on these principals is fragile. It only takes the 
> replacement of a built-in with sub-class redefining __getitem__ (to 
> support some worthy aim elsewhere in the code) to invalidate it.

The FAQ entry could be more forceful that it is only talking about 
certain built-in types, and once you change things to another type, the 
promises may no longer hold.

But we should not hold it against the FAQs that the promises made about 
one type don't apply to other types.

> 5. sort() is not atomic if an element is of a type that overrides 
> comparison in Python. (Nor is modifying a dictionary if __hash__ or 
> __eq__ are redefined.)

Indeed, and the FAQ should be more forceful about that proviso.

--

___
Python tracker 

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



[issue44991] [sqlite3] cleanup callbacks (GIL handling, naming, ...)

2021-10-12 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset cfb1df3b71501a80ed57739181ec2ed30012c491 by Erlend Egeberg 
Aasland in branch 'main':
bpo-44991: Normalise function and collation callback naming (GH-28209)
https://github.com/python/cpython/commit/cfb1df3b71501a80ed57739181ec2ed30012c491


--

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-10-12 Thread Petr Viktorin


Petr Viktorin  added the comment:

PyStructSequence_NewType exists, and is the same as the proposed 
PyStructSequence_FromModuleAndDesc except it doesn't take the module (which 
isn't necessary: PyStructSequence_Desc has no way to define functionality that 
would need the module state).

--

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

2021-10-12 Thread Petr Viktorin


Petr Viktorin  added the comment:

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

The only thing the proposed PR adds is a way to set ht_module, which actually 
isn't very useful (it's used for module state access, but PyStructSequence_Desc 
doesn't allow you to add custom methods or anything else that would need the 
module state).

I'd close this bpo as duplicate. And close the PR -- it's well done, but 
unfortunately, solves the wrong problem :(

--

___
Python tracker 

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

sort() is atomic, even if GIL is released during executing custom __lt__. It is 
guaranteed that no operations on the list in other threads can affect the 
result of sort().

I do not understand what non-atomic you see in x = L[i]. The value of x is 
determined by values of L and i at the start of the operation. GIL is not 
released during indexing L, and if it is released between indexing and 
assignment, it does not affect the result.

The FAQ answer is specially about built-in types, it is not related to types 
with overwritten __getitem__ etc.

The most questionable examples are dict operations. But even they provide some 
kind of atomacity. But you perhaps need to know internals to understand 
limitations.

We perhaps should explicitly document what non-trivial operations are atomical 
(for example list and dict copying is atomic) and whether atomacity is the part 
of the language specification or CPython implementation detail. In many places 
in the stdlib the code relies on GIL for atomacity.

--

___
Python tracker 

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



[issue15870] PyType_FromSpec should take metaclass as an argument

2021-10-12 Thread Petr Viktorin


Petr Viktorin  added the comment:

The new issue is bpo-45383.

There's a sprint newt week; I'll probably get to it then.


> But, I am trying to understand the preference for static better.  There is 
> probably something to learn or even important I am missing.

The original motivating use case is not "create types dynamically on demand", 
but "create types without details of the C structure being compiled into the 
extension". That is, make it possible for modules to be compatible with several 
versions of Python.
The spec is designed to be extensible; the type struct is designed to be fast 
at runtime.


> And I have some plans to make static specs useful in type checking

This is quickly getting out of scope here, but if you're interested, I put down 
some notes here: https://github.com/encukou/abi3/issues/19

--

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2021-10-12 Thread wyz23x2


wyz23x2  added the comment:

I think this six year old issue can be closed. All patches for 3.x are 
committed, and Python 2.7 is EOL.

--
nosy: +wyz23x2

___
Python tracker 

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



[issue45445] Fail if an invalid -X option is provided

2021-10-12 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

We found that using -X  can be very confusing and annoying when you make 
typos, so I think having errors if you pass some unknown stuff will be 
outweighing any downside of making this more strict.

--
messages: 403733
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Fail if an invalid -X option is provided

___
Python tracker 

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



[issue45445] Fail if an invalid -X option is provided

2021-10-12 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue45315] `PyType_FromSpec` does not copy the name

2021-10-12 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Hm, I haven't find any case who use dynamical tp_name of Type_Spec 
> temporarily.


The use case is creating types entirely on demand, with dynamically created 
specs.
This is useful e.g. for wrapping objects of a different object system, like C++ 
classes or Qt/GTK widgets.

But this issue is not about adding new API to enable a new use case. The 
*current* API can reasonably be used with a dynamic name string. So we 
shouldn't wait until someone tells us they need this fixed :)

So this should either be fixed or the requirement should be documented. (And 
the documentation would IMO sound like we're acknowledging a design bug, so 
it's better to fix.)

--

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2021-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue45441] Some links in the document is changed

2021-10-12 Thread miss-islington


miss-islington  added the comment:


New changeset 38e3ada75a7b5d911d81e8e4b70a99e181093866 by Miss Islington (bot) 
in branch '3.9':
bpo-45441: Update some moved URLs in documentation (GH-28861)
https://github.com/python/cpython/commit/38e3ada75a7b5d911d81e8e4b70a99e181093866


--

___
Python tracker 

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



[issue45441] Some links in the document is changed

2021-10-12 Thread miss-islington


miss-islington  added the comment:


New changeset 32866dd471709dd7f3bd63ce762dec72198483d2 by Miss Islington (bot) 
in branch '3.10':
bpo-45441: Update some moved URLs in documentation (GH-28861)
https://github.com/python/cpython/commit/32866dd471709dd7f3bd63ce762dec72198483d2


--

___
Python tracker 

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



[issue45441] Some links in the document is changed

2021-10-12 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue45340] Lazily create dictionaries for plain Python objects

2021-10-12 Thread Mark Shannon


Mark Shannon  added the comment:

Josh,

I'm not really following the details of what you are saying.

You claim "Key-sharing dictionaries were accepted largely without question 
because they didn't harm code that broke them".
Is that true? I don't remember it that way. They were accepted because they 
saved memory and didn't slow things down.

This issue, proposes the same thing: less memory used, no slower or a bit 
faster.

If you are curious about how the first few instances of a class are handled, it 
is described here: 
https://github.com/faster-cpython/ideas/issues/72#issuecomment-920117600

Lazy attribute is not an issue here. How well keys are shared across instances 
depends on the dictionary implementation and was improved by 
https://github.com/python/cpython/pull/28520


It would be helpful if you could give specific examples where you think this 
change would use more memory or be slower.

--

___
Python tracker 

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



[issue45446] Add a way to hide fields in dataclasses

2021-10-12 Thread Nium


Change by Nium :


--
nosy: formigacomcaimbra
priority: normal
severity: normal
status: open
title: Add a way to hide fields in dataclasses
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



[issue45447] IDLE: Support syntax highlighting for .pyi stub files

2021-10-12 Thread Alex Waygood


Change by Alex Waygood :


--
title: Support syntax highlighting for .pyi stub files -> IDLE: Support syntax 
highlighting for .pyi stub files

___
Python tracker 

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



[issue45446] Add a way to hide fields in dataclasses

2021-10-12 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +27195
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28904

___
Python tracker 

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



[issue45447] Support syntax highlighting for .pyi stub files

2021-10-12 Thread Alex Waygood


New submission from Alex Waygood :

IDLE currently does not do any syntax highlighting if you use it to open a .pyi 
stub file, even though everything in a .pyi file is a valid Python expression. 
It would be great if syntax highlighting for .pyi files could be supported.

--
assignee: terry.reedy
components: IDLE
messages: 403738
nosy: AlexWaygood, terry.reedy
priority: normal
severity: normal
status: open
title: Support syntax highlighting for .pyi stub files
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



[issue45411] Add Mimetypes for Subtitle Files

2021-10-12 Thread Ɖric Araujo

Ɖric Araujo  added the comment:

Additions to mimetypes have been backported in the past, with the thought that 
these are not new behaviour added but only entries in a registry (and bringing 
the python module in line with external data sources) so there’s value and no 
risk in releasing these additions in point releases.

I don’t have a link to the discussion about that, and looking at 4 or 5 recent 
PRs to mimetype I see that backports haven’t been consistent.  So maybe another 
ticket would be to synchronize the dicts in active branches + record the 
backport policy somewhere (not sure a comment would be enough, easy to miss at 
the top of a long dict).

--
nosy: +eric.araujo
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue45448] PIP package installation failure for multiple packages

2021-10-12 Thread Zayden Micheal James


New submission from Zayden Micheal James :

When I try to install numpy using python version 3.10, pip version 21.2.4
it gives me a PEP517 error, with a bunch of other exceptions.

When I try to install tensorflow using python version 3.10, pip version 21.2.4 
it gives me an error saying that there is no such package.

I've tried multiple pip and python combo's for installation... Aswell as inside 
and outside a virtual enviroment.

--
components: Installation
messages: 403740
nosy: zayvelleman
priority: normal
severity: normal
status: open
title: PIP package installation failure for multiple packages
type: compile error
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



[issue45447] IDLE: Support syntax highlighting for .pyi stub files

2021-10-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

It should be fairly easy to recognize x.pyi as a python file.  Just have to 
find the place.  Something like
  def f(i:int) -> int: ...
would have 'def' and 'int' highlighted.

--

___
Python tracker 

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



[issue20692] Tutorial and FAQ: how to call a method on an int

2021-10-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

No. The last version did not properly incorporate my suggestion, so I will make 
a PR that I am willing to merge.

--
assignee: docs@python -> terry.reedy

___
Python tracker 

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



[issue43139] test_ttk test_compound, test_tk test_type fail with Tk 8.6.11.1

2021-10-12 Thread E. Paine


E. Paine  added the comment:

Felix, are these still the exact errors you're experiencing? Both in my normal 
Arch install and in a chroot environment I get the following errors instead:

==
FAIL: test_winfo_rgb (tkinter.test.test_tkinter.test_misc.MiscTest)
--
Traceback (most recent call last):
  File "/cpython/Lib/tkinter/test/test_tkinter/test_misc.py", line 213, in 
test_winfo_rgb
self.assertEqual(rgb('#4a3c8c'), (0x4a4a, 0x3c3c, 0x8c8c))
^^
AssertionError: Tuples differ: (19016, 15399, 35985) != (19018, 15420, 35980)

First differing element 0:
19016
19018

- (19016, 15399, 35985)
?  ^^^^  ^

+ (19018, 15420, 35980)
?  ^^^^  ^


==
FAIL: test_configure_type (tkinter.test.test_tkinter.test_widgets.MenuTest)
--
Traceback (most recent call last):
  File "/cpython/Lib/tkinter/test/test_tkinter/test_widgets.py", line 1244, in 
test_configure_type
self.checkEnumParam(widget, 'type',
^^^
  File "/cpython/Lib/tkinter/test/widget_tests.py", line 151, in checkEnumParam
self.checkInvalidParam(widget, name, '',

  File "/cpython/Lib/tkinter/test/widget_tests.py", line 73, in 
checkInvalidParam
with self.assertRaises(tkinter.TclError) as cm:
^^^
AssertionError: TclError not raised

--


In case I'm doing something stupid, here are the commands I used to set-up the 
chroot environment:

$ CHROOT=chroot
$ mkdir $CHROOT
$ mkarchroot $CHROOT/root base-devel tk git gnu-free-fonts
$ xhost + local:
$ sudo mount --bind $CHROOT/root $CHROOT/root
$ sudo arch-chroot $CHROOT/root
> git clone https://github.com/python/cpython.git
> cd cpython
> ./configure && make -j24
> ./python -m test -v -u gui test_tk

I'll start looking into these errors, since I'm able to reproduce them.

--
nosy: +epaine

___
Python tracker 

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



[issue45256] Remove the usage of the C stack in Python to Python calls

2021-10-12 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +27196
pull_request: https://github.com/python/cpython/pull/28905

___
Python tracker 

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



[issue45449] Document that collections.abc types are subscriptable

2021-10-12 Thread Filipe LaĆ­ns

New submission from Filipe LaĆ­ns :

Since 3.9, the types in collections.abc are subscriptable and can be used as 
type hints, but this is not documented.
We should write something similar to what's on the typing module documentation 
for the deprecated types.

--
assignee: docs@python
components: Documentation
messages: 403744
nosy: FFY00, docs@python, gvanrossum, kj
priority: normal
severity: normal
status: open
title: Document that collections.abc types are subscriptable
type: enhancement
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



[issue45421] Remove dead code from html.parser

2021-10-12 Thread Mariatta


Mariatta  added the comment:


New changeset 562c0d7398b9f34ff63a1dc77113dad96a93ce4e by Alberto Mardegan in 
branch 'main':
bpo-45421: Remove dead code from html.parser (GH-28847)
https://github.com/python/cpython/commit/562c0d7398b9f34ff63a1dc77113dad96a93ce4e


--
nosy: +Mariatta

___
Python tracker 

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



[issue45449] Document that collections.abc types are subscriptable

2021-10-12 Thread Filipe LaĆ­ns

Filipe LaĆ­ns  added the comment:

Just to clarify: some type checkers will still allow using them as type hints 
in Python versions before 3.9, but `from __future__ import annotations` needs 
to be used so that we don't error out at ruuntime.

--

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

There is a non-trivial ammount of users that try to parenthesize lambda 
parameters:

>>> lambda (x,y,z): x+y+z
  File "", line 1
lambda (x,y,z): x+y+z
   ^
SyntaxError: invalid syntax

We should improve the error message in this case

--
messages: 403747
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Improve syntax error for parenthesized arguments

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Example:

>>> lambda (x,y,z): x+y+z
  File "", line 1
lambda (x,y,z): x+y+z
   ^^^
SyntaxError: Function parameters cannot be parenthesized

--

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Andre Roberge


Change by Andre Roberge :


--
nosy: +aroberge

___
Python tracker 

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



[issue45446] Add a way to hide fields in dataclasses

2021-10-12 Thread Eric V. Smith


New submission from Eric V. Smith :

Please explain what "hiding" does.

--
nosy: +eric.smith

___
Python tracker 

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



[issue45417] Enum creation non-linear in the number of values

2021-10-12 Thread Carl Friedrich Bolz-Tereick


Change by Carl Friedrich Bolz-Tereick :


--
nosy: +Carl.Friedrich.Bolz
nosy_count: 6.0 -> 7.0
pull_requests: +27198
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28907

___
Python tracker 

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



[issue45448] PIP package installation failure for multiple packages

2021-10-12 Thread Eric V. Smith


Eric V. Smith  added the comment:

You should report these problems to the numpy and tensorflow projects. I'm 
assuming they don't support 3.10 yet.

--
nosy: +eric.smith
resolution:  -> third party
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



[issue45417] Enum creation non-linear in the number of values

2021-10-12 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

I fixed the reliance of set being insertion ordered in pypy and opened a pull 
request.

--

___
Python tracker 

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



[issue42345] Equality of typing.Literal depends on the order of arguments

2021-10-12 Thread Alick Zhao


Alick Zhao  added the comment:

Mainly to clarify, this is fixed in Python 3.9 and above, but won't be fixed in 
Python 3.8, right?

```
~$ python3.8
Python 3.8.11 (default, Jul 24 2021, 13:24:12)
[Clang 12.0.5 (clang-1205.0.22.11)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
FileNotFoundError: [Errno 2] No such file or directory: 
'/Users/taoz/.pythonstartup'
>>> from typing import Literal
>>> Literal[1,2]==Literal[2,1]
False
>>>
```

--
nosy: +alick

___
Python tracker 

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



[issue38659] enum classes cause slow startup time

2021-10-12 Thread Ethan Furman


Ethan Furman  added the comment:

The reason for that quadratic behavior is that for each new member (aka 
attribute), all the previous members must be checked to see if the new member 
is a duplicate.

In practice I wouldn't expect this to be a problem as most enums should be 
fairly small -- are there any real-world examples where there are more than, 
say, a hundred?

--

___
Python tracker 

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Jeff Allen


Jeff Allen  added the comment:

Thomas wrote:
> it's as part of this discussion in 
> https://mail.python.org/archives/list/python-...@python.org/thread/ABR2L6BENNA6UPSPKV474HCS4LWT26GY/#IAOCDDCJ653NBED3G2J2YBWD7HHPFHT6
>  and others in #python-dev 

That's where I noticed it, but it seemed the wrong place to explore this way.

Steven is right, I'm over-stating the case. And although valid that this is 
CPython specific, it's well sign-posted and I'm just being thin-skinned.

Serhiy writes:
> sort() is atomic, even if GIL is released during executing custom __lt__. It 
> is guaranteed that no operations on the list in other threads can affect the 
> result of sort().

The strategy noted here: 
https://github.com/python/cpython/blob/2d21612f0dd84bf6d0ce35bcfcc9f0e1a41c202d/Objects/listobject.c#L2261-L2265
does guarantee that, which I hadn't noticed. What if during the release of the 
GIL, another thread appends to L? In my simple experiment I get a ValueError 
and the modifications are lost. I think that is not thread-safe.

Serhiy also writes:

> I do not understand what non-atomic you see in x = L[i]. The value of x is 
> determined by values of L and i at the start of the operation. GIL is not 
> released during indexing L, and if it is released between indexing and 
> assignment, it does not affect the result.

and Steven:

> Does that matter though? I think that's a distinction that makes no 
difference.

> We know that another thread could change the L or the i before the 
assignment, if they are global. But once the L[i] lookup has occurred, 
it doesn't matter if they change. It's not going to affect what value 
gets bound to the x.

Fair enough. Atomicity is a bit slippery, I find. It depends where the critical 
region starts. Thinking again, it's not the assignment that's the issue ...

L is pushed
i is pushed
__getitem__ is called
x is popped

It is possible, if i and L are accessible to another thread and change after L 
is pushed, that x is given a value composed from an i and an L that never 
existed concurrently in the view of the other thread. Straining at gnats here, 
but atomicity is a strong claim.

And on the point about re-ordering and CPUs, I can't imagine re-ordering that 
effectively changes the order of byte codes. But do CPython threads run in 
separate CPUs, or is that only when we have multiple interpreters? If so, and L 
were in a hot memory location (either the variable or its content), this could 
be inconsistent between threads. Sorry, I don't know the memory coherence 
CPython has: I know I couldn't rely on it in Java.

I'm just arguing that the section gives advice that is *nearly* always right, 
which is a horrible thing to debug. I'll stop stirring.

--

___
Python tracker 

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



[issue45447] IDLE: Support syntax highlighting for .pyi stub files

2021-10-12 Thread Alex Waygood


Alex Waygood  added the comment:

It looks like support for .py files is hardcoded into IDLE's source code in the 
following places:


* browser.ModuleBrowserTreeItem.OnDoubleClick
* browser.ModuleBrowserTreeItem.IsExpandable
* browser.ModuleBrowserTreeItem.listchildren
* editor.ispythonsource  << This is the one that controls syntax highlighting
* iomenu.IOBinding.filetypes


If I were to file a PR adding support for .pyi files, would you prefer that I 
hardcoded ".pyi" in, or would it be better to add a SUPPORTED_FILES constant 
somewhere?

--

___
Python tracker 

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



[issue45446] Add a way to hide fields in dataclasses

2021-10-12 Thread Nium


Nium  added the comment:

The objective of this feature is to add a way to omit fields of a dataclass 
when `asdict` or `astuple` is used.

The main propuse is to add the `hide` parameter in `field` and add it as an 
attribute in the `Field` class.
```py
@dataclass
class User:
name: str
ws: WebSocket = field(hide=True)


user = User("NiumXp", None)
assert asdict(user) == {"name": "NiumXp"}
```
`asdict` will ignore all fields that have the `hide` attribute set as `True`.

---

Actually a possible solution to do it is doing this:
```py
from dataclasses import *

_asdict = asdict


class WebSocket:
pass


def asdict(obj):
def factory(it):
fields = []

for raw_field in it:
name, _ = raw_field

field = obj.__dataclass_fields__[name]
if not field.metadata.get("hide"):
fields.append(raw_field)

return dict(fields)
return _asdict(obj, dict_factory=factory)


@dataclass
class User:
name: str
ws: WebSocket = field(metadata={"hide": True})


user = User("NiumXp", None)
assert asdict(user) == {"name": "NiumXp"}
```
We need to make the same in `astuple` and to avoid writing 
`field(metadata={"hide": True)` multiple times we can use

```py
from functools import partial
from dataclasses import field as _field

field = _field(metadata={"hide": True})
```

But, this means that we can't reuse the `metadata` parameter.

--

___
Python tracker 

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50350/test_bench2.patch

___
Python tracker 

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


Added file: https://bugs.python.org/file50351/bench2.py

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Why not "lambda parameters cannot be parenthesized" (optionally "lambda 
function")? def-ed function parameters are parenthesized, so just saying 
"Function parameters cannot be parenthesized" seems very weird.

--
nosy: +josh.r

___
Python tracker 

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



[issue44359] test_ftplib.test_makeport() fails as "env changes" if a socket operation times out in a thread: TimeoutError is not catched

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:

I reproduced manually the issue. test_makeport() can trigger the "Uncaught 
thread exception: Exception".

test_makeport (test.test_ftplib.TestTLS_FTPClassMixin) ...

Warning -- Uncaught thread exception: Exception
Exception in thread Thread-67:
Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/asyncore.py", line 90, in read
obj.handle_read_event()
^^^
  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 384, in 
handle_read_event
self._do_ssl_handshake()

  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 345, in 
_do_ssl_handshake
self.socket.do_handshake()
^^
  File "/home/vstinner/python/main/Lib/ssl.py", line 1346, in do_handshake
self._sslobj.do_handshake()
^^^
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:998)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/vstinner/python/main/Lib/threading.py", line 1031, in 
_bootstrap_inner
self.run()
^^
  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 298, in run
asyncore.loop(timeout=0.1, count=1)
^^^
  File "/home/vstinner/python/main/Lib/asyncore.py", line 214, in loop
poll_fun(timeout, map)
^^
  File "/home/vstinner/python/main/Lib/asyncore.py", line 157, in poll
read(obj)
^
  File "/home/vstinner/python/main/Lib/asyncore.py", line 94, in read
obj.handle_error()
^^
  File "/home/vstinner/python/main/Lib/test/test_ftplib.py", line 421, in 
handle_error
raise Exception
^^^
Exception

ok

--
title: test_ftplib fails as "env changes" if a socket operation times out in a 
thread: TimeoutError is not catched -> test_ftplib.test_makeport() fails as 
"env changes" if a socket operation times out in a thread: TimeoutError is not 
catched

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-12 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It looks like the error is in inspect.formatannotation().

For instances of type, that function incorrectly returns only 
annotation.__qualname__.

Instead, it should return repr(annotation) which would include the args.

=


def formatannotation(annotation, base_module=None):
if getattr(annotation, '__module__', None) == 'typing':
return repr(annotation).replace('typing.', '')
if isinstance(annotation, type):# <== Erroneous case
if annotation.__module__ in ('builtins', base_module):
return annotation.__qualname__
return annotation.__module__+'.'+annotation.__qualname__
return repr(annotation)

--

___
Python tracker 

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



[issue45438] inspect not capturing type annotations created by __class_getitem__

2021-10-12 Thread Guido van Rossum


Guido van Rossum  added the comment:

Sure. Waiting for your PR. :-)

--

___
Python tracker 

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



[issue45443] 'ThreadPoolExecutor' object has no attribute 'map'

2021-10-12 Thread Gregory Beauregard


Gregory Beauregard  added the comment:

I get no attribute error with this code in 3.9 or 3.10.

--
nosy: +GBeauregard

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> so just saying "Function parameters cannot be parenthesized" seems very weird.

I agree that the wording can be improved, but is not weird, it has the same 
problem in functions:

>>> def foo(x,y,(z,w),k):
  File "", line 1
def foo(x,y,(z,w),k):
^
SyntaxError: invalid syntax

--

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

With PR 28906 it will show:

>>> def foo(x,y,(z,w),k):
  File "", line 1
def foo(x,y,(z,w),k):
^
SyntaxError: Function parameters cannot be parenthesized

I am happy to take suggestions for the wording

--

___
Python tracker 

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



[issue45450] Improve syntax error for parenthesized arguments

2021-10-12 Thread Andre Roberge


Andre Roberge  added the comment:

+1 on adding better error messages for these cases. I also agree with having 
different explanations with lambda and def.

Below is what I have with friendly-traceback: perhaps the first line of both of 
these might be suitable?   (I will likely change the first line in each case to 
be as similar to what you end up with.)

>>> set_include("why")
>>> lambda (x, y): x + y

`lambda` does not allow parentheses around its arguments.
This was allowed in Python 2 but it not allowed in Python 3.

>>> def foo(x, (y, z), w):

You cannot have explicit tuples as function arguments.
You can only use identifiers (variable names) as function arguments.
Assign any tuple to a parameter and unpack it
within the body of the function.

--

___
Python tracker 

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



[issue45435] delete misleading faq entry about atomic operations

2021-10-12 Thread Ben


Ben  added the comment:

The problem with the FAQs is that it's over-simplifying things to the point 
where it can sometimes mislead.

Notably, it says the GIL protects these operations; but as Antoine points out,  
many operations on datatypes drop back into Python (including potential decrefs)

Concerns about non-atomic evaluation of the composition of operations in these 
statements is mostly due to the way the FAQ is presented,  it should be made 
clearer *which* operations it's describing to be atomic.
(Otherwise you get questions like "is x = L[x] atomic?")

graingert said the following might be useful, so:
Going through each of the points of the FAQ...

The following seem relatively straight-forward and non-controversial(?):
x = L[i]
x = L.pop()
x = y
L.append(x)
L1.extend(L2)

I'm not even sure what it *means* when it says the following:
D.keys()

The following probably have some caveats:
D[x] = y

These appear to be the suspect ones:
D1.update(D2)
L.sort()
L[i:j] = L2
x.field = y

Exploring each in more detail...

dict.keys is just a mystery to me, maybe this mattered in Python 2 but these 
are view objects now, or maybe I am missing something?

dict.__setitem__ needs clarification really, surely the actual setting of the 
item is "atomic" in that other threads will either see the dict with or without 
the item and not halfway through some resizing operation or something, but in 
doing the setting it may trigger many __eq__ calls on the other keys
(either during the resize itself, or just during probing).

The dict.update case seems like it should hold if both dicts have keys made of 
only other builtin types so that the GIL can continue to protect.  If the keys 
of either are custom objects with their own __eq__ then the "atomicity" of the 
operation is in question
as the __eq__ can happen "during" the update.
Imagine two update()s to the same dict,  if the keys have custom __eq__'s then 
the (concurrent) composition of the two may give some mix of the two 
dictionaries overlapping keys.
(Note that the __hash__ doesn't matter as it is not recomputed on an update)

For list.sort it's more subtle,
there is built-in protection to make it somewhat atomic
which means that append()s and extend()s shouldn't be lost
but concurrent threads might suddenly see the list be emptied and concurrent 
len()/L.pop() see sequentially inconsistent results.

For list.__setitem__ it's clear it's non-atomic in the case that the elements 
of the list are custom objects with their own __del__, and the FAQ does infact 
mention this case (at the bottom).

Attribute assignment is odd,  I can't see how that can be described as "atomic" 
for arbitrary objects. There is no way the FAQ really means that x and y are 
instances of `object`.

There are questions about operations that are potentially missing(?) from the 
list:
len(L)
D1.copy()
L1 += L2  (or does "extend" cover this too?)
... etc,  and other datatypes (tuples are an obvious question here)

It's not clear why the FAQ picked these exact operations out specifically.

Fundamentally this FAQ tries to be both a language definition ("You can rely on 
these operations being atomic") but also somewhat of an 
implementation-dependent description ("this is what is true in CPython").
Perhaps the best long-term solution would be to remove this "FAQ" and either 
move more detailed discussion about atomicity guarantees for various operations 
to the actual docs for the built-in data structures or to relax the guarantees 
the language gives -- asking people to use mutexes/async libraries more and 
only guaranteeing enough to make those cases work.

--
nosy: +bjs

___
Python tracker 

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



[issue45410] python -m test -jN: write stderr in stdout to get messages in order

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27199
pull_request: https://github.com/python/cpython/pull/28908

___
Python tracker 

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



[issue45410] python -m test -jN: write stderr in stdout to get messages in order

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset dbe213de7ef28712bbfdb9d94a33abb9c33ef0c2 by Victor Stinner in 
branch 'main':
bpo-45410: Enhance libregrtest -W/--verbose3 option (GH-28908)
https://github.com/python/cpython/commit/dbe213de7ef28712bbfdb9d94a33abb9c33ef0c2


--

___
Python tracker 

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



[issue45405] configure fails on macOS with non-Apple clang version 13 which implements --print-multiarch

2021-10-12 Thread Ned Deily


Ned Deily  added the comment:


New changeset 9c4766772cda67648184f8ddba546a5fc0167f91 by David Bohman in 
branch 'main':
bpo-45405: Prevent ``internal configure error`` when running ``configure``  
with recent versions of non-Apple clang. (#28845)
https://github.com/python/cpython/commit/9c4766772cda67648184f8ddba546a5fc0167f91


--

___
Python tracker 

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



[issue45405] configure fails on macOS with non-Apple clang version 13 which implements --print-multiarch

2021-10-12 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45405] configure fails on macOS with non-Apple clang version 13 which implements --print-multiarch

2021-10-12 Thread miss-islington


Change by miss-islington :


--
pull_requests: +27201
pull_request: https://github.com/python/cpython/pull/28911

___
Python tracker 

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



[issue45421] Remove dead code from html.parser

2021-10-12 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:

I should also check again the stack consumption. Old issues:

* bpo-29465: Modify _PyObject_FastCall() to reduce stack consumption
* bpo-29234: Disable inlining of _PyStack_AsTuple() to reduce the stack 
consumption
* bpo-29227: Reduce C stack consumption in function calls
* bpo-28858: Fastcall uses more C stack

See also: "Stack consumption" of 
https://vstinner.github.io/contrib-cpython-2017q1.html

--

___
Python tracker 

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:

5 years ago, I added _PyObject_CallArg1() (similar to PyObject_CallOneArg()) 
and then I removed it since it consumed more stack memory than existing 
function, whereas I added _PyObject_CallArg1() to reduce the stack consumption.

commit 7bfb42d5b7721ca26e33050d025fec5c43c00058
Author: Victor Stinner 
Date:   Mon Dec 5 17:04:32 2016 +0100

Issue #28858: Remove _PyObject_CallArg1() macro

Replace
   _PyObject_CallArg1(func, arg)
with
   PyObject_CallFunctionObjArgs(func, arg, NULL)

Using the _PyObject_CallArg1() macro increases the usage of the C stack, 
which
was unexpected and unwanted. PyObject_CallFunctionObjArgs() doesn't have 
this
issue.

--

___
Python tracker 

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



[issue45405] configure fails on macOS with non-Apple clang version 13 which implements --print-multiarch

2021-10-12 Thread miss-islington


miss-islington  added the comment:


New changeset edae3e2ac73151217b4b4e096dd9f17cc0a50c11 by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-45405: Prevent ``internal configure error`` when running 
``configure``  with recent versions of non-Apple clang. (GH-28845) (GH-28911)
https://github.com/python/cpython/commit/edae3e2ac73151217b4b4e096dd9f17cc0a50c11


--

___
Python tracker 

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



[issue45405] configure fails on macOS with non-Apple clang version 13 which implements --print-multiarch

2021-10-12 Thread miss-islington


miss-islington  added the comment:


New changeset 9901d153c201d852d27dc9d3074e283c26468f6d by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-45405: Prevent ``internal configure error`` when running 
``configure``  with recent versions of non-Apple clang. (GH-28845) (GH-28910)
https://github.com/python/cpython/commit/9901d153c201d852d27dc9d3074e283c26468f6d


--

___
Python tracker 

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



[issue45447] IDLE: Support syntax highlighting for .pyi stub files

2021-10-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thank you for doing the research.

I have been thinking about adding a file containing idlelib 'leaf' objects, 
those with no idlelib dependencies, which are needed in more than one file. 
would be to reduce the complexity of the idlelib dependency graph, which has 
enough cyclic dependencies to make startup tricky.  Time to do it.  
idlelib/common.py?, leaves.py?, or ???  Draft:
---
"""Idlelib objects with no external idlelib dependencies and which are needed 
in more than one idlelib module.  They are included here because a) they don't 
particularly belong elsewhere or b) because inclusion here simplifies the 
idlelib dependency graph.

TODO: Python versions (editor and help_about), tk version and patchlevel 
(pyshell, help_about, maxos?, editor?), std streams (pyshell, run), warning 
stuff (ditto).
"""

# python_extensions is used in editor, browser, and iomenu.
# .pyw is for Windows; .pyi is for stub files.
python_extensions = ('.py', '.pyw', '.pyi')  
extension_string = "*" + " *".join(python_extensions)
---

editor.EditorWindow.ispythonsource could be moved into the new file if a 
'firstline=None' argument were added.

OnDoubleClick should use IsExpandable.  IsExpandable should use the logic in 
ispythonsource so Linux no-extension python source can be browsed as well as 
edited.

After manual testing, add a new test_common.py file in idlelib.idle_test. After 
imports, it could start with one test:

class ExtensionTest(TestCase):
def test_stub(self):
self.assertIn('.pyi', common.python_extensions)
self.assertIn('.pyi', common.extension_string)

For IDLE, I can and will backport.

--
stage:  -> test needed

___
Python tracker 

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



[issue45405] configure fails on macOS with non-Apple clang version 13 which implements --print-multiarch

2021-10-12 Thread Ned Deily


Ned Deily  added the comment:

Merged for release in 3.10.1 and 3.9.8. Thanks for the issue and PR, David!

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



[issue45451] IDLE Shell GUI - remove window border

2021-10-12 Thread primexx


New submission from primexx :

Python 3.10 bundled IDLE with a small change in the interactive interpreter 
shell.

Previously, the line indicators ">>>" were in-line with the command line, and a 
long/multi line command would have the same indentation as the indicator which 
was not ideal.

that has been changed in 3.10 so that the line indicators are in a separate 
area as the actual commands so actual commands are always indented 
consistently. this is good.

however, there is now a thick window border separating the line indicator and 
the main window. this is jarring and creates a visual separation that 
disassociates the line indicator from the line itself.

i have on several occasions sat there waiting for something to finish only to 
notice that it has already finished but i missed seeing the next line indicator 
to the left.

the window border creates two separate spaces and is distracting.

an improvement would be to instead of the window border, eliminate it and shade 
the left side with a very light colour (probably even lighter than my photoshop 
in the attached image).

actually, I suggest that the best solution is to remove the window border and 
leave the entire thing contiguously white, with no shading, similar to what it 
looked like previously. except that it now has correct indentation. I think 
this is the most visually cohesive and easy to use.

Attached is an image to illustrate. Again, I suggest the "not shaded" version 
is the best.

--
assignee: terry.reedy
components: IDLE
files: idle310.PNG
messages: 403774
nosy: primexx, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE Shell GUI - remove window border
type: enhancement
versions: Python 3.10
Added file: https://bugs.python.org/file50352/idle310.PNG

___
Python tracker 

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27202
pull_request: https://github.com/python/cpython/pull/28912

___
Python tracker 

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27203
pull_request: https://github.com/python/cpython/pull/28913

___
Python tracker 

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 489176e4285314f9ea87b8bd91fe1d55d9af2c42 by Victor Stinner in 
branch 'main':
bpo-45434: Convert Py_GETENV() macro to a function (GH-28912)
https://github.com/python/cpython/commit/489176e4285314f9ea87b8bd91fe1d55d9af2c42


--

___
Python tracker 

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-12 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27204
pull_request: https://github.com/python/cpython/pull/28914

___
Python tracker 

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



[issue45452] Support crash tolerance for gdbm module

2021-10-12 Thread Dong-hee Na


New submission from Dong-hee Na :

>From gdbm 1.21, gdbm supports the crash tolerance feature.
We may need to provide APIs for those versions.

https://www.gnu.org.ua/software/gdbm/manual/Crash-Tolerance.html

Following features will be provided if the user using gdbm >= 1.21
- Need to provide `GDBM_NUMSYNC` as `s`.
- Need to provide API for gdbm_failure_atomic()
- Need to provide API for gdbm_latest_snapshot()

--
assignee: corona10
components: Extension Modules
messages: 403776
nosy: corona10, vstinner
priority: normal
severity: normal
status: open
title: Support crash tolerance for gdbm module
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



[issue45452] Support crash tolerance for gdbm module

2021-10-12 Thread Dong-hee Na


Dong-hee Na  added the comment:

I am going to work on this issue :)

--

___
Python tracker 

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



[issue36521] Consider removing docstrings from co_consts in code objects

2021-10-12 Thread Inada Naoki


Inada Naoki  added the comment:

Although I still feel reducing 16% tuples is attractive, no one support the 
idea.

I leave this as-is for now, and will go to lazy-loading docstring (maybe, 
co_linetable too) later.

--
resolution:  -> rejected
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



[issue45453] test_embed: random crash on AMD64 Fedora Rawhide Clang 3.x

2021-10-12 Thread STINNER Victor


New submission from STINNER Victor :

test_embed does crash randomly on AMD64 Fedora Rawhide Clang 3.x:

* https://buildbot.python.org/all/#/builders/188/builds/880
* https://buildbot.python.org/all/#/builders/188/builds/879

So far, I failed to reproduce the issue.

--
components: Tests
messages: 403779
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_embed: random crash on AMD64 Fedora Rawhide Clang 3.x
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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-12 Thread Dong-hee Na


Dong-hee Na  added the comment:

FYI, I got a mail about this feature from Terence Kelly who design these 
amazing things :)

--

___
Python tracker 

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



  1   2   >