<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/cpython-git.git/Objects/bytesobject.c, branch fix-namedexpr-comment</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-36389: Fix _PyBytesWriter in release mode (GH-16624)</title>
<updated>2019-10-07T20:31:42+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2019-10-07T20:31:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=60ec6efd96d95476fe5e38c491491add04f026e5'/>
<id>60ec6efd96d95476fe5e38c491491add04f026e5</id>
<content type='text'>
Fix _PyBytesWriter API when Python is built in release mode with
assertions.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fix _PyBytesWriter API when Python is built in release mode with
assertions.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-36389: _PyObject_CheckConsistency() available in release mode (GH-16612)</title>
<updated>2019-10-07T16:42:01+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@python.org</email>
</author>
<published>2019-10-07T16:42:01+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=6876257eaabdb30f27ebcbd7d2557278ce2e5705'/>
<id>6876257eaabdb30f27ebcbd7d2557278ce2e5705</id>
<content type='text'>
bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is
now also available in release mode. For example, it can be used to
debug a crash in the visit_decref() function of the GC.

Modify the following functions to also work in release mode:

* _PyDict_CheckConsistency()
* _PyObject_CheckConsistency()
* _PyType_CheckConsistency()
* _PyUnicode_CheckConsistency()

Other changes:

* _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL
  (equals to 0).
* _PyBytesWriter_CheckConsistency() now returns 1 and is only used
  with assert().
* Reorder _PyObject_Dump() to write safe fields first, and only
  attempt to render repr() at the end.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
bpo-36389, bpo-38376: The _PyObject_CheckConsistency() function is
now also available in release mode. For example, it can be used to
debug a crash in the visit_decref() function of the GC.

Modify the following functions to also work in release mode:

* _PyDict_CheckConsistency()
* _PyObject_CheckConsistency()
* _PyType_CheckConsistency()
* _PyUnicode_CheckConsistency()

Other changes:

* _PyMem_IsPtrFreed(ptr) now also returns 1 if ptr is NULL
  (equals to 0).
* _PyBytesWriter_CheckConsistency() now returns 1 and is only used
  with assert().
* Reorder _PyObject_Dump() to write safe fields first, and only
  attempt to render repr() at the end.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933)</title>
<updated>2019-09-14T09:24:05+00:00</updated>
<author>
<name>Serhiy Storchaka</name>
<email>storchaka@gmail.com</email>
</author>
<published>2019-09-14T09:24:05+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=279f44678c8b84a183f9eeb85e0b086228154497'/>
<id>279f44678c8b84a183f9eeb85e0b086228154497</id>
<content type='text'>
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values
(like in the optional third parameter of getattr). "None" should be used if None is accepted
as argument and passing None has the same effect as not passing the argument at all.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values
(like in the optional third parameter of getattr). "None" should be used if None is accepted
as argument and passing None has the same effect as not passing the argument at all.</pre>
</div>
</content>
</entry>
<entry>
<title>Cut disused recode_encoding logic in _PyBytes_DecodeEscape. (GH-16013)</title>
<updated>2019-09-12T18:12:22+00:00</updated>
<author>
<name>Greg Price</name>
<email>gnprice@gmail.com</email>
</author>
<published>2019-09-12T18:12:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=3a4f66707e824ef3a8384827590ebaa6ca463dc0'/>
<id>3a4f66707e824ef3a8384827590ebaa6ca463dc0</id>
<content type='text'>
All call sites pass NULL for `recode_encoding`, so this path is
completely untested.  That's been true since before Python 3.0.
It adds significant complexity to this logic, so it's best to
take it out.

All call sites now have a literal NULL, and that's been true since
commit 768921cf3 eliminated a conditional (`foo ? bar : NULL`) at
the call site in Python/ast.c where we're parsing a bytes literal.
But even before then, that condition `foo` had been a constant
since unadorned string literals started meaning Unicode, in commit
572dbf8f1 aka v3.0a1~1035 .

The `unicode` parameter is already unused, so mark it as unused too.
The code that acted on it was also taken out before Python 3.0, in
commit 8d30cc014 aka v3.0a1~1031 .

The function (PyBytes_DecodeEscape) is exposed in the API, but it's
never been documented.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All call sites pass NULL for `recode_encoding`, so this path is
completely untested.  That's been true since before Python 3.0.
It adds significant complexity to this logic, so it's best to
take it out.

All call sites now have a literal NULL, and that's been true since
commit 768921cf3 eliminated a conditional (`foo ? bar : NULL`) at
the call site in Python/ast.c where we're parsing a bytes literal.
But even before then, that condition `foo` had been a constant
since unadorned string literals started meaning Unicode, in commit
572dbf8f1 aka v3.0a1~1035 .

The `unicode` parameter is already unused, so mark it as unused too.
The code that acted on it was also taken out before Python 3.0, in
commit 8d30cc014 aka v3.0a1~1031 .

The function (PyBytes_DecodeEscape) is exposed in the API, but it's
never been documented.
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unneeded assignment in PyBytes_Concat() (GH-15274)</title>
<updated>2019-09-10T16:11:10+00:00</updated>
<author>
<name>Sergey Fedoseev</name>
<email>fedoseev.sergey@gmail.com</email>
</author>
<published>2019-09-10T16:11:10+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=afdeb189e97033b54cef44a7490d89d2013cb4e5'/>
<id>afdeb189e97033b54cef44a7490d89d2013cb4e5</id>
<content type='text'>
The `wb.len = -1` assignment is unneeded since its introduction in 161d695fb0455ce52530d4f43a9eac4c738f64bb as `PyObject_GetBuffer` always fills it in.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `wb.len = -1` assignment is unneeded since its introduction in 161d695fb0455ce52530d4f43a9eac4c738f64bb as `PyObject_GetBuffer` always fills it in.</pre>
</div>
</content>
</entry>
<entry>
<title>Cut tricky `goto` that isn't needed, in _PyBytes_DecodeEscape. (GH-15825)</title>
<updated>2019-09-10T08:51:04+00:00</updated>
<author>
<name>Greg Price</name>
<email>gnprice@gmail.com</email>
</author>
<published>2019-09-10T08:51:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=0711642eec58d00f31031279df799fbddaf6f2c1'/>
<id>0711642eec58d00f31031279df799fbddaf6f2c1</id>
<content type='text'>
This is the sort of `goto` that requires the reader to stare hard at
the code to unpick what it's doing.

On doing so, the answer is... not very much!

* It jumps from the bottom of the loop to almost the top; the effect
  is to bypass the loop condition `s &lt; end` and also the
  `if`-condition `*s != '\\'`, acting as if both are true.

* We've just decremented `s`, after incrementing it in the `switch`
  condition.  So it has the same value as when `s == end` failed.
  Before that was another increment... and before that we had
  `s &lt; end`.  So `s &lt; end` true, then increment, then `s == end`
  false... that means `s &lt; end` is still true.

* Also this means `s` points to the same character as it did for the
  `switch` condition.  And there was a `case '\\'`, which we didn't
  hit -- so `*s != '\\'` is also true.

* That means this has no effect on the behavior!  The most it might do
  is an optimization -- we get to skip those two checks, because (as
  just proven above) we know they're true.

* But gosh, this is the *invalid escape sequence* path.  This does not
  seem like the kind of code path that calls for extreme optimization
  tricks.

So, take the `goto` and the label out.

Perhaps the compiler will notice the exact same facts we showed above,
and generate identical code.  Or perhaps it won't!  That'll be OK.

But then, crucially, if some future edit to this loop causes the
reasoning above to *stop* holding true... the compiler will adjust
this jump accordingly.  One of us fallible humans might not.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is the sort of `goto` that requires the reader to stare hard at
the code to unpick what it's doing.

On doing so, the answer is... not very much!

* It jumps from the bottom of the loop to almost the top; the effect
  is to bypass the loop condition `s &lt; end` and also the
  `if`-condition `*s != '\\'`, acting as if both are true.

* We've just decremented `s`, after incrementing it in the `switch`
  condition.  So it has the same value as when `s == end` failed.
  Before that was another increment... and before that we had
  `s &lt; end`.  So `s &lt; end` true, then increment, then `s == end`
  false... that means `s &lt; end` is still true.

* Also this means `s` points to the same character as it did for the
  `switch` condition.  And there was a `case '\\'`, which we didn't
  hit -- so `*s != '\\'` is also true.

* That means this has no effect on the behavior!  The most it might do
  is an optimization -- we get to skip those two checks, because (as
  just proven above) we know they're true.

* But gosh, this is the *invalid escape sequence* path.  This does not
  seem like the kind of code path that calls for extreme optimization
  tricks.

So, take the `goto` and the label out.

Perhaps the compiler will notice the exact same facts we showed above,
and generate identical code.  Or perhaps it won't!  That'll be OK.

But then, crucially, if some future edit to this loop causes the
reasoning above to *stop* holding true... the compiler will adjust
this jump accordingly.  One of us fallible humans might not.</pre>
</div>
</content>
</entry>
<entry>
<title>Make PyXXX_Fini() functions private (GH-15531)</title>
<updated>2019-08-26T22:12:32+00:00</updated>
<author>
<name>Victor Stinner</name>
<email>vstinner@redhat.com</email>
</author>
<published>2019-08-26T22:12:32+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=bed4817d52d7b5a383b1b61269c1337b61acc493'/>
<id>bed4817d52d7b5a383b1b61269c1337b61acc493</id>
<content type='text'>
For example, rename PyTuple_Fini() to _PyTuple_Fini().

These functions are only declared in the internal C API.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For example, rename PyTuple_Fini() to _PyTuple_Fini().

These functions are only declared in the internal C API.</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-37483: add _PyObject_CallOneArg() function (#14558)</title>
<updated>2019-07-04T10:31:34+00:00</updated>
<author>
<name>Jeroen Demeyer</name>
<email>J.Demeyer@UGent.be</email>
</author>
<published>2019-07-04T10:31:34+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=196a530e00d88a138973bf9182e013937e293f97'/>
<id>196a530e00d88a138973bf9182e013937e293f97</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-36974: tp_print -&gt; tp_vectorcall_offset and tp_reserved -&gt; tp_as_async (GH-13464)</title>
<updated>2019-05-31T02:13:39+00:00</updated>
<author>
<name>Jeroen Demeyer</name>
<email>J.Demeyer@UGent.be</email>
</author>
<published>2019-05-31T02:13:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=530f506ac91338b55cf2be71b1cdf50cb077512f'/>
<id>530f506ac91338b55cf2be71b1cdf50cb077512f</id>
<content type='text'>
Automatically replace
tp_print -&gt; tp_vectorcall_offset
tp_compare -&gt; tp_as_async
tp_reserved -&gt; tp_as_async
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Automatically replace
tp_print -&gt; tp_vectorcall_offset
tp_compare -&gt; tp_as_async
tp_reserved -&gt; tp_as_async
</pre>
</div>
</content>
</entry>
<entry>
<title>bpo-22385: Support output separators in hex methods. (#13578)</title>
<updated>2019-05-29T18:46:58+00:00</updated>
<author>
<name>Gregory P. Smith</name>
<email>greg@krypto.org</email>
</author>
<published>2019-05-29T18:46:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/cpython-git.git/commit/?id=0c2f9305640f7655ba0cd5f478948b2763b376b3'/>
<id>0c2f9305640f7655ba0cd5f478948b2763b376b3</id>
<content type='text'>
* bpo-22385: Support output separators in hex methods.

Also in binascii.hexlify aka b2a_hex.

The underlying implementation behind all hex generation in CPython uses the
same pystrhex.c implementation.  This adds support to bytes, bytearray,
and memoryview objects.

The binascii module functions exist rather than being slated for deprecation
because they return bytes rather than requiring an intermediate step through a
str object.

This change was inspired by MicroPython which supports sep in its binascii
implementation (and does not yet support the .hex methods).

https://bugs.python.org/issue22385</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* bpo-22385: Support output separators in hex methods.

Also in binascii.hexlify aka b2a_hex.

The underlying implementation behind all hex generation in CPython uses the
same pystrhex.c implementation.  This adds support to bytes, bytearray,
and memoryview objects.

The binascii module functions exist rather than being slated for deprecation
because they return bytes rather than requiring an intermediate step through a
str object.

This change was inspired by MicroPython which supports sep in its binascii
implementation (and does not yet support the .hex methods).

https://bugs.python.org/issue22385</pre>
</div>
</content>
</entry>
</feed>
