[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-11-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue2771] Test issue

2021-11-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue42967] [CVE-2021-23336] urllib.parse.parse_qsl(): Web cache poisoning - `; ` as a query args separator

2021-11-08 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 99c7e9853fa13af414168f179213e3d2fae03a45 by Victor Stinner in 
branch 'main':
bpo-40170: Update What's New in Python 3.9 (GH-29470)
https://github.com/python/cpython/commit/99c7e9853fa13af414168f179213e3d2fae03a45


--

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-11-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27723
pull_request: https://github.com/python/cpython/pull/29470

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



[issue21644] Optimize bytearray(int) constructor to use calloc()

2021-11-08 Thread STINNER Victor


STINNER Victor  added the comment:

I abandonned the issue because I didn't have time to work on it. If you want, 
you can open a new issue for that.

--

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



[issue24666] Buffered I/O does not take file position into account when reading blocks

2021-10-22 Thread STINNER Victor


STINNER Victor  added the comment:

Hi, the io module doesn't use the block size of the filesystem. 
io.BufferedReader uses a default buffer size of 8 * 1024 bytes. I don't think 
that it's really important to respect the block size in Python. There are 
buffers at many levels. io.BufferedReader is a buffer in user space, but there 
is also a buffer in the kernel. I'm not sure how relevant is to use know that a 
"disk sector" is 4096 bytes, when most people use SSDs which use way larger SSD 
blocks (ex: 512 KB). It's hard to say what's real block size. The disk firmware 
can lie (pretend it's 4 KiB) or the kernel can lie. The disk firmware can 
emulate different "block sizes".

If you write a database, maybe you would like to start caring about that, but 
you may want to use direct I/O (O_DIRECT) flag for that.

In short, Python works as expect, it's efficient and you should not worry about 
that ;-)

--
nosy: +vstinner

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



[issue44959] EXT_SUFFIX is missing '.sl' on HP-UX

2021-10-22 Thread STINNER Victor


STINNER Victor  added the comment:

> Can this be merged to python 3.10 as well? Thanks

It's unclear to me if it's a new feature or a bugfix. But since the change is 
trivial, I'm fine with backporting it as a bugfix to 3.9 and 3.10 branches.

--

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



[issue5120] Change _tkinter initialization for new versions of Aqua Tk on OS X

2021-10-21 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue18276] posixpath.c:_fd_converter() should use PyObject_AsFileDescriptor()

2021-10-21 Thread STINNER Victor


STINNER Victor  added the comment:

I like calling .fileno() explicitly. It seems like it's not really needed to 
call it implicitly, since this issue doesn't get much activity. I suggest to 
reject it.

--
status: pending -> open

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



[issue42961] Use-after-free (of a heap type) during finalization

2021-10-21 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner
nosy_count: 3.0 -> 4.0
pull_requests: +27403
pull_request: https://github.com/python/cpython/pull/26274

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-10-21 Thread STINNER Victor


STINNER Victor  added the comment:

I created https://github.com/python/cpython/pull/29121 to add 
PyThreadState_SetProfile() and PyThreadState_SetTrace() functions.

--

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



[issue39947] [C API] Make the PyThreadState structure opaque (move it to the internal C API)

2021-10-21 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27399
pull_request: https://github.com/python/cpython/pull/29121

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



[issue44019] operator.call/operator.__call__

2021-10-21 Thread STINNER Victor


STINNER Victor  added the comment:

test___all__ was not supposed to fail with the missing "call" in 
operator.__all__?

--

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



[issue45459] Limited API support for Py_buffer

2021-10-19 Thread STINNER Victor


STINNER Victor  added the comment:

Maybe a PEP is needed to collect usages of the Py_buffer API and check if the 
ABI is future proof. A PEP may help to discuss with other projects which 
currently consume this API.

I suggest to start with the smallest possible API and then slowly extend it. 
It's too easy to make mistakes :-( Once it's added to the stable ABI, it will 
be really hard to change it.

For example, PyBuffer.format is a "char*", but who owns the string? For a 
stable ABI, I would suggest to duplicate the string.

For shape, stripes and suboffsets arrays, I would also suggest to allocate 
these arrays on the heap people to ensure that it cannot be modified from the 
outside.

In your PR, PyBuffer_GetLayout() gives indirectly access to the internal 
Py_buffer structure members and allows to modify them. One way is to avoid this 
issue is to return a *copy* of these arrays.

I would prefer to require to call "Set" functions to modify a Py_buffer to 
ensure that a buffer always remains consistency.


> PyBuffer_NewEx(PyObject *obj, void *buf,  Py_ssize_t len, Py_ssize_t 
> itemsize, int readonly, int ndim, char *format, Py_ssize_t *shape, Py_ssize_t 
> *strides, Py_ssize_t *suboffsets, void *internal)

This API looks like PyCode_New() which was broken *often* so it looks like a 
bad pattern for a stable ABI.

Maybe PyBuffer_New() + many Set() functions would be more future proof.

But I don't know which Py_buffer members are mandatory to have a "valid" buffer.

What if tomorrow we add new members. Will it be possible to initalize them to a 
reasonable default value?

--

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



[issue11173] Undocumented public APIs in Python 3.2

2021-10-19 Thread STINNER Victor


STINNER Victor  added the comment:

> I think this is complete, so I'll close this if nobody will object.

I concur, please close it ;-)

--
status: pending -> open

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



[issue41603] Compilation issue 3.8.5 with Redhat 7.8 and gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)

2021-10-19 Thread STINNER Victor


STINNER Victor  added the comment:

Python 3.8 is no longer supported. Can you reproduce the issue with Python 
3.11? I fixed bugs like this one in the meanwhile.

--

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



[issue45436] test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

2021-10-19 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x 
with Tcl/Tk 8.6.11 -> test_tk.test_configure_type() fails with Tcl/Tk 8.6.11

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



[issue45436] test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x with Tcl/Tk 8.6.11

2021-10-19 Thread STINNER Victor


Change by STINNER Victor :


--
title: test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x 
-> test_tk.test_configure_type() failed on x86 Gentoo Non-Debug with X 3.x with 
Tcl/Tk 8.6.11

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



[issue1336] subprocess.Popen hangs when child writes to stderr

2021-10-19 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-19 Thread STINNER Victor


Change by STINNER Victor :


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

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-19 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 52af0756b2ffc6788e364971d05cdaf127d77d5a by Victor Stinner in 
branch 'main':
bpo-45434: Only exclude  in Python 3.11 limited C API (GH-29027)
https://github.com/python/cpython/commit/52af0756b2ffc6788e364971d05cdaf127d77d5a


--

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5f09bb021a2862ba89c3ecb53e7e6e95a9e07e1d by Victor Stinner in 
branch 'main':
bpo-35134: Add Include/cpython/longobject.h (GH-29044)
https://github.com/python/cpython/commit/5f09bb021a2862ba89c3ecb53e7e6e95a9e07e1d


--

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



[issue19459] Python does not support the GEORGIAN-PS charset

2021-10-18 Thread STINNER Victor


STINNER Victor  added the comment:

Python uses UTF-8 if the locale is not supported:

$ LANG=xxx python3.9 -c "import sys; print(sys.flags.utf8_mode)"
1

On Fedora 34, the locale is still supported, and Python 3.11 still fails:

vstinner@apu$ LANG=ka_GE.georgianps locale
LANG=ka_GE.georgianps
LC_CTYPE="ka_GE.georgianps"
LC_NUMERIC="ka_GE.georgianps"
LC_TIME="ka_GE.georgianps"
LC_COLLATE="ka_GE.georgianps"
LC_MONETARY="ka_GE.georgianps"
LC_MESSAGES="ka_GE.georgianps"
LC_PAPER="ka_GE.georgianps"
LC_NAME="ka_GE.georgianps"
LC_ADDRESS="ka_GE.georgianps"
LC_TELEPHONE="ka_GE.georgianps"
LC_MEASUREMENT="ka_GE.georgianps"
LC_IDENTIFICATION="ka_GE.georgianps"
LC_ALL=

vstinner@apu$ LANG=ka_GE.georgianps python3.11 -c "import sys; 
print(sys.flags.utf8_mode)"
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = './python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  stdlib dir = '/home/vstinner/python/main/Lib'
  sys._base_executable = '/home/vstinner/python/main/python'
  sys.base_prefix = '/usr/local'
  sys.base_exec_prefix = '/usr/local'
  sys.platlibdir = 'lib'
  sys.executable = '/home/vstinner/python/main/python'
  sys.prefix = '/usr/local'
  sys.exec_prefix = '/usr/local'
  sys.path = [
'/usr/local/lib/python311.zip',
'/home/vstinner/python/main/Lib',
'/home/vstinner/python/main/build/lib.linux-x86_64-3.11-pydebug',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the 
filesystem encoding
Python runtime state: core initialized
LookupError: unknown encoding: GEORGIAN-PS

Current thread 0x7ff89b81d2c0 (most recent call first):
  

--
resolution: fixed -> 
status: closed -> open

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27315
pull_request: https://github.com/python/cpython/pull/29044

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset aad88d33d9db0a93e480f0234292b948890dfc2a by Victor Stinner in 
branch 'main':
bpo-35134: Split warnings.h and weakrefobject.h (GH-29042)
https://github.com/python/cpython/commit/aad88d33d9db0a93e480f0234292b948890dfc2a


--

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27313
pull_request: https://github.com/python/cpython/pull/29042

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-10-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 034f607906de6e375cc9a98cc3b09f6d56f8be10 by Victor Stinner in 
branch 'main':
bpo-43760: Rename _PyThreadState_DisableTracing() (GH-29032)
https://github.com/python/cpython/commit/034f607906de6e375cc9a98cc3b09f6d56f8be10


--

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-10-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27304
pull_request: https://github.com/python/cpython/pull/29032

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27298
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/29027

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-10-18 Thread STINNER Victor


STINNER Victor  added the comment:

> * Cython: https://github.com/cython/cython/pull/4411

Merged:

* 0.29.x: 
https://github.com/cython/cython/commit/cbddad23e30ea6d31e0178a4c623f1f6d75452c3
* master: 
https://github.com/cython/cython/commit/4df1103bd30143ce022b07f98a2f62678d417e92

--

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



[issue30774] list_repr not safe against concurrent mutation

2021-10-18 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue32291] Value error for string shared memory in multiprocessing

2021-10-18 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner
status: pending -> open

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-18 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue.

--
resolution: fixed -> 
status: closed -> open

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



[issue45440] [C API] Py_IS_INFINITY() macro doesn't work in the limited C API if isinf() is not defined

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 00ffc4513df7b89a168e88da4d1e3ac367f7682f by Victor Stinner in 
branch 'main':
bpo-45440: Remove pymath.c fallbacks (GH-28977)
https://github.com/python/cpython/commit/00ffc4513df7b89a168e88da4d1e3ac367f7682f


--

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



[issue30459] PyList_SET_ITEM could be safer

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 51f8196d05f0e271358eee0f90fe044b20449fb5 by Victor Stinner in 
branch 'main':
bpo-30459: Use (void) in macros setting variables (GH-28982)
https://github.com/python/cpython/commit/51f8196d05f0e271358eee0f90fe044b20449fb5


--

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



[issue45476] [C API] Disallow using PyFloat_AS_DOUBLE() as l-value

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

I created bpo-45490: "[meta][C API] Avoid C macro pitfalls and usage of static 
inline functions" to discuss macros and static inline functions more generally.

--

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



[issue45490] [meta][C API] Avoid C macro pitfalls and usage of static inline functions

2021-10-15 Thread STINNER Victor


New submission from STINNER Victor :

C macros are really cool and useful, but there are a bunch of pitfalls which 
are better to avoid:
https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html

Some macros of the Python C API have been converted to static inline functions 
over the last years. It went smoothly, I am not aware of any major issue with 
these conversions.

This meta issue tracks other issues related to macros and static inline 
functions.


=== Return void ===

One issue is that some macros are treated as an expression and can be reused, 
whereas it was not intended. For example PyList_SET_ITEM() was implemented as 
(simplified code):

  #define PyList_SET_ITEM(op, i, v) (op->ob_item[i] = v)

This expression has a value! Two projects used this value by mistake, like:

  "if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0)"

PyList_SET_ITEM() was fixed by casting the expression to void:

  #define PyList_SET_ITEM(op, i, v) ((void)(op->ob_item[i] = v))

=> bpo-30459



=== Abuse macros as an l-value ===

The Py_TYPE() macro could be used to assign a value: "Py_TYPE(obj) = new_type".

The macro was defined as:

  #define Py_TYPE(ob) (ob->ob_type)

It was converted to a static inline function to disallow using it as an l-value 
and a new Py_SET_TYPE(op, new_type) function was added. These changes give more 
freedom to other Python implementations to implement "PyObject" and 
Py_SET_TYPE().

=> bpo-45476 "[C API] Disallow using PyFloat_AS_DOUBLE() as l-value"
=> bpo-39573 PyObject Py_TYPE/Py_SET_TYPE


=== C API: Macros and embedded Python ===

Sadly, only symbols exported by libpython are accessible to other programming 
languages embedding Python. Macros of the Python C API are simply not available 
to them. Projects embedding Python have to hardcode constants and copy macros 
to their own language, with the risk of being outdated when Python macros are 
updated.

Even some projects written in C cannot use macros, because they only use 
libpython symbols. The vim text editor embeds Python this way.

Also, macros are simply excluded from the Python stable ABI (PEP 384).


=== Performance of static inline functions ===

In bpo-45116, it seems like _PyEval_EvalFrameDefault() reached Visual Studio 
thresholds and some static inline functions are no longer inlined 
(Py_INCREF/Py_DECREF).

I also noticed that when Python is built in debug mode in Visual Studio, static 
inline functions are not inlined. Well, the compiler is free to not inline in 
debug mode. I guess that GCC and clang also skip inlining using -Og and/or -O0 
optimization levels. Using __forceinline and __attribute__((always_inline)) on 
static inline functions (Py_INCREF, Py_TYPE) for debug builds was discussed in 
bpo-45094, but the idea was rejected.

On the other side, sometimes it's better to *disable* inlining on purpose to 
reduce the stack memory consumption, using the Py_NO_INLINE macro. See recent 
measurements of the stack memory usage:
https://bugs.python.org/issue45439#msg403768

In GH-28893, I noticed that converting a static inline function 
(PyObject_CallOneArg) to a regular function made it faster. I am not really 
sure, more benchmarks should be run to really what's going on.


=== Advantages of static inline functions ===

* It's possible to put a breakpoint on a static inline functions.

* Debuggers and profilers are able to get the static inline function names from 
the machine line, even with inline functions.

* Parameters and the return value have well defined types.

* Variables have a local scope.

* There is no risk of evaluating an expression multiple times.

* Regular C code. No need to use "\" character to multi-line statement. No need 
for "do { ... } while (0)" and other quicks to workaround preprocessor 
pitfalls. No abuse of (((parenthesis))).

--
components: C API
messages: 404038
nosy: vstinner
priority: normal
severity: normal
status: open
title: [meta][C API] Avoid C macro pitfalls and usage of static inline functions
versions: Python 3.11

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



[issue30459] PyList_SET_ITEM could be safer

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27269
pull_request: https://github.com/python/cpython/pull/28982

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



[issue45116] Performance regression 3.10b1: inlining issue in the big _PyEval_EvalFrameDefault() function with Visual Studio (MSC)

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
title: Performance regression 3.10b1 and later on Windows: Py_DECREF() not 
inlined in PGO build -> Performance regression 3.10b1: inlining issue in the 
big _PyEval_EvalFrameDefault() function with Visual Studio (MSC)

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



[issue45444] test.test_concurrent_futures fail in x86_ 64 architecture

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

What is your operating system? (name/version) Did you try to build Python 
manually and run the test manually? How did you build Python? What are the 
configure flags and compiler flags?

--
nosy: +vstinner

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

PyThreadState.cframe.use_tracing format changed again: set value set to 0 or 
255.
https://github.com/python/cpython/commit/bd627eb7ed08a891dd1356756feb1ce2600358e4

--

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-43760: Add PyThreadState_EnterTracing() (GH-28542)

I created changes to use it:

* pythoncapi_compat: 
https://github.com/pythoncapi/pythoncapi_compat/commit/10fde24739cab4547e9c27c31c8804a25e23e8a0
* Cython: https://github.com/cython/cython/pull/4411
* greenlet: https://github.com/python-greenlet/greenlet/pull/267

--

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



[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 547d26aa08aa5e4ec6e4f8a5587b30b39064a5ba by Victor Stinner in 
branch 'main':
bpo-43760: Add PyThreadState_EnterTracing() (GH-28542)
https://github.com/python/cpython/commit/547d26aa08aa5e4ec6e4f8a5587b30b39064a5ba


--

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



[issue43725] Create a release branch ABI stability regression test

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

> the dump needs to be generated in a docker container using the same compiler 
> version that is used in the CI

I'm not used to docker and I don't know how to get a docker similar than the 
one used by GitHub Action. Is there a documentation somewhere giving commands 
to get the docker image and how to run it?

--

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



[issue45310] test_multiprocessing_forkserver: test_shared_memory_basics() failed with FileExistsError: [Errno 17] File exists: '/test01_tsmb'

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27267
pull_request: https://github.com/python/cpython/pull/28979

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



[issue45484] test_pickle segfault on s390x RHEL7 LTO 3.x

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

It seems like pickle tests started to crash at build 936, 4 days ago:
https://buildbot.python.org/all/#/builders/402/builds/936

This build was trigged by the change:

commit fcb3d2ff633f3e9a826888d8b29c305a3959ff54
Author: Mark Shannon 
Date:   Mon Oct 11 11:34:02 2021 +0100

Restore PEP 523 functionality. (GH-28871)


I don't know if the commit is related to the crash or not.

--

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



[issue45484] test_pickle segfault on s390x RHEL7 LTO 3.x

2021-10-15 Thread STINNER Victor


New submission from STINNER Victor :

s390x RHEL7 LTO 3.x:
https://buildbot.python.org/all/#/builders/402/builds/979


0:02:00 load avg: 5.14 [193/427/2] test_pickletools crashed (Exit code -11) -- 
running: test_unparse (30.6 sec), test_concurrent_futures (1 min 56 sec), 
test_multiprocessing_spawn (43.2 sec)
Fatal Python error: Segmentation fault

Current thread 0x03ffb8e77700 (most recent call first):
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3304 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  (...)
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  ...

Extension modules: _testcapi, _testbuffer (total: 2)


and


test_instance_dispatch_table (test.test_pickle.CDispatchTableTests) ... ok
test_appends_on_non_lists (test.test_pickle.CDumpPickle_LoadPickle) ... ok
test_attribute_name_interning (test.test_pickle.CDumpPickle_LoadPickle) ... ok
Fatal Python error: Segmentation fault

Current thread 0x03ff80377700 (most recent call first):
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  (...)
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  File 
"/home/dje/cpython-buildarea/3.x.edelsohn-rhel-z.lto/build/Lib/test/pickletester.py",
 line 3305 in __getattr__
  ...

Extension modules: _testcapi, _testbuffer (total: 2)


--
components: Tests
messages: 404014
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_pickle segfault on s390x RHEL7 LTO 3.x
versions: Python 3.11

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



[issue45482] [C API] Move _PyNamespace_New() to the internal C API

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: [C API] Add PySimpleNamespace_New() function -> [C API] Move 
_PyNamespace_New() to the internal C API

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



[issue45482] [C API] Add PySimpleNamespace_New() function

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 354c35220d25a893e502014478f6739dad6897f3 by Victor Stinner in 
branch 'main':
bpo-45482: Rename namespaceobject.h to pycore_namespace.h (GH-28975)
https://github.com/python/cpython/commit/354c35220d25a893e502014478f6739dad6897f3


--

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



[issue45440] [C API] Py_IS_INFINITY() macro doesn't work in the limited C API if isinf() is not defined

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27265
pull_request: https://github.com/python/cpython/pull/28977

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



[issue45476] [C API] Disallow using PyFloat_AS_DOUBLE() as l-value

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
title: [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static 
inline functions -> [C API] Disallow using PyFloat_AS_DOUBLE() as l-value

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



[issue45476] [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static inline functions

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

> #define Py_RVALUE(expr) ((void)0, (expr))

Oh, that's a clever trick!

I wrote GH-28976 which uses it.

--

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



[issue45476] [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static inline functions

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27264
pull_request: https://github.com/python/cpython/pull/28976

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



[issue44113] [C API] Deprecate legacy API for configure Python initialization

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a7f8dfd25a167ccfde9996c499fa38a2aba60022 by Victor Stinner in 
branch 'main':
bpo-44113: Move the What's New entry to Deprecate section (GH-28974)
https://github.com/python/cpython/commit/a7f8dfd25a167ccfde9996c499fa38a2aba60022


--

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



[issue45482] [C API] Add PySimpleNamespace_New() function

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

> The other choice is to move the function to the internal C API.

I created GH-28975 for that.

--

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



[issue45482] [C API] Add PySimpleNamespace_New() function

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27263
pull_request: https://github.com/python/cpython/pull/28975

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



[issue44113] [C API] Deprecate legacy API for configure Python initialization

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27262
pull_request: https://github.com/python/cpython/pull/28974

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 105582e74c1817bc6a9d99bcb6540b34a3367292 by Victor Stinner in 
branch 'main':
bpo-45434: Remove Include/eval.h header file (GH-28973)
https://github.com/python/cpython/commit/105582e74c1817bc6a9d99bcb6540b34a3367292


--

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27261
pull_request: https://github.com/python/cpython/pull/28973

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



[issue35081] Move internal headers to Include/internal/

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 063abd931f064a4b6b478b0b6e9aa13ee38d2cff by Victor Stinner in 
branch 'main':
bpo-35081: Move interpreteridobject.h to Include/internal/ (GH-28969)
https://github.com/python/cpython/commit/063abd931f064a4b6b478b0b6e9aa13ee38d2cff


--

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



[issue45476] [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static inline functions

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

For PyObject, I converted Py_REFCNT(), Py_TYPE() and Py_SIZE() to static inline 
functions to enforce the usage of Py_SET_REFCNT(), Py_SET_TYPE() and 
Py_SET_SIZE(). Only a minority of C extensions are affected by these changes. 
Also, there is more pressure from recent optimization projects to abstract 
accesses to PyObject members.

I agree that it doesn't seem that "AS" functions are abused to *set* the inner 
string:

* PyByteArray_AS_STRING()
* PyBytes_AS_STRING()
* PyFloat_AS_DOUBLE()

> If "protecting against wrong use" is the only reason to go down the slippery 
> path of starting to rely on compiler optimizations for performance critical 
> operations, the argument is not good enough.

Again, I'm not aware of any performance issue caused by short static inline 
functions like Py_TYPE() or the proposed PyFloat_AS_DOUBLE(). If there is a 
problem, it should be addressed, since Python uses more and more static inline 
functions.

static inline functions is a common feature of C language. I'm not sure where 
your doubts of bad performance come from.

Using static inline functions has other advantages. It helps debugging and 
profiling, since the function name can be retrieved by debuggers and profilers 
when analysing the machine code. It also avoids macro pitfalls (like abusing a 
macro to use it as an l-value ;-)).

--

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



[issue45474] [C API] marshal.h must not use FILE* type in the limited C API

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

Petr:
> Just note that these were *not* part of the limited API, which is defined in 
> Misc/stable_abi.txt rather than the #ifdefs: 
> https://docs.python.org/3.10/c-api/stable.html#stable
> If they were, the functions would need to remain in the stable ABI.

Thanks for double checking. I wasn't sure ;-)
https://github.com/python/cpython/pull/28956#issuecomment-943704218

--

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



[issue45482] [C API] Add PySimpleNamespace_New() function

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

I created this issue while cleaning the C API. I'm not fully convinced that 
PySimpleNamespace_New() must be made public.

The other choice is to move the function to the internal C API.

--

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



[issue45482] [C API] Add PySimpleNamespace_New() function

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


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

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



[issue45482] [C API] Add PySimpleNamespace_New() function

2021-10-15 Thread STINNER Victor


New submission from STINNER Victor :

Python has a types.SimpleNamespace type which is convenient to cheap a "simple 
namespace". I propose to make its C API public (but exclude it from the limited 
C API): add PySimpleNamespace_New() function.

It's currently used in:

* Modules/timemodule.c: time.get_clock_info(name)
* Python/sysmodule.c: sys.implementation

It's also used in:

* Python/import.c: _PyImport_BootstrapImp()
* Modules/_testmultiphase.c: createfunc_nonmodule() used as the Py_mod_create 
slot

--
components: C API
messages: 403984
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] Add PySimpleNamespace_New() function
versions: Python 3.11

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8e5de40f90476249e9a2e5ef135143b5c6a0b512 by Victor Stinner in 
branch 'main':
bpo-35134: Move classobject.h to Include/cpython/ (GH-28968)
https://github.com/python/cpython/commit/8e5de40f90476249e9a2e5ef135143b5c6a0b512


--

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



[issue35081] Move internal headers to Include/internal/

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue since there is still activity on it.

--
resolution: fixed -> 
status: closed -> open

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



[issue35081] Move internal headers to Include/internal/

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27257
pull_request: https://github.com/python/cpython/pull/28969

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27256
pull_request: https://github.com/python/cpython/pull/28968

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



[issue45084] urllib.parse: remove deprecated functions (splittype, to_bytes, etc.)

2021-10-15 Thread STINNER Victor


STINNER Victor  added the comment:

pip uses deprecated functions indirectly:
https://github.com/python/cpython/pull/28115

Python 3.11 seems to be too early to *remove* functions. We can attempt again 
in the next Python release ;-)

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

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-15 Thread STINNER Victor


Change by STINNER Victor :


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

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


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

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 77b24ba505744532d7cfd721b1c92d205e145180 by Victor Stinner in 
branch 'main':
bpo-35134: Move Include/cellobject.h to Include/cpython/ (GH-28964)
https://github.com/python/cpython/commit/77b24ba505744532d7cfd721b1c92d205e145180


--

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



[issue45476] [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static inline functions

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:

I searched for "PyFloat_AS_DOUBLE.*=" regex in the PyPI top 5000 projects. I 
couldn't find any project doing that.

I only found perfectly safe comparisons:

traits/ctraits.c:if (PyFloat_AS_DOUBLE(value) <= 
PyFloat_AS_DOUBLE(low)) {
traits/ctraits.c:if (PyFloat_AS_DOUBLE(value) >= 
PyFloat_AS_DOUBLE(high)) {
c/_cffi_backend.c:return PyFloat_AS_DOUBLE(ob) != 0.0;
pandas/_libs/src/klib/khash_python.h:   ( PyFloat_AS_DOUBLE(a) == 
PyFloat_AS_DOUBLE(b) );

--

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27253
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/28964

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:

commit 37b1d607bf0f1a9c1e89b1715349efc24dc180e0 (upstream/main, main)
Author: Victor Stinner 
Date:   Fri Oct 15 01:50:28 2021 +0200

po-35134: Move Include/funcobject.h to Include/cpython/ (GH-28958)

Remove redundant "#ifndef Py_LIMITED_API" in funcobject.h.

--

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7076bef8ba8836a19d5033f4ceb8eb9837de2301 by Victor Stinner in 
branch 'main':
bpo-45434: Remove useless space in includes (GH-28963)
https://github.com/python/cpython/commit/7076bef8ba8836a19d5033f4ceb8eb9837de2301


--

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



[issue41710] threading.Lock.acquire(timeout) should use sem_clockwait(CLOCK_MONOTONIC)

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 03bbc6066ff40c62edd57612be9150dcf1b123c8 by Victor Stinner in 
branch 'main':
bpo-41710: Fix What's New Entry credit (GH-28962)
https://github.com/python/cpython/commit/03bbc6066ff40c62edd57612be9150dcf1b123c8


--

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



[issue45476] [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static inline functions

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:

Raymond:
> AFAICT, no one has ever has problems with these being macros.

This issue is about the API of PyFloat_AS_DOUBLE(). Implementing it as a macro 
or a static inline function is an implementation detail which doesn't matter. 
But I don't know how to disallow "PyFloat_AS_DOUBLE(obj) = value" if it is 
defined as a macro.

Have a look at the Facebook "nogil" project which is incompatible with 
accessing directly the PyObject.ob_refcnt member:
"Extensions must use Py_REFCNT and Py_SET_REFCNT instead of directly accessing 
reference count fields"
https://docs.google.com/document/d/18CXhDb1ygxg-YXNBJNzfzZsDFosB5e6BfnXLlejd9l0/edit

Raymond:
> You could simply document, "don't do that".

Documentation doesn't work. Developers easily fall into traps when it's 
possible to fall. See bpo-30459 for such trap with PyList_SET_ITEM() and 
PyCell_SET() macros. They were misused by two Python projects.


Raymond:
> We really don't have to go on thin ice converting to functions that might or 
> might not be inlined depending on compiler specific nuances.

Do you have a concrete example where a static inline function is not inlined, 
whereas it was inlined when it was a macro? So far, I'm not aware of any 
performance issue like that.

There were attempts to use __attribute__((always_inline)) (Py_ALWAYS_INLINE), 
but so far, using it was not a clear win.

--

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27252
pull_request: https://github.com/python/cpython/pull/28963

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



[issue41710] threading.Lock.acquire(timeout) should use sem_clockwait(CLOCK_MONOTONIC)

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27251
pull_request: https://github.com/python/cpython/pull/28962

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



[issue45476] [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static inline functions

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


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

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 284994762d820d8e09cc019f8f7c4bc501e37dd4 by Victor Stinner in 
branch 'main':
bpo-45434: Limited Python.h no longer includes stdio.h (GH-28960)
https://github.com/python/cpython/commit/284994762d820d8e09cc019f8f7c4bc501e37dd4


--

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27249
pull_request: https://github.com/python/cpython/pull/28960

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



[issue45474] [C API] marshal.h must not use FILE* type in the limited C API

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


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

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



[issue45474] [C API] marshal.h must not use FILE* type in the limited C API

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset af1083e975b9627a5c97013d3a2b9aef0e4b333c by Victor Stinner in 
branch 'main':
bpo-45474: Fix the limited C API of marshal.h (GH-28956)
https://github.com/python/cpython/commit/af1083e975b9627a5c97013d3a2b9aef0e4b333c


--

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests:  -23644

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue since there is new activity on it :-)

--
resolution: fixed -> 
status: closed -> open

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27247
pull_request: https://github.com/python/cpython/pull/28958

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0a883a76cda8205023c52211968bcf87bd47fd6e by Victor Stinner in 
branch 'main':
bpo-35134: Add Include/cpython/floatobject.h (GH-28957)
https://github.com/python/cpython/commit/0a883a76cda8205023c52211968bcf87bd47fd6e


--

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



[issue45476] [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static inline functions

2021-10-14 Thread STINNER Victor


New submission from STINNER Victor :

The Python C API provides "AS" functions to convert an object to another type, 
like PyFloat_AS_DOUBLE(). These macros can be abused to be used as l-value: 
"PyFloat_AS_DOUBLE(obj) = new_value;". It prevents to change the PyFloat 
implementation and makes life harder for Python implementations other than 
CPython.

I propose to convert these macros to static inline functions to disallow using 
them as l-value.

I made a similar change for Py_REFCNT(), Py_TYPE() and Py_SIZE(). For these 
functions, I added "SET" variants: Py_SET_REFCNT(), Py_SET_TYPE(), 
Py_SET_SIZE(). Here, I don't think that the l-value case is legit, and so I 
don't see the need to add a way to *set* a value.

For example, I don't think that PyFloat_SET_DOUBLE(obj, value) would make 
sense. A Python float object is supposed to be immutable.

--
components: C API
messages: 403950
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] Convert "AS" functions, like PyFloat_AS_DOUBLE(), to static 
inline functions
versions: Python 3.11

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



[issue35134] Add a new Include/cpython/ subdirectory for the "CPython API" with implementation details

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +27246
pull_request: https://github.com/python/cpython/pull/28957

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



[issue45474] [C API] marshal.h must not use FILE* type in the limited C API

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


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

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



[issue45474] [C API] marshal.h must not use FILE* type in the limited C API

2021-10-14 Thread STINNER Victor


New submission from STINNER Victor :

Include/marshal.h defines 2 functions with FILE* argument in the limited C API, 
whereas the PEP 384 disallows that:

"In addition, functions expecting FILE* are not part of the ABI, to avoid 
depending on a specific version of the Microsoft C runtime DLL on Windows."
https://www.python.org/dev/peps/pep-0384/

PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int);
PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int);

I propose to exclude these functions from the limited C API.

Hopefully, they are not part of the documented stable ABI.

--
components: C API
messages: 403941
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] marshal.h must not use FILE* type in the limited C API
versions: Python 3.11

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



[issue45434] [C API] Clean-up the Python.h header file

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:

I tried to remove the  include from Python.h:

-#include// memcpy()

... but it required me to modify 100+ files. I don't know the exact number, I 
gave up after 100 files. I was near half of C extensions built by setup.py, so 
the number total may be around 150 files which should include explicitly 
.

"#include " can now be removed from Python.h, but I'm not sure if it's 
a good idea. I started by removing  and my plan is to see if it 
breaks third party C extensions. Right now, Cython is broken which prevents me 
to use my https://github.com/vstinner/pythonci tool :-(

--

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:

I decided to merge my PR to address https://bugs.python.org/issue45439 initial 
issue: "[C API] Move usage of **tp_vectorcall_offset** from public headers to 
the internal C API".

Last years, I added `tstate` parameters to internal C functions. The agreement 
was that only internal functions should use it, and indirectly that this 
`tstate` parameter should be hidden. I'm now sure exactly, but `tstate` started 
to pop up in `Include/cpython/abstract.h` around "call" functions. This PR fix 
this issue.

About the impact on performances: well, it's really hard to draw a clear 
conclusion. Inlining, LTO and PGO give different results on runtime performance 
and stack memory usage.

IMO the fact that public C API functions are now regular functions should not 
prevent us to continue (micro) optimizing Python. We can always add a variant 
to the internal C API using an API a little bit different (e.g. add `tstate` 
parameter) or defined as a static inline function, rather than a regular 
function.

The unclear part is if PyObject_CallOneArg() (regular function call) is faster 
than _PyObject_CallOneArg() (static inline function, inlined). The performance 
may depend if it's called in the Python executable or in a dynamic library (PLT 
indirection which may be avoided by `gcc -fno-semantic-interposition`).

Well, happy hacking and let's continue *continuous* benchmarking Python!

--

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



[issue45439] [C API] Move usage of tp_vectorcall_offset from public headers to the internal C API

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3cc56c828d2d8f8659ea49447234bf0d2b87cd64 by Victor Stinner in 
branch 'main':
bpo-45439: Move _PyObject_VectorcallTstate() to pycore_call.h (GH-28893)
https://github.com/python/cpython/commit/3cc56c828d2d8f8659ea49447234bf0d2b87cd64


--

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



[issue45452] Support crash tolerance feature for gdbm module

2021-10-14 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

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



[issue45467] Fix incremental decoder and stream reader in the "raw-unicode-escape" codec

2021-10-14 Thread STINNER Victor


STINNER Victor  added the comment:

Serhiy: I suppose that this issue can now be closed?

--

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



<    8   9   10   11   12   13   14   15   16   17   >