Re: [Python-Dev] cpython: Uniformize argument names of "call" functions

2016-11-30 Thread Serhiy Storchaka
On 29.11.16 19:58, victor.stinner wrote: https://hg.python.org/cpython/rev/7efddbf1aa70 changeset: 105395:7efddbf1aa70 user:Victor Stinner date:Tue Nov 29 18:47:56 2016 +0100 summary: Uniformize argument names of "call" functions * Callable object: callable, o, callable_obje

Re: [Python-Dev] cpython: Uniformize argument names of "call" functions

2016-11-30 Thread Serhiy Storchaka
On 30.11.16 11:15, Victor Stinner wrote: 2016-11-30 10:01 GMT+01:00 Serhiy Storchaka : Uniformize argument names of "call" functions * Callable object: callable, o, callable_object => func * Object for method calls: o => obj * Method name: name or nameid => method This

Re: [Python-Dev] cpython: Revert unintended merge

2016-12-03 Thread Serhiy Storchaka
On 03.12.16 22:13, steve.dower wrote: https://hg.python.org/cpython/rev/a60767015bed changeset: 105436:a60767015bed user:Steve Dower date:Sat Dec 03 12:12:23 2016 -0800 summary: Revert unintended merge I suppose it should be reverted in the 3.6 branch too. ___

Re: [Python-Dev] PyPy progress: list of CPython 3.5 crashers and bugs

2016-12-05 Thread Serhiy Storchaka
On 05.12.16 20:38, Terry Reedy wrote: I believe that this item in your list is a design choice rather than a bug. "* _collectionsmodule.c: deque_repr uses "[...]" as repr if recursion is detected. I'd suggest that "deque(...)" is clearer---it's not a list." I strongly suspect that Raymond H.

Re: [Python-Dev] List mutation in list_repr?

2016-12-07 Thread Serhiy Storchaka
On 07.12.16 12:19, Patrick Westerhoff wrote: On Tue, Dec 6, 2016 at 5:32 PM, Random832 wrote: It *shouldn't*, but it can't be enforced. It's one of those things where if Python assumes all user code is sane (in this case, overridden __repr__ not messing with the list) it can bite in a way that

Re: [Python-Dev] PyObject_CallFunction(func, "O", arg) special case

2016-12-09 Thread Serhiy Storchaka
On 09.12.16 19:46, Victor Stinner wrote: The PyObject_CallFunction() function has a special case when the format string is "O", to pass exactly one Python object: * If the argument is a tuple, the tuple is unpacked: it behaves like func(*arg) * Otherwise, it behaves like func(arg) This case is

Re: [Python-Dev] PyObject_CallFunction(func, "O", arg) special case

2016-12-09 Thread Serhiy Storchaka
On 09.12.16 19:46, Victor Stinner wrote: Last days, I patched functions of PyObject_CallFunction() family to use internally fast calls. I implemented the special case to keep backward compatibility. I replaced a lot of code using PyObject_CallFunction() with PyObject_CallFunctionObjArgs() when t

Re: [Python-Dev] Someons's put a "Python 2.8" on GitHub

2016-12-10 Thread Serhiy Storchaka
On 10.12.16 07:56, Larry Hastings wrote: "Python 2.8 is a backwards-compatible Python interpreter with new features from Python 3.x. It was produced by forking Python 2.7.12 and backporting some of the new syntax, builtins, and libraries from Python 3. Python code and C-extensions targeting Pytho

Re: [Python-Dev] Making sure dictionary adds/deletes during iteration always raise exception

2016-12-13 Thread Serhiy Storchaka
On 13.12.16 11:51, Max Moroz wrote: Would it be worth ensuring that an exception is ALWAYS raised if a key is added to or deleted from a dictionary during iteration? Currently, dict.__iter__ only raises "RuntimeError" when "dictionary changed size during iteration". I managed to add 1 key and de

Re: [Python-Dev] PyObject_CallFunction(func, "O", arg) special case

2016-12-15 Thread Serhiy Storchaka
On 15.12.16 10:45, Victor Stinner wrote: > Ah? It's possible that I forgot to update the documentation of some > functions. But sorry, I don't see where. Can you point me which file > is outdated please? https://docs.python.org/3/c-api/object.html#c.PyObject_CallMethod Seems online documentation

Re: [Python-Dev] Deprecate `from __future__ import unicode_literals`?

2016-12-17 Thread Serhiy Storchaka
On 16.12.16 21:24, Guido van Rossum wrote: e.g. the argument to getattr() -- I still hear of code that breaks due to this occasionally) What is the problem with unicode in getattr()? Unicode attribute name is converted to str, and since the result is cached, this even don't add much overhead.

Re: [Python-Dev] Deprecate `from __future__ import unicode_literals`?

2016-12-17 Thread Serhiy Storchaka
On 17.12.16 13:44, Christian Heimes wrote: On 2016-12-17 10:06, Serhiy Storchaka wrote: On 16.12.16 21:24, Guido van Rossum wrote: e.g. the argument to getattr() -- I still hear of code that breaks due to this occasionally) What is the problem with unicode in getattr()? Unicode attribute

[Python-Dev] Constifying C API

2016-12-18 Thread Serhiy Storchaka
Originally C API didn't use the const qualifier. Over few last years the const qualifier was added to C API if that preserved backward compatibility. For example input "char *" parameters were changed to "const char *". This makes C API compatible with C++, eliminates C compiler warnings, and h

Re: [Python-Dev] Issue #23903 - stable API is incomplete

2016-12-21 Thread Serhiy Storchaka
On 21.12.16 11:50, Victor Stinner wrote: 2016-12-21 2:52 GMT+01:00 Steve Dower : _PyBytes_DecodeEscape _PyDebug_PrintTotalRefs _PyThreadState_Current _PyTrash_thread_deposit_object _PyTrash_thread_destroy_chain _PyUnicode_DecodeUnicodeEscape _Py_AddToAllObjects _Py_ForgetReference _Py_GetRefTota

[Python-Dev] PySlice_GetIndicesEx annd stable ABI: bikeshedding

2016-12-21 Thread Serhiy Storchaka
Three months ago we discussed about an issue with PySlice_GetIndicesEx(). (https://mail.python.org/pipermail/python-dev/2016-August/145901.html) The problem was that PySlice_GetIndicesEx() takes the size of the sequence, but the size of the sequence can be changed when call custom __index__() m

Re: [Python-Dev] Issue #23903 - stable API is incomplete

2016-12-21 Thread Serhiy Storchaka
On 21.12.16 17:41, Steve Dower wrote: "Ok, now why should _Py_PrintReferences() function be exported?" It probably shouldn't, but it needs an #ifndef Py_LIMITED_API check so it is excluded from the headers (my list was automatically generated). And ideally, private functions that are deliberate

Re: [Python-Dev] PySlice_GetIndicesEx annd stable ABI: bikeshedding

2016-12-22 Thread Serhiy Storchaka
On 22.12.16 12:16, Armin Rigo wrote: On 21 December 2016 at 15:51, Serhiy Storchaka wrote: The code if (PySlice_GetIndicesEx(item, length, &start, &stop, &step, &slicelength) < 0) return -1; should be replaced with if (foo(item, &s

Re: [Python-Dev] PySlice_GetIndicesEx annd stable ABI: bikeshedding

2016-12-26 Thread Serhiy Storchaka
On 21.12.16 19:34, Brett Cannon wrote: On Wed, 21 Dec 2016 at 06:52 Serhiy Storchaka mailto:storch...@gmail.com>> wrote: [SNIP] Let's start bikeshedding. What are your ideas about names and the order of arguments of two following functions? 1. Takes a slice object, r

[Python-Dev] Document C API that is not part of the limited API

2016-12-27 Thread Serhiy Storchaka
From the documentation: https://docs.python.org/3/c-api/stable.html In the C API documentation, API elements that are not part of the limited API are marked as "Not part of the limited API." But they don't. I prepared a sample patch that adds the notes to Unicode Objects and Codecs C AP

Re: [Python-Dev] SystemError: new style getargs format but argument is not a tuple

2017-01-01 Thread Serhiy Storchaka
On 02.01.17 01:23, Terry Reedy wrote: There are several recent question on Stackoverflow about SystemError: new style getargs format but argument is not a tuple PIL/pillow, 2.7, Nov 28, 2016 https://stackoverflow.com/questions/40844212/systemerror-new-style-getargs-format-but-argument-is-not-a-

Re: [Python-Dev] SystemError: new style getargs format but argument is not a tuple

2017-01-05 Thread Serhiy Storchaka
On 05.01.17 06:43, Terry Reedy wrote: On 1/1/2017 6:40 PM, Serhiy Storchaka wrote: On 02.01.17 01:23, Terry Reedy wrote: There are several recent question on Stackoverflow about SystemError: new style getargs format but argument is not a tuple [snip] Resulting from using 3rd party packages

Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-05 Thread Serhiy Storchaka
On 05.01.17 22:37, Alexander Belopolsky wrote: I propose the following: 1. For 3.6, restore and document 3.5 behavior. Recommend that 3rd party types that are both integer-like and buffer-like implement their own __bytes__ method to resolve the bytes(x) ambiguity. The __bytes__ method is used

Re: [Python-Dev] Adding bytes.frombuffer() constructor to PEP 467

2017-01-06 Thread Serhiy Storchaka
On 06.01.17 21:31, Alexander Belopolsky wrote: On Thu, Jan 5, 2017 at 5:54 PM, Serhiy Storchaka mailto:storch...@gmail.com>> wrote: On 05.01.17 22:37, Alexander Belopolsky wrote: 2. For 3.7, I would like to see a drastically simplified bytes(x): 2.1. Accept only o

Re: [Python-Dev] Default formatting

2017-01-22 Thread Serhiy Storchaka
On 25.10.16 12:37, Serhiy Storchaka wrote: Classes that doesn't define the __format__ method for custom PEP 3101 formatting inherits it from parents. Originally the object.__format__ method was designed as [1]: def __format__(self, format_spec): return format(str(self), format

Re: [Python-Dev] adding threaded tests to the test suite

2017-01-22 Thread Serhiy Storchaka
On 22.01.17 22:02, Ethan Furman wrote: Question: I need to add a threaded test to the enum test module [1] -- is there anything extra I need to worry about besides the test itself? Setting or resetting or using a tool library, etc? You can use the test.support.start_threads() context manager.

Re: [Python-Dev] re performance

2017-01-28 Thread Serhiy Storchaka
On 28.01.17 20:04, Brett Cannon wrote: Maybe regex should get a mention in the docs like requests does under urllib.request? https://bugs.python.org/issue22594 ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo

Re: [Python-Dev] re performance

2017-01-29 Thread Serhiy Storchaka
On 29.01.17 22:30, Steve Holden wrote: Why not declare re deprecated and remove it in Python 4? I am pretty sure everyone wants to keep re in all 3.x releases, but that support need not extend beyond. So Py4 would have no battery for re, but it would (should!) be common knowledge that regex was t

Re: [Python-Dev] re performance

2017-01-29 Thread Serhiy Storchaka
On 29.01.17 12:18, Jakub Wilk wrote: * Armin Rigo , 2017-01-28, 12:44: The theoretical kind of regexp is about giving a "yes/no" answer, whereas the concrete "re" or "regexp" modules gives a match object, which lets you ask for the subgroups' location, for example. Strange at it may seem, I am n

Re: [Python-Dev] re performance

2017-02-01 Thread Serhiy Storchaka
On 31.01.17 21:40, Wang, Peter Xihong wrote: Regarding to the performance difference between "re" and "regex" and packaging related options, we did a performance comparison using Python 3.6.0 to run some micro-benchmarks in the Python Benchmark Suite (https://github.com/python/performance): Re

Re: [Python-Dev] Translated Python documentation

2017-02-22 Thread Serhiy Storchaka
On 22.02.17 18:15, Victor Stinner wrote: 2017-02-22 16:40 GMT+01:00 Antoine Pitrou : As long as you are asking for "moral" support and not actually vouching for the accuracy of third-party translations, then +1 from me. The main complain about these translations is the accuracy. My bet is tha

Re: [Python-Dev] Split Misc/NEWS into individual files

2017-02-22 Thread Serhiy Storchaka
On 22.02.17 22:59, Victor Stinner wrote: While we are talking about changing things... I would propose to require to specify a module name if a change is in the Library section, and then maybe even group changes per module. Some changes can be related to a couple of modules. _

[Python-Dev] Statistics of documentation changes

2017-02-25 Thread Serhiy Storchaka
For the discussion about translating Python documentation I have collected some statistics. See the attachment. The difference of the documentation between recent feature releases is only 5-7%. Early bugfix releases change about 1-2% of the documentation. The tutorial is more stable. There is

Re: [Python-Dev] Reports on my CPython contributions

2017-03-05 Thread Serhiy Storchaka
On 25.02.17 01:50, Victor Stinner wrote: Recently, I wrote reports of my CPython contributions since 1 year 1/2. Some people on this list might be interested, so here is the list. Nice reading! ___ Python-Dev mailing list Python-Dev@python.org https

Re: [Python-Dev] Set program name through exec -a or environment variable

2017-03-18 Thread Serhiy Storchaka
On 18.03.17 15:15, Freddy Rietdijk wrote: I would like to know if you're open to supporting `exec -a` or an environment variable for setting `argv[0]`, and have some pointers as to where that should be implemented. On Nixpkgs we typically use wrappers to set environment variables like PATH or PY

[Python-Dev] Py_SIZE vs PyXXX_GET_SIZE

2017-03-20 Thread Serhiy Storchaka
What is the preferable way of getting the size of tuple, list, bytes, bytearray: Py_SIZE or PyTuple_GET_SIZE, PyList_GET_SIZE, PyBytes_GET_SIZE, PyByteArray_GET_SIZE? Are macros for concrete types more preferable or they are outdated? On one hand concrete type macros are longer than Py_SIZE, a

Re: [Python-Dev] PyCharm debugger became 40x faster on Python 3.6 thanks to PEP 523

2017-03-25 Thread Serhiy Storchaka
On 25.03.17 12:04, Victor Stinner wrote: https://blog.jetbrains.com/pycharm/2017/03/inside-the-debugger-interview-with-elizaveta-shashkova/ "What changed in Python 3.6 to allow this? The new frame evaluation API was introduced to CPython in PEP 523 and it allows to specify a per-interpreter fun

[Python-Dev] Not all public names in C API have the "Py" prefix

2017-03-27 Thread Serhiy Storchaka
A number of public typedef names without the "Py" prefix survived the Grand Renaming [1]. A couple of new names without the "Py" prefix were added after the Grand Renaming (e.g. getter and setter [2]). That names were included in the Stable ABI. The long list of such names can be found in PEP

Re: [Python-Dev] Not all public names in C API have the "Py" prefix

2017-03-27 Thread Serhiy Storchaka
On 27.03.17 13:43, Victor Stinner wrote: 2017-03-27 12:22 GMT+02:00 Serhiy Storchaka : Should we to do something with this? Maybe add Py-prefixed aliases and temporary keep old names for compatibility (but allow to hide them if define a special macro)? Is is possible to keep backward

Re: [Python-Dev] What version is an extension module binary compatible with

2017-03-28 Thread Serhiy Storchaka
On 28.03.17 14:24, Miro Hrončok wrote: However, recently we found an issue with this approach [1]: an extension module built against Python 3.6.1 cannot be run on Python 3.6.0, because it uses a macro that, in 3.6.1, uses the new PySlice_AdjustIndices function. The macro expanding to PySlice_Ad

[Python-Dev] Guarantee the success of some object creation C API functions

2017-05-01 Thread Serhiy Storchaka
I want to add promises to public C API functions that create trivial instances of immutable basic types (integers 0 and 1, empty tuple, string and bytes object) -- PyLong_FromLong(0), PyLong_FromLong(1), PyTuple_New(0), PyUnicode_FromStringAndSize(NULL, 0), PyUnicode_FromString(""), PyBytes_FromStr

Re: [Python-Dev] Guarantee the success of some object creation C API functions

2017-05-01 Thread Serhiy Storchaka
On 02.05.17 00:52, Chris Angelico wrote: Aside from straight-up bugs, how can one of these functions fail? Is memory allocation failure the only way? Yes, memory allocation failure is the only way. In normal Python build this can happen only at early stage of the interpreter initialization, u

Re: [Python-Dev] Is adding support for os.PathLike an enhancement or bugfix?

2017-05-04 Thread Serhiy Storchaka
On 03.05.17 21:15, Brett Cannon wrote: My allergies have hit me hard so I'm not thinking at full capacity, but did we ever decide if supporting os.PathLike in the stdlib was viewed as an enhancement or bugfix? Specifically I'm thinking of https://bugs.python.org/issue30218 for adding support to s

Re: [Python-Dev] Is adding support for os.PathLike an enhancement or bugfix?

2017-05-04 Thread Serhiy Storchaka
On 04.05.17 21:01, Berker Peksağ wrote: We've already backported a few patches that improves the PEP 519 support in the stdlib with the permission from the release manager of 3.6. I'd ask Ned whether bpo-30218 qualifies for backporting to 3.6. AFAIK it was before releasing 3.6.1. Some users avo

Re: [Python-Dev] Python Tests

2017-05-14 Thread Serhiy Storchaka
On 14.05.17 18:04, Pranav Deshpande wrote: Hello, everyone. I wanted to contribute to Python so I began by following the steps given here: https://docs.python.org/devguide/ WHile executing ./python -m test -j3 I encountered the following error: 383 tests OK. 1 test failed: test_re 21 tes

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Serhiy Storchaka
29.05.17 15:13, Antoine Pitrou пише: I hope readers won't get bothered by what is mostly a link to blogpost (well, two of them :-)), but I suspect there at least 2 or 3 people who might be interested in the following analysis: https://www.corsix.org/content/compilers-cpython-interpreter-main-loop

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Serhiy Storchaka
29.05.17 17:15, Serhiy Storchaka пише: 29.05.17 15:13, Antoine Pitrou пише: I hope readers won't get bothered by what is mostly a link to blogpost (well, two of them :-)), but I suspect there at least 2 or 3 people who might be interested in the following analysis: https://www.corsi

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-29 Thread Serhiy Storchaka
30.05.17 09:06, Greg Ewing пише: Steven D'Aprano wrote: What does "tp" stand for? Type something, I guess. I think it's just short for "type". There's an old tradition in C of giving member names a short prefix reminiscent of the type they belong to. Not sure why, maybe someone thought it help

Re: [Python-Dev] "Micro-optimisations can speed up CPython"

2017-05-30 Thread Serhiy Storchaka
30.05.17 18:38, Guido van Rossum пише: On Mon, May 29, 2017 at 11:16 PM, Serhiy Storchaka <mailto:storch...@gmail.com>> wrote: 30.05.17 09:06, Greg Ewing пише: Steven D'Aprano wrote: What does "tp" stand for? Type something, I guess.

[Python-Dev] Put token information in one place

2017-05-31 Thread Serhiy Storchaka
Currently when you add a new token you need to change a couple of files: * Include/token.h * _PyParser_TokenNames in Parser/tokenizer.c * PyToken_OneChar(), PyToken_TwoChars() or PyToken_ThreeChars() in Parser/tokenizer.c * Lib/token.py (generated from Include/token.h) * EXACT_TOKEN_TYPES in Li

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Serhiy Storchaka
31.05.17 17:11, Victor Stinner пише: I have a question on the CPython coding code for C code, the PEP 7: https://www.python.org/dev/peps/pep-0007/ """ Code structure: (...); braces are strongly preferred but may be omitted where C permits, and they should be formatted as shown: if (mro != NULL)

Re: [Python-Dev] Put token information in one place

2017-05-31 Thread Serhiy Storchaka
31.05.17 20:58, Brett Cannon пише: I assume there's a build rule for Python/graminit.c and porting pgen to Python would require Python be installed to do a build from scratch. Have we made that a requirement yet? If so then rewriting pgen in Python would make it easier to maintain (although whe

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Serhiy Storchaka
31.05.17 20:27, Guido van Rossum пише: I interpret the PEP as saying that you should use braces everywhere but not to add them in code that you're not modifying otherwise. (I.e. don't go on a brace-adding rampage.) If author and reviewer of a PR disagree I would go with "add braces" since that'

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-05-31 Thread Serhiy Storchaka
01.06.17 09:36, Benjamin Peterson пише: Modern GCC can defend against these kinds of problems. If I introduce a "goto fail" bug somewhere in Python, I get a nice warning: ../Objects/abstract.c: In function ‘PyObject_Type’: ../Objects/abstract.c:35:5: warning: this ‘if’ clause does not guard... [-

Re: [Python-Dev] "Global freepool"

2017-06-01 Thread Serhiy Storchaka
01.06.17 12:20, Victor Stinner пише: 2017-06-01 10:40 GMT+02:00 Antoine Pitrou : This is already exactly how PyObject_Malloc() works. (...) Oh ok, good to know... IMHO the main thing the private freelists have is that they're *private* precisely, so they can avoid a couple of conditional bra

Re: [Python-Dev] "Global freepool"

2017-06-01 Thread Serhiy Storchaka
01.06.17 21:44, Larry Hastings пише: p.s. Speaking of freelists, at one point Serhiy had a patch adding a freelist for single- and I think two-digit ints. Right now the only int creation optimization we have is the array of constant "small ints"; if the int you're constructing isn't one of tho

Re: [Python-Dev] Extremely slow test modules

2017-06-03 Thread Serhiy Storchaka
03.06.17 13:31, Antoine Pitrou пише: Is there a reason some of our tests are excruciatingly slow in `-uall` mode? `test_multiprocessing_spawn` is understandable (after all, it will spawn a new executable for each subprocess), but other tests leave me baffled: - test_tools: 7 min 41 sec - test_t

Re: [Python-Dev] Extremely slow test modules

2017-06-03 Thread Serhiy Storchaka
03.06.17 16:01, Antoine Pitrou пише: On Sat, 3 Jun 2017 15:28:18 +0300 Serhiy Storchaka wrote: test_tools (in particular the test for the unparse.py script), test_tokenize, and test_lib2to3 read and proceed every Python file in the stdlib. This is necessary in full test run because some

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-03 Thread Serhiy Storchaka
Yet about braces. PEP 7 implicitly forbids breaking the line before an opening brace. An opening brace should stay at the end the line of the outer compound statement. if (mro != NULL) { ... } else { ... } if (type->tp_dictoffset != 0 && base->tp_dictoffset

Re: [Python-Dev] PEP 7 and braces { .... } on if

2017-06-04 Thread Serhiy Storchaka
03.06.17 23:30, Barry Warsaw пише: On Jun 03, 2017, at 07:25 PM, Serhiy Storchaka wrote: But the latter example continuation lines are intended at the same level as the following block of code. I propose to make exception for that case and allow moving an open brace to the start of the next

[Python-Dev] Handle errors in cleanup code

2017-06-12 Thread Serhiy Storchaka
There is an idiomatic Python code: do_something() try: do_something_other() except: undo_something() raise If an error is raised when execute do_something_other(), then we should first restore the state that was before calling do_something(), and then rerais

Re: [Python-Dev] Issue #21071: change struct.Struct.format type from bytes to str

2017-06-15 Thread Serhiy Storchaka
27.03.17 15:12, Victor Stinner пише: I would like to change struct.Struct.format type from bytes to str. I don't expect that anyone uses this attribute, and struct.Struct() constructor accepts both bytes and str. http://bugs.python.org/issue21071 It's just to be convenient: more functions accep

Re: [Python-Dev] [python-committers] Proposed release schedule for Python 3.5.4

2017-06-21 Thread Serhiy Storchaka
2017-06-22 5:58 GMT+03:00 Larry Hastings : > There have only been two (2) checkins into the 3.4 branch since 3.4.6 was > released back in January: > > f37b0cb230069481609b0bb06891b5dd26320504 > bpo-25008: Deprecate smtpd and point to aiosmtpd > > fa53dbdec818b0f2a0e22ca12a49d83ec948fc91 > I

Re: [Python-Dev] [python-committers] New workflow change: Welcome to blurb

2017-06-23 Thread Serhiy Storchaka
2017-06-24 6:24 GMT+03:00 Larry Hastings : > One minor but ongoing problem we've had in CPython core development has been > the mess of updating Misc/NEWS. Day-to-day developers may have a conflict > if they lose a push race, which means a little editing. You'll have a > similar, if slightly wors

Re: [Python-Dev] New workflow change: Welcome to blurb

2017-06-24 Thread Serhiy Storchaka
24.06.17 11:53, Antoine Pitrou пише: On Fri, 23 Jun 2017 20:24:05 -0700 Larry Hastings wrote: We've been talking about addressing this for years. Fixing this was one of the goals of the new workflow. And finally, as of right now, the future is here. Ladies and gentlemen, I present: blurb.

Re: [Python-Dev] New workflow change: Welcome to blurb

2017-06-24 Thread Serhiy Storchaka
24.06.17 18:57, Larry Hastings пише: On 06/24/2017 01:53 AM, Antoine Pitrou wrote: Would you like to make it 3.5-compatible? 3.6 is quite young and not all systems have it (e.g. Ubuntu 16.04, which many people use, has 3.5). Well, tbh I think that's a bit silly. First of all, it shouldn't be

Re: [Python-Dev] New workflow change: Welcome to blurb

2017-06-24 Thread Serhiy Storchaka
25.06.17 04:51, Nick Coghlan пише: So count me in as a +1 for standardising on a model where: - client-side core-workflow tools are free to use features from the latest released version of Python - we expect core devs to set up a venv or conda env to run those tools if their system Python is too

Re: [Python-Dev] New workflow change: Welcome to blurb

2017-06-24 Thread Serhiy Storchaka
25.06.17 06:04, Nick Coghlan пише: On 25 June 2017 at 11:56, Terry Reedy wrote: On 6/24/2017 7:48 PM, Brett Cannon wrote: I should also mention that after Larry blows up Misc/NEWS into individual files in about a week I will add a check to Bedevere for a news file unless the PR is labeled as t

Re: [Python-Dev] New workflow change: Welcome to blurb

2017-06-25 Thread Serhiy Storchaka
24.06.17 18:57, Larry Hastings пише: On 06/24/2017 01:53 AM, Antoine Pitrou wrote: Would you like to make it 3.5-compatible? 3.6 is quite young and not all systems have it (e.g. Ubuntu 16.04, which many people use, has 3.5). Well, tbh I think that's a bit silly. First of all, it shouldn't be

Re: [Python-Dev] __qualname__ format question

2017-06-25 Thread Serhiy Storchaka
25.06.17 15:06, Christian Tismer пише: by chance, I stumbled over meth_get__qualname__ in methodobject.c and calculate_qualname in descrobject.c . The first uses res = PyUnicode_FromFormat("%S.%s", type_qualname, m->m_ml->ml_name); and the latter uses res = PyUnicode_F

Re: [Python-Dev] New work-in-progress bisection tool for the Python test suite (in regrtest)

2017-06-26 Thread Serhiy Storchaka
26.06.17 23:37, Victor Stinner пише: 2017-06-26 21:58 GMT+02:00 Brett Cannon : I don't see why regrtest isn't the right place for this. The current regrest CLI isn't designed for subcommands, and I don't want to "pollute" regrtest with multiple options for bisect. Currently, my script has alre

Re: [Python-Dev] Summary of Python tracker Issues

2017-07-01 Thread Serhiy Storchaka
30.06.17 19:09, Python tracker пише: ACTIVITY SUMMARY (2017-06-23 - 2017-06-30) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open6006 (-20) Victor closed a h

Re: [Python-Dev] Summary of Python tracker Issues

2017-07-01 Thread Serhiy Storchaka
23.06.17 19:09, Python tracker пише: ACTIVITY SUMMARY (2017-06-16 - 2017-06-23) Python tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue. Do NOT respond to this message. Issues counts and deltas: open6026 ( -8) Terry closed a t

Re: [Python-Dev] Impact of Namedtuple on startup time

2017-07-17 Thread Serhiy Storchaka
17.07.17 15:43, Antoine Pitrou пише: Cost of creating a namedtuple has been identified as a contributor to Python startup time. Not only Python core and the stdlib, but any third-party library creating namedtuple classes (there are many of them). An issue was created for this: https://bugs.pyth

Re: [Python-Dev] Need help to fix urllib(.parse) vulnerabilities

2017-07-21 Thread Serhiy Storchaka
21.07.17 13:02, Victor Stinner пише: Recently, two security vulnerabilities were reported in the urllib module: https://bugs.python.org/issue30500 http://python-security.readthedocs.io/vuln/bpo-30500_urllib_connects_to_a_wrong_host.html#bpo-30500-urllib-connects-to-a-wrong-host => already fixed

Re: [Python-Dev] bpo-5001: More-informative multiprocessing error messages (#3079)

2017-08-29 Thread Serhiy Storchaka
30.08.17 01:52, Antoine Pitrou пише: https://github.com/python/cpython/commit/bd73e72b4a9f019be514954b1d40e64dc3a5e81c commit: bd73e72b4a9f019be514954b1d40e64dc3a5e81c branch: master author: Allen W. Smith, Ph.D committer: Antoine Pitrou date: 2017-08-30T00:52:18+02:00 summary: bpo-5001: More-

Re: [Python-Dev] [RFC] Removing pure Python implementation of OrderedDict

2017-09-05 Thread Serhiy Storchaka
05.09.17 11:38, INADA Naoki пише: ## Cons * All Python 3.7 implementations should provide _collections.OrderedDict PyPy has it already. But I don't know about micropython. Current C implementation of OrderedDict is not safe regarding using mutating dict methods (or dict C API) like dict._

Re: [Python-Dev] PEP 548: More Flexible Loop Control

2017-09-05 Thread Serhiy Storchaka
06.09.17 03:11, R. David Murray пише: I've written a PEP proposing a small enhancement to the Python loop control statements. Short version: here's what feels to me like a Pythonic way to spell "repeat until": while: break if The PEP goes into some detail on why this f

[Python-Dev] Re: Packing a long list of numbers into memory

2021-10-10 Thread Serhiy Storchaka
10.10.21 17:19, Facundo Batista пише: > I have a long list of nums (several millions), ended up doing the following: > > struct.pack_into(f'{len(nums)}Q', buf, 0, *nums) Why not use array('Q', nums)? ___ Python-Dev mailing list -- python-dev@python

[Python-Dev] Re: Packing a long list of numbers into memory

2021-10-10 Thread Serhiy Storchaka
10.10.21 18:18, Facundo Batista пише: > You mean `array` from the `array` module? The only way I see using it > is like the following: > shm = shared_memory.SharedMemory(create=True, size=total_size) a = array.array('Q', nums) shm.buf[l_offset:r_offset] = a.tobytes() > > But I don'

[Python-Dev] Re: Packing a long list of numbers into memory

2021-10-10 Thread Serhiy Storchaka
10.10.21 19:05, Patrick Reader пише: > This still isn't a completely direct write - you're still creating an array > in between which is then copied into shm, whereas struct.pack_into writes > directly into the shared memory with no intermediate buffer. > > And unfortunately you can't do > > sh

[Python-Dev] Re: Why doesn't peephole optimise away operations with fast locals?

2021-10-11 Thread Serhiy Storchaka
10.10.21 23:38, Guido van Rossum пише: > What's exasperating to me about this whole discussion is that nobody has > shown any reason why this kind of code would be occurring in user code. > STORE_FAST x LOAD_FAST x seems that it must come from a user writing > >     x = x No, it comes from pretty

[Python-Dev] Re: Packing a long list of numbers into memory

2021-10-11 Thread Serhiy Storchaka
11.10.21 01:35, MRAB пише: > Maybe what's needed is to add, say, '*' to the format string to indicate > that multiple values should come from an iterable, e.g.: > >     struct.pack_into(f'{len(nums)}*Q', buf, 0, nums) > > in this case len(nums) from the nums argument. See https://www.python.org/

[Python-Dev] Re: What is __int__ still useful for?

2021-10-13 Thread Serhiy Storchaka
13.10.21 20:10, Antoine Pitrou пише: > It used to be that defining __int__ allowed an object to be accepted as > an integer from various functions, internal and third-party, thanks to > being implicitly called by e.g. PyLong_AsLong. > > Today, and since bpo-37999, this is no longer the case. It s

[Python-Dev] Re: What is __int__ still useful for?

2021-10-14 Thread Serhiy Storchaka
14.10.21 12:24, Eryk Sun пише: > Maybe an alternate constructor could be added -- such as > int.from_number() -- which would be restricted to calling __int__(), > __index__(), and __trunc__(). See thread "More alternate constructors for builtin type" on Python-ideas: https://mail.python.org/archiv

[Python-Dev] Re: RFC on Callable Type Syntax

2021-10-17 Thread Serhiy Storchaka
12.10.21 00:03, Guido van Rossum пише: > But if I see > >     def Comparison(a: T, b: T) -> Literal[-1, 0, 1]: >     ... > > my first thought is that it's a comparison function that someone hasn't > finished writing yet, not a function type -- since if it did have at > least one line of code

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-01 Thread Serhiy Storchaka
This is excellent! 01.11.21 14:17, Petr Viktorin пише: >> CPython treats the control character NUL (``\0``) as end of input, >> but many editors simply skip it, possibly showing code that Python >> will not >> run as a regular part of a file. It is an implementation detail and we will get rid of

[Python-Dev] Re: Preventing Unicode-related gotchas (Was: pre-PEP: Unicode Security Considerations for Python)

2021-11-02 Thread Serhiy Storchaka
02.11.21 16:16, Petr Viktorin пише: > As for \0, can we ban all ASCII & C1 control characters except > whitespace? I see no place for them in source code. All control characters except CR, LF, TAB and FF are banned outside comments and string literals. I think it is worth to ban them in comments a

[Python-Dev] Re: Preventing Unicode-related gotchas (Was: pre-PEP: Unicode Security Considerations for Python)

2021-11-03 Thread Serhiy Storchaka
02.11.21 18:49, Jim J. Jewett пише: > If escape sequences were also allowed in comments (or at least in strings > within comments), this would make sense. I don't like banning them > otherwise, since odd characters are often a good reason to need a comment, > but it is definitely a "mention, no

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-03 Thread Serhiy Storchaka
03.11.21 11:01, Stephen J. Turnbull пише: > And of > course UTF-16 is incompatible in that sense, although I don't know if > anybody actually saves Python code in UTF-16. CPython does not currently support UTF-16 for source files. ___ Python-Dev mailin

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-03 Thread Serhiy Storchaka
03.11.21 12:36, Petr Viktorin пише: > On 03. 11. 21 2:58, Kyle Stanley wrote: >> I'd suggest both: briefer, easier to read write up for average user in >> docs, more details/semantics in informational PEP. Thanks for working >> on this, Petr! > > Well, this is the brief write-up :) > Maybe it woul

[Python-Dev] Re: Preventing Unicode-related gotchas (Was: pre-PEP: Unicode Security Considerations for Python)

2021-11-03 Thread Serhiy Storchaka
03.11.21 14:31, Petr Viktorin пише: > For example: should the parser emit a lightweight audit event if it > finds a non-ASCII identifier? (See below for why ASCII is special.) > Or for encoding declarations? There are audit events for import and compile. You can also register import hooks if you w

[Python-Dev] Re: pre-PEP: Unicode Security Considerations for Python

2021-11-03 Thread Serhiy Storchaka
03.11.21 15:14, Stephen J. Turnbull пише: > So the only > time that wouldn't be true is if escape sequences are allowed to > represent characters. I believe unicode_escape is the only codec > that does. Also raw_unicode_escape and utf_7. And maybe punycode or idna, I am not sure.

[Python-Dev] Re: Having Sorted Containers in stdlib?

2021-11-09 Thread Serhiy Storchaka
10.11.21 01:47, Bob Fang пише: > 1) Some mainstream language support them out of box: C++ for example > have set/map which are sorted by the key order, and Java has TreeMap > which is internally a Red-black tree. >From my C++ and Java experience, hashtable-based containers are much more useful tha

[Python-Dev] Re: Do we need to remove everything that's deprecated?

2021-11-12 Thread Serhiy Storchaka
12.11.21 12:55, Petr Viktorin пише: >   AttributeError: '[...]Tests' object has no attribute 'failUnless' > (bpo-45162) This one caused me troubles more then one time. It is so easy to make a typo and write assertEquals instead of assertEqual or assertRaisesRegexp instead of assertRaisesRegex. Tes

[Python-Dev] Re: Optimizing literal comparisons and contains

2021-11-28 Thread Serhiy Storchaka
28.11.21 17:13, Skip Montanaro пише: >> That is not entirely true: >> https://github.com/python/cpython/pull/29639#issuecomment-974146979 > > The only places I've seen "if 0:" or "if False:" in live code was for > debugging. Optimizing that hardly seems necessary. In any case, the > original comm

[Python-Dev] Re: Optimizing literal comparisons and contains

2021-11-28 Thread Serhiy Storchaka
27.11.21 15:47, Jeremiah Vivian пише: > Many operations involving two literals are optimized (to a certain level). So > it sort of surprises me that literal comparisons are not optimized and > literal contains only convert the right operand to a constant if possible. > I'd like to implement opti

[Python-Dev] Re: Optimizing literal comparisons and contains

2021-11-29 Thread Serhiy Storchaka
29.11.21 14:32, Mark Shannon пише: > Excluding  1 < 2 seems inconsistent. It is not excluded, it is just not included. There should be reasons for adding any feature, and the benefit should exceed the cost. ___ Python-Dev mailing list -- python-dev@pyth

[Python-Dev] Re: Optimizing literal comparisons and contains

2021-11-29 Thread Serhiy Storchaka
29.11.21 18:36, Victor Stinner пише: > You should consider "no longer have to justify why it's not optimized" > as a clear benefit of making this change :-) This optimization is > proposed once a year for many years... > > For me, any possible compilation-ahead optimization (which doesn't > break

[Python-Dev] Re: multiple inheritance and `__str__`

2021-12-01 Thread Serhiy Storchaka
01.12.21 09:56, Ethan Furman пише: > Some searching turned up issue 36793: "Do not define unneeded __str__ > equal to __repr__" . > > As can be seen, `__str__` is needed for inheritance to work properly.  > Thoughts on reverting that patch? As the author of issue36793 I do not think so. If you re

[Python-Dev] The python command help is too long

2021-12-18 Thread Serhiy Storchaka
The output of "python -h" is 104 lines long now. It was only 51 lines in 3.6. 35% of it is about the -X option, and 30% about environment variables. Also some lines in the -X option description are too long (102 columns). Both topics are "advanced" and mostly interested for debugging. I suggest to

<    4   5   6   7   8   9   10   11   12   >