[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

If you want pass to become an expression, what should these do?

x = pass

print(pass)

mydict[pass] = 1

type(pass)

There is nothing special about the ternary if operator. It is just an 
operator like plus, minus and more. The only difference is that plus 
takes two arguments, and if...else takes three:

expression + expression

expression if expression else expression

If pass becomes legal in the if...else ternary operatory, it must be an 
expression, so it must have a value. What is that value?

--
title: 'pass' in 'if-else' linear expression -> operator 'pass' in 'if-else' 
linear expression

___
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


Change by Terry J. Reedy :


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



[issue45456] 'pass' in 'if-else' linear expression

2021-10-12 Thread wyz23x2


wyz23x2  added the comment:

Well,
x = 1 if False else pass
and
if False: x = 1

1 line vs 1 line :) It's just not needed.

--
nosy: +wyz23x2

___
Python tracker 

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



[issue45456] 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Change by Evgeniy Ivanov :


--
title: operator 'pass' in 'if-else' linear expression -> 'pass' in 'if-else' 
linear expression

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


miss-islington  added the comment:


New changeset cc90732d15b267feb4cb75ec4c448a3c66e6c520 by Miss Islington (bot) 
in branch '3.9':
bpo-20692: Add Programming FAQ entry for 1.__class__ error. (GH-28918)
https://github.com/python/cpython/commit/cc90732d15b267feb4cb75ec4c448a3c66e6c520


--

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

formaly it's not bug, this is future request ok?

--

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


miss-islington  added the comment:


New changeset 47673c47db352916384e4f35fa520e48475e2601 by Miss Islington (bot) 
in branch '3.10':
bpo-20692: Add Programming FAQ entry for 1.__class__ error. (GH-28918)
https://github.com/python/cpython/commit/47673c47db352916384e4f35fa520e48475e2601


--

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

this wrong example

now i'm use this
x += x*2 if math.pow(x) > 386 else ''

wanted to say that doing this now

my_func(x) if x > 100 else ''

--

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

or another example:

def my_func(x):
 something_do


my_func(x) if x > 100 else 

--

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

it is more readable

--

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Evgeniy Ivanov  added the comment:

ok, but what you say for this?

x += x*2 if math.pow(x) > 386 else pass

and 

if math.pow(x) > 386:
 x += x*2

1 line vs 2 line

now i'm use this

x += x*2 if math.pow(x) > 386 else ''

--

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


Change by Evgeniy Ivanov :


--
resolution: not a bug -> 
status: closed -> open
type: compile error -> 

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


New changeset 380c44087505d0d560f97e325028f27393551164 by Terry Jan Reedy in 
branch 'main':
bpo-20692: Add Programming FAQ entry for 1.__class__ error. (GH-28918)
https://github.com/python/cpython/commit/380c44087505d0d560f97e325028f27393551164


--

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


Change by miss-islington :


--
pull_requests: +27211
pull_request: https://github.com/python/cpython/pull/28920

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


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 11.0 -> 12.0
pull_requests: +27210
pull_request: https://github.com/python/cpython/pull/28919

___
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


Change by Terry J. Reedy :


--
pull_requests: +27209
pull_request: https://github.com/python/cpython/pull/28918

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

This is not a bug, "pass" is not an operator, it is not an expression, it is a 
statement and is only allowed in places where statements are allowed.

The if expression requires all three operands to be expressions.

Even if "pass" was permitted, what would it do? What would be the value of x 
after this assignment?

x = 1 if False else pass

If you need x to be undefined, use an if statement:


if False:
# this block is not run
x = 1

# x is undefined here

--
nosy: +steven.daprano
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



[issue45451] IDLE Shell GUI - remove window border

2021-10-12 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Whereas to me, 'not shaded' is easily the worst.  Users can customize the 
sidebar colors, but since the default is the same at the text, I would not want 
to deliver IDLE with a scheme that I think is awful.

On Windows, I agree that the light theme border is too heavy.  The dark  theme 
light border is barely noticeable.  On mac, its the opposite: light theme ok, 
dark theme white border is too prominent.  I would be willing to look at a 
change.

--

___
Python tracker 

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



[issue45456] operator 'pass' in 'if-else' linear expression

2021-10-12 Thread Evgeniy Ivanov


New submission from Evgeniy Ivanov :

Why operator 'pass' not implement to 'if-else' linear expression?
Construction ' if  else pass' throws SyntaxError in 
Python 3.9

--
messages: 403793
nosy: evgnor86
priority: normal
severity: normal
status: open
title: operator 'pass' in 'if-else' linear expression
type: compile error
versions: 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



[issue45451] IDLE Shell GUI - remove window border

2021-10-12 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +taleinat

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


Guido van Rossum  added the comment:

Okay, thanks. We may do one of the other ideas (maybe co_flags & CO_DOCSTRING).

--

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


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 1.0 -> 2.0
pull_requests: +27208
pull_request: https://github.com/python/cpython/pull/28917

___
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


STINNER Victor  added the comment:


New changeset 678433f25e0d08dad7edf72be8f0cf9420e4ed2c by Victor Stinner in 
branch 'main':
bpo-45453: Fix test_embed.StdPrinterTests (GH-28916)
https://github.com/python/cpython/commit/678433f25e0d08dad7edf72be8f0cf9420e4ed2c


--

___
Python tracker 

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



[issue18376] show the effective count of process when running the testsuite

2021-10-12 Thread za


za  added the comment:

The patch seems outdated. Is the ticket still relevant?

--
nosy: +za

___
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


Change by STINNER Victor :


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

___
Python tracker 

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



[issue45454] Unable to explicitly subclass protocol when subclass has mixin requiring init

2021-10-12 Thread Chris Meyer


Chris Meyer  added the comment:

This looks like it a regression specific to Python 3.9.7 and has been fixed.

https://bugs.python.org/issue45081
https://github.com/python/cpython/pull/28132.

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



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

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:

Ah, I reproduced a crash locally:

0:00:19 load avg: 2.00 [3/3/1] test_embed crashed (Exit code -11)
Fatal Python error: Segmentation fault

Current thread 0x7fef0ea9f2c0 (most recent call first):
  File "/home/vstinner/python/main/Lib/test/test_embed.py", line 1560 in 
create_printer
  File "/home/vstinner/python/main/Lib/test/test_embed.py", line 1595 in 
test_disallow_instantiation

The crash happens when sys.__stdout__.fileno() is not 1 or 2. It happens with 
my recents changes in bpo-45410.

--

___
Python tracker 

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



[issue45455] Fill func.__doc__ lazily

2021-10-12 Thread Inada Naoki


Inada Naoki  added the comment:

Pros:

Faster (about 3~5%) faster function creation, when function don't have 
annotations.
When function has annotation, function creation is much slower so performance 
gain become tiny.

Cons:

Somewhat backward incompatible:

```
>>> def foo(): "foo"
...
>>> def bar(): "bar"
...
>>> bar.__code__ = foo.__code__
>>> bar.__doc__
'foo'  # was 'bar'
```

--
stage: patch review -> 

___
Python tracker 

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



[issue45455] Fill func.__doc__ lazily

2021-10-12 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue45455] Fill func.__doc__ lazily

2021-10-12 Thread Inada Naoki


New submission from Inada Naoki :

Move setting `func.__doc__` from PyFunction_New() to __doc__ descriptor, for 
faster function creation.

This issue is spin-off of bpo-36521.

--
components: Interpreter Core
messages: 403786
nosy: methane
priority: normal
severity: normal
status: open
title: Fill func.__doc__ lazily
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



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

2021-10-12 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c63623a0a6892ce8683dbf8c769793ea897e6ba8 by Victor Stinner in 
branch 'main':
bpo-45434: bytearrayobject.h no longer includes  (GH-28913)
https://github.com/python/cpython/commit/c63623a0a6892ce8683dbf8c769793ea897e6ba8


--

___
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


STINNER Victor  added the comment:

Oh, maybe this is no traceback on a crash because of my recent libregrtest 
changes in bpo-45410.

--

___
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


STINNER Victor  added the comment:

It also crashed on the Address Sanitizer job of GitHub Action:
https://github.com/python/cpython/runs/3877327574

0:09:15 load avg: 4.46 [267/413/1] test_embed crashed (Exit code -11) -- 
running: test_gdb (1 min 2 sec), test_peg_generator (57.4 sec)

== Tests result: FAILURE then SUCCESS ==

1 re-run test:
test_embed

--

___
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: +27205
pull_request: https://github.com/python/cpython/pull/28915

___
Python tracker 

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



[issue45454] Unable to explicitly subclass protocol when subclass has mixin requiring init

2021-10-12 Thread Chris Meyer


New submission from Chris Meyer :

If I make a explicit subclass of a protocol that also inherits from a mixin and 
calls super() in order to initialize the mixin, I get the "Protocols cannot be 
instantiated" exception.

This case arises when having a hierarchy of both protocols and concrete classes 
that implement the protocols.

A simple example is:

import typing


class P(typing.Protocol):
def m1(self) -> None: ...

class M:
def __init__(self) -> None:
super().__init__()
self.o = True

class C(M, P):
def __init__(self) -> None:
super().__init__()
self.op = True

def m1(self) -> None:
pass

c = C()

I can resolve this in particular cases by not invoking super in the mixin or 
putting a special no-super class in the hierarchy. However, that is not a 
general solution and once the class hierarchy gets more complicated, it fails 
to work.

Am I missing any known solution to this issue?

--
components: Library (Lib)
messages: 403782
nosy: cmeyer
priority: normal
severity: normal
status: open
title: Unable to explicitly subclass protocol when subclass has mixin requiring 
init
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



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

> bpo-45410: Enhance libregrtest -W/--verbose3 option (GH-28908)

Oh. Sadly, with this change, faulthandler is no longer able to dump a traceback 
on a crash :-(

--

___
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


Change by Dong-hee Na :


--
title: Support crash tolerance for gdbm module -> Support crash tolerance 
feature for gdbm module

___
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


Change by Dong-hee Na :


--
nosy: +serhiy.storchaka

___
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



[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



[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



[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



[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



[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



[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: +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


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



[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



[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



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



[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



[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



[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



[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



[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



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



[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



[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



[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



[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



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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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


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



[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



[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



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


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



[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



[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

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



[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



[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



[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



[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



[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



[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



[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



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



[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



[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



[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



  1   2   >