[issue41103] Removing old buffer support

2021-08-05 Thread Petr Viktorin


Petr Viktorin  added the comment:

These should be removed from the *limited API*, but stay for the stable ABI.
(PEP 652 mentions this can happen but doesn't give details, which will be a bit 
tricky. These are good candidates for figuring out the process.)

I assigned this to myself; I'll try to get to it for 3.11.


> What is the benefit of removing this? Is copy pasting the compatibility layer 
> to (possibly many) different projects worth the "cleanup"?

Yes. PyObject_AsReadBuffer is dangerous *in general*, but in certain specific 
cases where you're relying on CPython implementations details it can work. For 
example, borrowing a buffer from a *string* or *array* will work on CPython, 
and I don't see that changing any time soon. So, using PyObject_AsReadBuffer is 
still tech debt, but for some projects that's OK.

All this should be documented in the release notes, though, so the projects 
know what they're doing. (And the release notes should be written *with the 
change*, not later, so projects testing early can read them.)

--
assignee:  -> petr.viktorin
nosy: +petr.viktorin
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-30 Thread Łukasz Langa

Łukasz Langa  added the comment:

Resolved as "wontfix" due to presence in the stable ABI.

--
resolution:  -> wont fix
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset 6b922dae6cae9f212d678a36e8b41f2287cf5441 by Miss Islington (bot) 
in branch '3.10':
bpo-41103: Resurrect the old buffer protocol. (GH-27437) (GH-27441)
https://github.com/python/cpython/commit/6b922dae6cae9f212d678a36e8b41f2287cf5441


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset ce5e1a6809b714eb0383219190a076d9f883e008 by Inada Naoki in branch 
'main':
bpo-41103: Resurrect the old buffer protocol. (GH-27437)
https://github.com/python/cpython/commit/ce5e1a6809b714eb0383219190a076d9f883e008


--
nosy: +lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 5.0 -> 6.0
pull_requests: +25970
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27441

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread Inada Naoki


Change by Inada Naoki :


--
resolution: fixed -> 
stage: resolved -> 
status: closed -> open
versions: +Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread Inada Naoki


Inada Naoki  added the comment:

Should I resurrect only function implementation and symbol?
Or may I resurrect definitions in header files too?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +25967
pull_request: https://github.com/python/cpython/pull/27437

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread Inada Naoki


Inada Naoki  added the comment:

Oh, I didn't notice that APIs deprecated in Python 3.0 are included in stable 
ABIs defined at Python 3.2!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2021-07-29 Thread Tarun Johar


Tarun Johar  added the comment:

Also filed under https://bugs.python.org/issue44609

PEP 384 and PEP 652 define a stable ABI to be used with Python 3.2 and later.  
On Windows, symbols for the stable ABI are exported from the python3.dll shared 
library.

The following functions are present in Python 3.9 but have been removed from 
Python 3.10b3:

PyObject_AsCharBuffer()
PyObject_AsReadBuffer()
PyObject_AsWriteBuffer()
PyObject_CheckReadBuffer()

Without these functions, an extension cannot utilize the stable ABI to access 
the buffer memory of data structures.  The buffer protocol is suggested as an 
alternative, but the buffer functions PyObject_GetBuffer() and 
PyBuffer_Release() are not present in the stable ABI.

While these two functions may be added to the stable ABI, removal of the four 
functions above makes Python 3.10 incompatible with previous versions.  It is 
requested that the four functions be reinstated and maintained as described in 
PEP 652.

--
nosy: +tarun.johar

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2020-11-25 Thread Inada Naoki


Inada Naoki  added the comment:

Thank you for reporting. I removed these APIs to get such feedback as early as 
possible.

We are free to revive these APIs if it breaks too much and some projects can 
not be fixed before Python 3.10 release.

Some project maintainers ignore deprecations and wait compile errors to fix 
soemthing. (e.g. 
https://github.com/rogerbinns/apsw/issues/288#issuecomment-62322)
That's why we need to break some projects during alpha phase.


> What is the benefit of removing this? Is copy pasting the compatibility layer 
> to (possibly many) different projects worth the "cleanup"?

Oh, no need to copy-paste compatibility layer for all projects. They can 
migrate to new APIs.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2020-11-25 Thread STINNER Victor


STINNER Victor  added the comment:

PyObject_AsCharBuffer() is dangerous: it returns a dangling pointer by design. 
PyObject_GetBuffer() design is safer: the API ensures that the buffer remains 
valid until PyBuffer_Release() is called.

PyQt5 was updated to use the safe PyObject_GetBuffer()/PyBuffer_Release(). 
PyQt4 is no longer updated, that's why I proposed a downstream fix which 
copy/paste the old code. Changing PyQt4 to use the safe API was not worth it, 
since it's complex to redesign the impacted function qpycore_encode().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2020-11-25 Thread Miro Hrončok

Miro Hrončok  added the comment:

I've just seen a fix of PyQt4 that basically copy pastes (some of) the removed 
code to PyQt4:

https://src.fedoraproject.org/rpms/PyQt4/pull-request/2#request_diff

What is the benefit of removing this? Is copy pasting the compatibility layer 
to (possibly many) different projects worth the "cleanup"?

In Fedora, at least 7 packages are broken so far:

PyQt4: https://bugzilla.redhat.com/show_bug.cgi?id=1895298
libsolv: https://bugzilla.redhat.com/show_bug.cgi?id=1896411
m2crypto: https://bugzilla.redhat.com/show_bug.cgi?id=1897148
apsw: https://bugzilla.redhat.com/show_bug.cgi?id=1897500
djvulibre: https://bugzilla.redhat.com/show_bug.cgi?id=1897558
wsaccel: https://bugzilla.redhat.com/show_bug.cgi?id=1899550
webassets: https://bugzilla.redhat.com/show_bug.cgi?id=1899555

--
nosy: +hroncok, vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2020-06-25 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2020-06-25 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed by Inada Naoki in branch 
'master':
bpo-41103: Remove old buffer protocol support (#21117)
https://github.com/python/cpython/commit/6f8a6ee59cb7f99f68df8ee9c3e8c8cf19af3eed


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2020-06-24 Thread Inada Naoki


Change by Inada Naoki :


--
keywords: +patch
pull_requests: +20280
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/21117

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41103] Removing old buffer support

2020-06-24 Thread Inada Naoki


New submission from Inada Naoki :

https://docs.python.org/3/c-api/objbuffer.html
Old buffer protocol has been deprecated since Python 3.0.
It was useful to make transition from Python 2 easy.
But it's time to remove.

--
components: C API
messages: 372251
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: Removing old buffer support
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com