[issue43075] ReDoS in request

2021-01-30 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- stage: -> needs patch versions: +Python 3.10 ___ Python tracker <https://bugs.python.org/issue43075> ___ ___ Python-bugs-lis

[issue24275] lookdict_* give up too soon

2021-01-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Please test also creating a large dict with string-only or non-string keys. Since you add a code in insertdict() it can potentially affects performance. -- ___ Python tracker <https://bugs.python.org/issue24

[issue43083] Minor errors related to error handling in _sqlite3 module

2021-01-31 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : There are few minor errors in the _sqlite3: * In two places the result of PyList_Append() is not checked. * The lastrowid field of pysqlite_Cursor can contain a reference to destroyed object when GIL is released for calling sqlite3_last_insert_rowid

[issue43083] Minor errors related to error handling in _sqlite3 module

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +23209 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24395 ___ Python tracker <https://bugs.python.org/issu

[issue43030] signed/unsigned mismatch in Py_UNICODE_ISSPACE macro

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 42b1806af90b86ec393ca7da14e99ce95ec6c53b by Serhiy Storchaka in branch 'master': bpo-43030: Fixed a compiler warning in Py_UNICODE_ISSPACE with signed wchar_t (GH-24350) https://github.com/python/cpyt

[issue43080] pprint for dataclass instances

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: For all other classes we check that there is no user defined __repr__. But it is difficult to check this for dataclass or namedtuple because there is no base class for dataclasses or namedtuples which provides standard __repr__ implementation. All

[issue43084] curses.window.enclose() should return bool

2021-01-31 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : curses.window.enclose() is the only curses wrapper which returns 0/1 while the original function is declared returning bool. https://linux.die.net/man/3/wenclose -- components: Extension Modules messages: 386021 nosy: serhiy.storchaka priority

[issue43030] signed/unsigned mismatch in Py_UNICODE_ISSPACE macro

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 229ef39bcc14ee7838968dfda51d045304e5cf39 by Miss Islington (bot) in branch '3.8': bpo-43030: Fixed a compiler warning in Py_UNICODE_ISSPACE with signed wchar_t (GH-24350) (GH-24397) https://github.com/python/cpyt

[issue43030] signed/unsigned mismatch in Py_UNICODE_ISSPACE macro

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- components: +C API -Extension Modules resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.10, Python 3.8 ___ Python tracker <https://bugs.python.or

[issue43080] pprint for dataclass instances

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Good idea Eric, it should work. But it can make the code of pprint potentially less flexible. Currently it uses a mapping which maps __repr__ to corresponding pprint implementation. Only exception is for dicts, for historical reasons. It potentially can

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset d64fd4bb5bb4fd2e3277f39d3ad99b5a8d193e1b by Serhiy Storchaka in branch 'master': bpo-43016: Rewrite tests for curses (GH-24312) https://github.com/python/cpython/commit/d64fd4bb5bb4fd2e3277f39d3ad99b

[issue43084] curses.window.enclose() should return bool

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +23212 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24398 ___ Python tracker <https://bugs.python.org/issu

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +23213 pull_request: https://github.com/python/cpython/pull/24399 ___ Python tracker <https://bugs.python.org/issue43

[issue43083] Minor errors related to error handling in _sqlite3 module

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 9073180db521dc83e6216ff0da1479d00167f643 by Serhiy Storchaka in branch 'master': bpo-43083: Fix error handling in _sqlite3 (GH-24395) https://github.com/python/cpython/commit/9073180db521dc83e6216ff0da1479

[issue43083] Minor errors related to error handling in _sqlite3 module

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset e9d4960d15c5282904cf26e469ce7cee39f634f7 by Serhiy Storchaka in branch '3.9': [3.9] bpo-43016: Rewrite tests for curses (GH-24312). (GH-24399) https://github.com/python/cpython/commit/e9d4960d15c5282904cf26e469ce7c

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +23215 pull_request: https://github.com/python/cpython/pull/24401 ___ Python tracker <https://bugs.python.org/issue43

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 7ca947e93bff2b9d78312dc8ed8e0a2b7d25d3f3 by Serhiy Storchaka in branch '3.8': [3.8] bpo-43016: Rewrite tests for curses (GH-24312). (GH-24399) (GH-24401) https://github.com/python/cpython/commit/7ca947e93bff2b9d78312dc8ed8e0a

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue12669] test_curses skipped on buildbots

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> out of date stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue41604] [curses.panel] Failed panel.set_userptr will decrement refcount of original userptr

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 3243e8a4b4b4cf321f9b28335d565742a34b1976 by Anonymous Maarten in branch 'master': bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933) https://github.com/python

[issue41604] [curses.panel] Failed panel.set_userptr will decrement refcount of original userptr

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +23218 pull_request: https://github.com/python/cpython/pull/24403 ___ Python tracker <https://bugs.python.org/issue41

[issue27067] Improve curses tests

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Continued in issue42789 and issue43016. -- status: open -> closed ___ Python tracker <https://bugs.python.org/issu

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Failures on buildbots: https://buildbot.python.org/all/#/builders/506/builds/765 == ERROR: test_output_character (test.test_curses.TestCurses

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +23220 stage: resolved -> patch review pull_request: https://github.com/python/cpython/pull/24405 ___ Python tracker <https://bugs.python.org/issu

[issue41604] [curses.panel] Failed panel.set_userptr will decrement refcount of original userptr

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 3c8d6934436e20163be802f5239c5b4e4925eeec by Serhiy Storchaka in branch '3.9': [3.9] bpo-41604: Don't decrement the reference count of the previous user_ptr when set_panel_usertpr fails (GH-21933). (GH-24403) https://github.com

[issue41604] [curses.panel] Failed panel.set_userptr will decrement refcount of original userptr

2021-01-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: -Python 3.5, Python 3.6, Python 3.7 ___ Python tracker <https://bugs.python.or

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset a1e9a1e120a11c563e166c15721169184c802f8b by Serhiy Storchaka in branch 'master': bpo-43016: Fix test_curses on platform without cursesw (GH-24405) https://github.com/python/cpython/commit/a1e9a1e120a11c563e166c15721169

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 304f9d2622fa4fd0833d60d31ddf7321a6a8141b by Miss Islington (bot) in branch '3.9': bpo-43016: Fix test_curses on platform without cursesw (GH-24405) (GH-24407) https://github.com/python/cpython/commit/304f9d2622fa4fd0833d60d31ddf73

[issue43016] Improve tests for curses

2021-01-31 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset aab84a58063e68cb7ff5f7b8d96c431200d0e340 by Miss Islington (bot) in branch '3.8': bpo-43016: Fix test_curses on platform without cursesw (GH-24405) (GH-24408) https://github.com/python/cpython/commit/aab84a58063e68cb7ff5f7b8d96c43

[issue43016] Improve tests for curses

2021-02-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue43016> ___ ___ Pyth

[issue43089] The optional argument to random.Random() is called "x" not "seed"

2021-02-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +mark.dickinson, rhettinger ___ Python tracker <https://bugs.python.org/issue43089> ___ ___ Python-bugs-list mailin

[issue42899] Is it legal to eliminate tests of a value, when that test has no effect on control flow?

2021-02-02 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: `True or b` is always True and differs from `b or True`. `x = True and y` is always equivalent to `x = y`. What is the use case of your optimization? Can you provide examples of real code which would benefit from removing all boolean tests (not only the

[issue43132] Incorrect handling of PyObject_RichCompareBool() in the _zoneinfo module

2021-02-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset effaec0bb54f381db8ccfa62514bc26b00946b40 by Zackery Spytz in branch 'master': bpo-43132: Fix incorrect handling of PyObject_RichCompareBool() in _zoneinfo (GH-24450) https://github.com/python/cpyt

[issue43132] Incorrect handling of PyObject_RichCompareBool() in the _zoneinfo module

2021-02-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43132] Incorrect handling of PyObject_RichCompareBool() in the _zoneinfo module

2021-02-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c8b4375fe1aca1188f57ecf482547abd77e3ef91 by Miss Islington (bot) in branch '3.9': bpo-43132: Fix incorrect handling of PyObject_RichCompareBool() in _zoneinfo (GH-24450) (GH-24457) https://github.com/python/cpyt

[issue43133] Accept file mode "rw" to open-or-create a file and seek to the start

2021-02-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Open modes "r", "r+", "w", "w+", "a", "a+" are supported by C function fopen() and similar functions in other languages. Would not "rw" be confusing? Are there fopen-like functions i

[issue43132] Incorrect handling of PyObject_RichCompareBool() in the _zoneinfo module

2021-02-05 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: needs patch -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43132] Incorrect handling of PyObject_RichCompareBool() in the _zoneinfo module

2021-02-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Sorry, I thought I just forgot to close this issue. -- resolution: fixed -> stage: resolved -> needs patch status: closed -> open ___ Python tracker <https://bugs.python.or

[issue41754] Webbrowser Module Cannot Find xdg-settings on OSX

2021-02-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Is it possible that your PATH contains a non-directory? Because it can give results a NotADirectoryError: >>> subprocess.check_output(['xdg-settings', 'get', 'default-web-browser'], >>> env={'PATH'

[issue40361] Darwin systems using win settings for webbrowser.py

2021-02-08 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- status: open -> closed ___ Python tracker <https://bugs.python.org/issue40361> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue43101] Add deprecation of float limits for resource to documentation

2021-02-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This change was indirectly documented in What's New for 3.8 (deprecation) https://docs.python.org/3.8/whatsnew/3.8.html#build-and-c-api-changes: """ Functions that convert Python number to C integer like PyLong_AsLong() and argument pa

[issue43165] Support the same files with new param in shutil.copyfile

2021-02-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can use try/except. try: shutil.copyfile("test.txt", "test.txt") except SameFileError: pass -- nosy: +serhiy.storchaka ___ Python tracker <https://bug

[issue43213] Shortcut for checking if PurePath object contains str

2021-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Path is not string, and it was made not string-like intentionally. Otherwise it would be made a subclass of str. If you want to check whether a string is a substring of the string representation of the path, just do it explicitly: 'share' i

[issue43213] Shortcut for checking if PurePath object contains str

2021-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I guess that you need to use the parts attribute. Note that `'share' in str(path)` and `'share' in path.parts` are two very different things, even if they can give the same result in some cases. When reply be email, please remove the q

[issue43205] Python Turtle Colour

2021-02-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If issue24990 is closed, this issue should be closed as well, as it is just a particular case of issue24990. -- nosy: +serhiy.storchaka resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Foreign languag

[issue43222] Regular expression split fails on 3.6 and not 2.7 or 3.7+

2021-02-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There was a bug in the regular expression engine which caused re.split() working incorrectly with zero-width patterns. Note that in your example _DIGIT_BOUNDARY_RE.split("10.0.0") returns ['10.0.0'] on Python 2.7 -- the result which y

[issue43217] tkinter style map return value in alt theme

2021-02-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What is our OS and Python version. I cannot reproduce this on Linux, perhaps it is OS-specific. Try to test with the latest Python release. Maybe this bug was fixed in issue42328. -- nosy: +serhiy.storchaka

[issue43217] tkinter style map return value in alt theme

2021-02-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Tested on Python 3.8.6 and 3.8.7+, Windows 10. On 3.8.6 the bug is reproduced, on 3.8.7+ all works as expected. -- resolution: -> out of date stage: -> resolved status: open -> closed superseder: -> ttk style.map function incorrectly

[issue34013] Inconsistent SyntaxError for print

2021-02-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Would it be too much if add a Python 2 rule for print statement in grammar to produce better error message? invalid_print_stmt: | 'print' ( test (',' test)* [','] ] | '>>' test [ (',&#x

[issue43246] Dict copy optimization violates subclass invariant

2021-02-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The choice of testing __iter__ was because OrderedDict overrides __iter__, and since dicts are ordered now, the order of insertion does matter. -- nosy: +serhiy.storchaka ___ Python tracker <ht

[issue43255] Ceil division with /// operator

2021-02-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since adding new operator is a syntax-level change, it needs a PEP. It is better to start with discussing on the Python-ideas mailing list (https://mail.python.org/mailman3/lists/python-ideas.python.org/). Let's see if this idea will be accepted favo

[issue43251] sqlite3_column_name() failures should raise MemoryError

2021-02-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Well, it returns NULL in case of out of memory, but is it the only cause? Can NULL be returned for other reasons? -- ___ Python tracker <https://bugs.python.org/issue43

[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-02-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is a kind of optimization. We first perform few fast checks for exact types, and then slower subclass checks. I do not know whether this optimization is worth, but it was written so, and there is nothing wrong in it. -- nosy: +serhiy.storchaka

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It also returns NULL if the column name was not set (is it even possible?). -- ___ Python tracker <https://bugs.python.org/issue43

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Investigate where column names are initialized and whether is it possible to get them NULLs. The array of column names is filled with NULLs when initialized and later it is filled with references to strings. I am wondering whether there is a gap between

[issue43276] add `false` and `true` keywords (aliases) for True and False

2021-02-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: You can do it yourself in your script. It is just two lines of code: true = True false = False And it works in all Python versions! -- nosy: +serhiy.storchaka resolution: -> rejected stage: -> resolved status: open -&g

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Please go ahead! -- ___ Python tracker <https://bugs.python.org/issue43251> ___ ___ Python-bugs-list mailing list Unsub

[issue43267] [sqlite3] Redundant type checks in pysqlite_statement_bind_parameter()

2021-02-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PyLong_Check is two memory reads, bits operation, and comparison with 0. And one non-inlined function call when limited API is used. PyLong_CheckExact is only one memory read and comparison. I am not sure that the difference is significant enough to

[issue43251] [sqlite3] sqlite3_column_name() failures should raise MemoryError

2021-02-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could you please give a link to the discussion? -- ___ Python tracker <https://bugs.python.org/issue43251> ___ ___ Python-bug

[issue43290] [sqlite3] remove legacy code from pysqlite_step

2021-02-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Look at issue in which the workaround was added. Does it contain some examples? -- ___ Python tracker <https://bugs.python.org/issue43

[issue43340] json.load() can raise UnicodeDecodeError, but this is not documented

2021-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: json.loads() accepts also data encoded with UTF-16 and UTF-32. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue43

[issue43350] [sqlite3] Active statements are reset twice in _pysqlite_query_execute()

2021-03-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There are three calls of pysqlite_statement_reset() in _pysqlite_query_execute(). And all three of them can be called with the same statement object. But repeated calls are no-ops because pysqlite_statement_reset() clears flag in_use and calls

[issue43399] xml.etree.ElementTree.extend does not work with iterators when using the Python implementation

2021-03-04 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Your proposed fix LGTM. Please open a PR. Don't forget about test and NEWS entry. -- ___ Python tracker <https://bugs.python.org/is

[issue43416] Add README files in Include/cpython and Include/internal

2021-03-06 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : I always hesitate in what subdirectory of Include/ to add a declaration of new private API. What is more "private"? It would be nice to add README files in these directories which describe what API should be declared here and what is the

[issue43413] tuple subclasses allow kwargs

2021-03-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Hmm, but in my experience, tuple on Python 3.6 doesn't take keyword arguments > either: They do. >>> tuple(sequence='abc') ('a', 'b', 'c') >>> list(sequence='abc') ['a&

[issue43432] Add function `clear` to the `os` module

2021-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If you write a flexible Text ui program, you should use functions provided by a text ui library which you use to clear the screen or a part of screen. If you want to call an external command, use os.system(), os.popen() or more flexible subprocess module

[issue43443] Should shelve support dict union?

2021-03-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The comment is outdated. Shelf objects also do not support methods copy and fromkey. Creating a new Shelve object without specifying a new underlying database object does not make much sense. Maybe say that they implement the MutableMapping interface

[issue43462] canvas.bbox returns None on 'hidden' items while coords doesn't

2021-03-10 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What do you mean by "return nothing not even None"? Does it hang? -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.o

[issue40681] shelve.open() should accept pathlib.Path

2020-05-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Support pathlike objects on dbm/shelve ___ Python tracker <https://bugs.python

[issue40668] Catastrophic loss of precision in colorsys module

2020-05-19 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is correct. Colorspaces for RGB an YIQ are different. Not all RGB colors can be represented in YIQ and vice versa. For YIQ color (0, 1, 0) you need RGB color (0.9468822170900693, -0.27478764629897834, -1.1085450346420322), but the G and B components

[issue40682] random.Random.seed() with version=1 does not consistently match Python 2 behavior

2020-05-19 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +mark.dickinson, rhettinger ___ Python tracker <https://bugs.python.org/issue40682> ___ ___ Python-bugs-list mailin

[issue40702] frozensets should not allow the |= operator

2020-05-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is okay. In this case `a |= b` is equivalent to `a = a | b`. The same behavior is for tuples, strings, and other non-mutable collections: t = (1, 2) t += (3, 4) s = 'ab' s += 'cd' And even for numbers! i = 5 i += 1 -- nos

[issue40670] supplying an empty string to timeit causes an IndentationError

2020-05-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Accepting an empty string in CLI is just an artifact of the implementation. There was no intention to support it. It will fail if pass a space: ./python -m timeit ' ' or two empty arguments: IndentationError: ./python -m timeit '

[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-21 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +gregory.p.smith ___ Python tracker <https://bugs.python.org/issue40701> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40731] CWI url's protocol on LICENSE file from http to https

2020-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The text of the license cannot be changed without consulting with lawyers. -- nosy: +gvanrossum, serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue40568] Modify -c command-line option to accept multiple inputs

2020-05-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It would be breaking change. In addition to multiline strings you can use \n with $' on Posix: python -c $'with open("somefile.txt") as f:\n s = f.read()\n print(len(s))' Maybe there is similar feature on Windows, but in

[issue40752] Implement PurePath.__len__

2020-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The length of the object is the number of some items in the object. It is usually tied with iteration: len(obj) == len(list(obj)). Is this true for PurePath? -- nosy: +serhiy.storchaka ___ Python tracker

[issue40753] Remove Python 2 compatibility code from pathlib

2020-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This code is valid in Python 3. We usually do not accept such pure cosmetic changes. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue40752] Implement PurePath.__len__

2020-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: If it is not iterable, the length does not make sense. Do you expect also len(-123) == 4? -- ___ Python tracker <https://bugs.python.org/issue40

[issue40752] Implement PurePath.__len__

2020-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Path is not a string with bells and whistles. It was intentionally made not a string subclass because some string operations (including len()) just do not make sense for path or are ambiguous. I am closing this as it goes against the initial design of

[issue40753] Remove Python 2 compatibility code from pathlib

2020-05-24 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +pitrou ___ Python tracker <https://bugs.python.org/issue40753> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue40753] Remove Python 2 compatibility code from pathlib

2020-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Similar cleanup (and many many others) was proposed when pathlib was initially added to the stdlib. They were rejected, so now we need a new discussion to revise the old decision. See issue20002. -- ___ Python

[issue40160] documentation example of os.walk should be less destructive

2020-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 1. There is already a warning before example. 2. Even if you blindly copy-paste the example it will not work. You have to set the top variable. So I don't see any problem here. You always can shoot yourself in the foot if try e

[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Maybe just document that tempdir should be a string? -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: In any case this is a new feature, so it can be added only in 3.10, and we need the documentation patch for 3.9 and older. As a workaround you can use os.fsdecode(): tempfile.tempdir = os.fsdecode(b'/doesnt

[issue40762] Writing bytes using CSV module results in b prefixed strings

2020-05-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: According to the documentation (https://docs.python.org/3/library/csv.html#writer-objects): """ A row must be an iterable of strings or numbers for Writer objects and a dictionary mapping fieldnames to strings or numbers (by passing th

[issue40761] unittest.TestCase.asserTrue return True even if the expr is False

2020-05-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: assertTrue() always returns None, but its returned value is irrelevant, because it is only used for its side effect. -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue40

[issue35714] Document that the null character '\0' terminates a struct format spec

2020-05-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 3f59b55316f4c6ab451997902579aa69020b537c by Zackery Spytz in branch 'master': bpo-35714: Reject null characters in struct format strings (GH-16928) https://github.com/python/cpython/commit/3f59b55316f4c6ab451997902579aa

[issue35714] Document that the null character '\0' terminates a struct format spec

2020-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Zackery, do you mind to create a backport to 3.8? -- ___ Python tracker <https://bugs.python.org/issue35714> ___ ___ Pytho

[issue40762] Writing bytes using CSV module results in b prefixed strings

2020-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It would be confusing. There would be the encoding argument for open() to encode strings to bytes and the encoding argument for csv.writer() to decode bytes to strings. The latter will be ignored in all normal cases (for strings and numbers

[issue35714] Document that the null character '\0' terminates a struct format spec

2020-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 5ff5edfef63b3dbc1abb004b3fa4b3db87e79ff9 by Zackery Spytz in branch '3.8': [3.8] bpo-35714: Reject null characters in struct format strings (GH-16928) (GH-20419) https://github.com/python/cpyt

[issue37999] No longer use implicit convertion to int with loss

2020-05-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 578c3955e0222ec7b3146197467fbb0fcfae12fe by Serhiy Storchaka in branch 'master': bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636) https://github.com/python/cpython/commit/578c3955e0222ec7b3146197467fbb

[issue37999] No longer use implicit convertion to int with loss

2020-05-26 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +19693 pull_request: https://github.com/python/cpython/pull/20437 ___ Python tracker <https://bugs.python.org/issue37

[issue40792] Make PyNumber_Index() always returning an exact int instance

2020-05-27 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently PyNumber_Index() can return something that's an instance of a strict subclass of int. For example PyNumber_Index(Py_True) returns Py_True. The same for operator.index(): >>> import operator >>> operator.index(True) True

[issue40792] Make PyNumber_Index() always returning an exact int instance

2020-05-27 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch pull_requests: +19699 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20443 ___ Python tracker <https://bugs.python.org/issu

[issue40792] Make PyNumber_Index() always returning an exact int instance

2020-05-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This change conflicts with the test added in issue26202. We perhaps should revert issue26202. This can also affect the user code which depends on range() attributes start, stop and step being instances of the int subclass

[issue40762] Writing bytes using CSV module results in b prefixed strings

2020-05-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since Pandas opens an output file it has control on what encoding is used. It is a Pandas' responsibility to decode bytes, or raise an exception, or just ignore the problem if it is pretty uncommon case. Pandas already have a complex code for forma

[issue40793] print() performance problem with very large numbers

2020-05-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is not a print() problem, it is a problem with converting an integer to decimal string representation. AFAIK it has quadratic complexity from the size of the integer. -- nosy: +mark.dickinson, serhiy.storchaka

[issue40701] tempfile mixes str and bytes in an inconsistent manner

2020-05-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Well, the behavior for an existing bytes path was not unintended, but some people can depend on it. But before making it an official feature, we should also check other cases of an unintended behavior. What if set tempfile.tempdir to a Path object or to a

<    29   30   31   32   33   34   35   36   37   38   >