[issue47240] Python 3.x built for ppc+ppc64 errs on: No module named 'msvcrt', '_posixsubprocess'

2022-04-06 Thread Sergey Fedorov
New submission from Sergey Fedorov : While adding definitions for additional universal binary option (ppc+ppc64) is rather straightforward (following already existing examples in the source code), and Python 3.x after patching do build as universal for named two arch, trying to install any

[issue47079] Integral.denominator shouldn't return an int

2022-03-27 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > It does not satisfy your assumptions in msg416056. Yes, but does it fits to assumptions of the numbers module? To be fair, there is even no requirement, that numerator/denominator are Integral instances (#25619 address also this). BTW, it seems,

[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > Integral.__add__ is an abstract method, so it is a problem of your > implementation. But such an implementation does satisfy all assumptions of the Integral abc, correct? -- ___ Python tracker

[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > The module documentation should not contain all historical reasons of every > design decision. Sure. But, for example, there should be an explanation of why foo+foo.denominator could produce an error for a valid implementation of the Integr

[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > There is no "why". Why not? Apparently, this is a documentation error, at least. (And I doubt there are tests for default methods.) > If you are interesting "why", try to search old archives for the history of >

[issue47079] Integral.denominator shouldn't return an int

2022-03-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > There is no such constrain. Why not? Any example where it does make sense to have different types for numerator and denominator? -- ___ Python tracker <https://bugs.python.org/issu

[issue47079] Integral.denominator shouldn't return an int

2022-03-25 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > How would it work for bool or IntEnum? Neither subclass the Integral abc. The constraint (for which I care about) is: numerator/denominator should have same types. The default implementation, which I propose: it's the same type as the given

[issue47079] Integral.denominator shouldn't return an int

2022-03-21 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- keywords: +patch pull_requests: +30110 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32022 ___ Python tracker <https://bugs.python.org/issu

[issue47079] Integral.denominator shouldn't return an int

2022-03-20 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > self(1) instead or, rather, type(self)(1) -- ___ Python tracker <https://bugs.python.org/issue47079> ___ ___ Python-

[issue47079] Integral.denominator shouldn't return an int

2022-03-20 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : As the __int__() method is required, I believe it can return self(1) instead. Also, probably +self normalization could be avoided in the Integral.numerator(). -- components: Library (Lib) messages: 415660 nosy: Sergey.Kirpichev priority: normal

[issue45818] socketserver.BaseRequestHandler inherited class

2021-11-16 Thread Sergey M.
New submission from Sergey M. : Due to ```python try: self.handle() finally: self.finish() ``` construct in `socketserver.BaseRequestHandler.__init__()` method inherited classes with `overrided __init__()` method may suffer from incomplete initialization. For example, in the

[issue44840] Nested if/else gets phantom else trace again (3.10)

2021-08-05 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue44840> ___ ___ Python-bugs-list mailing list Unsub

[issue44626] Incorrect tracing of nested if/if/for/yield

2021-07-13 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue44626> ___ ___ Python-bugs-list mailing list Unsub

[issue44570] 3.10.0b3 doesn't trace line events for return in some cases

2021-07-08 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: Pablo, it seems: the 3.10 branch as for https://github.com/nedbat/coveragepy/issues/1184#issuecomment-873506523 still has this issue - I can reproduce one. -- ___ Python tracker <https://bugs.python.

[issue44570] 3.10.0b3 doesn't trace line events for return in some cases

2021-07-05 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue44570> ___ ___ Python-bugs-list mailing list Unsub

[issue44022] urllib http client possible infinite loop on a 100 Continue response

2021-07-05 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd nosy_count: 8.0 -> 9.0 pull_requests: +25593 pull_request: https://github.com/python/cpython/pull/27033 ___ Python tracker <https://bugs.python.org/issu

[issue39759] os.getenv documentation is misleading

2021-07-02 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue39759> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44346] Fraction constructor may accept spaces around '/'

2021-06-09 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > See previous discussion in #9574. Given this, probably spaces around '/' should be disallowed. -- ___ Python tracker <https://bugs.pytho

[issue44346] Fraction constructor may accept spaces around '/'

2021-06-08 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Wed, Jun 09, 2021 at 06:18:22AM +, Vedran Čačić wrote: > I was surprised to realize `complex` doesn't accept '2 + 3j' Good catch, probably that should be allowed too. > e.g. how about 3_j? The PEP 515 added '_' as a

[issue44346] Fraction constructor may accept spaces around '/'

2021-06-08 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : Per https://bugs.python.org/msg394731 suggestion. For instance, mpq_set_str() does support this. Also, gmpy2.mpq(). Tentative patch attached. -- components: Library (Lib) files: fraction-spaces.diff keywords: patch messages: 395314 nosy

[issue44267] Wrong PEP 515 parsing in decimal module (both C and Python versions)

2021-05-30 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Sun, May 30, 2021 at 08:58:56AM +, Mark Dickinson wrote: > Yep, you're absolutely right. I should have said "after the PEP is final" Unfortunately, neither correction can fix that the PEP does not "accurately des

[issue44267] Wrong PEP 515 parsing in decimal module (both C and Python versions)

2021-05-30 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Sun, May 30, 2021 at 08:32:40AM +, Mark Dickinson wrote: > Standards Track PEPs are historical documents; it's quite common that an > actual implementation ends up diverging from a PEP in small ways after > the PEP is accepted, and we

[issue44267] Wrong PEP 515 parsing in decimal module (both C and Python versions)

2021-05-30 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Sun, May 30, 2021 at 08:20:14AM +, Mark Dickinson wrote: > There was some discussion of this on the python-dev mailing list at the time I see. > It's probably best left alone. PEP 515 is clear. If this is not a bug - it should be adju

[issue44267] Wrong PEP 515 parsing in decimal module (both C and Python versions)

2021-05-29 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : Added file: https://bugs.python.org/file50072/0001-bpo-44267-fix-parsing-Decimal-s-with-underscores.patch ___ Python tracker <https://bugs.python.org/issue44

[issue44267] Wrong PEP 515 parsing in decimal module (both C and Python versions)

2021-05-29 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : While working on issue44258 I discover that the decimal module doesn't follow specification in PEP 515: "The current proposal is to allow one underscore between digits, and after base specifiers in numeric literals." (c) For example: &g

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-28 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Fri, May 28, 2021 at 06:48:14AM +, Mark Dickinson wrote: > So yes please to the PR. There should be tests that check that only the > underscore rules allowed by `int` and the others are supported: e.g., > `Fraction("1__2")`,

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-28 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- pull_requests: +25017 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26422 ___ Python tracker <https://bugs.python.org/issu

[issue44258] Support PEP 515 for Fraction's initialization from string

2021-05-27 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : Right now: >>> from fractions import Fraction as F >>> F(1_2_3, 3_2_1) Fraction(41, 107) but >>> F('1_2_3/3_2_1') Traceback (most recent call last): File "", line 1, in File "/home/sk/src/cpyth

[issue44154] Optimize Fraction pickling

2021-05-21 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Thu, May 20, 2021 at 12:03:38AM +, Raymond Hettinger wrote: > Raymond Hettinger added the comment: > You're right that this won't work for decimal because it takes a > string constructor. A fancier reduce might do the trick but

[issue43420] Optimize rational arithmetics

2021-05-17 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > I'll have to see if the slowdown can be mitigated somehow. Yes, for small components this is a known slowdown. I'm trying to mitigate that case in https://github.com/python/cpython/pull/25518. Except for the mixed mode (Fraction's

[issue44154] Optimize Fraction pickling

2021-05-17 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: Not sure why this wasn't closed after pr merging. If this was intentional - let me know and reopen. I'm less sure if something like this will work for a Decimal(). Perhaps, if the constructor will accept an integer as the value[1], not just

[issue44154] Optimize Fraction pickling

2021-05-16 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > Oh yes - please do. Ok, I did. > It's not just pickle size - going through str() makes (un)pickling quadratic > time in both directions if components are large. Yeah, I noticed speedup too, but size was much more important for may app

[issue44154] Optimize Fraction pickling

2021-05-16 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- pull_requests: +24803 stage: -> patch review pull_request: https://github.com/python/cpython/pull/26186 ___ Python tracker <https://bugs.python.org/issu

[issue44154] Optimize Fraction pickling

2021-05-16 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : The current version of the Fraction.__reduce__() method uses str(), which produces bigger dumps, esp. for large components. C.f.: >>> import random, pickle >>> from fractions import Fraction as F >>> random.se

[issue32133] documentation: numbers module nitpick

2021-05-15 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: Maybe some methods from the Complex class could be moved to the Number class? I think, that something like the ring structure (probably even a commutative ring) is expected from the number classes in the Python. I.e. there should be __add__/__sub__

[issue44071] Syntax error in Python3 documentation

2021-05-07 Thread Sergey Maslyakov
Sergey Maslyakov added the comment: Thank you, Dennis! I was wrong. Closing the ticket. -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44071] Syntax error in Python3 documentation

2021-05-07 Thread Sergey Maslyakov
New submission from Sergey Maslyakov : https://docs.python.org/3/library/subprocess.html#subprocess.check_output The code sample seems to have a misplaced closing round bracket. It should go after "stdout" ``` run(..., check=True, stdout=PIPE).stdout ``` -- assignee: d

[issue15907] move doctest test-data files into a subdirectory of Lib/test

2021-05-06 Thread Sergey Polischouck
Change by Sergey Polischouck : -- nosy: +polischouckserg ___ Python tracker <https://bugs.python.org/issue15907> ___ ___ Python-bugs-list mailing list Unsub

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-05-01 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Tue, Apr 27, 2021 at 08:31:35AM +, Raymond Hettinger wrote: > Well, that complicated things ;-) I suppose he can revive this if he wants. That was just to note: it wasn't my (=> bad & stupid) idea. Lets hope, he will note,

[issue26092] doctest should allow custom sys.displayhook

2021-04-26 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- pull_requests: +24342 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25651 ___ Python tracker <https://bugs.python.org/issu

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > Thank you for the suggestion Raymond, that was Guido's suggestion. -- ___ Python tracker <https://bugs.python.org

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Tue, Apr 27, 2021 at 02:49:15AM +, Jelle Zijlstra wrote: > Forcing all of them to change doesn't seem particularly valuable. It seems, this will cost very little work on their side, much less than on the CPython side. Do you agree? Someth

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > so I'll simply record my -1 for the proposed change and move on Mark, thank you for some PR review, anyway. I hope, we still can count Guido +1 on the change. > If you want to push this change through, the way forward would likely be t

[issue26092] doctest should allow custom sys.displayhook

2021-04-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > I personally haven't encountered this problem in the past years Noam, that's because Python has your patch :-) But if we revert one - mentioned solution with mock.patch will work. Please, tell us if you find it bad f

[issue12403] Mention sys.displayhook in code module docs and the compile builtin docs

2021-04-26 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue12403> ___ ___ Python-bugs-list mailing list Unsub

[issue26092] doctest should allow custom sys.displayhook

2021-04-26 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: Tim, lets decide on this simple issue. To me, https://bugs.python.org/issue8048 was obviously a bad thing. While it "fixes" one application, which customize sys.displayhook in a strange way - it break testing almost everyone, which do sys.d

[issue23975] numbers.Rational implements __float__ incorrectly

2021-04-25 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- pull_requests: +24321 stage: -> patch review pull_request: https://github.com/python/cpython/pull/25619 ___ Python tracker <https://bugs.python.org/issu

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-23 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Fri, Apr 23, 2021 at 11:51:17AM +, Mark Dickinson wrote: > The name "Integral" isn't actually _wrong_ as such; it's just perhaps > not the name that we would have chosen if we were inventing the > numbers ABC right now.

[issue23975] numbers.Rational implements __float__ incorrectly

2021-04-23 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue23975> ___ ___ Python-bugs-list mailing list Unsub

[issue11977] Document int.conjugate, .denominator, ...

2021-04-23 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue11977> ___ ___ Python-bugs-list mailing list Unsub

[issue23602] Implement __format__ for Fraction

2021-04-23 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue23602> ___ ___ Python-bugs-list mailing list Unsub

[issue30094] PDB enhancement

2021-04-23 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue30094> ___ ___ Python-bugs-list mailing list Unsub

[issue32133] documentation: numbers module nitpick

2021-04-23 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue32133> ___ ___ Python-bugs-list mailing list Unsub

[issue43602] Include Decimal's in numbers.Real

2021-04-22 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: Well, probably everyone else agree with Raymond. Yet, I'll try to clarify few things. On Mon, Apr 19, 2021 at 03:38:29AM +, Raymond Hettinger wrote: > No strong use cases have emerged that would warrant overturning > the long-standing prio

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-22 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- keywords: +patch pull_requests: +24272 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/25552 ___ Python tracker <https://bugs.python.org/issu

[issue27763] Add complex case to test_builtin abs()

2021-04-21 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > We're testing the cmath functions on complex number inputs Indeed. Also, for abs(complex) - there is test_abs() in the test_complex.py. > The complex number creation from both strings and pairs of floats should be > tested independen

[issue43602] Include Decimal's in numbers.Real

2021-04-16 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: Probably, this thread https://mail.python.org/archives/list/python-id...@python.org/thread/KOE3MQ5NSMGTLIH6IHAQWTIOELXG4AFQ/ is relevant here. I would appreciate Oscar's feedback on this issue. -- nosy: +oscarben

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-13 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue32891> ___ ___ Python-bugs-list mailing list Unsub

[issue32466] Fix missing test coverage for fractions.Fraction.__new__

2021-04-10 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: Mark, I think the Lib/fractions.py now is covered by tests in the test_fractions.py. $ ./python -m venv ~/venv/cpython $ . ~/venv/cpython/bin/activate $ pip install coverage Collecting coverage Using cached coverage-5.5-cp310-cp310-manylinux1_x86_64

[issue43602] Include Decimal's in numbers.Real

2021-03-23 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Tue, Mar 23, 2021 at 01:03:47PM +, Mark Dickinson wrote: > What do you think the result of `1.0 + Decimal(1)` should be, and > more importantly why? Possible options are: > > - Decimal('2') > - 2.0 (a float) > - a `TypeE

[issue43602] Include Decimal's in numbers.Real

2021-03-23 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Tue, Mar 23, 2021 at 10:21:50AM +, Mark Dickinson wrote: > Mark Dickinson added the comment: > > I assume, the reason is: there is no lossless conversion to float's (and > > vice verse). > and in fact we _do_ have lossless

[issue43602] Include Decimal's in numbers.Real

2021-03-23 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > Operations between decimals and floats raise a TypeError. I saw this) And as I said, I assume, the reason is: there is no lossless conversion to float's (and vice verse). If so (point 2), neither multiple-precision type (e.g. gmpy2.mpfr) can

[issue43602] Include Decimal's in numbers.Real

2021-03-22 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : Commit 82417ca9b2 includes Decimal's in the numbers tower, but only as an implementation of the abstract numbers.Number. The mentioned reason is "Decimals are not interoperable with floats" (see comments in the numbers.py as well), i

[issue43420] Optimize rational arithmetics

2021-03-21 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Mon, Mar 22, 2021 at 04:34:32AM +, Tim Peters wrote: > For example, setting up a module global `_gcd` name for `math.gcd` Looking on the stdlib, I would just import gcd. > default `_gcd=math.gcd` arguments to the methods? Then it's &g

[issue43420] Optimize rational arithmetics

2021-03-21 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Mon, Mar 22, 2021 at 02:35:59AM +, Tim Peters wrote: > Thanks, all! This has been merged now. If someone wants to > continue pursuing things left hanging, I'd suggest opening > a different BPO report. Tim, if you are about micro-opt

[issue43420] Optimize rational arithmetics

2021-03-12 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > a short paragraph or section on alternative implementations There are no alternative implementations. SymPy's PythonRational (AFAIR, this class not in the default namespace) is an internal fallback solution, for case when no gmpy2 is a

[issue43420] Optimize rational arithmetics

2021-03-10 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Tue, Mar 09, 2021 at 05:11:09AM +, Tim Peters wrote: > those for + and - are much subtler In fact, these optimizations will payoff faster (wrt denominators size), esp. due to gcd==1 branch. Sorry for off-topic: > WRT which, I added Py

[issue43420] Optimize rational arithmetics

2021-03-08 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Sun, Mar 07, 2021 at 12:16:36PM +, Mark Dickinson wrote: > but not the "incompatible denominators" part. :-) The typical use there is > that those fractions have been converted from floats But there is no limits to use Fraction&

[issue43420] Optimize rational arithmetics

2021-03-07 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: On Sun, Mar 07, 2021 at 10:34:24PM +, Aaron Meurer wrote: > I'm surprised to hear that the "typical use-case" of Fraction > is fractions converted from floats. For statistics module - that may be true. Unfortunately, no (other) p

[issue43420] Optimize rational arithmetics

2021-03-07 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: > I'd prefer to keep the code simplicity It's not going to be complicated so much and algorithms are well known, but I see your point. > and the speed for small inputs here Speed loss is not so big, 10-20%. > Python's needs ar

[issue1814] Victor Stinner's GMP patch for longs

2021-03-07 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue1814> ___ ___ Python-bugs-list mailing list Unsub

[issue21922] PyLong: use GMP

2021-03-07 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- nosy: +Sergey.Kirpichev ___ Python tracker <https://bugs.python.org/issue21922> ___ ___ Python-bugs-list mailing list Unsub

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Sergey B Kirpichev
Change by Sergey B Kirpichev : -- pull_requests: +23544 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24779 ___ Python tracker <https://bugs.python.org/issu

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Sergey B Kirpichev
Sergey B Kirpichev added the comment: I have similar timings (for a draft version of PR, see f.patch) as for the last comment, though the small-dens overhead seems to be bigger(~20%): $ python3.10 -m timeit -r11 -s 'from fractions import Fraction as F' -s 'a=F(10,3)' -

[issue43420] Optimize rational arithmetics

2021-03-06 Thread Sergey B Kirpichev
New submission from Sergey B Kirpichev : fractions.py uses naive algorithms for doing arithmetics. It may worth implementing less trivial versions for addtion/substraction and multiplication (e.g. Henrici algorithm and so on), described here: https://www.eecis.udel.edu/~saunders/courses/822

[issue38905] venv python reports wrong sys.executable in a subprocess on Windows

2020-10-08 Thread Sergey Nudnou
Sergey Nudnou added the comment: Hello, I've just run into a related issue. I have a python script, which starts an another python script using subprocess.Popen(). The parent script gets pid of the child and monitors up its activity through a database by this pid. The child script up

[issue33239] tempfile module: functions with the 'buffering' option are incorrectly documented

2020-09-13 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd nosy_count: 4.0 -> 5.0 pull_requests: +21279 pull_request: https://github.com/python/cpython/pull/21763 ___ Python tracker <https://bugs.python.org/issu

[issue35276] Document thread safety

2020-08-24 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue35276> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue26834] Add truncated SHA512/224 and SHA512/256

2020-08-07 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue26834> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue41415] duplicated signature of dataclass in help()

2020-07-27 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +20793 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21652 ___ Python tracker <https://bugs.python.org/issu

[issue41415] duplicated signature of dataclass in help()

2020-07-27 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : In [191]: import dataclasses, pydoc In [192]: @dataclass ...: class C: ...: pass ...: In [193]: print(pydoc.render_doc(C)) Python Library Documentation: class C in module __main__ class C(builtins.object) | C() -> None | |

[issue41141] remove unneeded handling of '.' and '..' from patlib.Path.iterdir()

2020-06-27 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +20336 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21179 ___ Python tracker <https://bugs.python.org/issu

[issue41141] remove unneeded handling of '.' and '..' from patlib.Path.iterdir()

2020-06-27 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Currently patlib.Path.iterdir() filters out '.' and '..'. It's unneeded since patlib.Path.iterdir() uses os.listdir() under the hood, which returns neither '.' nor '..'. https://docs.python.org/3/library/os.ht

[issue40302] Add pycore_byteswap.h internal header file with _Py_bswap32() function

2020-05-10 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd nosy_count: 3.0 -> 4.0 pull_requests: +19338 pull_request: https://github.com/python/cpython/pull/15659 ___ Python tracker <https://bugs.python.org/issu

[issue27961] remove support for platforms without "long long"

2019-12-09 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +17021 pull_request: https://github.com/python/cpython/pull/17539 ___ Python tracker <https://bugs.python.org/issue27

[issue37347] Reference-counting problem in sqlite

2019-11-28 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +16894 pull_request: https://github.com/python/cpython/pull/17413 ___ Python tracker <https://bugs.python.org/issue37

[issue38524] functools.cached_property is not supported for setattr

2019-10-22 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue38524> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38517] functools.cached_property should support partial functions and partialmethod's

2019-10-22 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: issue38524 is related. -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue38517> ___ ___ Python-bugs-list m

[issue35696] remove unnecessary operation in long_compare()

2019-09-20 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: These warnings are caused by https://github.com/python/cpython/commit/c6734ee7c55add5fdc2c821729ed5f67e237a096. I'd fix them, but I'm not sure if we are going to restore CHECK_SMALL_INT() ¯\_(ツ)_/¯ -- nosy: +

[issue38147] add macro for __builtin_unreachable

2019-09-19 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: > If you care of _PyLong_Copy() performance, you should somehow manually inline > _PyLong_New() inside _PyLong_Copy(). It doesn't solve this: > We could add a function that bypass that check, but in LTO build > PyObject_MALLOC(

[issue38205] Py_UNREACHABLE() no longer behaves as a function call

2019-09-19 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: FWIW I proposed to add Py_ASSUME() macro that uses __builtin_unreachable() in bpo-38147. -- ___ Python tracker <https://bugs.python.org/issue38

[issue38211] clean up type_init()

2019-09-18 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +15852 stage: -> patch review pull_request: https://github.com/python/cpython/pull/16257 ___ Python tracker <https://bugs.python.org/issu

[issue38211] clean up type_init()

2019-09-18 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : I wrote patch that cleans up type_init(): 1. Removes conditions already checked by assert() 2. Removes object_init() call that effectively creates an empty tuple and checks that this tuple is empty -- messages: 352710 nosy: sir-sigurd priority

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Also quote from Py_UNREACHABLE() doc: > Use this in places where you might be tempted to put an assert(0) or abort() > call. https://github.com/python/cpython/commit/6b519985d23bd0f0bd072b5d5d5f2c60a81a19f2 does exactly that, it replaces assert(0

[issue38205] Python no longer compiles without small integer singletons

2019-09-17 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: I believe that the problem is caused by the change in Py_UNREACHABLE() (https://github.com/python/cpython/commit/3ab61473ba7f3dca32d779ec2766a4faa0657923). Before the mentioned commit Py_UNREACHABLE() was an expression, now it's a block. Py_UNREAC

[issue38147] add macro for __builtin_unreachable

2019-09-12 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : GCC (along with Clang and ICC) has __builtin_unreachable() and MSVC has __assume() builtins, that can be used to optimize out unreachable conditions. So we could add macro like this: #ifdef Py_DEBUG # define Py_ASSUME(cond) (assert(cond)) #else # if

[issue38094] unneeded assignment to wb.len in PyBytes_Concat using buffer protocol

2019-09-10 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +15517 stage: -> patch review pull_request: https://github.com/python/cpython/pull/15274 ___ Python tracker <https://bugs.python.org/issu

[issue38079] _PyObject_VAR_SIZE should avoid arithmetic overflow

2019-09-09 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +15471 stage: -> patch review pull_request: https://github.com/python/cpython/pull/14838 ___ Python tracker <https://bugs.python.org/issu

[issue38015] inline function generates slightly inefficient machine code

2019-09-07 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: I use GCC 9.2. -- ___ Python tracker <https://bugs.python.org/issue38015> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue38015] inline function generates slightly inefficient machine code

2019-09-06 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: I added similar patch that replaces get_small_int() with macro version, since it also induces unnecessary casts and makes machine code less efficient. Example assembly can be checked at https://godbolt.org/z/1SjG3E. This change produces tiny, but

  1   2   3   >