[issue47168] Improvements for stable ABI definition files

2022-04-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thinking more about Doc/data/stable_abi.dat, I don't think the rename is worth 
it. The file is not meant to be used/edited by humans.
If someone needs the data for something other than running the Sphinx 
extension, let me know. We should provide a proper data source for their use 
case.

--

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



[issue47168] Improvements for stable ABI definition files

2022-04-08 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +30441
pull_request: https://github.com/python/cpython/pull/32415

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



[issue47169] Stable ABI: Some optional (#ifdef'd) functions aren't handled correctly

2022-04-08 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +30440
pull_request: https://github.com/python/cpython/pull/32414

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



[issue23312] google thinks the docs are mobile unfriendly

2022-04-08 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue23312] google thinks the docs are mobile unfriendly

2022-04-08 Thread Petr Viktorin

Petr Viktorin  added the comment:

This has been solved by the new theme. The Goolgle report linked above shows 
“Passed” and “96” (out of 100).
It does show a few opportunities to improve, but many seem to indirectly 
complain that the page is big.

I'm closing the issue.

--
nosy: +petr.viktorin

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



[issue47169] Stable ABI: Some optional (#ifdef'd) functions aren't handled correctly

2022-04-06 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue47115] Documentation inconsistency with the stable ABI

2022-04-06 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset d79f118d044e9b4244b5dfda35448d39202d7f56 by Petr Viktorin in 
branch 'main':
bpo-47115: Document which parts of structs are in limited API/stable ABI 
(GH-32196)
https://github.com/python/cpython/commit/d79f118d044e9b4244b5dfda35448d39202d7f56


--

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



[issue47168] Improvements for stable ABI definition files

2022-04-06 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +30412
pull_request: https://github.com/python/cpython/pull/32365

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



[issue21314] Document '/' in signatures

2022-04-04 Thread Petr Viktorin


Petr Viktorin  added the comment:

- PEP 570 (Python Positional-Only Parameters) is final
- The language spec was updated to mention it
- the FAQ entry was revised to not link to the PEP and be a self-contained 
explanation

IMO the only thing left is to make searching for `/` yield the right results, 
but that is bpo-15871.
Closing this issue.

--
nosy: +petr.viktorin
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

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



[issue47168] Improvements for stable ABI definition files

2022-04-01 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 079143df7e40c4d336cb5c385b166aa91058d050 by Petr Viktorin in 
branch 'main':
bpo-47168: Mark files generated by `make regen-limited-abi` as generated 
(GH-32195)
https://github.com/python/cpython/commit/079143df7e40c4d336cb5c385b166aa91058d050


--

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



[issue47179] pymalloc should align to max_align_t

2022-03-31 Thread Petr Viktorin


New submission from Petr Viktorin :

malloc() returns memory that's "suitably aligned for any built-in type".
All of Python's allocation functions should do the same. 

In bpo-27987 (PR-12850, PR-13336), the alignment was raised* to 16 bytes and 
`long double`. This is OK for current architectures, so there is no practical 
issue right now.

But, C11 defines a [max_align_t] type which sounds like the *correct* thing to 
use for determining pymalloc/PyGC_Head alignment.
At least we should assert that obmalloc's ALIGNMENT is a multiple of 
`alignof(max_align_t)`, and use max_align_t rather than `long double` in 
PyGC_Head.



See also this python-cffi issue: 
https://foss.heptapod.net/pypy/cffi/-/issues/531#note_181779

[max_align_t]: https://en.cppreference.com/w/c/types/max_align_t

* (on 64-bit arches)

--
components: C API
messages: 416421
nosy: methane, petr.viktorin, pitrou, vstinner
priority: normal
severity: normal
status: open
title: pymalloc should align to max_align_t

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



[issue44133] Some C-API symbols (e.g. Py_FrozenMain) are not always exported on Unix

2022-03-30 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Ah, sorry, I could have described the issue better. It's not a problem with 
> exporting, PyThread_get_thread_native_id() isn't available on Solaris (and 
> possibly other platforms) at all.

Jakub, does this mean test_stable_abi_ctypes fails on Solaris?
Are there any other missing functions?
I opened bpo-47169 to improve the situation.

--

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



[issue47169] Stable ABI: Some optional (#ifdef'd) functions aren't handled correctly

2022-03-30 Thread Petr Viktorin


New submission from Petr Viktorin :

- PyThread_get_thread_native_id is only available when PY_HAVE_THREAD_NATIVE_ID 
is defined. The test currently always expects it to be available.
- PyOS_CheckStack is only available when USE_STACKCHECK is defined (i.e. on 
Windows). It should be exported from the DLL.

I plan to:
- add the appropriate metadata
- improve handling & testing of such optional functions in general

--
components: C API
messages: 416377
nosy: petr.viktorin
priority: normal
severity: normal
status: open
title: Stable ABI: Some optional (#ifdef'd) functions aren't handled correctly

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



[issue47168] Improvements for stable ABI definition files

2022-03-30 Thread Petr Viktorin


New submission from Petr Viktorin :

This issue groups together a few changes I'd like to make:

- Rename Doc/data/stable_abi.dat to *.csv, so it gets syntax highlighting. (The 
only user of that file should be the Sphinx extension)
- Mark autogenerated files as such in .gitattributes
- Convert Misc/stable_abi.txt to TOML, and change the parser to match (this 
will need a heads-up on python-dev)

--
messages: 416376
nosy: petr.viktorin
priority: normal
severity: normal
status: open
title: Improvements for stable ABI definition files

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



[issue47168] Improvements for stable ABI definition files

2022-03-30 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue47115] Documentation inconsistency with the stable ABI

2022-03-30 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue47115] Documentation inconsistency with the stable ABI

2022-03-30 Thread Petr Viktorin


Petr Viktorin  added the comment:

So. According to PEP 384 (which added all structs in the stable ABI, except 
Py_buffer), some structs are opaque and others have a few members exposed:
https://peps.python.org/pep-0384/#structures

I will split the latter into 1) structs that have a few fields exposed mainly 
for backwards compatibility (which, of course, is very important here). Best 
practice is to treat them as opaque (use getters/setters):

- PyObject (ob_refcnt, ob_type)
- PyVarObject (ob_base, ob_size)

... and 2) structs for which all fields are part of the ABI (and the struct's 
size as well: for most of these as users are expected to provide arrays):

- PyMethodDef
- PyMemberDef
- PyGetSetDef
- PyModuleDefBase
- PyModuleDef
- PyStructSequence_Field
- PyStructSequence_Desc
- PyType_Slot
- PyType_Spec
- Py_buffer (new in 3.11)

The opaque structs continue to be:

- PyThreadState
- PyInterpreterState
- PyFrameObject
- symtable
- PyWeakReference
- PyLongObject
- PyTypeObject

--
nosy: +vstinner

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



[issue47142] Document importlib.resources.abc.Traversable

2022-03-28 Thread Petr Viktorin

New submission from Petr Viktorin :

importlib.resources.files is documented [0] as returning 
importlib.resources.abc.Traversable, which is an undocumented class (dead link) 
now. It should be documented.
The [source] has helpful docstrings, but is missing some details. I'd like to 
know these before writing some docs:

- Can the argument to `joinpath` contain path separators?
- Are the methods expected to raise specific exception types (e.g. if a 
resource is missing, or you call iterdir on a “file”)? This seems quite 
important for people who implement the protocol.


[0]: 
https://docs.python.org/dev/library/importlib.resources.html#importlib.resources.files
[source]: 
https://github.com/python/cpython/blob/main/Lib/importlib/resources/abc.py#L49

--
assignee: docs@python
components: Documentation
messages: 416164
nosy: docs@python, jaraco, petr.viktorin
priority: normal
severity: normal
status: open
title: Document importlib.resources.abc.Traversable

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



[issue47115] Documentation inconsistency with the stable ABI

2022-03-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thanks for the report! You're right that this is misleading. I'll clarify the 
docs for this and other structs.

- struct PyTypeObject is part if the limited API.
- its fields and size are not part of the API or stable ABI.

--

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



[issue45413] Add install scheme for virtual environments

2022-03-18 Thread Petr Viktorin

Petr Viktorin  added the comment:


New changeset 48d926269963cfe7a49c0a4f34af4fe9b832399b by Miro Hrončok in 
branch 'main':
bpo-45413: Define "posix_venv", "nt_venv" and "venv" sysconfig installation 
schemes (GH-31034)
https://github.com/python/cpython/commit/48d926269963cfe7a49c0a4f34af4fe9b832399b


--

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



[issue45149] Cover directory and zipfile execution in __main__ module docs

2022-03-11 Thread Petr Viktorin


Change by Petr Viktorin :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

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



[issue40059] Provide a toml module in the standard library

2022-03-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

The PR is merged and buildbots are green. Thank you to everyone who helped!


Now would be a good time to bikeshed wording in the documentation.

>From the PR:
> Would it be good to mention in the docs why load() takes only binary files? 
> The encoding requirement probably isn't obvious for first-time users.

--

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



[issue40059] Provide a toml module in the standard library

2022-03-08 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 591f6754b56cb7f6c31fce8c22528bdf0a99556c by Taneli Hukkinen in 
branch 'main':
bpo-40059: Add tomllib (PEP-680) (GH-31498)
https://github.com/python/cpython/commit/591f6754b56cb7f6c31fce8c22528bdf0a99556c


--
nosy: +petr.viktorin

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



[issue45413] Add install scheme for virtual environments

2022-03-04 Thread Petr Viktorin


Petr Viktorin  added the comment:

Steve, could you take a look at the PR discussion and chime in about how this 
should be done?

--

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



[issue46623] test_zlib: test_pair() and test_speech128() fail with s390x hardware accelerator

2022-03-03 Thread Petr Viktorin


Petr Viktorin  added the comment:

The current fix skips all of the tests, rather than just the parts that fail.

--
nosy: +petr.viktorin
resolution: fixed -> 
status: closed -> open

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



[issue46748] Python.h includes stdbool.h

2022-02-28 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thank you, Kumar & Victor, for fixing up the issue!

I meant to check the buildbots before closing the issue, but got side-tracked.

--
stage: patch review -> resolved
status: pending -> closed

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



[issue46748] Python.h includes stdbool.h

2022-02-25 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 2c228a7b8f89e9ed8d390370abd771d4993b79d8 by Petr Viktorin in 
branch 'main':
bpo-46748: Don't import  in public headers (GH-31553)
https://github.com/python/cpython/commit/2c228a7b8f89e9ed8d390370abd771d4993b79d8


--

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



[issue46836] [C API] Move PyFrameObject to the internal C API

2022-02-24 Thread Petr Viktorin


Petr Viktorin  added the comment:

OK, looking at it more carefully, it makes sense to do the change.

--

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



[issue46748] Python.h includes stdbool.h

2022-02-24 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue46836] [C API] Move PyFrameObject to the internal C API

2022-02-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

So, this will break Cython and gevent, but (unlike the optimization work that 
broke f_code/f_frame) it won't provide any value to users?

I don't see how that's a good idea.

--

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



[issue46835] ImportError: bad magic number in ... does not indicate where is that file located

2022-02-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

I assume a PR review should be enough.

--
components: +Library (Lib) -Interpreter Core

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



[issue46748] Python.h includes stdbool.h

2022-02-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

It is in C99, but in an optional header.
IMO, including the header in the internals is perfectly OK, but opting everyone 
else in isn't very nice.
i.e. it would probably be OK to use `_Bool`, the actual C99 keyword that `bool` 
is defined as. But that's ugly enough to prefer `int`...

--

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



[issue46748] Python.h includes stdbool.h

2022-02-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

Yes, stdbool.h is essentially a backport of C++'s bool type to C.

--

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



[issue46748] Python.h includes stdbool.h

2022-02-14 Thread Petr Viktorin


New submission from Petr Viktorin :

In main, cpython/pystate.h newly includes stdbool.h, providing a definition for 
`bool` that might be incompatible with other software.

See here: https://github.com/cmusphinx/sphinxbase/pull/90

Eric, is this necessary? Would an old-school `int` do?
Or should we say it's 2022 already and everyone needs to use stdbool.hfore 
bools?

--
messages: 413216
nosy: eric.snow, petr.viktorin
priority: normal
severity: normal
status: open
title: Python.h includes stdbool.h
versions: Python 3.11

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



[issue46613] Add PyType_GetModuleByDef to the public & limited API

2022-02-11 Thread Petr Viktorin


Petr Viktorin  added the comment:

It's in public API, adding it to limited is still pending.

--

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



[issue46613] Add PyType_GetModuleByDef to the public & limited API

2022-02-11 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 204946986feee7bc80b233350377d24d20fcb1b8 by Petr Viktorin in 
branch 'main':
bpo-46613: Add PyType_GetModuleByDef to the public API (GH-31081)
https://github.com/python/cpython/commit/204946986feee7bc80b233350377d24d20fcb1b8


--

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-11 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-11 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 8b8673fe940c4ebc4512bff5af180b66def3d1ae by Petr Viktorin in 
branch '3.10':
[3.10] bpo-46433: _PyType_GetModuleByDef: handle static types in MRO (GH-30696) 
(GH-31262)
https://github.com/python/cpython/commit/8b8673fe940c4ebc4512bff5af180b66def3d1ae


--

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-10 Thread Petr Viktorin


Petr Viktorin  added the comment:

Just 3.10, after all. 3.9 doesn't have the function yet.

I did the backport, but I'd welcome a review by a fresh set of eyes!

--
versions:  -Python 3.9

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-10 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +29429
stage: backport needed -> patch review
pull_request: https://github.com/python/cpython/pull/31262

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



[issue45413] Add install scheme for virtual environments

2022-02-09 Thread Petr Viktorin


Petr Viktorin  added the comment:

> I think we want the scheme to be static and accessible on all platforms, like 
> the others. So it probably should be 'nt_venv' and 'posix_venv' with 
> additional/improved logic to help apps determine when they need each.

Why? (This is a real question, I genuinely don't know.)

To put this in context, this has been discussed since October, and there was 
agreement on how to change it.
Now a PR exists. It is tested. Also, since this fixes urgent breaking changes, 
patches for "venv" is already in Fedora and Ubuntu deadsnakes PPA, and 
virtualenv also supports it. Changing direction now will mean lots of work 
changing and re-testing anything. That's definitely possible, just frustrating, 
but if someone calls to change something again, we risk not making it in 3.11.

How can we ensure the decision won't change again?
How can these discussions be made more effective?

--

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



[issue46640] Python can now use the C99 NAN constant or __builtin_nan()

2022-02-07 Thread Petr Viktorin


Petr Viktorin  added the comment:

> IMO this PEP is outdated for a long time.

It is not. Even if it is, it should be marked as such, and that is not a 
decision that should be done in this issue.

Please, don't break the rules because you think they're outdated.

> Well, if you ask me, I would simply require a C99 compiler. That's all :-)

Please propose that change. Perhaps it would be a good change to make, but I 
don't even know how to determine that.
Nor can I list the places where the change should be made -- at least there 
should be a What's New entry like 
https://docs.python.org/3.10/whatsnew/3.6.html#build-and-c-api-changes

> Note: Python uses C11 , but it remains an optional requirement.

That's fine. You can still build with an older compiler.

--

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



[issue46640] Python can now use the C99 NAN constant or __builtin_nan()

2022-02-07 Thread Petr Viktorin


Petr Viktorin  added the comment:

Adding new C99 features needs a change in PEP 7 
(https://www.python.org/dev/peps/pep-0007/#c-dialect)

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

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-02-04 Thread Petr Viktorin


Petr Viktorin  added the comment:

Almost. It's a bugfix so it needs backports to 3.10 & 3.9.
Thanks for the reminder!
I should get to them next week.

--
status: pending -> open

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



[issue42222] Modernize integer test/conversion in randrange()

2022-02-03 Thread Petr Viktorin


Petr Viktorin  added the comment:

Since this is a user-visible change in 3.11, could you add a What's New entry?

--
nosy: +petr.viktorin

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



[issue46613] Add PyType_GetModuleByDef to the public & limited API

2022-02-02 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue46613] Add PyType_GetModuleByDef to the public & limited API

2022-02-02 Thread Petr Viktorin


New submission from Petr Viktorin :

_PyType_GetModuleByDef (added in bpo-42100)allows module state access 
from slot methods (like tp_init or nb_add),
the main thing missing from PEP 573 (Module State Access from C 
Extension Methods).
It's time to make it public.

The function itself can be implemented using only limited API, though 
it's a bit tricky to do so correctly (and our implementation uses 
private speedups), so it's better if extension authors can use it as a 
pre-made building block.

Discussed in: 
https://mail.python.org/archives/list/capi-...@python.org/thread/WMSDNMQ7A6LE6X4MQW4QAQUKDDL7MJ72/
Note that a bug was found in the CPython optimization recently: bpo-46433

--
components: C API
messages: 412378
nosy: petr.viktorin
priority: normal
severity: normal
status: open
title: Add PyType_GetModuleByDef to the public & limited API
versions: Python 3.11

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



[issue45703] importlib.invalidate_caches() does not invalidate _NamespacePath's _last_parent_path-based cache

2022-02-02 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue45703] importlib.invalidate_caches() does not invalidate _NamespacePath's _last_parent_path-based cache

2022-02-02 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +29260
pull_request: https://github.com/python/cpython/pull/31076

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



[issue46355] [C API] Document PyFrameObject and PyThreadState changes and explain how to port code to Python 3.11

2022-01-31 Thread Petr Viktorin


Petr Viktorin  added the comment:

> I would hope that competent C programmers would know not to read or write to 
> undocumented fields. But if they come from a Python background, that might 
> not be obvious.

Tread carefully when changing decades-old API, documented or not. The docs 
weren't always as useful and complete as they are now.

> If the advice for something is "use Python", we should probably add an API 
> function.

Not really. If PyObject_GetAttrString doesn't add too much overhead, IMO it's 
fine to use it.

--

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



[issue46355] [C API] Document PyFrameObject and PyThreadState changes and explain how to port code to Python 3.11

2022-01-31 Thread Petr Viktorin


Change by Petr Viktorin :


--
nosy: +petr.viktorin
nosy_count: 2.0 -> 3.0
pull_requests: +29215
pull_request: https://github.com/python/cpython/pull/31032

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



[issue44734] turtle: tests for Vec2D.__abs__ are too strict

2022-01-27 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue44734] turtle: tests for Vec2D.__abs__ are too strict

2022-01-27 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset aa78287bc6d1c4fc07ee134642eb72db67b771a0 by Karolina Surma in 
branch 'main':
bpo-44734: Fix floating point precision in test_turtle (GH-30910)
https://github.com/python/cpython/commit/aa78287bc6d1c4fc07ee134642eb72db67b771a0


--

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



[issue44734] turtle: tests for Vec2D.__abs__ are too strict

2022-01-27 Thread Petr Viktorin


Petr Viktorin  added the comment:

> The first and last test should use assertAlmostEqual with a suitable 
> tolerance (the default tolerance is probably fine).

The merged PR only added tolerance to the last test. On some architectures, the 
first test still fails.
(No one is to blame -- this comment should apply to one line but GitHub shows 
two lines as context: 
https://github.com/python/cpython/pull/27343#pullrequestreview-714345826 )

Karolina's new PR is waiting for CLA confirmation.

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

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



[issue45703] importlib.invalidate_caches() does not invalidate _NamespacePath's _last_parent_path-based cache

2022-01-26 Thread Petr Viktorin


Petr Viktorin  added the comment:

Embarassingly, it seems it bust needs regen-importlib, at least for 3.10

--

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



[issue45703] importlib.invalidate_caches() does not invalidate _NamespacePath's _last_parent_path-based cache

2022-01-26 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +29101
pull_request: https://github.com/python/cpython/pull/30922

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



[issue46513] AC_C_CHAR_UNSIGNED from configure.ac confuses GCC 12+ by defining __CHAR_UNSIGNED__

2022-01-26 Thread Petr Viktorin


Petr Viktorin  added the comment:

Yeah, that looks like it's for some long-forgotten compiler that didn't 
implement `signed char` at all. 1994 was a fun time, apparently.

--
nosy:  -miss-islington

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



[issue22079] Ensure in PyType_Ready() that base class of static type is static

2022-01-24 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Is there a reason to not add these fields to PyTypeObject?


Can't say I haven't thought of that, but AFAIK it would mean breaking the C API 
substantially. Even if not it'd be a PEP-sized change, IMO.

--
nosy: +petr.viktorin

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



[issue46404] 3.11a4: a small attrs regression

2022-01-24 Thread Petr Viktorin


Petr Viktorin  added the comment:

I guess at least there should be a warning about this in dataclasses docs?
The reproducer with dataclasses (which exhibits the same error on 3.10 and 
3.11):

import dataclasses

@dataclasses.dataclass(slots=True)
class A:
pass


@dataclasses.dataclass(slots=True)
class B(A):
def test(self):
super()

B().test()

--
nosy: +petr.viktorin

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



[issue46417] Clear static types in Py_Finalize() for embedded Python

2022-01-20 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Sharing objects between interpreters is bad

That's your opinion, I don't necessarily share it.

> and is causing complex bugs.

But converting static things (types, small ints) to heap is also causing bugs :(



Anyway, for this issue: is there a way to test if the types are correctly 
reinitialized if there are multiple finalize/init cycles?
I worry about introducing more unexpected issues here.

--

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-01-19 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue46433] _PyType_GetModuleByDef optimization is incorrect

2022-01-19 Thread Petr Viktorin


New submission from Petr Viktorin :

I'm looking at the _PyType_GetModuleByDef optimization in 
https://github.com/python/cpython/pull/25504/files -- previously I assumed it's 
OK since it passed review.
But it doesn't look correct: 
- in the `_PyType_HasFeature` assert, we should be looking at `super` rather 
than `type`
- it's definitely possible that a hear type has a static type in the MRO -- 
`object`, at least. The `(PyHeapTypeObject*)super` cast is invalid in the case 
when the module is not found. And it's *also* incorrect in some cases of 
diamond inheritance, when a static type comes before the type we're looking for 
in `bases`.

It also adds a precondition that's not feasible public API, which this was 
meant to become: it should be callable with any type object. That's possible to 
do by keeping faster internal API and adding a public version with checks, but 
the diamond inheritance problem remains. Py_TPFLAGS_HEAPTYPE needs to be 
checked at runtime (except for the first iteration, if we're sure we're 
handling a static type).

Does that analysis sound right?

--
messages: 410962
nosy: petr.viktorin, vstinner
priority: normal
severity: normal
status: open
title: _PyType_GetModuleByDef optimization is incorrect
versions: Python 3.11

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

I'd post it to capi-sig, or to the existing thread on python-dev. But here's a 
good place too, especially if you want feedback from a smaller group of people 
first.

--

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



[issue46431] Trouble subclassing ExceptionGroup

2022-01-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

> can you just assign the task to a field on the exception other than __note__?

That might work, but I'm afraid of touching namespaces I don't own. If the 
subclass is feasible, I'd rather go with that.

--

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



[issue46431] Trouble subclassing ExceptionGroup

2022-01-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

Thanks for looking into it!

> If you don't define derive the superclass constructor is used, which means 
> you get something of type ExceptionGroup, not your subclass.

That might be fine in my case (for a MVP at least). Is there any other danger 
in not overriding it?
I see the docs say "A subclass needs to override it", but it might be better to 
enumerate the perils, or if such a class is unusable, not allow creating it.

--

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



[issue46376] PyMapping_Check returns 1 for list

2022-01-19 Thread Petr Viktorin


Petr Viktorin  added the comment:

Changing the existing functions is a no-go for backwards compatibility reasons. 
I think the best way forward would be to add a new function, and then possibly 
deprecate the old one if it's deemed dangerous.

If you want to push this forward, could you summarize the use case(s) and 
expected behavior (docs) for such a function? It probably doesn't need a PEP, 
but it's worth looking here for what to think about when making a proposal: 
https://www.python.org/dev/peps/pep-0001/#what-belongs-in-a-successful-pep

--
nosy: +petr.viktorin

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



[issue46431] Trouble subclassing ExceptionGroup

2022-01-19 Thread Petr Viktorin


New submission from Petr Viktorin :

I want to test a web application by crawling every reachable page. If an error 
occurs, I need to keep track of the page the error occured at (and additional 
info like what links were followed to get to the page, so a `__note__` string 
isn't enough). This info is in an object I'll call Task.
To use the improvements from PEP 654 but also keep extra info, I tried to make 
a subclass of ExceptionGroup:

```python
class MultiError(ExceptionGroup):
def __init__(self, failed_tasks):
super.__init__(
f"{len(tasks)} tasks failed",
[t.exception for t in failed_tasks],
)
self.tasks = tasks
# ... and set __note__ on each exception for nice tracebacks
```

but this fails with a rather opaque message:

```python
>>> class Task: exception = AssertionError() # enough of a Task for this 
>>> example 
... 
>>> MultiError([Task(), Task()])
Traceback (most recent call last):
  File "", line 1, in 
TypeError: function takes exactly 2 arguments (1 given)
```

Knowing about `__new__` and following a note in the docs, I'm able to fix this, 
but It's not obvious.
Before suggesting stuff, I'll ask: Am I doing something weird, or should this 
be made easier/more obvious?


Another issue I ran into: the list of exceptions is stored in the 
publicly-named but undocumented attribute `exceptions`. Am I allowed to use it?

--
messages: 410942
nosy: iritkatriel, petr.viktorin
priority: normal
severity: normal
status: open
title: Trouble subclassing ExceptionGroup
versions: Python 3.11

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



[issue46417] [subinterpreters] Clear static types in Py_Finalize()

2022-01-18 Thread Petr Viktorin


Petr Viktorin  added the comment:

If we have static types, that means there is a mechanism to share some objects 
across interpreters.
And if that's the case, why can't small ints (like 
sys.float_info.n_unnamed_fields) be static & shared as well?

--
nosy: +petr.viktorin

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



[issue22039] PyObject_SetAttr doesn't mention value = NULL

2022-01-17 Thread Petr Viktorin


Petr Viktorin  added the comment:

This cannot be changed in 3.x, since the PyObject_DelAttr macro calls 
PyObject_SetAttr(..., NULL), and the macro is expanded in all extensions that 
use the stable ABI.
(Technically, it would be possible to add a PyObject_SetAttr *macro* that would 
warn/fail, while keeping the PyObject_SetAttr *function* untouched, but that 
would be a pain to test/maintain.) 

The wording could be clarified to something like: "This behaviour is deprecated 
in favour of using PyObject_DelAttr(), but there are currently no plans to 
remove it."

--

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



[issue46283] [subinterpreters] Unicode interned strings must not be shared between interpreters

2022-01-10 Thread Petr Viktorin


Petr Viktorin  added the comment:

Another proposed alternative is to make these immortal, and share them.

There were some discussions about this, but no PEP to capture the pros/cons of 
the alternatives and the decision.

--
nosy: +petr.viktorin

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



[issue46070] [subinterpreters] asyncio crash when importing _asyncio in subinterpreter (Python 3.8 regression)

2022-01-07 Thread Petr Viktorin


Petr Viktorin  added the comment:

> The problem is that this change fixed another bug, well, see: bpo-44050. 
> While a revert should fix win_py399_crash_reproducer.py, it will reintroduce 
> bpo-44050 bug.

bpo-44050 is an attempt to fix a regression introduced in bpo-38858, perhaps 
that regression should be reverted as well?

--

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



[issue38735] PYTHONPYCACHEPREFIX fails when importing a module from the root ("/")

2022-01-07 Thread Petr Viktorin


Petr Viktorin  added the comment:

Here's a patch, but testing it would require putting a file in the root 
directory. I don't dare do that from the test suite. Is one-time manual testing 
OK here?

--

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



[issue38735] PYTHONPYCACHEPREFIX fails when importing a module from the root ("/")

2022-01-07 Thread Petr Viktorin


Change by Petr Viktorin :


--
keywords: +patch
nosy: +petr.viktorin
nosy_count: 2.0 -> 3.0
pull_requests: +28660
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30456

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



[issue42032] Setting PYTHONPYCACHEPREFIX using ~ (tilde) creates a "~" folder

2022-01-07 Thread Petr Viktorin

Petr Viktorin  added the comment:

> It would perhaps be useful if the os.path.expanduser call was added in the 
> cache_from_source() function in importlib?

No: that would mean Python would be doing work that the shell should do. 
Possibly it would be duplicating the work. Possibly it would be doing it wrong. 
What if your shell uses ⌂ rather than ~? What if the shell has a different idea 
of what the home directory is? Remember, you can use Python with any shell, not 
just Unix/POSIX command-line ones (which is what os.path.expanduser emulates).

Thanks for reporting the issue, though! The separation of concerns definitely 
isn't obvious at first.

--
nosy: +petr.viktorin
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2022-01-05 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Personally, I'd rather we not revert the original change.

Even in 3.10? Your PR looks pretty heavy for a bugfix release, and won't apply 
cleanly to 3.10.

> Moving the data to _PyRuntimeState would save me some effort with related 
> work I'm doing right now.

I guess that's what makes the PR hard to review. What's the plan (or are there 
more conflicting plans), and what's the state in 3.10 vs. main?

--
nosy: +petr.viktorin

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



[issue40421] [C API] Add getter functions for PyFrameObject and maybe move PyFrameObject to the internal C API

2021-12-20 Thread Petr Viktorin


Petr Viktorin  added the comment:

The docs for PyFrame_GetCode say it's returning an "int". 
https://docs.python.org/3/c-api/reflection.html#c.PyFrame_GetCode
Same for PyFrame_GetBack. Are there more?

"Get the frame code." is not very clear. Could this link to 
https://docs.python.org/3/c-api/code.html ?

--
nosy: +petr.viktorin

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



[issue45383] PyType_FromSpec API fails to use metaclass of bases

2021-12-17 Thread Petr Viktorin


Petr Viktorin  added the comment:

Nice! It's starting to look reasonable, I'll try an implementation when I get 
some focus time. (Sadly I can't promise it'll be this year.)

Just one detail:

> A flag probably can do the same.  I have no preference, `ApplySpec` seems 
> great to me.

I didn't get what you mean here.

--

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



[issue45383] PyType_FromSpec API fails to use metaclass of bases

2021-12-17 Thread Petr Viktorin


Petr Viktorin  added the comment:

I don't see how instantiating a metaclass with non-default tp_new would work if 
you don't know some details about the specific metaclass. So IMO we can we 
limit ourselves to scenarios where either:
1) the metaclass uses default tp_new, or
2) the code that creates the class knows about the metaclass

For case 2), we could leave allocation to the calling code, and add an API 
function that does the rest of the work of applying the spec. Something like:

/* Create a metaclass */
metatype_spec = {stuff};
metatype = PyType_FromSpecAndBases(&metatype_spec, &PyType_Type);
/* Create a type */
type_spec = {other_stuff};
newtype = alloc_metatype();
PyType_ApplySpec(newtype, &type_spec);

PyType_ApplySpec would assert PyType_Ready wasn't called before, and call it 
after filling in the name, slots, etc.
The metatype could disable its tp_new to disallow PyType_FromSpec (and Python 
__new__), effectively enforcing "using_metaclass_cinit_pretty_promise_please".

There could be a slot for code to run at the end of PyType_ApplySpec -- the 
"PyArray_InitDTypeFromSpec" in your pseudocode.


That seems better than calling the metaclass, but to answer questions on that 
idea:

>> - basicsize/itemsize could be allowed with __basicsize__/__itemsize__ in the 
>> dict.
>Do we need this?  I need the basicsize of the metaclass, but that of the class 
>seems fixed/OK?

That's the size of the instance. One more level down :)

>> - members could theoretically be copied to individual descriptors; there 
>> doesn't seem much need for keeping tp_members around.
> But a Python MetaClass (that the author may not even realize about) might 
> need access to these to work properly?
> A bit far fetched, but...

Seems very far-fetched to me. IMO these, like e.g. tp_methods, should only be 
used as arguments for the code that puts the descriptors in __dict__. How the 
descriptors got there is a detail, the class doesn't need to use tp_members 
(nor advertise that it does).

--

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



[issue46070] broken subinterpreters

2021-12-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

That was a fix for GH-17350, which might need to be reverted as well.

Victor, could you take another look at GH-17350? I must admit I (still) don't 
understand this change; what would break if it was reverted (along with the 
fixup from bpo-44050)?

--

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



[issue46070] broken subinterpreters

2021-12-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

Interned strings were broken in GH-20058, see bpo-46006. Maybe that's also the 
issue here?

--
nosy: +vstinner

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



[issue45383] PyType_FromSpec API fails to use metaclass of bases

2021-12-14 Thread Petr Viktorin


Petr Viktorin  added the comment:

I haven't forgotten this issue, but when I get to it it always leads to a 
rabbit hole. Sometimes just chasing refleaks, but there are deeper issues as 
well.

AFAICS, there's no way to call metatype.tp_new for such a class. I guess the 
safest option is to fail when the metaclass has a custom tp_new -- because that 
means the metaclass is requesting that it wants to allocate/initialize its 
types itself.

We can call metatype.tp_init, and probably should. And __init_subclass__ too, I 
suppose.

But at that point, this is duplicating a lot of existing functionality, and I'm 
starting to wonder if this wouldn't all be better with calling the metaclass 
instead.
What's missing?
- basicsize/itemsize could be allowed with __basicsize__/__itemsize__ in the 
dict.
- flags: we could add mechanisms to set individual flags after the type is 
created, as needed.
- slots can usually be applied after the class is created; maybe there should 
be a public function for this.
- members could theoretically be copied to individual descriptors; there 
doesn't seem much need for keeping tp_members around.

Does that seem like a more reasonable direction to explore?

--

___
Python tracker 
<https://bugs.python.org/issue45383>
___
___
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-12-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

The current struct is also likely to continue covering most future uses.
If we decide to add PyBufferEx functions but continue providing the current 
ones (with the current struct), most users won't be affected. (But it'll be a 
bit more work for us than throwing the old API out entirely.)

--

___
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



[issue45459] Limited API support for Py_buffer

2021-12-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

Antoine has a good point. We can freeze the Py_buffer struct. If it needs to be 
extended in the future, it'll need a new set of functions and names -- and 
perhaps a versioning scheme. We'll know more about the problem when/if it comes 
up.

--

___
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



[issue46007] [C API] PyUnicode_CHECK_INTERNED() doesn't work in the limited C API

2021-12-08 Thread Petr Viktorin


Petr Viktorin  added the comment:

+1, PyUnicodeObject/PyASCIIObject is excluded from the limited API since Python 
3.2, so it wasn't possible to use this macro.

--

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



[issue45703] importlib.invalidate_caches() does not invalidate _NamespacePath's _last_parent_path-based cache

2021-12-07 Thread Petr Viktorin


Petr Viktorin  added the comment:

Sadly, the backport is non-trivial. I'm putting on my TODO list, but I doubt 
I'll get to it soon :(

--

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



[issue43795] Implement PEP 652 -- Maintaining the Stable ABI

2021-12-07 Thread Petr Viktorin


Change by Petr Viktorin :


--
pull_requests: +28180
pull_request: https://github.com/python/cpython/pull/29956

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



[issue27580] CSV Null Byte Error

2021-11-26 Thread Petr Viktorin


Petr Viktorin  added the comment:

*docutils, not distutils

--

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



[issue27580] CSV Null Byte Error

2021-11-26 Thread Petr Viktorin


Petr Viktorin  added the comment:

The NUL check was around for a long time, available to be used (XKCD-1172 
style) as a simple check against reading binary files. The change did break 
tests of distutils.
Maybe it deserves a What's New entry?

--
nosy: +petr.viktorin

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



[issue45703] importlib.invalidate_caches() does not invalidate _NamespacePath's _last_parent_path-based cache

2021-11-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

Now, is this a bugfix, or a new feature?
I lean toward calling it a bugfix and backporting to earlier versions.

--

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



[issue45035] sysconfig's posix_home scheme has different platlib value to distutils's unix_home

2021-11-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

Yes. This is a minor bug in the deprecated distutils module.

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

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



[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2021-11-23 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue45775] Implementation of colorsys.rgb_to_yuv and vice versa

2021-11-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

> YUV is a common color encoding system. It's used by the JPEG image format and 
> MPEG video format for example.

As far as I understand it, the YUV/RGB conversion used by JPEG is not the same 
as the one used by MPEG, and neither of those is the Rec 709 YUV proposed here.

YUV is used in video production and photography. If you need to work with it, 
you most likely need some kind of precise color matching. If colorsys 
implements the wrong one *for you* (even if it's the most commonly used one, 
and what HDTV uses), then the stdlib has failed you.

Meanwhile, RGB/HLS is used by Web designers writing CSS, GUI authors giving you 
a big green button to click, or color pickers for your avatar's hair. They're 
designing for uncalibrated monitors. *That* is the target audience for colorsys.
The image libraries these people use to read JPGs invariably convert to RGB and 
throw away any precise color information, which is meaningless on uncalibrated 
monitors.

I cannot see a use case for YUV in colorsys that doesn't also require a more 
complex image processing library. It's that library that should provide the 
necessary colorspace conversions, depending on if it's dealing with JPEG or 
MPEG or HDTV.

But please point out my mistakes and clear my doubts!

--

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



[issue45783] test_freeze fails if a file is removed

2021-11-23 Thread Petr Viktorin


Change by Petr Viktorin :


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

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



[issue45783] test_freeze fails if a file is removed

2021-11-23 Thread Petr Viktorin


Petr Viktorin  added the comment:


New changeset 8ed1495ad900dd815ff8fb97926da5312aaa23f9 by Eric Snow in branch 
'main':
bpo-45783: Preserve file moves and deletions in the tests for the freeze tool. 
(GH-29527)
https://github.com/python/cpython/commit/8ed1495ad900dd815ff8fb97926da5312aaa23f9


--

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



[issue45126] [sqlite3] cleanup and harden Connection and Cursor __init__

2021-11-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

I think it's a good idea, but without the "will be disallowed in Python 3.13" 
part -- we should tell people that it's discouraged, but there's not much point 
in removing it.

But there's no consensus whether that's a good way to handle things, in 
general. So I'll leave it up to you.

--
status: pending -> open

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



[issue44445] Add `site-include` install scheme path in sysconfig

2021-11-23 Thread Petr Viktorin


Change by Petr Viktorin :


--
keywords: +patch
nosy: +petr.viktorin
nosy_count: 7.0 -> 8.0
pull_requests: +27958
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/29578

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



[issue45848] Pegen's nice error reporting crashes with non-UTF-8 files

2021-11-23 Thread Petr Viktorin


Petr Viktorin  added the comment:

Wow! Thank you for the quick fix!

--

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



[issue45848] Pegen's nice error reporting crashes with non-UTF-8 files

2021-11-19 Thread Petr Viktorin


Change by Petr Viktorin :


--
title: Pegen's nice error reporting crashes non-UTF-8 files -> Pegen's nice 
error reporting crashes with non-UTF-8 files

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



[issue45848] Pegen's nice error reporting crashes non-UTF-8 files

2021-11-19 Thread Petr Viktorin


New submission from Petr Viktorin :

Parsing a script with non-UTF-8 encoding and a missing close parenthesis, like 
a file with the following 2 lines:

# encoding: ascii
(

... crashes with:

python: Parser/pegen.c:408: get_error_line: Assertion `p->tok->fp == NULL || 
p->tok->fp == stdin' failed.
Aborted (core dumped)

--
components: Parser
files: missing_paren_ascii.py
messages: 406602
nosy: lys.nikolaou, pablogsal, petr.viktorin
priority: normal
severity: normal
status: open
title: Pegen's nice error reporting crashes non-UTF-8 files
Added file: https://bugs.python.org/file50451/missing_paren_ascii.py

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



[issue45775] Implementation of colorsys.rgb_to_yuv and vice versa

2021-11-18 Thread Petr Viktorin


Petr Viktorin  added the comment:

I argued for keeping colorsys: RGB/HLS/HSV are useful in several fields. 
Colorsys is a nice low-power battery to have around for e.g. picking a color 
for highlighting any kind of output.

YIQ is the odd one out: it describes actual color, rather than instructions for 
a monitor. I think that if you need YIQ, YUV, CMYK, sRGB, XYZ or Lab, you 
should reach for a more specialized library. In other words, I don't see YIQ as 
an example to be followed.

--
nosy: +petr.viktorin

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



  1   2   3   4   5   6   7   8   9   10   >