[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

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

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

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

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

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

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:

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

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

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

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

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

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

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

[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

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

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

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

[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

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

[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

[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

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

[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

[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

[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

[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

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

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

[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

[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

[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

[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

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

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

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

[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

[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

[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

[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

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

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

[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

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

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

[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

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

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

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

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

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