[issue39112] Misleading documentation for tuple

2019-12-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I believe that this is a duplicate issue.  As noted before, filter, map, 
reversed, and zip are classes, but they return iterators and are documented 
differently.

--
nosy: +terry.reedy
versions:  -Python 3.5, Python 3.6

___
Python tracker 

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



[issue39111] Misleading documentation for NotImplemented

2019-12-27 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions:  -Python 3.5, Python 3.6

___
Python tracker 

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



[issue19083] IDNA prefix should be case insensitive

2019-12-27 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.7, Python 3.8, Python 3.9 -Python 3.4

___
Python tracker 

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



[issue19083] IDNA prefix should be case insensitive

2019-12-27 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +17170
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/17726

___
Python tracker 

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



[issue39145] Innocuous parent class changes multiple inheritance MRO

2019-12-27 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Whether this proposed change is worth a PEP is a value judgement, but 
whether it will need a PEP is, I think, a fact. It is a backwards 
incompatible change (it will change the inheritance order of classes) 
potentially breaking people's code. Its not a small change, so it will 
(almost certainly) need a PEP.

The C3 linearisation algoritm has been published in the academic 
literature, where it has been peer-reviewed. It has been in use in 
languages such as Dylan, Python and Perl 6 for at least 16 years. Your 
variant is experimental and untested (unless you can point to languages 
already using it). It won't be easy to convince the core devs to change 
algorithms unless you can point to an actual problem with the status quo 
more serious than "it surprises me".

I don't think the bug tracker is the right place to debate your variant: 
probably not enough eyes on it, and I'm certainly not qualified to pick 
out problems with your design or judge if it is better. If you want to 
take this further, I suggest you try the Python-Ideas or Python-Dev 
mailing lists:

* Python-Ideas is high-volume and plagued by bike-shedding, but is the 
official first step for proposing major changes to the language.

* Python-Dev is lower volume and more likely to catch the eye of senior 
core developers, but they may tell you to take it to Python-Ideas first 
(but not always).

https://www.python.org/community/lists/

If you don't like mailing lists, you could try Discuss:

https://discuss.python.org

Whichever forum you pick, be prepared for serious push-back. The onus 
will be on you to prove that the status quo is not good and your 
alternative solves some real problems. You might want to read these 
first:

https://www.curiousefficiency.org/posts/2011/02/status-quo-wins-stalemate.html

https://www.curiousefficiency.org/posts/2011/04/musings-on-culture-of-python-dev.html

I'm telling you this not to discourage you from taking it further, but 
so that you understand that if you want this change you have to be 
prepared to work for it.

Good luck!

--

___
Python tracker 

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



[issue39145] Innocuous parent class changes multiple inheritance MRO

2019-12-27 Thread Cyker Way


Cyker Way  added the comment:

a typo:

...at this time we know we can extract X in (f1') because X is NOT in any 
tail...

Missed the "NOT" in the previous text.

--

___
Python tracker 

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



[issue39145] Innocuous parent class changes multiple inheritance MRO

2019-12-27 Thread Cyker Way


Cyker Way  added the comment:

Thanks for reply. It's not about the Python's implementation of C3 but C3 
itself being used as the MRO algorithm in Python. It bites when you remove an 
independent interface from your class definition and its method calls become 
something else.

I think I can propose an easy fix to C3. I would just call it C3.9 if it's 
going to be merged in Python 3.9. The difference between C3.9 and C3 is: During 
a merge, put the list of the parents in front of the linearizations of the 
parents, namely:

Instead of: L[C(B1 ... BN)] = C + merge(L[B1], ..., L[BN], B1 ... BN)

We do: L[C(B1 ... BN)] = C + merge(B1 ... BN, L[B1], ... , L[BN])

This preserves the guarantees of C3 (for example, local precedence ordering, 
monotonicity), plus another property: When you remove a leaf node in the 
dependency graph, the MRO of other nodes remain the same. Practically, this 
means when a developer removes an independent interface from his class, he 
knows the MRO of the remaining classes keep the same. Here the independent 
interface can even have its own class hierarchy, and the proof goes by removing 
each leaf one by one in its hierarchy.

For example, using the same mro.py:

E + [BDA BA DC A]
EB + [DA A DC A]
EBD + [A A C A]
EBDA + [C]
EBDAC

E + [BDXA BA DC X A]
EB + [DXA A DC X A]
EBD + [XA A C X A]
EBDX + [A A C A]
EBDXA + [C]
EBDXAC


You can see EBDAC is a sub-sequence of EBDXAC.

The proof is intuitive. I can give a sketch here. Assume without loss of 
generality, class E extends A, B, C, D, and we add a new base class X between B 
and C, now we have:

(f1) E + [ABXCD L(A) L(B) X L(C) L(D)]

Compare this with:

(f0) E + [ABCD L(A) L(B) L(C) L(D)]

We can carry all the computation in f1 just as in f0 until X becomes the head 
of the first list item:

(f1') E... + [XCD ... X ... ]

(f0') E... + [CD ... ... ]


At this time we know we can extract X in (f1') because X is in any tail. After 
we extract X, (f1') becomes (f0') and we can carry all the operations just as 
in (f0'). So the result of (f1) is merely an added X and all other elements 
keep the same order. Intuitively, the performance of C3.9 should be almost the 
same as C3. The only drawback I can think of is existing code may have a 
different MRO, but that happened when Python adopted C3.

Not sure if this is worth a PEP. If anyone is interested feel free to leave a 
message.

--

___
Python tracker 

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



[issue39136] Typos in whatsnew file and docs

2019-12-27 Thread Gurupad Hegde


Gurupad Hegde  added the comment:

Hi, I am a new contributor here. Have created the below pull request.
https://github.com/python/cpython/pull/17720 

Please let me know if i have to do anything else from my end.

--
nosy: +gurupad93

___
Python tracker 

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



[issue38731] bad input crashes py_compile library

2019-12-27 Thread miss-islington


miss-islington  added the comment:


New changeset 04c1efe5acc89b6f3f2c208604a1c35641e8a380 by Miss Islington (bot) 
in branch '3.8':
bpo-38731: Fix function signature of quiet in docs (GH-17719)
https://github.com/python/cpython/commit/04c1efe5acc89b6f3f2c208604a1c35641e8a380


--
nosy: +miss-islington

___
Python tracker 

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



[issue39145] Innocuous parent class changes multiple inheritance MRO

2019-12-27 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Have you read the description of how the MRO is calculated? It's a standard 
algorithm. So long as the result matches the C3 linearisation algorithm, then 
it's not a bug.

https://en.wikipedia.org/wiki/C3_linearization

https://www.python.org/download/releases/2.3/mro/

I've gone back to Python 2.4 and tested the MRO. With and without class X, the 
MRO is:

E B D C X A object
E B D A C object

so the result seems to be consistent back to 2.4 if not older. So it's not a 
change in behaviour in 3.8. It also matches the result of my own implementation 
of the C3 algorithm that I wrote some time ago to check my understanding of it.

So it looks to me that this is the correct behaviour, going back to 2.3, so I'm 
closing it as "Not a bug". If you disagree, and can find a bug in Python's C3 
linearisation algorithm, please feel free to reopen. If you disagree with the 
choice of the C3 algorithm, and want to suggest some other algorithm, you'll 
need to write a PEP setting forth the pros and cons of both, explaining why the 
alternative is better than the status quo.

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



[issue38731] bad input crashes py_compile library

2019-12-27 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:


New changeset 98f0f04b5016e63561d313a3446b7b58f2c12611 by Pablo Galindo 
(Batuhan Taşkaya) in branch 'master':
bpo-38731: Fix function signature of quiet in docs (GH-17719)
https://github.com/python/cpython/commit/98f0f04b5016e63561d313a3446b7b58f2c12611


--
nosy: +pablogsal

___
Python tracker 

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



[issue38731] bad input crashes py_compile library

2019-12-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17169
pull_request: https://github.com/python/cpython/pull/17725

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread miss-islington


miss-islington  added the comment:


New changeset d7aa3d26845be77ebca1b3954830aace6ef31e58 by Miss Islington (bot) 
in branch '3.7':
bpo-39144 Align ctags and etags behaviours in the makefile and include Python 
stdlib files (GH-17721)
https://github.com/python/cpython/commit/d7aa3d26845be77ebca1b3954830aace6ef31e58


--

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread miss-islington


miss-islington  added the comment:


New changeset 2786fdec79c35b4a68afea2bbbedbba3b6eb2269 by Miss Islington (bot) 
in branch '3.8':
bpo-39144 Align ctags and etags behaviours in the makefile and include Python 
stdlib files (GH-17721)
https://github.com/python/cpython/commit/2786fdec79c35b4a68afea2bbbedbba3b6eb2269


--
nosy: +miss-islington

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17168
pull_request: https://github.com/python/cpython/pull/17723

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17167
pull_request: https://github.com/python/cpython/pull/17722

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset ef7eaafc9d2e370cf79b3674e56f643bbfe239e2 by Pablo Galindo 
(Anthony Shaw) in branch 'master':
bpo-39144 Align ctags and etags behaviours in the makefile and include Python 
stdlib files (GH-17721)
https://github.com/python/cpython/commit/ef7eaafc9d2e370cf79b3674e56f643bbfe239e2


--
nosy: +pablogsal

___
Python tracker 

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



[issue39145] Innocuous parent class changes multiple inheritance MRO

2019-12-27 Thread Cyker Way


New submission from Cyker Way :

With an inheritance graph like this:

A   C
B   D  (X)  A
E

Adding or removing class X in E's parents will change the order of A and C in 
E's MRO: EBDAC vs EBDCXA.

I couldn't imagine what would be the "perfect" MRO. However, given X is 
completely independent from A and C, this behavior looks strange and 
problematic.

--
components: Interpreter Core
files: mro.py
messages: 358921
nosy: cykerway
priority: normal
severity: normal
status: open
title: Innocuous parent class changes multiple inheritance MRO
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file48804/mro.py

___
Python tracker 

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



[issue39090] Document various options for getting the absolute path from pathlib.Path objects

2019-12-27 Thread Josh Holland


Change by Josh Holland :


--
nosy: +anowlcalledjosh

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2019-12-27 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. Can you please attach a sample script with the handler 
used to illustrate the issue?

--
nosy: +vinay.sajip, xtreak

___
Python tracker 

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



[issue37542] UDP sendto() sends duplicate packets

2019-12-27 Thread Alex Grönholm

Alex Grönholm  added the comment:

Can you reproduce this on localhost, or over Ethernet while only listening on 
that specific interface? If not, then likely this is just a Wireshark artifact.

Failing that, you should construct a script that allows others to try to 
reproduce the effect.

--
nosy: +alex.gronholm

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread anthony shaw


Change by anthony shaw :


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

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread anthony shaw


anthony shaw  added the comment:

Also, make tags will reset the "tags" file, whereas, make TAGS will not.
If you ran "make tags" then "make TAGS" you will have a corrupt etags file

--

___
Python tracker 

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



[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread anthony shaw


New submission from anthony shaw :

make tags will include

- Modules/_ctypes/

where as make TAGS will not.

Also, neither include the Python source files for the standard library, which 
both etags and ctags are capable of handling.

PR to follow

--
components: Build
messages: 358917
nosy: anthony shaw
priority: normal
severity: normal
status: open
title: Align ctags and etags targets and include Python stdlib
type: enhancement

___
Python tracker 

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



[issue38731] bad input crashes py_compile library

2019-12-27 Thread Batuhan


Change by Batuhan :


--
pull_requests:  -17163

___
Python tracker 

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



[issue22640] Add silent mode for py_compile

2019-12-27 Thread Batuhan


Change by Batuhan :


--
pull_requests: +17165
pull_request: https://github.com/python/cpython/pull/17719

___
Python tracker 

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



[issue39136] Typos in whatsnew file and docs

2019-12-27 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue38731] bad input crashes py_compile library

2019-12-27 Thread Batuhan


Change by Batuhan :


--
pull_requests: +17163
pull_request: https://github.com/python/cpython/pull/17719

___
Python tracker 

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



[issue39143] Implementing sub-generation steps in the gc

2019-12-27 Thread Pablo Galindo Salgado

New submission from Pablo Galindo Salgado :

While I was re-reading The Garbage Collection Handbook [Moss, Hosking, Jones], 
I have been doing some benchmarks of different aspects of our garbage 
collection and taking statistics using the pyperformance suite as long as 
several "production" applications that heavily creates objects. I have observed 
that our
collector presents a form of "generational nepotism" in some typical scenarios. 
The most common reason is
that when promotions of the youngest generations happen, some very young 
objects that just arrived in the generation are promoted because we have 
reached a threshold, and its death will be delayed. These objects
will likely die immediately if the promotion was delayed a bit (think of a 
burst of temporary objects being created at once) or if the promotion could 
distinguish "age" with more granularity. 

The book proposes serval solutions to this problem, and one of the simpler ones 
taking the
architecture of our collector is to use sub-generation steps: 

> Promotion can be delayed by structuring a generation into two or more aging 
> spaces. This
allows objects to be copied between the fromspace and tospace an arbitrary 
number of
times within the generation before they are promoted. In Lieberman and Hewitt's 
original
generational collector [1983], a generation is collected several times before 
all survivors
are eventually promoted en masse. In terms of the aging semispaces of Figure 
9.2b, ei­
ther all live objects in fromspace are evacuated to tospace within this 
generation or all
are promoted to the next generation, depending on the age of the generation as 
a whole.

Basically, the differences between steps and generations are that both 
segregate objects by age,
but different generations are collected at different frequencies whereas all 
the steps of a
generation are collected at the same time. By using steps in the youngest 
generation (where
most mutation occurs), and by reducing premature col­lection, the load on the 
write barrier
can be reduced while also controlling promotion, without need for per-object 
age records.

--

What do you think about implementing sub-generation steps? Maybe only on the 
youngest generation?

A "lazy" way of implementing this (although without the semantic of "steps") is 
adding more intermediate generations with the same threshold (but this likely 
won't yield the same benefits).

--
components: Interpreter Core
messages: 358916
nosy: nascheme, pablogsal, tim.peters
priority: normal
severity: normal
status: open
title: Implementing sub-generation steps in the gc
type: enhancement
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



[issue33944] Deprecate and remove pth files

2019-12-27 Thread Ionel Cristian Mărieș

Ionel Cristian Mărieș  added the comment:

No. You can't put an usercustomize in a wheel.

--

___
Python tracker 

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



[issue39117] Performance regression for making bound methods

2019-12-27 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



[issue39142] logging.config.dictConfig will convert namedtuple to ConvertingTuple

2019-12-27 Thread Henrique


New submission from Henrique :

While passing

{
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"verbose": {"format": "%(levelname)s %(asctime)s %(module)s 
%(message)s"}
},
"handlers": {
"stackdriver": {
"class": "google.cloud.logging.handlers.CloudLoggingHandler",
"client": client,
"resource": resource,
},
},
"root": {"level": "INFO", "handlers": ["stackdriver"]},
}

to logging.config.dictConfig it will convert resource, which is a namedtuple to 
ConvertingTuple, this will make 
google.cloud.logging.handlers.CloudLoggingHandler break down the line.

I am having to create a wrapper class like 

class Bla:
resource = logging.resource.Resource(
type="cloud_run_revision",
labels={},
)

def _to_dict(self):
return self.resource._to_dict()

to go around this

--
messages: 358914
nosy: hcoura
priority: normal
severity: normal
status: open
title: logging.config.dictConfig will convert namedtuple to ConvertingTuple
type: crash
versions: Python 3.7

___
Python tracker 

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



[issue39082] AsyncMock is unable to correctly patch static or class methods

2019-12-27 Thread Aniket Panse


Change by Aniket Panse :


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

___
Python tracker 

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



[issue39075] types.SimpleNamespace should preserve attribute ordering (?)

2019-12-27 Thread Eric Snow


Eric Snow  added the comment:

> IMHO, dropping the sort should be a default behavior. If some user need
> this feature, maybe we could supply a param to open the sort function or not?

Consider opening a separate issue (or start a thread on python-ideas)
about adding a more sophisticated implementation to the stdlib's
"reprlib" module.  If you do so then please draw from the
argparse._AttributeHolder implementation.

--

___
Python tracker 

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



[issue39076] Use types.SimpleNamespace for argparse.Namespace

2019-12-27 Thread Eric Snow


Eric Snow  added the comment:

Anyway, this probably isn't a discussion worth extending much further.  I don't 
think it's important enough. :)  So if you have reservations about this then 
feel free to close the issue.

--

___
Python tracker 

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



[issue39076] Use types.SimpleNamespace for argparse.Namespace

2019-12-27 Thread Eric Snow


Eric Snow  added the comment:

Sorry if there was any confusion.  I didn't mean to suggest we get rid
of argparse.Namespace (in favor of SimpleNamespace).  Rather, the
former would subclass the latter.

> * types.SimpleNamespace() sorts attributes, so this would get in the way of 
> issue #39058.

hence issue 39075

> * argparse.Namespace() supports a __contains__() method that isn't offered by 
> types.SimpleNamespace():

As I suggested originally, there isn't any problem here if
argparse.Namespace subclasses SimpleNamespace.

> * Argparse is sensitive to start-up time so we mostly want to avoid adding 
> new dependencies.

I agree on avoiding extra imports.  The simple solution right now is
to use "type(sys.implementation)", though that isn't the clearest
code.

FWIW, this would also be solved if we added SimpleNamespace to the
builtins, but that is a separate discussion. :)

> * The __repr__ for SimpleNamespace() doesn't round-trip and isn't what we 
> have now with Namespace.

We could certainly fix the repr, but that's kind of irrelevant here if
argparse.Namespace is a subclass.

FWIW, this is also resolved if we add SimpleNamespace to the builtins
(as "namespace").

> * Ironically, the class name "Namespace" is simpler than "SimpleNamespace" ;-)

Agreed. :)  We only used that long name because putting it in the
"types" module mean it needed to have an extra clear name.

That said, it is irrelevant here if argparse.Namespace is a subclass

> * Much of the code in argparse.Namespace() inherits from _AttributeHolder, so 
> switching to types.SimpleNamespace() doesn't really save us much code.

Honestly, _AttributeHolder isn't needed.  The only thing it provides
is a nice repr (like SimpleNamespace does), with some extra
functionality for dynamically sorting/filtering down the attrs shown
in the repr.   There are 3 subclasses and Namespace doesn't even use
the attr filtering.  The implementation doesn't seem to warrant a
dedicated base class and it would be simpler for those 2 subclasses to
each to have a dedicated __repr__ implementation (and for Namespace to
subclass SimpleNamespce), rather than to subclass _AttributeHolder.
Subclassing from _AttributeHolder gives the illusion that there is
something more going on there than there actually is.

Aside from that, there's the weaker argument about consistency and
avoiding duplication (i.e. SimpleNamespace is the canonical "simple"
namespace implementation in Python).  Also, if SimpleNamespace had
existed when argparse was written then I expect it would have been
used instead.

> Are there any upsides to switching?  Attribute lookup is almost equally fast 
> using either approach, so there is no speed benefit:

Yeah, I didn't expect there to much difference in performance.

--

___
Python tracker 

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



[issue35143] `from __future__ import annotations` has no effect inside `ast.parse`

2019-12-27 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I don't think this is a bug. Technically the 'from __future__ import 
annotations' is a compiler option, not an AST one. Also, the flag says that 
"annotations become strings at runtime" and at the point, we have an AST is not 
still runtime. The CO_FUTURE_ANNOTATIONS only takes place in the compiler that 
reverses the AST object into a string. If we make the AST aware of 
CO_FUTURE_ANNOTATIONS, then what the compiler will see in the presence of  
'from __future__ import annotations' would be different if you compile a module 
than if you parse it using ast.parse() and then compile the result (in the 
second case the compiler will see strings in the annotations, not AST nodes 
while in the first case it will see nodes). Additionally, doing this will limit 
tools that want to analyze the contents of those annotations before they get 
turned into strings (like type checker, linters...etc).

--
nosy: +pablogsal

___
Python tracker 

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



[issue39141] IDLE Clear function returns 256 on Mac OS Catalina

2019-12-27 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue26219] implement per-opcode cache in ceval

2019-12-27 Thread Eric Snow


Change by Eric Snow :


--
nosy: +eric.snow

___
Python tracker 

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



[issue38671] pathlib.Path.resolve(strict=False) returns relative path on Windows if the entry does not exist

2019-12-27 Thread Tzu-ping Chung


Change by Tzu-ping Chung :


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

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-12-27 Thread Michel Desmoulin


Michel Desmoulin  added the comment:

Can usercustomize.py be used as an alternative to "*.pth" execution magic ?

--
nosy: +Michel Desmoulin

___
Python tracker 

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



[issue39141] IDLE Clear function returns 256 on Mac OS Catalina

2019-12-27 Thread David Turner


New submission from David Turner :

Trying to set up shortcut function to clear screen but its not working as 
expected on my Mac OS Catalina -- below is txt from idle



import os
>>> cls= lambda: os.system('clear')
>>> cls()
256

--
messages: 358908
nosy: twiste...@gmail.com
priority: normal
severity: normal
status: open
title: IDLE Clear function returns 256 on Mac OS Catalina
type: behavior
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



[issue35143] `from __future__ import annotations` has no effect inside `ast.parse`

2019-12-27 Thread Batuhan


Batuhan  added the comment:

> Having a real "ast.unparse" would be better however. It seems that the 
> building blocks are all there, just not in that form.

Now we have that :) 
https://docs.python.org/3.9/whatsnew/3.9.html#improved-modules

--

___
Python tracker 

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



[issue39032] wait_for and Condition.wait still not playing nicely

2019-12-27 Thread Antonin Rousset


Change by Antonin Rousset :


--
nosy: +Antonin Rousset

___
Python tracker 

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



[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2019-12-27 Thread Guido van Rossum

Guido van Rossum  added the comment:

Thanks. Can you be specific about “modern libraries”? Please clarify your use 
cases.

--

___
Python tracker 

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



[issue38131] compile(mode='eval') uninformative error message

2019-12-27 Thread Batuhan


Change by Batuhan :


--
components: +Interpreter Core -Library (Lib)
nosy: +BTaskaya
versions: +Python 3.9 -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



[issue38131] compile(mode='eval') uninformative error message

2019-12-27 Thread Batuhan


Batuhan  added the comment:

with PR 17715 

>>> import ast
>>> expr_without_lineno_but_ok = 
>>> ast.Expression(body=ast.BinOp(left=ast.Num(n=2), right=ast.Num(n=2), 
>>> op=ast.Add()))
>>> expr_with_lineno_but_with_wrong_body = 
>>> ast.Expression(body=[ast.BinOp(left=ast.Num(n=2), right=ast.Num(n=2), 
>>> op=ast.Add())])
>>> ast.fix_missing_locations(expr_with_lineno_but_with_wrong_body)
>>> compile(expr_without_lineno_but_ok, "", "eval")
Traceback (most recent call last):
  File "", line 1, in 
TypeError: required field "lineno" missing from expr
>>> compile(expr_with_lineno_but_with_wrong_body, "", "eval")
Traceback (most recent call last):
  File "", line 1, in 
TypeError: expected some sort of expr, but got [<_ast.BinOp object at 
0x7f3f57dc4c80>]

--

___
Python tracker 

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



[issue38131] compile(mode='eval') uninformative error message

2019-12-27 Thread Batuhan


Change by Batuhan :


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

___
Python tracker 

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



[issue33165] Add stacklevel parameter to logging APIs

2019-12-27 Thread Evandro Coan


Change by Evandro Coan :


--
pull_requests: +17159
pull_request: https://github.com/python/cpython/pull/17714

___
Python tracker 

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



[issue39134] can't construct dataclass as ABC (or runtime check as data protocol)

2019-12-27 Thread Alexander Hirner


Alexander Hirner  added the comment:

Pardon my sloppiness. 

1. That should have been PEP 544. The last point referred to the notion of data 
protocols [0].

2. I think solving this issue for dataclasses would ensure better composition 
with modern libraries and other idioms like Protocol and ABC.


[0] 
https://www.python.org/dev/peps/pep-0544/#runtime-checkable-decorator-and-narrowing-types-by-isinstance

--

___
Python tracker 

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