<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Objects/bytesobject.c, branch enum-lost-fixes</title>
<subtitle>github.com: python/cpython.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/'/>
<entry>
<title>bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)</title>
<updated>2021-02-26T22:51:55+00:00</updated>
<author>
<name>Brandt Bucher</name>
<email>brandtbucher@gmail.com</email>
</author>
<published>2021-02-26T22:51:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=145bf269df3530176f6ebeab1324890ef7070bf8'/>
<id>145bf269df3530176f6ebeab1324890ef7070bf8</id>
<content type='text'>
Co-authored-by: Guido van Rossum &lt;guido@python.org&gt;
Co-authored-by: Talin &lt;viridia@gmail.com&gt;
Co-authored-by: Pablo Galindo &lt;pablogsal@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Co-authored-by: Guido van Rossum &lt;guido@python.org&gt;
Co-authored-by: Talin &lt;viridia@gmail.com&gt;
Co-authored-by: Pablo Galindo &lt;pablogsal@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-43268: Pass interp rather than tstate to internal functions (GH-24580)</title>
<updated>2021-02-19T14:10:45+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2021-02-19T14:10:45+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=bcb094b41f7fe4dd1686c50891d85632fcf0d481'/>
<id>bcb094b41f7fe4dd1686c50891d85632fcf0d481</id>
<content type='text'>
Pass the current interpreter (interp) rather than the current Python
thread state (tstate) to internal functions which only use the
interpreter.

Modified functions:

* _PyXXX_Fini() and _PyXXX_ClearFreeList() functions
* _PyEval_SignalAsyncExc(), make_pending_calls()
* _PySys_GetObject(), sys_set_object(), sys_set_object_id(), sys_set_object_str()
* should_audit(), set_flags_from_config(), make_flags()
* _PyAtExit_Call()
* init_stdio_encoding()
* etc.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Pass the current interpreter (interp) rather than the current Python
thread state (tstate) to internal functions which only use the
interpreter.

Modified functions:

* _PyXXX_Fini() and _PyXXX_ClearFreeList() functions
* _PyEval_SignalAsyncExc(), make_pending_calls()
* _PySys_GetObject(), sys_set_object(), sys_set_object_id(), sys_set_object_str()
* should_audit(), set_flags_from_config(), make_flags()
* _PyAtExit_Call()
* init_stdio_encoding()
* etc.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-42431: Fix outdated bytes comments (GH-23458)</title>
<updated>2020-12-03T10:46:16+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2020-12-03T10:46:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=2ad93821a69e6efac3b0efe1d205d6e5ef030791'/>
<id>2ad93821a69e6efac3b0efe1d205d6e5ef030791</id>
<content type='text'>
Also move definitions of internal macros F_LJUST etc to private header.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also move definitions of internal macros F_LJUST etc to private header.
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)</title>
<updated>2020-12-01T09:37:39+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-12-01T09:37:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=32bd68c839adb7b42af12366ab0892303115d1d1'/>
<id>32bd68c839adb7b42af12366ab0892303115d1d1</id>
<content type='text'>
No longer use deprecated aliases to functions:

* Replace PyObject_MALLOC() with PyObject_Malloc()
* Replace PyObject_REALLOC() with PyObject_Realloc()
* Replace PyObject_FREE() with PyObject_Free()
* Replace PyObject_Del() with PyObject_Free()
* Replace PyObject_DEL() with PyObject_Free()</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No longer use deprecated aliases to functions:

* Replace PyObject_MALLOC() with PyObject_Malloc()
* Replace PyObject_REALLOC() with PyObject_Realloc()
* Replace PyObject_FREE() with PyObject_Free()
* Replace PyObject_Del() with PyObject_Free()
* Replace PyObject_DEL() with PyObject_Free()</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-42435: Speed up comparison of bytes and bytearray object (GH--23461)</title>
<updated>2020-11-22T20:00:53+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2020-11-22T20:00:53+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=313467efdc23a1ec8662b77d2001642be598f80a'/>
<id>313467efdc23a1ec8662b77d2001642be598f80a</id>
<content type='text'>
* Speed up comparison of bytes objects with non-bytes objects when
  option -b is specified.
* Speed up comparison of bytarray objects with non-buffer object.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Speed up comparison of bytes objects with non-bytes objects when
  option -b is specified.
* Speed up comparison of bytarray objects with non-buffer object.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-41974: Remove complex.__float__, complex.__floordiv__, etc (GH-22593)</title>
<updated>2020-10-09T11:14:37+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2020-10-09T11:14:37+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=e2ec0b27c02a158d0007c11dcc1f2d7a95948712'/>
<id>e2ec0b27c02a158d0007c11dcc1f2d7a95948712</id>
<content type='text'>
Remove complex special methods __int__, __float__, __floordiv__,
__mod__, __divmod__, __rfloordiv__, __rmod__ and __rdivmod__
which always raised a TypeError.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Remove complex special methods __int__, __float__, __floordiv__,
__mod__, __divmod__, __rfloordiv__, __rmod__ and __rdivmod__
which always raised a TypeError.
</pre>
</div>
</content>
</entry>
<entry>
<title>A (very) slight speed improvement for iterating over bytes (#21705)</title>
<updated>2020-08-03T16:04:13+00:00</updated>
<author>
<name>Guido van Rossum</name>
<email>guido@python.org</email>
</author>
<published>2020-08-03T16:04:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=488512bf4953d856fcb049a05060a450af52fcdc'/>
<id>488512bf4953d856fcb049a05060a450af52fcdc</id>
<content type='text'>
My mentee @xvxvxvxvxv noticed that iterating over array.array is
slightly faster than iterating over bytes.  Looking at the source I
observed that arrayiter_next() calls `getitem(ao, it-&gt;index++)` wheras
striter_next() uses the idiom (paraphrased)

    item = PyLong_FromLong(seq-&gt;ob_sval[it-&gt;it_index]);
    if (item != NULL)
        ++it-&gt;it_next;
    return item;

I'm not 100% sure but I think that the second version has fewer
opportunity for the CPU to overlap the `index++` operation with the
rest of the code (which in both cases involves a call).  So here I am
optimistically incrementing the index -- if the PyLong_FromLong() call
fails, this will leave the iterator pointing at the next byte, but
honestly I doubt that anyone would seriously consider resuming use of
the iterator after that kind of failure (it would have to be a
MemoryError).  And the author of arrayiter_next() made the same
consideration (or never ever gave it a thought :-).

With this, a loop like

    for _ in b: pass

is now slightly *faster* than the same thing over an equivalent array,
rather than slightly *slower* (in both cases a few percent).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
My mentee @xvxvxvxvxv noticed that iterating over array.array is
slightly faster than iterating over bytes.  Looking at the source I
observed that arrayiter_next() calls `getitem(ao, it-&gt;index++)` wheras
striter_next() uses the idiom (paraphrased)

    item = PyLong_FromLong(seq-&gt;ob_sval[it-&gt;it_index]);
    if (item != NULL)
        ++it-&gt;it_next;
    return item;

I'm not 100% sure but I think that the second version has fewer
opportunity for the CPU to overlap the `index++` operation with the
rest of the code (which in both cases involves a call).  So here I am
optimistically incrementing the index -- if the PyLong_FromLong() call
fails, this will leave the iterator pointing at the next byte, but
honestly I doubt that anyone would seriously consider resuming use of
the iterator after that kind of failure (it would have to be a
MemoryError).  And the author of arrayiter_next() made the same
consideration (or never ever gave it a thought :-).

With this, a loop like

    for _ in b: pass

is now slightly *faster* than the same thing over an equivalent array,
rather than slightly *slower* (in both cases a few percent).</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-41334: Convert constructors of str, bytes and bytearray to Argument Clinic (GH-21535)</title>
<updated>2020-07-20T12:53:55+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2020-07-20T12:53:55+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=12f433411bba8a0cdc4f09ba34472745ae9da0d1'/>
<id>12f433411bba8a0cdc4f09ba34472745ae9da0d1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37999: Simplify the conversion code for %c, %d, %x, etc. (GH-20437)</title>
<updated>2020-06-29T19:36:41+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2020-06-29T19:36:41+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=e67f7db3c34f70536f36c56bb82e33c3512a53a3'/>
<id>e67f7db3c34f70536f36c56bb82e33c3512a53a3</id>
<content type='text'>
Since PyLong_AsLong() no longer use __int__, explicit call
of PyNumber_Index() before it is no longer needed.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since PyLong_AsLong() no longer use __int__, explicit call
of PyNumber_Index() before it is no longer needed.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-40521: Optimize PyBytes_FromStringAndSize(str, 0) (GH-21142)</title>
<updated>2020-06-25T12:07:40+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2020-06-25T12:07:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=91698d8caa4b5bb6e8dbb64b156e8afe9e32cac1'/>
<id>91698d8caa4b5bb6e8dbb64b156e8afe9e32cac1</id>
<content type='text'>
Always create the empty bytes string singleton.

Optimize PyBytes_FromStringAndSize(str, 0): it no longer has to check
if the empty string singleton was created or not, it is always
available.

Add functions:

* _PyBytes_Init()
* bytes_get_empty(), bytes_new_empty()
* bytes_create_empty_string_singleton()
* unicode_create_empty_string_singleton()

_Py_unicode_state: rename empty structure member to empty_string.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Always create the empty bytes string singleton.

Optimize PyBytes_FromStringAndSize(str, 0): it no longer has to check
if the empty string singleton was created or not, it is always
available.

Add functions:

* _PyBytes_Init()
* bytes_get_empty(), bytes_new_empty()
* bytes_create_empty_string_singleton()
* unicode_create_empty_string_singleton()

_Py_unicode_state: rename empty structure member to empty_string.</pre>
</div>
</content>
</entry>
</feed>
