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

[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2018-12-23 Thread Sergey Bon.
Sergey Bon. added the comment: Documentation says: %U - Week number of the year (Sunday as the first day of the week) %W - Week number of the year (Monday as the first day of the week) It wouldn't be intuitive if %U assumed Sunday when weekday provided and Monday otherwise. There ar

[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2018-12-23 Thread Sergey Bon.
Sergey Bon. added the comment: Not following msg332388 would lead to this: # Sunday of the week 53 >>> datetime.strptime ('2017 Sun 53', '%Y %a %U') datetime.datetime(2017, 12, 31, 0, 0) # First day of the week 53 # oops! assumed Monday is the first day of the

[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2018-12-24 Thread Sergey Bon.
Sergey Bon. added the comment: If %W and %U are allowed to be used without specifying the weekday by assuming it to be the first day of the week, then the same rule should apply to %V (ISO 8601 week) for consistency. -- ___ Python tracker <ht

[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2019-01-11 Thread Sergey Shashkov
Sergey Shashkov added the comment: This patch actually fixes the problem: https://bugs.python.org/issue35588 https://github.com/python/cpython/commit/3a374e0c5abe805667b71ffaaa7614781101ff4c from fractions import Fraction import operator class Goo: __radd__, __rdivmod__

[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2019-01-17 Thread Sergey Bon.
Change by Sergey Bon. : -- keywords: +patch pull_requests: +11294 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue30802> ___ ___ Py

[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2019-01-17 Thread Sergey Bon.
Change by Sergey Bon. : -- keywords: +patch, patch pull_requests: +11294, 11295 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue30802] datetime.datetime.strptime('200722', '%Y%U')

2019-01-17 Thread Sergey Bon.
Change by Sergey Bon. : -- keywords: +patch, patch, patch pull_requests: +11294, 11295, 11296 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[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

[issue32952] Add __qualname__ for attributes of Mock instances

2018-02-25 Thread Sergey Kostyuk
New submission from Sergey Kostyuk : Good day. I have a question (or proposal, if you like) For now Mocks from unittest.mock module allows to mimic an interface of a some class or object instance. They pass isinstance checks, they allows to wrap callables with respect to their arguments. But

[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

[issue32435] tarfile recognizes .gz file as tar

2017-12-27 Thread Sergey Petrunin
New submission from Sergey Petrunin : Library's function 'tarfile.is_tarfile' returns 'True' on GZip file (9.7 megabytes see attachment), that is a file with 10 gigabytes of '0' character compressed with 'gzip' utility (no 'tar' whatsoev

[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

[issue34152] performance of some list slice assignment can be improved

2018-07-18 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Script for benchmarks: NAME=list-slice.json python -m perf timeit --name "l[len(l):] = reversed(l)" -l 1 -s "l = [None] * 100" "l[len(l):] = reversed(l)" --append $NAME python -m perf timeit --name "l[len(l):] = l&

[issue34152] performance of some list slice assignment can be improved

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

[issue34152] performance of some list slice assignment margin cases can be improved

2018-07-18 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- title: performance of some list slice assignment can be improved -> performance of some list slice assignment margin cases can be improved ___ Python tracker <https://bugs.python.org/issu

[issue34230] crashes in pysqlite_build_row_cast_map() on memory allocation failure

2018-07-25 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : pysqlite_build_row_cast_map() can crash on memory allocation failure: 1. it doesn't check that PyList_New() returns non-NULL 2. Py_DECREF() borrowed reference when -- components: Extension Modules messages: 322396 nosy: sir-sigurd priority: n

[issue34230] crashes in pysqlite_build_row_cast_map() on memory allocation failure

2018-07-25 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +7996 ___ Python tracker <https://bugs.python.org/issue34230> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue32788] Better error handling in sqlite3

2018-07-25 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +7998 ___ Python tracker <https://bugs.python.org/issue32788> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34303] micro-optimizations in functools.reduce()

2018-07-31 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : `PyTuple_SetItem()` can be replaced with macro version and `PyObject_Call()` can be used instead of `PyEval_CallObject()`. Here's benchmark results: $ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s "from functo

[issue34303] micro-optimizations in functools.reduce()

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

[issue28940] __length_hint__ isn't a hint for list()

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

[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-13 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : There are memory leaks in csv and pickle modules caused by incautious usage of PyMem_Resize(). See GitHub PR. -- components: Extension Modules messages: 323487 nosy: sir-sigurd priority: normal severity: normal status: open title: memory leaks in

[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-13 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8232 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34395> ___ ___ Py

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-13 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8233 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34397> ___ ___ Py

[issue34397] remove redundant overflow checks in tuple and list implementations

2018-08-13 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Max size of list and tuples is limited by PY_SSIZE_T_MAX / sizeof(PyObject*), so the sum of any two list/tuples sizes always <= PY_SSIZE_T_MAX if sizeof(PyObject*) > 1, which seems true for all supported (existing?) platforms. It means that ov

[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-14 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: > Could you elaborate a bit more on how/where the leak happens? It happens when PyMem_Resize() fails. It was used like this: Py_UCS4 *field = self->field; self->field = PyMem_Resize(field, Py_UCS4, self->field_size); The last statement chang

[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-16 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +8258 ___ Python tracker <https://bugs.python.org/issue34395> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34395] memory leaks in error handling in csv and pickle modules

2018-08-16 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +8262 ___ Python tracker <https://bugs.python.org/issue34395> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2018-08-24 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Currently BytesIO.writelines() uses BytesIO.write() which returns number of written bytes as Python ints, but these ints are not used by BytesIO.writelines(), so avoiding creation of these ints can improve performance of BytesIO.writelines() especially

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

2018-08-24 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8374 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34488> ___ ___ Py

[issue34573] Simplify __reduce__() of set and dict iterators.

2018-09-03 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Currently __reduce__() implementation of set and dict iterators saves items to list using next/PyList_Append(), it could be simplified by using PySequence_List(). -- components: Interpreter Core messages: 324550 nosy: sir-sigurd priority: normal

[issue34573] Simplify __reduce__() of set and dict iterators.

2018-09-03 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8512 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34573> ___ ___ Py

[issue34574] OrderedDict iterators are exhausted during pickling

2018-09-03 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : In [1]: from collections import OrderedDict In [2]: od = OrderedDict.fromkeys(range(10)) In [3]: it = iter(od) In [4]: it.__reduce__() Out[4]: (, ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9],)) In [5]: list(it) Out[5]: [] -- messages: 324551 nosy: sir

[issue34574] OrderedDict iterators are exhausted during pickling

2018-09-03 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8513 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34574> ___ ___ Py

[issue1621] Do not assume signed integer overflow behavior

2018-09-04 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- pull_requests: +8519 ___ Python tracker <https://bugs.python.org/issue1621> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34574] OrderedDict iterators are exhausted during pickling

2018-09-05 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: Other iterators either don't support pickling or aren't mutated during pickling: In [10]: it = iter({1}) In [11]: pickle.dumps(it) Out[11]: b'\x80\x04\x95\x1e\x00\x00\x00\x00\x00\x00\x00\x8c\x08builtins\x94\x8c\x04iter\x94\x93\x94]\x94K\x0

[issue34599] improve performance of _Py_bytes_capitalize()

2018-09-06 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : Currently _Py_bytes_capitalize() checks case before using conversion table, performance can be improved by using conversion table unconditionally. Benchmarks: $ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s "b

[issue34599] improve performance of _Py_bytes_capitalize()

2018-09-06 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8541 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34599> ___ ___ Py

[issue1621] Do not assume signed integer overflow behavior

2018-09-11 Thread Sergey Fedoseev
Sergey Fedoseev added the comment: > Now you rely on PyMem_Malloc() to detect the overflow. Now overflow is not possible or am I missing something? -- nosy: +sir-sigurd ___ Python tracker <https://bugs.python.org/iss

[issue34749] improve performance of binascii.a2b_base64()

2018-09-20 Thread Sergey Fedoseev
New submission from Sergey Fedoseev : I reworked implementation of binascii.a2b_base64() and there is significant speedup: $ python -m perf timeit --compare-to ~/tmp/cpython-master-venv/bin/python -s "from binascii import b2a_base64, a2b_base64; s = b2a_base64(1000 * b'b')&

[issue34749] improve performance of binascii.a2b_base64()

2018-09-20 Thread Sergey Fedoseev
Change by Sergey Fedoseev : -- keywords: +patch pull_requests: +8859 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue34749> ___ ___ Py

[issue34751] Hash collisions for tuples

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

[issue21165] Optimize str.translate() for replacement with substrings and non-ASCII strings

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

[issue32788] Better error handling in sqlite3

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

[issue34898] add mtime argument to gzip.compress

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

[issue28397] Faster index range checks

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

[issue23460] Decimals do not obey ':g' exponential notation formatting rules

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

[issue34995] functools.cached_property does not maintain the wrapped method's __isabstractmethod__

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

[issue18873] "Encoding" detected in non-comment lines

2013-09-06 Thread Sergey Vishnikin
Sergey Vishnikin added the comment: -cookie_re = re.compile("coding[:=]\s*([-\w.]+)") +cookie_re = re.compile("#[^\r\n]*coding[:=]\s*([-\w.]+)") Regex matches only if the encoding expression is preceded by a comment. -- keywords: +patch nosy: +armic

[issue9253] argparse: optional subparsers

2014-05-23 Thread Sergey Vilgelm
Changes by Sergey Vilgelm : -- nosy: +svilgelm ___ Python tracker <http://bugs.python.org/issue9253> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11159] Sax parser crashes if given unicode file name

2013-01-11 Thread Sergey Prokhorov
Changes by Sergey Prokhorov : -- nosy: +Sergey.Prokhorov ___ Python tracker <http://bugs.python.org/issue11159> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue10614] ZipFile: add a filename_encoding argument

2013-10-18 Thread Sergey Dorofeev
Sergey Dorofeev added the comment: I'd like to submit patch to support zip archives created on systems that use non-US codepage (e.g. russian CP866). Codepage would be specified in additional parameter of ZipFile constructor, named "codepage". If it is not specified, old behavi

[issue10614] ZipFile: add a filename_encoding argument

2013-10-18 Thread Sergey Dorofeev
Sergey Dorofeev added the comment: OK, here you are: --- zipfile.py-orig 2013-09-18 16:45:56.0 +0400 +++ zipfile.py 2013-10-19 01:59:07.444346674 +0400 @@ -885,7 +885,7 @@ fp = None # Set here since __del__ checks it _windows_illegal_name_trans_table

[issue5952] AttributeError exception in urllib.urlopen

2009-05-06 Thread Sergey Prigogin
New submission from Sergey Prigogin : File "/usr/grte/v1/piii-linux/lib/python2.4/urllib.py", line 82, in urlopen return opener.open(url) File "/usr/grte/v1/piii-linux/lib/python2.4/urllib.py", line 190, in open return getattr(self, name)(url) File "/u

[issue5952] AttributeError exception in urllib.urlopen

2009-05-07 Thread Sergey Prigogin
Sergey Prigogin added the comment: The problem is pretty obvious from the code. URLopener.open_http contains the following code: if data is not None: h.send(data) errcode, errmsg, headers = h.getreply() fp = h.getfile() if errcode == 200

[issue3073] Cookie.Morsel breaks in parsing cookie values with whitespace

2010-05-20 Thread Sergey Kirillov
Changes by Sergey Kirillov : -- nosy: +rushman ___ Python tracker <http://bugs.python.org/issue3073> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9182] argparse: optional argument w/ narg='+' conflicts w/ positional argsument

2010-07-06 Thread Sergey Konoplev
New submission from Sergey Konoplev : Hello, I am starting to use argparse package and faced the problem where an optional argument w/ nargs='+' conflicts w/ a positional argument. Here is the test case: >>> import argparse >>> p = argparse.ArgumentParser() &g

[issue9182] document “--” as a way to disti nguish option w/ narg='+' from positional argument in arg parse

2010-07-06 Thread Sergey Konoplev
Sergey Konoplev added the comment: Thank you for the hint. It is realy not so obvious. May be it is worth to add "--" into the usage string this way usage: [-h] [-b BAR [BAR ...]] -- foo Otherwise it leads to misunderstanding. --

[issue26545] os.walk is limited by python's recursion limit

2016-06-10 Thread Sergey Chvalyuk
Sergey Chvalyuk added the comment: There is another limitation with os.walk it also cannot go very deep inside tree because of scandir can throw OSError(36, 'File name too long') I have wrote tests for both cases: https://gist.github.com/grubberr/3367f1d605e292103b576a17a46ef3c3

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-07 Thread Sergey Litvinov
New submission from Sergey Litvinov: Bisection algorithms use mid = (lo+hi)//2 Textbook formula is mid = (hi-lo)//2 + lo See http://en.wikipedia.org/w/index.php?title=Binary_search_algorithm&oldid=634658510#Arithmetic For "vanilla" lists and integers it is not a problem but on

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-11 Thread Sergey Litvinov
Sergey Litvinov added the comment: mark.dickinson> do you have an example of the Lib/bisect.py code No. I was thinking about something hypothetical similar to the one you provided. rhettinger> The "textbook" formula is more important in languages rhettinger> without somethi

[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-15 Thread Sergey Shashkov
New submission from Sergey Shashkov: __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented when modulo is a class without __rtruediv__ or __mul__. Code sample: class Foo(object): def __rdivmod__(self, other): return 'rdivmod works&#

<    1   2   3   >