[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-13 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : When compiled with default NSMALLPOSINTS, _PyLong_FromUnsignedChar() is significantly faster than other PyLong_From*(): $ python -m perf timeit -s "from collections import deque; consume = deque(maxlen=0).extend; b = bytes(2**20)" "consume

[issue37837] add internal _PyLong_FromUnsignedChar() function

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

[issue37840] bytearray_getitem() handles negative index incorrectly

2019-08-13 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : bytearray_getitem() adjusts negative index, though that's already done by PySequence_GetItem(). This makes PySequence_GetItem(bytearray(1), -2) to return 0 instead of raise IndexError. -- components: Interpreter Core messages: 349545 nosy

[issue37840] bytearray_getitem() handles negative index incorrectly

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

[issue37842] Initialize Py_buffer variables more efficiently

2019-08-13 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Argument Clinic generates `{NULL, NULL}` initializer for Py_buffer variables. Such initializer zeroes all Py_buffer members, but as I understand only `obj` and `buf` members are really had to be initialized. Avoiding unneeded initialization provides tiny

[issue37842] Initialize Py_buffer variables more efficiently

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

[issue37907] speed-up PyLong_As*() for large longs

2019-08-21 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : PyLong_As*() functions computes result for large longs like this: size_t x, prev; x = 0; while (--i >= 0) { prev = x; x = (x << PyLong_SHIFT) | v->ob_digit[i]; if ((x >> PyLong_SHIFT) != prev) { *overflow = sign;

[issue37907] speed-up PyLong_As*() for large longs

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

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

2019-08-22 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +15094 pull_request: https://github.com/python/cpython/pull/15385 ___ Python tracker <https://bugs.python.org/issue27

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

2019-08-22 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +15095 pull_request: https://github.com/python/cpython/pull/15386 ___ Python tracker <https://bugs.python.org/issue27

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

2019-08-22 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +15098 pull_request: https://github.com/python/cpython/pull/15388 ___ Python tracker <https://bugs.python.org/issue27

[issue37938] refactor PyLong_As*() functions

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

[issue37938] refactor PyLong_As*() functions

2019-08-24 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : PyLong_As*() functions have a lot of duplicated code, creating draft PR with attempt to deduplicate them. -- components: Interpreter Core messages: 350367 nosy: sir-sigurd priority: normal severity: normal status: open title: refactor PyLong_As

[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: $ gcc -v 2>&1 | grep 'gcc version' gcc version 8.3.0 (Debian 8.3.0-19) using ./configure --enable-optimizations --with-lto $ python -m perf timeit -s "from collections import deque; consume = deque(maxlen=0).extend; b = bytes(2**20)&qu

[issue37802] micro-optimization of PyLong_FromSize_t()

2019-08-25 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Previous benchmarks results were obtained with non-LTO build. Here are results for LTO build: $ python -m perf timeit -s "from itertools import repeat; _len = repeat(None, 0).__length_hint__" "_len()" --compare-to=../cpython-ma

[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-25 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: These last results are invalid :-) I thought that I was checking _PyLong_FromUnsignedChar() on top of GH-15192, but that wasn't true. So the correct results for LTO build are: $ python -m perf timeit -s "from collections import deque; consum

[issue37973] improve docstrings of sys.float_info

2019-08-28 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : In [8]: help(sys.float_info) ... | | dig | DBL_DIG -- digits | This is not very helpful, https://docs.python.org/3/library/sys.html#sys.float_info is more verbose, so probably docstrings should be updated from where. -- assignee

[issue37974] zip() docstring should say 'iterator' instead of 'object with __next__()'

2019-08-28 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : In [3]: help(zip) class zip(object) | zip(*iterables) --> zip object | | Return a zip object whose .__next__() method returns a tuple where | the i-th element comes from the i-th iterable argument. The .__next__() | method continues until

[issue37976] zip() shadows TypeError raised in __iter__() of source iterable

2019-08-29 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : zip() shadows TypeError raised in __iter__() of source iterable: In [21]: class Iterable: ...: def __init__(self, n): ...: self.n = n ...: def __iter__(self): ...: return iter(range(self.n)) ...: In [22

[issue37976] zip() shadows TypeError raised in __iter__() of source iterable

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

[issue37976] zip() shadows TypeError raised in __iter__() of source iterable

2019-08-29 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Maybe it's not clear from description, but traceback only show the line with zip(), so it doesn't help at localizing the source of exception at all. You only see that 'argument #N must support iteration', but that argument has __iter_

[issue37976] zip() shadows TypeError raised in __iter__() of source iterable

2019-08-29 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Also using this example class: In [5]: iter(Iterable('one')) --- TypeError Traceback (most recent call last) in () > 1 iter(Iterable

[issue37976] zip() shadows TypeError raised in __iter__() of source iterable

2019-08-29 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: > map() does not have anything special. Just for the reference, in Python 2.7 map() has the same behavior and it caused many problems for me and other people working with/developing Django. -- ___ Python trac

[issue37986] Improve perfomance of PyLong_FromDouble()

2019-08-30 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : This patch simplifies fast path for floats that fit into C long and moves it from float.__trunc__ to PyLong_FromDouble(). +-+-+--+ | Benchmark | long-from-float-ref | long-from

[issue38015] inline function generates slightly inefficient machine code

2019-09-06 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +15372 pull_request: https://github.com/python/cpython/pull/15718 ___ Python tracker <https://bugs.python.org/issue38

[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

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

[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

[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

[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

[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

[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

[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

[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

[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

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

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

[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

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

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

[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

[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

[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

[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

[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

[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

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

[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

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

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

[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

[issue31862] Port the standard library to PEP 489 multiphase initialization

2019-05-22 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +13420 ___ Python tracker <https://bugs.python.org/issue31862> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34488] improve performance of BytesIO.writelines() by avoiding creation of unused PyLongs

2019-08-02 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: `BytesIO.write()` and `BytesIO.writelines()` are independent of each other. -- ___ Python tracker <https://bugs.python.org/issue34

[issue37802] micro-optimization of PyLong_FromSize_t()

2019-08-09 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Currently PyLong_FromSize_t() uses PyLong_FromLong() for values < PyLong_BASE. It's suboptimal because PyLong_FromLong() needs to handle the sign. Removing PyLong_FromLong() call and handling small ints directly in PyLong_FromSize_t() makes i

[issue37802] micro-optimization of PyLong_FromSize_t()

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

[issue30856] unittest.TestResult.addSubTest should be called immediately after subtest finishes

2017-07-05 Thread Sergey Fedoseev
New submission from Sergey Fedoseev: Currently TestResult.addSubTest() is called just before TestResult.stopTest(), but docs says that addSubTest is "Called when a subtest finishes". IMO that means that it will be called immediately after subtest finishes, but not after indefinite t

[issue30856] unittest.TestResult.addSubTest should be called immediately after subtest finishes

2017-07-05 Thread Sergey Fedoseev
Changes by Sergey Fedoseev : -- components: +Library (Lib) ___ Python tracker <http://bugs.python.org/issue30856> ___ ___ Python-bugs-list mailing list Unsub

[issue31108] add __contains__ for list_iterator (and others) for better performance

2017-08-02 Thread Sergey Fedoseev
Changes by Sergey Fedoseev : -- pull_requests: +3025 ___ Python tracker <http://bugs.python.org/issue31108> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31108] add __contains__ for list_iterator (and others) for better performance

2017-08-02 Thread Sergey Fedoseev
New submission from Sergey Fedoseev: > python -mtimeit -s "l = list(range(10))" "l[-1] in l" 1000 loops, best of 3: 1.34 msec per loop > python -mtimeit -s "l = list(range(10))" "l[-1] in iter(l)" >

[issue33234] Improve list() pre-sizing for inputs with known lengths

2018-12-20 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +10490 ___ Python tracker <https://bugs.python.org/issue33234> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36030] add internal API function to create tuple without items array initialization

2019-02-19 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : PyTuple_New() fills items array with NULLs to make usage of Py_DECREF() safe even when array is not fully filled with real items. There are multiple cases when this initialization step can be avoided to improve performance. For example it gives such speed

[issue36030] add internal API function to create tuple without items array initialization

2019-02-19 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +11952 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36030> ___ _

[issue36031] add internal API function to effectively convert just created list to tuple

2019-02-19 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : There are several cases in CPython sources when PyList_AsTuple() is used with just created list and immediately after that this list is Py_DECREFed. This operation can be performed more effectively since refcount of items is not changed. For example it

[issue36031] add internal API function to effectively convert just created list to tuple

2019-02-19 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +11953 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36031> ___ _

[issue36031] add internal API function to effectively convert just created list to tuple

2019-02-19 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Does this look like more real world example? Before: $ python -m perf timeit -s "t = (1, 2, 3)" "(*t, 4, 5)" . Mean +- std dev: 95.7 ns +- 2.3 ns After: $ python -m perf timeit -s "t = (1, 2, 3)" "(*t

[issue36030] add internal API function to create tuple without items array initialization

2019-02-20 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +11979 ___ Python tracker <https://bugs.python.org/issue36030> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36030] add internal API function to create tuple without items array initialization

2019-02-20 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Here's benchmarks for PyTuple_FromArray() PR: $ python -m perf timeit -s "l = [None]*0; tuple_ = tuple" "tuple_(l)" --duplicate=100 --compare-to=../cpython-master/venv/bin/python /home/sergey/tmp/cpython-master/venv/bin/python: .

[issue36062] move index normalization from list_slice() to PyList_GetSlice()

2019-02-20 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : list_slice() is used by PyList_GetSlice(), list_subscript() and for list copying. In list_subscript() slice indices are already normalized with PySlice_AdjustIndices(), so slice normalization currently performed in list_slice() is only needed for

[issue36062] move index normalization from list_slice() to PyList_GetSlice()

2019-02-20 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +11993 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36062> ___ _

[issue36063] replace PyTuple_SetItem() with PyTuple_SET_ITEM() in long_divmod()

2019-02-21 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : This change produces minor speed-up: $ python-other -m perf timeit -s "divmod_ = divmod" "divmod_(1, 1)" --duplicate=1000 --compare-to=../cpython-master/venv/bin/python python: . 64.6 ns +-

[issue36063] replace PyTuple_SetItem() with PyTuple_SET_ITEM() in long_divmod()

2019-02-21 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +11998 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36063> ___ _

[issue36072] str.translate() behave differently for ASCII-only and other strings

2019-02-21 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : In [186]: from itertools import cycle In [187]: class ContainerLike: ...: def __init__(self): ...: self.chars = cycle('12') ...: def __getitem__(self, key): ...: return next(self.chars) ...:

[issue36072] str.translate() behaves differently for ASCII-only and other strings

2019-02-21 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- title: str.translate() behave differently for ASCII-only and other strings -> str.translate() behaves differently for ASCII-only and other strings ___ Python tracker <https://bugs.python.org/issu

[issue36073] sqlite crashes with converters mutating cursor

2019-02-21 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : It's somewhat similar to bpo-10811, but for converter function: In [197]: import sqlite3 as sqlite ...: con = sqlite.connect(':memory:', detect_types=sqlite.PARSE_COLNAMES) ...: cur = con.cursor() ...: sqlite.converte

[issue36073] sqlite crashes with converters mutating cursor

2019-02-21 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +12008 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36073> ___ _

[issue36030] add internal API function to create tuple without items array initialization

2019-02-25 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +12062 ___ Python tracker <https://bugs.python.org/issue36030> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +12078 ___ Python tracker <https://bugs.python.org/issue36030> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: I added WIP PR with discussed micro-optimization, here are benchmark results: $ python -m perf compare_to --min-speed 1 -G master.json tuple-untracked.json Slower (1): - sqlite_synth: 5.16 us +- 0.10 us -> 5.22 us +- 0.08 us: 1.01x slower (+1%) Faster

[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: This optimization also can be used for BUILD_TUPLE opcode and in pickle module, if it's OK to add _PyTuple_StealFromArray() function :-) -- ___ Python tracker <https://bugs.python.org/is

[issue36030] add internal API function to create tuple without items array initialization

2019-02-26 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: > Can you please convert msg336142 into a perf script? > And then run again these benchmarks on PR 12052. ++-+--+ | Benchmark | ref | unt

[issue36030] add internal API function to create tuple without items array initialization

2019-02-27 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: >> This optimization also can be used for BUILD_TUPLE opcode and in pickle >> module, if it's OK to add _PyTuple_StealFromArray() function :-) > I would like to see a micro-benchmark show

[issue36030] add internal API function to create tuple without items array initialization

2019-02-27 Thread Sergey Fedoseev
Change by Sergey Fedoseev : Added file: https://bugs.python.org/file48174/list_as_tuple_bench.py ___ Python tracker <https://bugs.python.org/issue36030> ___ ___ Pytho

[issue36030] add internal API function to create tuple without items array initialization

2019-02-27 Thread Sergey Fedoseev
Change by Sergey Fedoseev : Added file: https://bugs.python.org/file48173/build_tuple_bench.py ___ Python tracker <https://bugs.python.org/issue36030> ___ ___ Python-bug

[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-11-27 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Before: $ ./python -m timeit -s "from binascii import unhexlify; b = b'aa'*2**20" "unhexlify(b)" 50 loops, best of 5: 5.68 msec per loop After: $ ./python -m timeit -s "from binascii import unhexlify; b = b'aa'

[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-11-27 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +4508 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue32147> ___ ___ Py

[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-11-27 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- components: +Library (Lib) ___ Python tracker <https://bugs.python.org/issue32147> ___ ___ Python-bugs-list mailing list Unsub

[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-01 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Serhiy, did you use the same benchmark as mentioned here? -- ___ Python tracker <https://bugs.python.org/issue32147> ___ ___

[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-01 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: > OS x86_64 GNU/Linux > compiler gcc version 7.2.0 (Debian 7.2.0-16) > CPU Architecture:x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 2 Co

[issue32147] improve performance of binascii.unhexlify() by using conversion table

2017-12-17 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Is there anything I can do to push this forward? BTW, Serhiy, what are your OS, compiler and CPU? -- ___ Python tracker <https://bugs.python.org/issue32

[issue8488] Docstrings of non-data descriptors "ignored"

2018-06-14 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue8488> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue33576] Make exception wrapping less intrusive for __set_name__ calls

2018-06-17 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue33576> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue21145] Add the @cached_property decorator

2018-06-17 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/issue21145> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34018] SQLite converters are documented to be sensitive to the case of type names, but they're not

2018-07-02 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : SQLite converters are documented to be sensitive to the case of type names, but they're not. In [50]: import sqlite3 ...: ...: sqlite3.converters.clear() ...: sqlite3.register_converter('T', lambda x: 'UPPE

[issue34018] SQLite converters are documented to be sensitive to the case of type names, but they're not

2018-07-02 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +7651 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34018> ___ ___ Py

[issue34041] add *deterministic* parameter to sqlite3.Connection.create_function()

2018-07-04 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : SQLiter 3.8.3 and higher allows to mark created functions as deterministic to allow additional optimizations. There isn't currently a way to it from Python. https://sqlite.org/c3ref/create_function.html -- components: Extension Modules mes

[issue34041] add *deterministic* parameter to sqlite3.Connection.create_function()

2018-07-04 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +7687 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34041> ___ ___ Py

[issue34052] sqlite's create_function() raises exception on unhashable callback, but creates function

2018-07-05 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : In [1]: import sqlite3 In [2]: con = sqlite3.connect(':memory:') In [3]: con.execute('SELECT f()') --- OperationalError Traceback (most r

[issue34052] sqlite's create_function() raises exception on unhashable callback, but creates function

2018-07-05 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +7702 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34052> ___ ___ Py

[issue34151] use malloc() for better performance of some list operations

2018-07-18 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Currently list concatenation, slicing and repeating operations are using PyList_New() which allocates memory for the items by calloc(). malloc() could be used instead, since the allocated memory is overwritten by mentioned operations. I made benchmarks

[issue34151] use malloc() for better performance of some list operations

2018-07-18 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +7869 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34151> ___ ___ Py

  1   2   >