[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-18 Thread Ma Lin


Ma Lin  added the comment:

> In my case, pgo got stuck on linking with the object.h.

Me too. Since commit 28d28e0 (the first commit to slow down the PGO build), if 
add `__forceinline` attribute to _Py_DECREF() function in object.h, the PGO 
build hangs (>50 minutes).

So PR 28427 may not be a short-term solution.

--

___
Python tracker 

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



Re: How to support annotations for a custom type in a C extension?

2021-09-18 Thread MRAB

On 2021-09-18 16:10, Serhiy Storchaka wrote:

18.09.21 09:40, Marco Sulla пише:

Ooook. I have a question. Why is this code not present in
dictobject.c? Where are the dict annotations implemented?


In dictobject.c.


I just had a look at dictobject.c. It too has a cast to PyCFunction.
--
https://mail.python.org/mailman/listinfo/python-list


Re: How to support annotations for a custom type in a C extension?

2021-09-18 Thread MRAB

On 2021-09-18 16:09, Serhiy Storchaka wrote:

18.09.21 03:54, MRAB пише:

static PyMethodDef customdict_methods[] = {
...
    {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_CLASS |
METH_O | METH_COEXIST, PyDoc_STR("See PEP 585")},
...
};


Note the flags: METH_CLASS says that it's a class method and
METH_COEXIST says that it should use this method instead of the slot.


"(PyCFunction)" is redundant, Py_GenericAlias already has the right
type. Overuse of casting to PyCFunction can hide actual bugs.


I borrowed that from listobject.c, which does have the cast.


METH_COEXIST is not needed. There is no slot for __class_getitem__, and
even if it was, there would be no reasons to prohibit using it.


--
https://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-18 Thread Chris Angelico
On Sun, Sep 19, 2021 at 11:46 AM Mostowski Collapse  wrote:
>
> Yeah, it seems weak references could indeed spare
> me mark_term(). But then I am stil left with sweep_trail().
> I did not yet measure what takes more time mark_term()
> or sweep_trail(). The displayed "gc" is the sum of both.
>
> From what I have seen, very large trail practically reduced
> to a zero trail during Prolog GC, I am assuming that
> mark_term() is not the working horse. Usually mark_term()
> only marks what is not-Garbage, and sweep_trail()
>
> has to deal with Garbage and not-Garbage. And there
> is usually a lot of Garbage, much more than not-Garbage.
> Finding the objects that survive, is like finding the needle
> in the haystack, except we do not have to scan the

If you stop referring to something, it is garbage. Python will dispose of it.

You literally need to do nothing at all, and let the language take
care of things.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to support annotations for a custom type in a C extension?

2021-09-18 Thread Serhiy Storchaka
18.09.21 09:40, Marco Sulla пише:
> Ooook. I have a question. Why is this code not present in
> dictobject.c? Where are the dict annotations implemented?

In dictobject.c.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to support annotations for a custom type in a C extension?

2021-09-18 Thread Serhiy Storchaka
18.09.21 03:54, MRAB пише:
> static PyMethodDef customdict_methods[] = {
> ...
>     {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_CLASS |
> METH_O | METH_COEXIST, PyDoc_STR("See PEP 585")},
> ...
> };
> 
> 
> Note the flags: METH_CLASS says that it's a class method and
> METH_COEXIST says that it should use this method instead of the slot.

"(PyCFunction)" is redundant, Py_GenericAlias already has the right
type. Overuse of casting to PyCFunction can hide actual bugs.

METH_COEXIST is not needed. There is no slot for __class_getitem__, and
even if it was, there would be no reasons to prohibit using it.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to "cast" an object to a derived class?

2021-09-18 Thread Robert Latest via Python-list
Stefan Ram wrote:
> Robert Latest  writes: But how can I "promote" a
>>given Opaque instance to the derived class?
>
>   Sometimes, one can use containment instead of inheritance.

Nah, doesn't work in my case. I'm trying to write a wrapper around
xml.etree.ElemenTree and .Element  to circumvent its idiotic namespace
handling. For that I need inheritance since I want to override the find..()
functions to return my derived MyElement classes. I think it could work but I
somehow need to convert the root Element to a MyElement.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-18 Thread Greg Ewing

On 16/09/21 6:13 am, Mostowski Collapse wrote:

So in Python I now do the following:

peek = kb.get(functor, NotImplemented)
if peek is not NotImplemented:


If you're able to use None instead of NotImplemented, you
could simplify that to

peek = kb.get(functor)
if peek:
...


But if get() in Python is implemented under the hood with
exception handling. ... then Python get() will probably be quite slow.


No, it doesn't use exceptions as far as I know. It should
be fairly fast.

--
Greg

--
https://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-18 Thread Mostowski Collapse
Yeah, it seems weak references could indeed spare
me mark_term(). But then I am stil left with sweep_trail().
I did not yet measure what takes more time mark_term()
or sweep_trail(). The displayed "gc" is the sum of both.

>From what I have seen, very large trail practically reduced
to a zero trail during Prolog GC, I am assuming that 
mark_term() is not the working horse. Usually mark_term()
only marks what is not-Garbage, and sweep_trail()

has to deal with Garbage and not-Garbage. And there
is usually a lot of Garbage, much more than not-Garbage.
Finding the objects that survive, is like finding the needle
in the haystack, except we do not have to scan the 

haystack, the needles are on the goal list. But afterwards,
the second pass, scanning the trail is the work of Heracles
cleaning the Augeas stables. This scan is trowing away the 
hay and keeping the needles.

Greg Ewing schrieb am Samstag, 18. September 2021 um 05:49:37 UTC+2:
> On 17/09/21 7:56 am, Mostowski Collapse wrote: 
> > The trail in Dogelog 
> > Runtime is a single linked list: 
> > 
> > -->[ A ]-->[ B ]-->[ C ]--> 
> > 
> > Now if B becomes unused, you need to rewire 
> > the trail, it should then look like: 
> > 
> > -->[ A ]-->[ C ]-->
> Python has a way of creating weak references (see the weakref 
> module). You could set the trail up like this: 
> 
> -->[*]-->[*]-->[*]--> 
> | | | 
> v v v 
> [w] [w] [w] 
> : : : 
> v v v 
> [A] [B] [C] 
> 
> where [w] is a weak reference object. Then you could periodically 
> scan the trail looking for dead weakref objects and remove the 
> corresponding [*] node from the list. 
> 
> You can also attach callbacks to weakref objects that are triggered 
> when the referenced object dies. You might be able to make use of 
> that to remove items from the trail instead of the periodic scanning. 
> 
> -- 
> Greg
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-18 Thread Greg Ewing

On 17/09/21 8:41 pm, Mostowski Collapse wrote:

Are exceptions
blocks in Python cheap or expensive? Are they like
in Java, some code annotation, or like in Go
programming language pushing some panic handler?


They're not free, but they're not hugely expensive either.
Don't be afraid to use them when it makes sense to do so.

I'm not sure what you mean by "some code annotations",
so I don't know how to answer that question. I suspect
that the way exceptions are implemented in the JVM is
similar to the way CPython does it, but I don't know
a lot about the JVM.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-18 Thread Greg Ewing

On 17/09/21 7:56 am, Mostowski Collapse wrote:

The trail in Dogelog
Runtime is a single linked list:

     -->[ A ]-->[ B ]-->[ C ]-->

Now if B becomes unused, you need to rewire
the trail, it should then look like:

     -->[ A ]-->[ C ]-->


Python has a way of creating weak references (see the weakref
module). You could set the trail up like this:

-->[*]-->[*]-->[*]-->
| | |
v v v
   [w]   [w]   [w]
: : :
v v v
   [A]   [B]   [C]

where [w] is a weak reference object. Then you could periodically
scan the trail looking for dead weakref objects and remove the
corresponding [*] node from the list.

You can also attach callbacks to weakref objects that are triggered
when the referenced object dies. You might be able to make use of
that to remove items from the trail instead of the periodic scanning.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


Re: Question again

2021-09-18 Thread Michael F. Stemper

On 16/09/2021 19.11, Alan Gauld wrote:

On 16/09/2021 06:50, af kh wrote:

Hello,
I was doing some coding on a website called replit


I have no idea what that is but...


after answering 'no' or 'yes' after the last sentence I wrote,
the Python window shut off,


That's what you told it to do in the code.
Regardless of which answer the user gives the program
reaches the end and stops.


  in replit I added one more sentence, but it isn't shown on Python,


I dn;t know what this means.


#Gives greetings to the user
import random

...

#Ask to pick between numbers 1~10 to see if you will get lucky today: Third 
question
number = input("Please pick between numbers 1~10 to see your luck for today: ")

#From number 1~3 and an answer
if number == "1" or number == "2" or number == "3" :
   print("You're in grat luck today!")

#From number 4~7 and an answer
elif number == "4" or number == "5" or number == "6" :
   print("damn, bad luck is coming your way")


The cde and comment are not consistent.


#From number 8~10 and an answer
elif number == "7" or number == "8" or number == "9" or number == "10" :
   print("I cannot sense any luck today, try again next time")


Same here.


This is, of course, why comments shouldn't just translate the code
into English. They'll get out of synch. Instead, comments should say
*why* the code is doing what it does.

--
Michael F. Stemper
Exodus 22:21
--
https://mail.python.org/mailman/listinfo/python-list


How to "cast" an object to a derived class?

2021-09-18 Thread Robert Latest via Python-list
Hi all, let's assume I'm using a module that defines some class "Opaque" and
also a function that creates objects of that type. In my program I subclass
that type because I want some extra functionality. But how can I "promote" a
given Opaque instance to the derived class? Of course I could just create an
instance of the derived type and copy all attributes from the original object
to the new one, but that either breaks when the opaque.py module changes, or it
requires introspection. It's easily done of course but seems overly clumsy. Is
there a more Pythonic way?

# this is the module opaque.py
class Opaque(): def __init__(self, x): assert isinstance(x, int) self.n = x

def make_opaque(): return Opaque(0)

# this is my program
import opaque class MyClass(opaque.Opaque):
# generic __init__ b/c I don't want to have to know anything about that
# class
def __init__(self, *a, **k): super().__init__(*a, *k) self.__something = 0

def get_something(self): return self.something

op = opaque.make_opaque()

# But I want to have this as type MyClass. This obviously doesn't work:
my_object = MyClass(op)
# But what does?
-- 
https://mail.python.org/mailman/listinfo/python-list


¡¡¡uoɥʇʎꓒ uᴉ ʇxǝʇ uʍoꓷ ǝpᴉsdꓵ ǝʇɐǝɹↃ oʇ ʍoΗ

2021-09-18 Thread Python 4 Fun
How to Create Upside Down text in Python!!!

This is a very simple yet very interesting program in python. 

We are going to make our text, word or string UPSIDE DOWN which will be still 
readable on phone or desktop if you stand on your head lol.

But any ways... lets do a little research first.

I am going to collect upside down texts using google as it cannot be written by 
yourself and if you do it would be time consuming.

To make this quick here are some text that I have found from following sources:

Read more...

 
https://pysnakeblog.blogspot.com/2021/09/create-upside-down-text-for-instagram.html
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue45240] Add +REPORT_NDIFF option to pdb tests that use doctest

2021-09-18 Thread Andrei Kulakov


Change by Andrei Kulakov :


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

___
Python tracker 

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



[issue45240] Add +REPORT_NDIFF option to pdb tests that use doctest

2021-09-18 Thread Andrei Kulakov


New submission from Andrei Kulakov :

It would be useful to have +REPORT_NDIFF option applied to pdb doctests because 
it makes it much more convenient to add / modify pdb tests, to fix pdb bugs, 
add pdb features.

I've worked on two pdb issues in the last few months and I wasn't aware of 
+REPORT_NDIFF, and so I was just looking at the output of failing tests (which 
are very long for some pdb tests), and comparing them manually.

This option, when enabled, automatically provides diff with in-line highlighted 
difference for a failed doctest. Otherwise two chunks of text are provided, 
'EXPECTED' and 'GOT ...'.

--
assignee: andrei.avk
components: Tests
messages: 402142
nosy: andrei.avk, kj
priority: normal
severity: normal
status: open
title: Add +REPORT_NDIFF option to pdb tests that use doctest
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue45234] copy_file raises FileNotFoundError when src is a directory

2021-09-18 Thread Eryk Sun


Change by Eryk Sun :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue45239] email.utils.parsedate_tz raises UnboundLocalError if time has more than 2 dots in it

2021-09-18 Thread Ben Hoyt


Change by Ben Hoyt :


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

___
Python tracker 

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



[issue45239] email.utils.parsedate_tz raises UnboundLocalError if time has more than 2 dots in it

2021-09-18 Thread Ben Hoyt


Ben Hoyt  added the comment:

For reference, here's a repro case:

$ python3.10 -c 'import email.utils; \
email.utils.parsedate_tz("Wed, 3 Apr 2002 12.34.56.78+0800")'
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python3.10/email/_parseaddr.py", line 50, in parsedate_tz
res = _parsedate_tz(data)
  File "/usr/local/lib/python3.10/email/_parseaddr.py", line 134, in 
_parsedate_tz
thh = int(thh)
UnboundLocalError: local variable 'thh' referenced before assignment

--

___
Python tracker 

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



[issue45239] email.utils.parsedate_tz raises UnboundLocalError if time has more than 2 dots in it

2021-09-18 Thread Ben Hoyt


New submission from Ben Hoyt :

In going through some standard library code, I found that the 
email.utils.parsedate_tz() function 
(https://docs.python.org/3/library/email.utils.html#email.utils.parsedate_tz) 
has a bug if the time value is in dotted format and has more than 2 dots in it, 
for example: "12.34.56.78". Per the docs, it should return None in the case of 
invalid input.

This is happening because in the case that handles the '.' separator (instead 
of the normal ':'), there's no else clause to return None when there's not 2 or 
3 segments.

>From 
>https://github.com/python/cpython/blob/dea59cf88adf5d20812edda330e085a4695baba4/Lib/email/_parseaddr.py#L118-L132:

if len(tm) == 2:
[thh, tmm] = tm
tss = '0'
elif len(tm) == 3:
[thh, tmm, tss] = tm
elif len(tm) == 1 and '.' in tm[0]:
# Some non-compliant MUAs use '.' to separate time elements.
tm = tm[0].split('.')
if len(tm) == 2:
[thh, tmm] = tm
tss = 0
elif len(tm) == 3:
[thh, tmm, tss] = tm
# HERE: need "else: return None"
else:
return None

We simply need to include that additional "else: return None" block in the '.' 
handling case.

I'll submit a pull request that fixes this soon (and adds a test for this case).

--
components: Library (Lib)
messages: 402140
nosy: barry, benhoyt
priority: normal
severity: normal
status: open
title: email.utils.parsedate_tz raises UnboundLocalError if time has more than 
2 dots in it
versions: Python 3.10

___
Python tracker 

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



[issue24165] Free list for single-digits ints

2021-09-18 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue45026] More compact range iterator

2021-09-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Iterating large integers:

$ ./python -m pyperf timeit -s 'r = range(0, 10**20, 3**35)' 'for i in r: pass'

baseline: Mean +- std dev: 223 us +- 10 us
PR 27986: Mean +- std dev: 128 us +- 4 us
PR 28176: Mean +- std dev: 99.0 us +- 3.7 us

$ ./python -m pyperf timeit -s 'r = range(0, 10**20, 3**35)' 'list(r)'
baseline: Mean +- std dev: 191 us +- 13 us
PR 27986: Mean +- std dev: 107 us +- 7 us
PR 28176: Mean +- std dev: 91.3 us +- 2.4 us

Unpickling:

$ ./python -m pyperf timeit -s 'from pickle import dumps, loads; p = 
dumps([iter(range(i)) for i in range(1000)])' 'loads(p)'
baseline: Mean +- std dev: 535 us +- 29 us
PR 27986: Mean +- std dev: 420 us +- 15 us
PR 28176: Mean +- std dev: 418 us +- 17 us

$ ./python -m pyperf timeit -s 'from pickle import dumps, loads; p = 
dumps([iter(range(i*10**10)) for i in range(1000)])' 'loads(p)'
baseline: Mean +- std dev: 652 us +- 37 us
PR 27986: Mean +- std dev: 530 us +- 43 us
PR 28176: Mean +- std dev: 523 us +- 17 us

Seems PR 28176 is slightly faster than PR 27986 in iterating long integers.

--

___
Python tracker 

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



[issue24138] Speed up range() by caching and modifying long objects

2021-09-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

(Never mind, that should have gone to https://bugs.python.org/issue24165, which 
is the integer freelist -- conclusion there in 2015 was also that it didn't do 
much.)

--

___
Python tracker 

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



[issue24138] Speed up range() by caching and modifying long objects

2021-09-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

Should we try the free list for integers again?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue24076] sum() several times slower on Python 3 64-bit

2021-09-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

@Stefan
> FWIW, a PGO build of Py3.7 is now about 20% *faster* here than my Ubuntu 
> 16/04 system Python 2.7

Does that mean we can close this issue? Or do I misunderstand what you are 
comparing? 32 vs. 64 bits? PGO vs. non-PGO?

OTOH on my Mac I still find that 3.10 with PGO is still more than twice as slow 
than 2.7.

Thinking about it that's a bit odd, since (presumably) the majority of the work 
in sum() involves a long int result (even though the values returned by range() 
all fit in 30 bits, the sum quickly exceeds that).

(earlier)
> I suspect that adding a free-list for single-digit PyLong objects (the most 
> common case) would provide some visible benefit.

If my theory is correct that wouldn't help this particular case, right?

FWIW just "for i in [x]range(15, 10**9, 15): pass" is about the same speed in 
Python 2.7 as in 3.11.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue45116] Performance regression 3.10b1 and later on Windows: Py_DECREF() not inlined in PGO build

2021-09-18 Thread Ken Jin


Ken Jin  added the comment:

@Pablo,
> If  is correct ...

For some verification, I benched pyperformance on Win10 AMD64, with the Python 
3.10a7 and 3.10rc2 x64 binaries downloaded directly from python.org website 
release pages. The results corroborate with neonene's (please see the attached 
file). In short, there was a 1.09x slowdown on average.

FYI, `pyperf system tune` doesn't work on Windows. So I manually disabled turbo 
boost and intel speedstep, but I didn't have time to research setting core 
affinity and the other stabilizations. Nonetheless, most of the benches were 
stable.

> I am marking this as a release blocker until there is some agreement.
Got it. Setting as advised.

--
priority: high -> release blocker
Added file: https://bugs.python.org/file50286/310a7_vs_310rc2_bench.txt

___
Python tracker 

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



[issue45134] Protocol dealloc not called if Server is closed

2021-09-18 Thread Mark


Change by Mark :


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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread Dieter Maurer


Dieter Maurer  added the comment:

Thank you for working on this issue!

--

___
Python tracker 

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



[issue45216] Remove redundant information from difflib docstrings

2021-09-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
title: Remove redundand information from difflib docstrings -> Remove redundant 
information from difflib docstrings

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See issue45238 for debug() in IsolatedAsyncioTestCase.

--

___
Python tracker 

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



[issue45238] Fix debug() in IsolatedAsyncioTestCase

2021-09-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue45238] Fix debug() in IsolatedAsyncioTestCase

2021-09-18 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Currently debug() does not work in IsolatedAsyncioTestCase subclasses. It runs 
synchronous code (setUp(), tearDown(), synchronous tests and cleanup 
functions), but does not run any asynchronous code (asyncSetUp(), 
asyncTearDown(), asynchronous tests and cleanup functions) and produces 
warnings "RuntimeWarning: coroutine 'xxx' was never awaited".

--
components: Library (Lib), asyncio
messages: 402132
nosy: asvetlov, ezio.melotti, michael.foord, rbcollins, serhiy.storchaka, 
yselivanov
priority: normal
severity: normal
status: open
title: Fix debug() in IsolatedAsyncioTestCase
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread miss-islington


miss-islington  added the comment:


New changeset 753f7af22e78456726496fd5d8bf38e7e6567e4e by Miss Islington (bot) 
in branch '3.10':
bpo-36674: Honour the skipping decorators in TestCase.debug() (GH-28446)
https://github.com/python/cpython/commit/753f7af22e78456726496fd5d8bf38e7e6567e4e


--

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread miss-islington


miss-islington  added the comment:


New changeset 7e465a6b8273dc0b6cb484c65664f618afa22484 by Miss Islington (bot) 
in branch '3.9':
bpo-36674: Honour the skipping decorators in TestCase.debug() (GH-28446)
https://github.com/python/cpython/commit/7e465a6b8273dc0b6cb484c65664f618afa22484


--

___
Python tracker 

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



[issue45216] Remove redundand information from difflib docstrings

2021-09-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +tim.peters

___
Python tracker 

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



[issue45198] __set_name__ documentation not clear about its usage with non-descriptor classes

2021-09-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +26851
pull_request: https://github.com/python/cpython/pull/28448

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +26850
pull_request: https://github.com/python/cpython/pull/28447

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset dea59cf88adf5d20812edda330e085a4695baba4 by Serhiy Storchaka in 
branch 'main':
bpo-36674: Honour the skipping decorators in TestCase.debug() (GH-28446)
https://github.com/python/cpython/commit/dea59cf88adf5d20812edda330e085a4695baba4


--

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since the behavior of debug() was different for the following cases:

@skip('skipping')
def test1(self):
pass
@othedecorator
@skip('skipping')
def test2(self):
pass
def test3(self):
self.skipTest('skipping')

I consider it as a bug and will backport the fix.

--

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 28446 makes TestCase.debug() honoring the skipping decorator.

The difference with PR 13180:

1. It does not run setUp() and tearDown() for tests decorated with the skipping 
decorator, as TestCase.run().
2. It has the same behavior for tests decorated with the skipping decorator and 
tests using skipTest() or raising a SkipTest -- raises a SkipTest.
3. Tests actually test the skipping decorator.

--
type: enhancement -> behavior
versions: +Python 3.10, Python 3.11, Python 3.9 -Python 3.8

___
Python tracker 

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



[issue5846] Deprecate obsolete functions in unittest

2021-09-18 Thread Erlend E. Aasland


Erlend E. Aasland  added the comment:

> It is an internal function. We can remove it without deprecation.

How convenient :)

--

___
Python tracker 

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



[issue36674] "unittest.TestCase.debug" should honour "skip" (and other test controls)

2021-09-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +26849
pull_request: https://github.com/python/cpython/pull/28446

___
Python tracker 

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



[issue45216] Remove redundand information from difflib docstrings

2021-09-18 Thread Nikita Sobolev


Change by Nikita Sobolev :


--
keywords: +patch
nosy: +sobolevn
nosy_count: 2.0 -> 3.0
pull_requests: +26848
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28445

___
Python tracker 

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



[issue45002] won't match correct version of tcl/tk

2021-09-18 Thread 郑之为

郑之为  added the comment:

OK... It's fine now, tests are still failing

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



[issue45198] __set_name__ documentation not clear about its usage with non-descriptor classes

2021-09-18 Thread miss-islington


miss-islington  added the comment:


New changeset 7ab114bf1fa0f28ee267a4c69e597cc49a186a14 by Miss Islington (bot) 
in branch '3.10':
bpo-45198: __set_name__ documentation not clear about its usage with 
non-descriptor classes (GH-28439)
https://github.com/python/cpython/commit/7ab114bf1fa0f28ee267a4c69e597cc49a186a14


--

___
Python tracker 

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



[issue45198] __set_name__ documentation not clear about its usage with non-descriptor classes

2021-09-18 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue45198] __set_name__ documentation not clear about its usage with non-descriptor classes

2021-09-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 94b462686b7dfabbd69cc9401037d736d71c4dc2 by Raymond Hettinger in 
branch 'main':
bpo-45198: __set_name__ documentation not clear about its usage with 
non-descriptor classes (GH-28439)
https://github.com/python/cpython/commit/94b462686b7dfabbd69cc9401037d736d71c4dc2


--

___
Python tracker 

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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger
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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a18d52269ab6071a605d6c72f6af585a4c533ca4 by Miss Islington (bot) 
in branch '3.9':
bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) 
(GH-28443)
https://github.com/python/cpython/commit/a18d52269ab6071a605d6c72f6af585a4c533ca4


--

___
Python tracker 

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



[issue45235] argparse does not preserve namespace with subparser defaults

2021-09-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 6e4101add568910409294554c8e863226a66bb64 by Miss Islington (bot) 
in branch '3.10':
bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) 
(GH-28442)
https://github.com/python/cpython/commit/6e4101add568910409294554c8e863226a66bb64


--

___
Python tracker 

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



Re: How to support annotations for a custom type in a C extension?

2021-09-18 Thread Marco Sulla
Ooook. I have a question. Why is this code not present in
dictobject.c? Where are the dict annotations implemented?

On Sat, 18 Sept 2021 at 03:00, MRAB  wrote:
>
> On 2021-09-17 21:03, Marco Sulla wrote:
> > I created a custom dict in a C extension. Name it `promethea`. How can
> > I implement `promethea[str, str]`? Now I get:
> >
> > TypeError: 'type' object is not subscriptable
> >
> Somewhere you'll have a table of the class's methods. It needs an entry
> like this:
>
>
> static PyMethodDef customdict_methods[] = {
> ...
>  {"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_CLASS |
> METH_O | METH_COEXIST, PyDoc_STR("See PEP 585")},
> ...
> };
>
>
> Note the flags: METH_CLASS says that it's a class method and
> METH_COEXIST says that it should use this method instead of the slot.
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list