[issue44659] Remove Ivan from list of typing experts

2021-07-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
title: Remove Ivan from list of,typing experts -> Remove Ivan from list of 
typing experts

___
Python tracker 

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



[issue44611] CPython uses deprecated randomness API

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -25742

___
Python tracker 

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



[issue44611] CPython uses deprecated randomness API

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +25742
pull_request: https://github.com/python/cpython/pull/27206

___
Python tracker 

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



[issue44661] Update property_descr_set to use vectorcall if possible.

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue44611] CPython uses deprecated randomness API

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -25740

___
Python tracker 

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



[issue44611] CPython uses deprecated randomness API

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +25740
pull_request: https://github.com/python/cpython/pull/27206

___
Python tracker 

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



[issue44661] Update property_descr_set to use vectorcall if possible.

2021-07-16 Thread Dong-hee Na


New submission from Dong-hee Na :

It shows a consistent 1-2% performance improvement.

Mean +- std dev: [property_base] 40.6 ns +- 0.6 ns -> [property_vectorcall] 
40.0 ns +- 0.7 ns: 1.01x faster

--
components: Interpreter Core
files: bench_property.py
messages: 397701
nosy: corona10, erlendaasland, kj, pablogsal, vstinner
priority: normal
severity: normal
status: open
title: Update property_descr_set to use vectorcall if possible.
type: performance
versions: Python 3.11
Added file: https://bugs.python.org/file50154/bench_property.py

___
Python tracker 

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



[issue44651] An unclear definition in Doc/glossary.rst

2021-07-16 Thread Steven Hsu


Steven Hsu  added the comment:

Thanks for your reply and suggestion.

I can totally understand your explanation about the definition of coercion.

In conclusion, I think this glossary entry may need some modification for 
better understanding, or simply be deleted.

So what's the next step?
Should I create a PR in GitHub?

Thanks for reply again.

--

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Another issue: exit() and quit() work unconditionally when called, regardless 
of the context:  "a = (3, exit(), 'abc')".  The abbreviated versions will not.

An alternative change is to revise the representation.  Perhaps tell the truth 
first by giving the standard representation --  
--  so that people might recognize that they are just seeing a printed string.  
Then add on the next line, "If you want to exit, enter 'exit' ...".

--

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I agree that turning 'exit' and 'quit' into semi-keywords is not acceptible.  I 
added this to my PR review.

>>> exit = 3
>>> exit

f:\dev\3x>

--

___
Python tracker 

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



[issue44589] Pattern Matching - duplicate keys in mapping patterns

2021-07-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-16 Thread Ken Jin


Change by Ken Jin :


--
pull_requests: +25739
pull_request: https://github.com/python/cpython/pull/27205

___
Python tracker 

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



[issue44589] Pattern Matching - duplicate keys in mapping patterns

2021-07-16 Thread Jack DeVries


Jack DeVries  added the comment:

The PR and backport to 3.10 have both been merged, so I think this issue can be 
closed.

--

___
Python tracker 

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-16 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +25738
pull_request: https://github.com/python/cpython/pull/27204

___
Python tracker 

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



[issue44659] Remove Ivan from list of,typing experts

2021-07-16 Thread Ken Jin


Ken Jin  added the comment:

The list for GH reviews is the CODEOWNERS file at 
https://github.com/python/cpython/blob/main/.github/CODEOWNERS

The list for grouping bpo users is the experts index (I hope) at 
https://devguide.python.org/experts/

Let's wait a bit to hear what Ivan wants. I recall seeing him replying on bpo 
recently but not on GH. So maybe we should leave him in for bpo but remove him 
from the GH reviews?

--

___
Python tracker 

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-16 Thread Guido van Rossum

Guido van Rossum  added the comment:

Let’s both, since this feels like a real bug fix to me.

--

___
Python tracker 

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-16 Thread Ken Jin


Ken Jin  added the comment:

> How far can/should we backport this?

It will work in 3.10 and 3.9 without issues. However, I don't remember if 
bugfixes for __future__ features require special treatment/are excluded from 
normal bugfix backports. I vaguely remember us not backporting from __future__ 
annotations very far back (since they usually broke backwards compatibility).

Maybe 3.10 is enough?

--

___
Python tracker 

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



[issue44660] email.feedparser Module Lacks Support for Section 3.5 of RFC 6532: message/global Emails with non-identity Content-Transfer-Encodings

2021-07-16 Thread Francis Johnson

New submission from Francis Johnson :

Note that I have created a fix for this and am working through the Python 
Developer’s Guide to propose it.

--
components: email
messages: 397693
nosy: barry, f18a14c09s, r.david.murray
priority: normal
severity: normal
status: open
title: email.feedparser Module Lacks Support for Section 3.5 of RFC 6532: 
message/global Emails with non-identity Content-Transfer-Encodings
type: behavior
versions: Python 3.11

___
Python tracker 

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



[issue44490] PEP 604 Union (int | str) doesn't have __parameters__

2021-07-16 Thread Ken Jin


Change by Ken Jin :


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

___
Python tracker 

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

How far can/should we backport this?

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-16 Thread Vedran Čačić

Vedran Čačić  added the comment:

> In the other hand, special-casing 'quit\n' and 'exit\n' could be seen as 
> analogous to special-casing '^Z\n'

Terry, there is a big difference between special-casing 'exit\n' and 
special-casing '^Z\n': 'exit' is a perfectly valid identifier (and people use 
it regularly), ^Z is not. Especially if 'exit\n' exited unconditionally, I 
think many people would be very frustrated and surprised when trying to inspect 
the variable called 'exit'.

I'd have no objection if something like '!exit' was special-cased, but then 
there is not much difference between adding a bang before and adding the 
parentheses after. Alternatively, exit can be proclaimed a keyword, but I 
really think this is overkill.

And please don't think this process that you're starting now will stop at these 
two words. Much more beginners, according to my experience, try to type `pip 
install something` inside Python REPL. If we do this, it will be a powerful 
precedent, and almost surely we will have the "magic mess" later.

--

___
Python tracker 

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



[issue41249] TypedDict inheritance doesn't work with get_type_hints and postponed evaluation of annotations across modules

2021-07-16 Thread Guido van Rossum

Guido van Rossum  added the comment:


New changeset 889036f7ef7290ef15b6c3373023f6a35387af0c by Germán Méndez Bravo 
in branch 'main':
bpo-41249: Fix postponed annotations for TypedDict (GH-27017)
https://github.com/python/cpython/commit/889036f7ef7290ef15b6c3373023f6a35387af0c


--

___
Python tracker 

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



[issue44490] PEP 604 Union (int | str) doesn't have __parameters__

2021-07-16 Thread Guido van Rossum


Change by Guido van Rossum :


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

___
Python tracker 

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



[issue44651] An unclear definition in Doc/glossary.rst

2021-07-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

OK with me.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue44659] Remove Ivan from list of,typing experts

2021-07-16 Thread Guido van Rossum


New submission from Guido van Rossum :

There is a list somewhere in bpo or GH that automatically adds Ivan to all bugs 
or reviews involving typing. He is no longer active. Can we remove him from 
those lists? And maybe add Ken Jin, who has built up a lot of expertise  in 
this area.

--
messages: 397688
nosy: gvanrossum, kj, levkivskyi, lukasz.langa
priority: normal
severity: normal
status: open
title: Remove Ivan from list of,typing experts

___
Python tracker 

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



[issue44589] Pattern Matching - duplicate keys in mapping patterns

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Is something left here?

--
nosy: +pablogsal

___
Python tracker 

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



[issue44610] Format issue with strftime and %Y

2021-07-16 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue44490] PEP 604 Union (int | str) doesn't have __parameters__

2021-07-16 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset bf89ff96e6ba21bb52b8597b5e51e8ffc57e6589 by Yurii Karabas in 
branch 'main':
bpo-44490: Improve typing module compatibility with types.Union (GH-27048)
https://github.com/python/cpython/commit/bf89ff96e6ba21bb52b8597b5e51e8ffc57e6589


--

___
Python tracker 

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



[issue44603] REPL: exit when the user types exit instead of asking them to explicitly type exit()

2021-07-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This has been proposed and rejected before.  So I think a pydev discussion and 
steering council decision would be needed to change.

The current rule in interactive mode is that typing an expression statement 
echoes the representation of the resulting object.  The proposal is make a 
rather startling exception to the rule.  The premise is that "the program knows 
what I meant".

However, that is a too-successful illusion.  'The program' has no idea what one 
meant other than to print the repr(ob).  Some coredevs had the idea to *guess* 
what was meant and to give two functions an exceptional representation with a 
message that would be correct when the guess is correct.

In the other hand, special-casing 'quit\n' and 'exit\n' could be seen as 
analogous to special-casing '^Z\n'.  And the patch restricts the special 
casing, without complicated code, to exactly those sequences of keystrokes.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue44524] __name__ attribute in typing module

2021-07-16 Thread Guido van Rossum

Guido van Rossum  added the comment:

Sorry for the slow progress. I don’t think it is important for Any orUnion to 
have these attributes, but the ones that match ABCs or concrete classes (e.g. 
MutableSet, Counter) should probably have __name__, __qualname__, and 
__module__, since the originals have those. I think __module__ should be set to 
‘typing’, and __qualname__ to ‘typing.WhatEver’.

--

___
Python tracker 

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



[issue44658] No ValueError for duplicate key value in mapping patern when lengths do not match

2021-07-16 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

See also https://bugs.python.org/issue44589

--
nosy: +brandtbucher, xtreak

___
Python tracker 

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



[issue44657] instancemethod_call should use PyInstanceMethod_GET_FUNCTION macro

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue43893] typing.get_type_hints does not accept type annotations with leading whitespaces

2021-07-16 Thread Guido van Rossum

Guido van Rossum  added the comment:

The more I think about this, the less I like it. AFAIK static checkers like 
mypy don’t strip leading white space from forward references either. (If I’m 
wrong, please show evidence.)

--

___
Python tracker 

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



[issue44657] instancemethod_call should use PyInstanceMethod_GET_FUNCTION macro

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue44592] tkinter focus_get() with non-tkinter Tk widget

2021-07-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Traceback (most recent call last):
  File "C:\Programs\Python310\lib\tkinter\__init__.py", line 1921, in __call__
return self.func(*args)
  File "C:\Programs\Python310\lib\tkinter\__init__.py", line 839, in callit
func(*args)
  File "C:\Programs\Python310\lib\tkinter\__init__.py", line 783, in focus_get
return self._nametowidget(name)
  File "C:\Programs\Python310\lib\tkinter\__init__.py", line 1536, in 
nametowidget
w = w.children[n]
KeyError: 'e'

Is catching KeyError in the following
try:
# Tcl sometimes returns extra windows, e.g. for
# menus; those need to be skipped
result.append(self._nametowidget(child))
except KeyError:
pass
really correct?  It appears to skip things that *can* get focus by key or mouse 
action.  But what choice is there?

Silently failing when asked to focus on something is even less obviously 
correct.  For 'widget = root.focus_get' to assign None to widget is not 
obviously useful as it likely just delays the error.

--

___
Python tracker 

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



[issue40529] Auto Completions with case insensitive

2021-07-16 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

It seems like this would be a very good feature to have for accesibility, 
because persons with low level disabilities (e.g. carpal syndrom) will 
generally have a harder time keeping shift down while pressing a few upper case 
letters, and they would often have caps lock remapped to Esc or Ctrl to make 
them more easily usable since caps lock is almost never used. I don't have 
disability but that's what I've heard!

--
nosy: +andrei.avk

___
Python tracker 

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



[issue29753] [Linux] ctypes packs bitfields Incorrectly

2021-07-16 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Charles and Sam: In the future, when responding by email, please delete the 
email you are responding to, except maybe for a line.  When your response is 
posted to web page, the quote is redundant and distracting.

--
nosy: +terry.reedy
versions:  -Python 3.8

___
Python tracker 

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



[issue44649] dataclasses slots with init=False field raises AttributeException

2021-07-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

With Pablo's changes, the error now reads (in 3.11):

obj.b
^
AttributeError: 'Example' object has no attribute 'b'

Which is a vast improvement!

I'm working on a PR to initialize obj.b in __init__.

--

___
Python tracker 

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



[issue39221] Cross compiled python installed wrong version of lib2to3/Grammar pickle

2021-07-16 Thread Andrew Aladjev

Andrew Aladjev  added the comment:

Hello. I've received more problems with pickle generation, reviewed source 
code, invented better bike for solving it. So I can provide full description of 
this issue and reduce other developers time on debugging.

Problem:

1. Martin v. Löwis  introduced pickle generation Wed Mar 19 
04:43:46 2008 commit 
https://github.com/python/cpython/commit/5e37baea8007cb64b65a180e4d6c80de292a8a4a#diff-c9bd4064884726c21716df7118dcaeb72a63cc8ddd49484c7f4676934b37d9bb

2. Martin provided code for generating of pickle file: head + tail + 
".".join(map(str, sys.version_info)) + ".pickle". This code has never been 
changed and comes as is in 2021 year.

Code means that current python interpreter uses its own version for creating a 
new pickle file for new cpython interpreter. It will work only when current 
python interpreter equals to new cpython interpreter. This code is broken by 
design.

3. We can see file "Lib/lib2to3/patcomp.py" in the commit above, today (2021) 
it is a part of "Lib/lib2to3/pygram.py". It comes with the following code:

_GRAMMAR_FILE = ... "Grammar.txt"
_PATTERN_GRAMMAR_FILE = ... "PatternGrammar.txt"

4. We can review step-by-step "load_grammar" real world usage from 
"Lib/lib2to3/pgen2/driver.py":

driver.load_grammar(_GRAMMAR_FILE)
driver.load_grammar(_PATTERN_GRAMMAR_FILE)

def load_grammar(gt="Grammar.txt", gp=None
gp = head + tail + ".".join(map(str, sys.version_info)) + ".pickle"

if force or not _newer(gp, gt):
  logger.info("Generating grammar tables from %s", gt)

def _newer(a, b):
  if not os.path.exists(a):
return False

This "code" comes as is today as a part of latest stable python 3.9.5. This 
workaround means that when pickle files doesn't exist - python will recreate it 
in runtime inside "lib/lib2to3" folder.

This workaround will ruin your production if "lib/lib2to3" is readonly and 
pickle files are not inside. Everybody will try to use this workaround as a 
security hole. But it looks like nobody from cpython cares.

Solution:

1. Apply provided remove_python_version_from_pickle.patch.
2. Cross compile new cpython.
3. Cross compile portage.
4. Chroot.
5. Run python -c "import lib2to3.pygram", it will create pickles without 
version postfix, stop python from creating junk in runtime, fix sandbox 
permission issues temporaly.
6. Reinstall portage.
7. Reinstall cpython without patch, it will recreate pickles during 
installation.
8. Reinstall portage.

This is just bike on the top of Martin's workaround. The best variant is to 
ignore cpython (and maybe python) completely, ignore software written in python 
where possible.

--
Added file: 
https://bugs.python.org/file50153/remove_python_version_from_pickle.patch

___
Python tracker 

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



[issue44655] Confusing message with AttributeError when attribute name matches suggestion

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset efda9054b9fc91e69ecb34eae84fdd2ca8e6feef by Miss Islington (bot) 
in branch '3.10':
bpo-44655: Include the name of the type in unset __slots__ attribute errors 
(GH-27199) (GH-27201)
https://github.com/python/cpython/commit/efda9054b9fc91e69ecb34eae84fdd2ca8e6feef


--

___
Python tracker 

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



[issue44655] Confusing message with AttributeError when attribute name matches suggestion

2021-07-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue44655] Confusing message with AttributeError when attribute name matches suggestion

2021-07-16 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue44655] Confusing message with AttributeError when attribute name matches suggestion

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset f783428a2313a729ca8b539c5a86ff114b9ff375 by Pablo Galindo Salgado 
in branch 'main':
bpo-44655: Include the name of the type in unset __slots__ attribute errors 
(GH-27199)
https://github.com/python/cpython/commit/f783428a2313a729ca8b539c5a86ff114b9ff375


--

___
Python tracker 

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



[issue35673] Loader for namespace packages

2021-07-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think a PR with tests would be a good first step.

--

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

We can probably leverage the unicodedata_UCD_east_asian_width_impl function in 
the unicodedata extension module to get the width of every character as emojis 
normally take 2 characters in the terminal. We could expose the necessary 
functions from there and use them in the 
_PyPegen_byte_offset_to_character_offset function

--

___
Python tracker 

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



[issue35673] Loader for namespace packages

2021-07-16 Thread Isaac


Isaac  added the comment:

Not sure if it's proper etiquette to bump issues on the tracker, but is there 
any interest in this issue for 3.11?

--
nosy: +fwahhab

___
Python tracker 

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



[issue44655] Confusing message with AttributeError when attribute name matches suggestion

2021-07-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue44655] Confusing message with AttributeError when attribute name matches suggestion

2021-07-16 Thread Eric V. Smith


Change by Eric V. Smith :


--
title: Confusing message with AttributreError when attribute name matches 
suggestion -> Confusing message with AttributeError when attribute name matches 
suggestion

___
Python tracker 

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



[issue44655] Confusing message with AttributreError when attribute name matches suggestion

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset a0b1d401db52391d13479c53ee3880e6640df98c by Miss Islington (bot) 
in branch '3.10':
bpo-44655: Don't include suggestions for attributes that are the same as the 
missing one (GH-27197) (GH-27198)
https://github.com/python/cpython/commit/a0b1d401db52391d13479c53ee3880e6640df98c


--

___
Python tracker 

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



[issue44655] Confusing message with AttributreError when attribute name matches suggestion

2021-07-16 Thread Eric V. Smith


Change by Eric V. Smith :


--
title: Confusing message with AttributreError suggestions -> Confusing message 
with AttributreError when attribute name matches suggestion

___
Python tracker 

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



[issue44655] Confusing message with AttributreError suggestions

2021-07-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

Got it. Thanks for jumping on this quickly.

--
title: Confusing error with __slots__ -> Confusing message with AttributreError 
suggestions

___
Python tracker 

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



[issue44655] Confusing error with __slots__

2021-07-16 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-16 Thread Ammar Askar


Ammar Askar  added the comment:

Aah, I won't have time to investigate until Monday. I'll take a look then 
unless someone gets to it first :)

--

___
Python tracker 

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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d by Pablo Galindo Salgado 
in branch 'main':
bpo-44655: Don't include suggestions for attributes that are the same as the 
missing one (GH-27197)
https://github.com/python/cpython/commit/6714dec5e104bdee4a0ed4d9966de27d1bfa1e3d


--

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ah, this is our friend _PyPegen_byte_offset_to_character_offset. I am glad we 
refactor it to be used by the Parser and the traceback mechanism. Ammar, would 
you like to take a look?

--

___
Python tracker 

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



[issue43950] Include column offsets for bytecode instructions

2021-07-16 Thread Ammar Askar

Ammar Askar  added the comment:

As reported by Will McGugan on twitter:

Printing may be wrong for some unicode characters like:


Traceback (most recent call last):
  File "test.py", line 1, in 
x = ("该" / 0) + (1 / 2)
 ~~^
TypeError: unsupported operand type(s) for /: 'str' and 'int'


and


Traceback (most recent call last):
  File "test.py", line 3, in 
x = ("" / 0) + (1 / 2)
 ~~~
TypeError: unsupported operand type(s) for /: 'str' and 'int'

--

___
Python tracker 

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



[issue10551] mimetypes read from the registry should not overwrite standard mime mappings

2021-07-16 Thread Shane Harvey


Shane Harvey  added the comment:

This issue says "mimetypes read from the registry should not overwrite standard 
mime mappings". Was this change ever made? the following issue claims that the 
"HKEY_CLASSES_ROOT\.js\Content Type" registry can still overrides ".js" files: 
https://bugs.python.org/issue43975?

--
nosy: +ShaneHarvey

___
Python tracker 

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



[issue44658] No ValueError for duplicate key value in mapping patern when lengths do not match

2021-07-16 Thread Jack DeVries


Jack DeVries  added the comment:

Another option if this problem is isolated to mapping patterns, we could 
introduce a new op-code: BUILD_MATCH_MAP, which is essentially a wrapper around 
BUILD_MAP that disallows duplicate key values.

--

___
Python tracker 

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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> it would be nicer if the version with the suggestion were more like the 
> version without the suggestion

Agreed, but that is actually not related with the suggestions. We only append a 
string at the end of whatever exception it was there. This difference is based 
on the attribute error for a slot not initialized vs an attribute error for 
something that is not there. For example, in 3.9:

---

class E:
__slots__=('blech')

E().blech

Traceback (most recent call last):
  File "/home/pablogsal/github/cpython/lel.py", line 6, in 
E().blech
AttributeError: blech


while

class E:
__slots__=('blech')

E().bluch

Traceback (most recent call last):
  File "/home/pablogsal/github/cpython/lel.py", line 4, in 
E().bluch
AttributeError: 'E' object has no attribute 'bluch'

--

___
Python tracker 

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



[issue44658] No ValueError for duplicate key value in mapping patern when lengths do not match

2021-07-16 Thread Jack DeVries


New submission from Jack DeVries :

Consider the following code:

class A:
a = 'a'

# runs without error
match {'a': 1}:
case {'a': 1, A.a: 1}:
pass

# raises ValueError
match {'a': 1, 'b': 1}:
case {'a': 1, A.a: 1}:
pass

In both cases, the mapping pattern is the same (and both are not valid due to 
duplicate key values). However, the pattern is only evaluated in the second 
case. This is because a key-length optimization provides a shortcut around 
pattern evaluation. The docs gives users a hint that things like this might 
happen, which is a good thing:

> Users should generally never rely on a pattern being evaluated. Depending on 
> > implementation, the interpreter may cache values or use other optimizations 
> > which skip repeated evaluations. 

> https://docs.python.org/3.10/reference/compound_stmts.html#overview

However, I can't help but think that these ergonomics are strange. Consider if 
some other code is mutating the value of `A.a`. This could create some very 
strange and flaky bugs where the state of `A.a` can change and make the pattern 
invalid, but nonetheless not cause an exception until much later, or not at all.

There is mapping pattern validation code in the `match_keys` function in 
ceval.c. I haven't looked, but I assume there is some other runtime validation 
for other match case types. I propose factoring Exception-raising validation 
into a separate procedure that is called before any optimization jumps occur.

This trades speed for consistent behavior, and I'm interested to hear what 
others think!

--
components: Interpreter Core
messages: 397662
nosy: jack__d
priority: normal
severity: normal
status: open
title: No ValueError for duplicate key value in mapping patern when lengths do 
not match
type: behavior
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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue44629] Some files from distutils module are importing all exceptions unnecessarily

2021-07-16 Thread Leonardo Freua

Leonardo Freua  added the comment:

Hi Éric, thanks for the info.

I'm still learning about all the processes and how things work around here in 
order to avoid opening issues that no longer make sense.

Thanks you again.

--

___
Python tracker 

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



[issue44657] instancemethod_call should use PyInstanceMethod_GET_FUNCTION macro

2021-07-16 Thread Sam Gross


Change by Sam Gross :


--
type: enhancement -> behavior

___
Python tracker 

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



[issue44657] instancemethod_call should use PyInstanceMethod_GET_FUNCTION macro

2021-07-16 Thread Sam Gross


New submission from Sam Gross :

The instancemethod_call function should use the PyInstanceMethod_GET_FUNCTION 
macro instead of the PyMethod_GET_FUNCTION macro. The current code is 
incorrect, but still works okay (doesn't crash)  because 
PyInstanceMethodObject.func is at the same offset as PyMethodObject.im_func.

https://github.com/python/cpython/blob/c90c591e5158ab7b531dcd6e2a5f00bc70ba7637/Objects/classobject.c#L465

--
components: Interpreter Core
messages: 397660
nosy: colesbury
priority: normal
severity: normal
status: open
title: instancemethod_call should use PyInstanceMethod_GET_FUNCTION macro
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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

Thanks, Pablo!

--

___
Python tracker 

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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

It's obviously not super important, but it would be nicer if the version with 
the suggestion were more like the version without the suggestion. Specifically, 
mentioning the object type:

>>> class E:
... __slots__=('a')
...
>>> E().a
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: a. Did you mean: 'a'?
>>> E().b
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'E' object has no attribute 'b'
>>>

--

___
Python tracker 

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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Maybe don't print the "Did you mean" part if the suggestion is the same as 
> the requested attribute?

I think this is a good idea and will take care of many other similar cases. 
Thanks for the suggestion, Eric! I will prepare a PR

--

___
Python tracker 

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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

For attribute errors we just call dir() on the object and we do a suggestion 
based on the names so if a name appears in the dir() then we will consider it 
for the suggestion.

--

___
Python tracker 

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



[issue44656] Dangerous mismatch between MAXPATHLEN and MAX_PATH on Windows

2021-07-16 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

In PC/getpathp.c CPython uses buffers with length MAXPATHLEN+1, which is 257 on 
Windows[1]. On Windows 7, where PathCch* functions are not available, CPython 
<= 3.8 fallbacks to PathCombineW()/PathCanonicalizeW()[2]. Those functions 
assume that the destination buffer has room for MAX_PATH (260) characters. This 
creates a dangerous setup: for example, gotlandmark()[3] can overflow the 
destination if `filename` is long enough, and `filename` can be user-controlled.

I couldn't devise a simple way to trigger a buffer overflow in a default Python 
installation, though it is possible if one, for example, makes sure that the 
landmark file ("lib\os.py") can't be found in the default locations and then 
supplies their own, long enough paths via e.g. PYTHONPATH environment variable 
which eventually end up in gotlandmark(). Even when such buffer overflow is 
triggered on my machine, I couldn't notice any change in behavior, probably 
because 3 bytes is small enough to not overwrite anything important.

However, I'm not comfortable with this. Could we just raise MAXPATHLEN from 256 
to 260 on Windows to avoid such kind of issues for sure?

Please also note that while the issue described above affects only Python <= 
3.8 on Windows 7, I think it would make sense to increase MAXPATHLEN in newer 
versions too to avoid any similar situations in the future (i.e. if two pieces 
of code interact and one of them uses MAX_PATH while another uses MAXPATHLEN).

[1] 
https://github.com/python/cpython/blob/0389426fa4af4dfc8b1d7f3f291932d928392d8b/Include/osdefs.h#L13
[2] 
https://github.com/python/cpython/blob/0389426fa4af4dfc8b1d7f3f291932d928392d8b/PC/getpathp.c#L278
[3] 
https://github.com/python/cpython/blob/0389426fa4af4dfc8b1d7f3f291932d928392d8b/PC/getpathp.c#L333

--
components: Windows
messages: 397655
nosy: izbyshev, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Dangerous mismatch between MAXPATHLEN and MAX_PATH on Windows
type: security
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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

Also, the dot after the first 'b' was confusing to me: I thought it had 
something to do with an attribute of b. And the quotes around the second 'b' 
were also confusing, but that's mostly because the original example initialized 
a class variable named 'b' with the str value 'b'.

Maybe a better error would use a colon:

AttributeError: foo: Did you mean: 'foo1'?

Looking at 3.10s behavior, I can't decide what logic it's using to suggest 
something:

>>> 'foo'.formatx
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'str' object has no attribute 'formatx'. Did you mean: 'format'?
>>> class C: pass
...
>>> C().a
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'C' object has no attribute 'a'

--

___
Python tracker 

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



[issue44649] dataclasses slots with init=False field raises AttributeException

2021-07-16 Thread Eric V. Smith


Eric V. Smith  added the comment:

I created issue 44655 for the confusing error message.

The problem with dataclasses is that the instance variable 'b' needs to be 
initialized, instead of the current dataclasses behavior where it relies on the 
class variable when reading 'b'.

--

___
Python tracker 

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



[issue44655] Confusing error with __slots__

2021-07-16 Thread Eric V. Smith


New submission from Eric V. Smith :

This is related to issue 44649. This is the simplest non-dataclasses case I 
could come up with.

Given:

class Example:
__slots__ = ('a', 'b')
def __init__(self, a):
self.a = a

obj = Example(42)
print(obj.b)

I get this in 3.10 and main:

Traceback (most recent call last):
  File "C:\home\eric\local\python\cpython\testdc.py", line 7, in 
print(obj.b)
  ^
AttributeError: b. Did you mean: 'b'?


The error message is confusing.

3.8 gives:

Traceback (most recent call last):
  File "testdc.py", line 7, in 
print(obj.b)
AttributeError: b

I don't have 3.9 around to test with.

Maybe don't print the "Did you mean" part if the suggestion is the same as the 
requested attribute?

The fact that the instance variable isn't initialized is the actual error in 
issue 44649, and I'll fix it there.

--
components: Interpreter Core
messages: 397652
nosy: eric.smith, pablogsal
priority: normal
severity: normal
status: open
title: Confusing error with __slots__
type: behavior
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



[issue42581] Docs site redirection doesn't work for 3.9

2021-07-16 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

It works for me (the first link) -- I think this can be closed.

--
nosy: +andrei.avk

___
Python tracker 

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



[issue44628] Remove the broken link for issue #445902 in unixcompiler.py (distutils)

2021-07-16 Thread Éric Araujo

Éric Araujo  added the comment:

distutils is being removed, see https://bugs.python.org/issue41282

--
nosy: +eric.araujo
resolution:  -> out of date
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



[issue44624] Script name for venv PowerShell activate

2021-07-16 Thread Éric Araujo

Change by Éric Araujo :


--
components: +Library (Lib) -Installation
nosy: +vinay.sajip

___
Python tracker 

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



[issue10572] Move test sub-packages to Lib/test

2021-07-16 Thread Brett Cannon


Brett Cannon  added the comment:

> After so long a reason came up that prevents the movement of tests of ctypes, 
> lib2to3, and idlelib (which even continues in the same folder, only the 
> nomenclature was changed)?

Time and energy.

--

___
Python tracker 

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



[issue44629] Some files from distutils module are importing all exceptions unnecessarily

2021-07-16 Thread Éric Araujo

Éric Araujo  added the comment:

distutils is a special case in the standard library: complicated code with even 
private helpers used by code in the wild, so we are extra careful when changing 
things in there.  But I should say it used to be special, and we used to be 
careful: setuptools copied the whole of distutils into their repo to make it 
easier to change things, and there’s a PEP to remove distutils from the 
standard library.  Thanks for checking first!

--
nosy: +eric.araujo
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
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



[issue44631] Refactoring the repr() of the _Environ class (os module)

2021-07-16 Thread Éric Araujo

Éric Araujo  added the comment:

Hello!  I’ve seen your name on a few recent tickets, thanks for contributing 
and welcome here! 

In general, the CPython project doesn’t do esthetic code changes for their own 
sake.  Not all code is changed from %-formatting when format is added, not all 
code using format changes to f-string, and code that works is left alone.  Each 
change merged takes resources to run tests, build packages, update clones; it 
changes the history of the files touched (which is important when investigating 
a bug months or years later); it takes time to review (pre or post-commit); it 
has the opportunity of introducing bugs.  Therefore, in the absence of a bug to 
fix or a new feature that is made easier by prior changes, I think this should 
be closed as not a bug.

--
nosy: +eric.araujo, lukasz.langa
versions:  -Python 3.10, 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



[issue44651] An unclear definition in Doc/glossary.rst

2021-07-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

Searching further, none of the uses of "coerce" or "coercion" in the docs seem 
to be a good match for the definition in this glossary entry. For example, from 
ipaddress.rst:

> By default, attempting to create a network object with host bits set will
result in :exc:`ValueError` being raised. To request that the
additional bits instead be coerced to zero, the flag ``strict=False`` can
be passed to the constructor

and from configparser.rst:

> A convenience method which coerces the *option* in the specified *section* to 
> an integer.

etc. I think we should just get rid of the glossary entry.

--

___
Python tracker 

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



[issue44651] An unclear definition in Doc/glossary.rst

2021-07-16 Thread Mark Dickinson


Mark Dickinson  added the comment:

Agreed that "of the same type" part is confusing. I suspect the intended 
meaning was that the operation *expects* both arguments to have the same type, 
so if the actual arguments have different types then they have to be coerced to 
a common type. In the example you mention, the 3 is converted to 3.0 so that 
the actual addition is applied to two arguments of the same type. So I think 
the "same type" part *was* intentional, if confusing.

But coercion was more of a real thing in Python 2, where there was a __coerce__ 
special method and a coerce builtin function. It isn't really a thing any more 
in Python 3, except inasmuch as it means "implicit type conversion". And I 
can't find any uses of :term:`coercion` elsewhere in the docs. Maybe we should 
just delete this glossary entry?

If all we mean by coercion is implicit type conversion, then the "operation 
which involves two arguments" part already seems over-specific: math.sqrt 
implicitly converts its argument to a float, for example.

--

___
Python tracker 

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



[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> Yeah I noticed it re-lookups __module__ unnecessarily multiple times for the 
> same type.

Actually I thought about this change, but did not implement it. Because it does 
not look performance critical, and future versions will likely do different 
tests (for example, testing the existence of special attribute, or check 
against lazily imported and cached classes from the typing module). Also, the 
test for TypeVar can be shared between genericaliasobject.c and unionobject.c.

It is mostly simple clean up, a line here, two lines there. 
genericaliasobject.c and unionobject.c could be merged in a single file, 
because they share several functions not used anywhere more. We perhaps merge 
them if more C implementations for typing be added in future.

--

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 42a5514cca6b4542f6b492b5652e337f15a89227 by Miss Islington (bot) 
in branch '3.10':
Revert "bpo-44645: Check for interrupts on any potentially backwards edge. 
(GH-27167)" (GH-27194) (#27195)
https://github.com/python/cpython/commit/42a5514cca6b4542f6b492b5652e337f15a89227


--

___
Python tracker 

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



[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +25730
pull_request: https://github.com/python/cpython/pull/27195

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset c90c591e5158ab7b531dcd6e2a5f00bc70ba7637 by Pablo Galindo Salgado 
in branch 'main':
Revert "bpo-44645: Check for interrupts on any potentially backwards edge. 
(GH-27167)" (#27194)
https://github.com/python/cpython/commit/c90c591e5158ab7b531dcd6e2a5f00bc70ba7637


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

To reproduce the problem:

$./python -m test test_threading -R : -v

...

test_original_excepthook (test.test_threading.ExceptHookTests) ... ok
test_system_exit (test.test_threading.ExceptHookTests) ... ok
test_can_interrupt_tight_loops (test.test_threading.InterruptMainTests) ...

(HANGS here or some time fails like in: 

==
FAIL: test_can_interrupt_tight_loops (test.test_threading.InterruptMainTests)
--
Traceback (most recent call last):
  File 
"/home/buildbot/buildarea/pull_request.cstratak-RHEL7-ppc64le.refleak/build/Lib/test/support/threading_helper.py",
 line 62, in decorator
return func(*args)
   ^^^
  File 
"/home/buildbot/buildarea/pull_request.cstratak-RHEL7-ppc64le.refleak/build/Lib/test/test_threading.py",
 line 1630, in test_can_interrupt_tight_loops
self.assertNotEqual(iterations, 0)
^^
AssertionError: 0 == 0
--

https://buildbot.python.org/all/#/builders/411/builds/92

--

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

To reproduce the problem:

./python -m test test_threading -R : -

--

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue44645] Python 3.10: Under some trivial circunstances, GIL not released

2021-07-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

PR 27167 hangs or fails. in the refleak buildbots, so I am going to proceed to 
revert

--
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue20201] Argument Clinic: rwbuffer support broken

2021-07-16 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



[issue20201] Argument Clinic: rwbuffer support broken

2021-07-16 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:


New changeset 9af34c935185eca497617a216d141c72ffaeae9c by Batuhan Taskaya in 
branch 'main':
bpo-20201: variadic arguments support for AC (GH-18609)
https://github.com/python/cpython/commit/9af34c935185eca497617a216d141c72ffaeae9c


--
nosy: +BTaskaya

___
Python tracker 

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



[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Ken Jin


Ken Jin  added the comment:

> I am going to backport these changes to 3.10 to make backporting of future 
> fixes easier.
> * Move declarations of _Py_make_parameters and _Py_subs_parameters ...

Unfortunately, _Py_make_parameters and _Py_subs_parameters are 3.11 only. They 
were part of https://github.com/python/cpython/pull/26980. And we couldn't 
backport it to 3.10 (please see the PR thread). Maybe we can ask Pablo to 
reconsider for addition in 3.10rc1 if we can get a core dev to approve that?

> * Perform cheaper tests before more expensive tests in is_unionable().
> * Optimize __module__ look up in is_typing_module().

Yeah I noticed it re-lookups __module__ unnecessarily multiple times for the 
same type. I tried fixing this a month ago (and also convert to interned PyId 
strings) but for some reason microbenchmarks didn't show much gain. Things may 
be different after you clean things up.

> * Extract related tests to separate class.

Yes please :). Maybe even a separate file altogether. GenericAlias has its own 
test_genericalias.

A big +1 on everything else. They were bugging me for a while but I didn't have 
the time to fix them. Thanks for taking this up Serhiy :)!

--

___
Python tracker 

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



[issue44648] Inspect.getsource raises wrong error on classes in interactive session

2021-07-16 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

This is kind of interesting:

 - The unit test was wrong, it was catching the wrong OSError. (I was catching 
regex first but after some tweaking and changes I lost it and forgot to readd)

 - The reason it was passing is exactly what you pointed out -- the __main__.py 
in `unittest` package. After I change the class' module to __main__ in the 
test, it starts looking at sys.modules['__main__'] which is the one in 
unittest, which doesn't have this class, which causes the inspect to throw 
another OSError.

 - I fixed the unit test by both checking for error regex and patching 
sys.modules['__main__'] (and of course restoring it later).

Thanks for helping to catch this :-)

--

___
Python tracker 

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



[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread Łukasz Langa

Change by Łukasz Langa :


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

___
Python tracker 

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



[issue44654] Refactor and clean up the union type implementation

2021-07-16 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

I started reviewing and rewriting Objects/unionobject.c several weeks ago. Some 
discovered bugs were reported and fixed in separate issues: issue44606, 
issue44632, issue44635, issue44636, issue44646, issue44652. Before fixing the 
remaining bugs (issue44633, issue44642, issue44653) I want to merge some minor 
changes:

* Rename _Py_UnionType to _PyUnion_Type. It is how PyTypeObject instances are 
named.
* Add _PyUnion_Check() and _PyGenericAlias_Check(). It simplified the code.
* Do not expose _Py_Union(). It is only used locally.
* Move declarations of _Py_make_parameters and _Py_subs_parameters from 
genericaliasobject.h to internal/pycore_unionobject.h. They are for internal 
use only.
* Fix a possible leak in dedup_and_flatten_args().
* Significantly simplify union_richcompare(). The Python implementation can be 
used for comparing types.Union with typing.Union.
* Perform cheaper tests before more expensive tests in is_unionable().
* Optimize __module__ look up in is_typing_module() and support types without 
__module__.
* Fix outdated comments.
* Minor style fixes.
* Extract related tests to separate class.
* Make some tests more accurate: they should test for TypeError only specific 
operators, not constructors.

I am going to backport these changes to 3.10 to make backporting of future 
fixes easier.

--
components: Interpreter Core
messages: 397635
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Refactor and clean up the union type implementation
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



[issue44648] Inspect.getsource raises wrong error on classes in interactive session

2021-07-16 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

I'm not sure though how is the unit test succeeding since the test module 
should have __file__ set. Looking into it..

--

___
Python tracker 

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



[issue40897] Inheriting from class that defines __new__ causes inspect.signature to always return (*args, **kwargs) for constructor

2021-07-16 Thread Łukasz Langa

Łukasz Langa  added the comment:

On second thought it's a bummer not to fix this in 3.9.x that will still be the 
only stable version until October. I'll refactor the relevant part of 
inspect.py in 3.9 to make the backport applicable.

--

___
Python tracker 

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



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

2021-07-16 Thread Guido van Rossum


Guido van Rossum  added the comment:

I think making NewType into a class isn't a good idea, it would be too slow. 
But I like issue34963 (PR 9951).

So then let's do some variation on (3) -- unionable things would include all 
types (of course), typevars, and things that have a special attribute. We could 
then set that special attribute on the function returned by NewType (like PR 
9951 already does for __name__ and __qualname__).

What to call it? Maybe "__unionable__"?

--

___
Python tracker 

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



  1   2   >