New submission from Petr Viktorin :
The "xxlimited" module (Modules/xxlimited.c) was added as part of PEP
384 (Defining a Stable ABI), and is undocumented. As far as I can tell,
it was added partly to test the stable ABI, and partly as an example of
how to write a module (like
Petr Viktorin added the comment:
Here is a PR for _PyType_GetModuleByDef:
https://github.com/python/cpython/pull/22835
--
___
Python tracker
<https://bugs.python.org/issue40
Change by Petr Viktorin :
--
nosy: +petr.viktorin
nosy_count: 18.0 -> 19.0
pull_requests: +21792
pull_request: https://github.com/python/cpython/pull/22838
___
Python tracker
<https://bugs.python.org/issue1
Change by Petr Viktorin :
--
keywords: +patch
pull_requests: +21789
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/22835
___
Python tracker
<https://bugs.python.org/issu
Change by Petr Viktorin :
--
components: +C API
type: -> enhancement
versions: +Python 3.10
___
Python tracker
<https://bugs.python.org/issue42100>
___
___
Py
New submission from Petr Viktorin :
I would like to add an internal _PyType_GetModuleByDef function to unblock
further work on isolating extension modules, as discussed here:
https://mail.python.org/archives/list/capi-...@python.org/thread/T3P2QNLNLBRFHWSKYSTPMVEIL2EEKFJU
Petr Viktorin added the comment:
New changeset 38a17d0752781c70fd971f372ddc8d3caf5ded88 by Miss Skeleton (bot)
in branch '3.9':
bpo-41726: Update the refcounts info of PyType_FromModuleAndSpec in
refcounts.dat (GH-22112) (GH-22808)
https://github.com/python/cpython/commit
Change by Petr Viktorin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Petr Viktorin :
--
resolution: fixed ->
status: closed -> open
___
Python tracker
<https://bugs.python.org/issue40703>
___
___
Python-bugs-list
Petr Viktorin added the comment:
Thank you, Stefan!
This should have a test as well.
I'm willing to mentor someone who wants to get into the C-API, otherwise this
has low priority for me.
--
resolution: -> fixed
stage: test needed -> resolved
status: open -&g
Petr Viktorin added the comment:
Also: PyType_GetSlot should return a function pointer, not data.
For some slots (Py_tp_doc, Py_tp_methods, Py_tp_members, Py_tp_getset) that
ship has sailed, but for new ones, we should honor the distinction between data
and function pointers. The C standard
Petr Viktorin added the comment:
Ah, scratch that: PyType_GetSlot returns a function pointer.
To be correct, we should to expose a new function like PyType_GetName.
It's true that CPython currently doesn't always honor the distinction between
data and function pointers, but the C standard
Petr Viktorin added the comment:
Thanks Victor, Hai Shi, Pablo, Stefan, Dong-hee Na and Mariatta for reviews!
I did not put all the details in the documentation because there are still
feature gaps. So, a full write-up is now in the informational PEP 630.
--
resolution: -> fi
Petr Viktorin added the comment:
Also note that the capsule generally needs to hold references to the objects in
exposes, and not rely on the module object to keep things alive. (Module
objects with multi-phase init are not unique nor immortal.)
_ctypes is an exception, since it doesn't have
Petr Viktorin added the comment:
Definitely. Sorry for the delay -- I missed the notification here.
--
___
Python tracker
<https://bugs.python.org/issue41
Petr Viktorin added the comment:
The slots are originally intended for defining types (PyType_FromSpec);
PyType_GetSlot is not as useful as it could be.
tp_name can be exposed, but it needs to also be handled properly
PyType_FromSpec -- e.g. raise an error
Change by Petr Viktorin :
--
nosy: +petr.viktorin
___
Python tracker
<https://bugs.python.org/issue41798>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Petr Viktorin :
One underlying issue from bpo-41631 is that importlib.util.LazyLoader produces
modules that are only fully loaded after an attribute is accessed (through
__getattribute__).
C-API functions like PyModule_GetState, PyModule_GetDict and such do not get
Petr Viktorin added the comment:
I started this here:
https://github.com/python/cpython/commit/60960cba606573450e76934c954787419524147d
Feel free to take that code.
--
nosy: +petr.viktorin
___
Python tracker
<https://bugs.python.org/issue41
Petr Viktorin added the comment:
New changeset 1e2f051a6127904cfee5f9e4021dd6e4a4d51c0f by Hai Shi in branch
'master':
bpo-41726: Update the refcounts info of PyType_FromModuleAndSpec in
refcounts.dat (GH-22112)
https://github.com/python/cpython/commit
Petr Viktorin added the comment:
That is interesting.
The original post here doesn't mention that the problem occurs in Mercurial's
"make all", specifically when building documentation, in the command:
/usr/bin/python3.9 gendoc.py "hgrc.5" > hgrc.5.txt.tmp
Coul
Petr Viktorin added the comment:
IMO, a slot should be exposed if there is some reason for exposing it.
bpo-41073 talks about tp_dealloc, which is already exposed as Py_tp_dealloc.
Recently, Py_bf_* slots were exposed (but not as part of the limited API), in
bpo-40724 which links
Petr Viktorin added the comment:
We need this bug solved for 3.9.0 rc2. Łukasz, you're the one to make the call
about the approach; how can we make your job easier?
My view is:
- Victor's PR 21961 is going in the right direction. But, as far as I know
(correct me if I'm wrong), Victor
Petr Viktorin added the comment:
I also looked into Mercurial. They have a large list of modules [0] that don't
work with the lazy-loading scheme. I don't think adding one more should be a
big problem for them; but we'll reach out to them and confirm that.
[0]
https://www.mercurial
Petr Viktorin added the comment:
New changeset d9a966ae08258da2ce2a432c943d8194760f09c4 by Petr Viktorin in
branch 'master':
bpo-38787: Clarify docs for PyType_GetModule and warn against common mistake
(GH-20215)
https://github.com/python/cpython/commit
Change by Petr Viktorin :
--
pull_requests: +21082
pull_request: https://github.com/python/cpython/pull/21973
___
Python tracker
<https://bugs.python.org/issue41
Petr Viktorin added the comment:
> Also, option 1 is virtually equivalent to the state of the _ast module prior
> to the recent changes except that the symbols are in a shared object instead
> of the binary or libpython. The advantage here is not moving them out of the
> s
Petr Viktorin added the comment:
Regarding ac46eb4ad6662cf6d771b20d8963658b2186c48c:
Module states come and go with the modules that contain them; if a
"get_global_ast_state" or "astmodulestate_global" needs to be accessed from
outside the module, it shouldn't be modul
Petr Viktorin added the comment:
Closing; please re-open if you have more info.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Petr Viktorin :
--
pull_requests: +20632
pull_request: https://github.com/python/cpython/pull/21489
___
Python tracker
<https://bugs.python.org/issue39
Petr Viktorin added the comment:
Larry and Ned, do you want this fix in the security-only releases you manage?
PRs for 3.6 ad 3.7 are ready, should you wish to merge them.
--
nosy: +larry, ned.deily -miss-islington
___
Python tracker
<ht
Petr Viktorin added the comment:
New changeset 5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4 by Rishi in branch
'master':
bpo-39017: Avoid infinite loop in the tarfile module (GH-21454)
https://github.com/python/cpython/commit/5a8d121a1f3ef5ad7c105ee378cc79a3eac0c7d4
--
nosy
Change by Petr Viktorin :
--
keywords: +patch
pull_requests: +20518
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/21374
___
Python tracker
<https://bugs.python.org/issu
Petr Viktorin added the comment:
Would it be worth it to add a "base" keyword argument to glob.glob?
--
nosy: +petr.viktorin
___
Python tracker
<https://bugs.python.o
Petr Viktorin added the comment:
What kind of security-related issues do you mean? A .pyc file is code; it can
do anything. Never run untrusted code, be it .py or .pyc.
See also: Lib/test/crashers/bogus_code_obj.py
--
nosy: +petr.viktorin
Petr Viktorin added the comment:
> If we extend PyType_GetSlot() to accept non-heaptype, we need find a way to
> judge the max slot of non-heaptype.
Static types can have some sub-slots structs but not others. A "max slot" will
not help for types that have tp_as_mapping but
Petr Viktorin added the comment:
I'm closing the issue. Please comment or reopen if I missed something.
--
resolution: -> not a bug
stage: needs patch -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Petr Viktorin added the comment:
AFAICS, Python 3 suports '%u' for printf-style formatting:
Python 3.8.3 (default, May 29 2020, 00:00:00)
[GCC 10.1.1 20200507 (Red Hat 10.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more i
Petr Viktorin added the comment:
> do we still only support single inheritance at the C level?
Not any more. Heap types may have multiple bases, and they can be created at
the C level (since Python 3.2, PEP 384).
> So, I think we should do something like walking up the hierarchy t
Petr Viktorin added the comment:
I wrote about the _PyType_GetModuleByDef idea on the capi-sig mailing list:
https://mail.python.org/archives/list/capi-...@python.org/thread/T3P2QNLNLBRFHWSKYSTPMVEIL2EEKFJU/
--
___
Python tracker
<ht
Petr Viktorin added the comment:
Since the removal of PyNoArgsFunction breaks user code, does it deserve a
mention in What's New – Porting to Python 3.9?
--
nosy: +petr.viktorin
___
Python tracker
<https://bugs.python.org/issue39
Petr Viktorin added the comment:
FWIW, another project that needs Py_GetArgcArgv is "setproctitle":
https://bugzilla.redhat.com/show_bug.cgi?id=1792059
See also: https://github.com/cherrypy/cherrypy/issues/1506
--
nosy: +petr.viktorin
Change by Petr Viktorin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Petr Viktorin :
--
keywords: +patch
nosy: +petr.viktorin
nosy_count: 1.0 -> 2.0
pull_requests: +19742
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/20493
___
Python tracker
<https://bugs.p
Petr Viktorin added the comment:
This broke compilation with mingw; see https://bugs.python.org/issue40777
--
nosy: +petr.viktorin
___
Python tracker
<https://bugs.python.org/issue24
Petr Viktorin added the comment:
Yes, it should be possible to wrap them in #if so they aren't part of the
stable ABI.
--
___
Python tracker
<https://bugs.python.org/issue40
New submission from Petr Viktorin :
In bpo-34037, AbstractEventLoop gained a new abstract method,
shutdown_default_executor:
https://docs.python.org/dev/library/asyncio-eventloop.html#asyncio.loop.shutdown_default_executor
All AbstractEventLoop subclasses need to define this method, otherwise
Petr Viktorin added the comment:
py3c has an open issue to check that Barry's notes on C extensions are
included: https://github.com/encukou/py3c/issues/1
However, C extensions are only a small part of the wiki page.
--
___
Python tracker
<ht
Petr Viktorin added the comment:
Indeed. The SQLite documentation talks about the limitations that
non-deterministic functions have, not about deterministic functions being
memoized: https://www.sqlite.org/deterministic.html
The flag would be better tested e.g. with a CHECK constraint
Change by Petr Viktorin :
--
pull_requests: +19690
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/20433
___
Python tracker
<https://bugs.python.org/issu
Petr Viktorin added the comment:
Thank you for responding so quickly!
> Petr, do you mind reviewing it?
Yes, but I'll only get to it next week.
--
___
Python tracker
<https://bugs.python.org/issu
Change by Petr Viktorin :
Added file: https://bugs.python.org/file49182/reproducer.c
___
Python tracker
<https://bugs.python.org/issue40217>
___
___
Python-bugs-list m
Petr Viktorin added the comment:
Ha! I think I found the issue in PySide now. It's different, but it's still a
CPython issue. It's actually a variant of the "defining class" problem from PEP
573.
It's legal to get the value of a slot, using PyType_GetSlot.
It's reasonable
Petr Viktorin added the comment:
Indeed, it seems my initial analysis was incorrect. I can't reproduce this
outside of PySide.
I'll close this bug and invesatigate more.
Sorry for the noise.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -&g
Petr Viktorin added the comment:
It looks like the fix breaks types that override Py_tp_alloc but not
Py_tp_traverse (as some types in PySide do.)
I'll investigate more and work on fixing that if someone doesn't beat me to it.
--
nosy: +petr.viktorin
Change by Petr Viktorin :
--
pull_requests: +19510
pull_request: https://github.com/python/cpython/pull/20215
___
Python tracker
<https://bugs.python.org/issue38
Petr Viktorin added the comment:
I guess I'll need to clarify the documentation here.
Call `PyType_GetModule` on the *defining class*, not on type(self). See the PEP
for details.
The associated module is not inherited; each class in the MRO can be defined in
a different module
Petr Viktorin added the comment:
> For example, Objects/longobject.c defines "PyTypeObject PyLong_Type =
> {...};". This type is exposed in the limited C API (!)
Technically, it is not, see https://www.python.org/dev/peps/pep-0384/#structures
Structures like PyLong_Typ
Petr Viktorin added the comment:
So, the failure is expected. Python's ABI can change until the 3.9.0 final
release, so wheels built for different commits can be incompatible.
This applies to alphas/betas as well, as you say.
There is the PEP 384 stable ABI, which is much stricter (and more
Petr Viktorin added the comment:
That seems reasonable. See the discussion around
https://bugs.python.org/issue38140 for context.
Note that __dictoffset__ and __weaklistoffset__ are also exposed as members (in
PyMemberDef type_members) and documented (Doc/c-api/structures.rst). A new
Change by Petr Viktorin :
--
pull_requests: +19251
pull_request: https://github.com/python/cpython/pull/19936
___
Python tracker
<https://bugs.python.org/issue38
Petr Viktorin added the comment:
reportlab reported failures on code like:
norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
Note that `or` has a `r` in it.
--
nosy: +petr.viktorin
___
Python tracker
<https://bugs.python.org/issue40
Petr Viktorin added the comment:
I'm working on the implementation as my time allows, here:
https://github.com/encukou/cpython/pull/3 .
Would it help to create a proper PR for CPython now? That would mean I could no
longer do rebases/force-pushes, so the commits would be less readable
Petr Viktorin added the comment:
I got a report from a library that ties together asyncio and some other async
libraries, getting errors like this:
tests/test_taskgroups.py:60: in test_run_natively
module.run(testfunc())
/usr/lib64/python3.9/asyncio/runners.py:48: in run
Change by Petr Viktorin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Petr Viktorin added the comment:
As discussed briefly in Mark's PR, benchmarks like this are now slower:
ret = dict(**{'a': 2, 'b': 4, 'c': 6, 'd': 8})
Python 3.8: Mean +- std dev: 281 ns +- 9 ns
master: Mean +- std dev: 456 ns +- 14 ns
Petr Viktorin added the comment:
> Can I submit the patch?
Yes!
If you think a patch is ready for review, just submit it. There's not much we
can comment on before we see the code :)
(I hope that doesn't contradict what your mentor s
Petr Viktorin added the comment:
Definitely!
--
___
Python tracker
<https://bugs.python.org/issue37207>
___
___
Python-bugs-list mailing list
Unsubscribe:
Petr Viktorin added the comment:
The change to dict() was not covered by the smaller PRs.
That one will need more thought, but AFAIK it wasn't yet rejected.
--
status: closed -> open
___
Python tracker
<https://bugs.python.org/issu
Petr Viktorin added the comment:
Moved to Discourse, IMO that's a better place for maintainers of other
PEP-3118-compatible libraries to chime in:
https://discuss.python.org/t/behavior-of-struct-format-native-bool/3774
--
___
Python tracker
Petr Viktorin added the comment:
I see. Thanks for your patience explaining this to me!
I will merge and continue in a different issue.
--
___
Python tracker
<https://bugs.python.org/issue39
Petr Viktorin added the comment:
I think we are speaking past each other.
In my (current) view, the semantics are spelled out in the documentation: "any
non-zero value will be True when unpacking".
There's also a mention that this corresponds to the _Bool type in C. While this
wa
Petr Viktorin added the comment:
> You are the one who wanted to *introduce* a hack by dereferencing
as char and then cast to _Bool. :-)
Yes, I did change my mind after reading the documentation.
The docs say two contradicting things:
1. The '?' conversion code corresponds to the _Bool t
Petr Viktorin added the comment:
> The docs for native mode (we now always assume C99):
>
> "The '?' conversion code corresponds to the _Bool type defined by C99."
But, nowhere is it suggested that conversion is "do memcpy and then interpret
the bit pattern&qu
Change by Petr Viktorin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Petr Viktorin added the comment:
> So I vote for not handling incorrectly packed values and removing
"and any non-zero value will be True when unpacking" from the docs,
which does not seem to make any sense for _Bool.
I disagree. I don't think struct module's job is to be fait
Change by Petr Viktorin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Petr Viktorin added the comment:
Oh! I just reead the docs more carefully; they say:
For the '?' format character, the return value is either True or False. When
packing, the truth value of the argument object is used. Either 0 or 1 in the
native or standard bool representation
Petr Viktorin added the comment:
> > > maybe we should be raising an error if the bytes are not a valid platform
> > > _Bool pattern?
> >
> > That's quite hard to test for.
>
> How so? We just make the same assumption you're making that true
Petr Viktorin added the comment:
The memoryview module does the same thing as struct, and its tests expect the
same behavior as with struct.
So, whatever we do in struct should be also done in memoryview.
--
title: test_struct failure on s390x Fedora Clang buildbot -> str
Change by Petr Viktorin :
--
nosy: +petr.viktorin
nosy_count: 4.0 -> 5.0
pull_requests: +18280
pull_request: https://github.com/python/cpython/pull/18928
___
Python tracker
<https://bugs.python.org/issu
Change by Petr Viktorin :
--
keywords: +patch
pull_requests: +18277
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/18925
___
Python tracker
<https://bugs.python.org/issu
Petr Viktorin added the comment:
> our unittest assuming that b'\xf0' should be true when interpreted as a bool
> is wrong.
> just get rid of that value from the loop in the test?
That could be the proper thing to do, but it does make it easy to invoke C
undefined behavior from Py
Petr Viktorin added the comment:
New changeset 3c97e1e457033bbb8bbe0b7198bd13fc794a12b0 by Petr Viktorin in
branch 'master':
bpo-39761: Fix dtrace build with empty $DFLAGS (GH-18766)
https://github.com/python/cpython/commit/3c97e1e457033bbb8bbe0b7198bd13fc794a12b0
Petr Viktorin added the comment:
New changeset 3c97e1e457033bbb8bbe0b7198bd13fc794a12b0 by Petr Viktorin in
branch 'master':
bpo-39761: Fix dtrace build with empty $DFLAGS (GH-18766)
https://github.com/python/cpython/commit/3c97e1e457033bbb8bbe0b7198bd13fc794a12b0
Petr Viktorin added the comment:
If you use a module subclass that needs some additional C-level infrastructure,
it would be more appropriate to override tp_clear/tp_free directly.
IMO limiting m_clear/m_free to work just with the module state won't hurt. But
it is an API change
Petr Viktorin added the comment:
No, in Python 2 the PyInt object (`int` in Python 2) always did fit into a C
long -- that was the underlying storage. If it didn't fit, a PyLong object
(`long` in Python 2) was used.
Python 3 doesn't have PyInt, it only has PyLong (`int` in Python 3
Petr Viktorin added the comment:
Viewing the oss-fuzz bug requires login. Is there any interesting public info
in it?
--
___
Python tracker
<https://bugs.python.org/issue39
Change by Petr Viktorin :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Petr Viktorin added the comment:
IMO:
- The "native" format should use native _Bool, and we should only test
unpacking 0 and 1
- The "standard" format should use portable char semantics: continue to treat
any non-zero value as true
- The docs should grow a warning that f
Petr Viktorin added the comment:
Yes. Can you use PyObject_Call instead (or one of the non-Vectorcall variants
listed in https://docs.python.org/3.9/c-api/call.html#object-calling-api )
Vectorcall is mainly a speed optimization over PyObject_Call. We want to allow
the C compiler to inline
Petr Viktorin added the comment:
The fix introduced a regression, see bpo-39761
--
___
Python tracker
<https://bugs.python.org/issue38960>
___
___
Python-bug
Change by Petr Viktorin :
--
pull_requests: +18123
pull_request: https://github.com/python/cpython/pull/18766
___
Python tracker
<https://bugs.python.org/issue38
Change by Petr Viktorin :
--
pull_requests: +18122
pull_request: https://github.com/python/cpython/pull/18766
___
Python tracker
<https://bugs.python.org/issue39
Petr Viktorin added the comment:
C compiler dev that it's indeed undefined behavior.
> Quick and obvious fix:
>
> static PyObject *
> nu_bool(const char *p, const formatdef *f)
> {
> char x;
> memcpy((char *), p, sizeof x
Petr Viktorin added the comment:
The call:
struct.unpack('>?', b'\xf0')
means to unpack a "native bool", i.e. native size and alignment. Internally,
this does:
static PyObject *
nu_bool(const char *p, const formatdef *f)
{
_Bool x;
memcpy((char *)
Petr Viktorin added the comment:
Why "sys.python_libdir"? Isn't that too public? A lot of similar path-related
info is in sysconfig; why shouldn't it be there?
How does "sys.python_libdir" work on other platforms?
--
___
Py
Petr Viktorin added the comment:
Indeed, builds are green: https://buildbot.python.org/all/#/builders/449
Thanks Victor for reporting and Harris for fixing this.
--
nosy: +petr.viktorin
resolution: -> fixed
stage: -> resolved
status: open -&g
Petr Viktorin added the comment:
New changeset d77e77116fa7a9fc85be1d9f417c7e9e33fe1296 by Miss Islington (bot)
in branch '3.8':
bpo-39555: Fix distutils test to handle _d suffix on Windows debug build
(GH-18357) (GH-18548)
https://github.com/python/cpython/commit
Petr Viktorin added the comment:
Closing; please reopen if we're somehow misunderstanding each other :)
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
401 - 500 of 909 matches
Mail list logo