Change by STINNER Victor :
--
pull_requests: +30442
pull_request: https://github.com/python/cpython/pull/32417
___
Python tracker
<https://bugs.python.org/issue40
Change by STINNER Victor :
--
title: Add object.__getstate__() introduced a refleak -> Add
object.__getstate__() introduced refleaks
___
Python tracker
<https://bugs.python.org/issu
STINNER Victor added the comment:
> bpo-26579: Add object.__getstate__(). (GH-2821)
> https://github.com/python/cpython/commit/884eba3c76916889fd6bff3b37b8552bfb4f9566
This change introduced reference leaks: see bpo-47250.
--
___
Python t
New submission from STINNER Victor :
The following change introduced reference leaks:
---
commit 884eba3c76916889fd6bff3b37b8552bfb4f9566
Author: Serhiy Storchaka
Date: Wed Apr 6 20:00:14 2022 +0300
bpo-26579: Add object.__getstate__(). (GH-2821)
Copying and pickling instances
STINNER Victor added the comment:
New changeset 85addfb9c6496eb3d26082348cf5aca848c877ef by Victor Stinner in
branch 'main':
bpo-35134: Remove the Include/code.h header file (GH-32385)
https://github.com/python/cpython/commit/85addfb9c6496eb3d26082348cf5ac
STINNER Victor added the comment:
New changeset 5c4d1f6e0e192653560ae2941a6677fbf4fbd1f2 by Victor Stinner in
branch 'main':
bpo-35134: Add Include/cpython/setobject.h header (GH-32384)
https://github.com/python/cpython/commit/5c4d1f6e0e192653560ae2941a6677
STINNER Victor added the comment:
New changeset ca219f6dfc57f8f4984f96df0f733b7de92fe91c by Victor Stinner in
branch 'main':
bpo-35134: Add Include/cpython/complexobject.h header (GH-32383)
https://github.com/python/cpython/commit/ca219f6dfc57f8f4984f96df0f733b
Change by STINNER Victor :
--
pull_requests: +30423
pull_request: https://github.com/python/cpython/pull/32385
___
Python tracker
<https://bugs.python.org/issue35
Change by STINNER Victor :
--
pull_requests: +30422
pull_request: https://github.com/python/cpython/pull/32384
___
Python tracker
<https://bugs.python.org/issue35
Change by STINNER Victor :
--
pull_requests: +30421
pull_request: https://github.com/python/cpython/pull/32383
___
Python tracker
<https://bugs.python.org/issue35
STINNER Victor added the comment:
In 2022, Python 3.11 still has the issue:
vstinner@apu$ python3.11 -m mailcap
Mailcap files:
/home/vstinner/.mailcap
/etc/mailcap
(...)
Mailcap entries:
(...)
text/html
copiousoutput
lineno 5
view/usr/bin
STINNER Victor added the comment:
The PyFrameObject structure was made opaque by bpo-46836.
--
___
Python tracker
<https://bugs.python.org/issue40421>
___
___
New submission from STINNER Victor :
The PyCodeObject structure is documented at:
https://docs.python.org/dev/c-api/code.html
The structured evolved a lot in Python 3.11 to optimize Python/ceval.c
performance:
* read-only co_code (object) was replaced with modifiable co_code_adaptive
(char
STINNER Victor added the comment:
I would be nice to make the PyThreadState opaque in Python 3.12. IMO it's too
late for Python 3.11. Hopefully, Cython should be prepared for such change. At
the beginning, maybe Cython can just use the internal C API, as it does to
access the int
STINNER Victor added the comment:
IMO the initial goal is now reached. I close the issue. Thanks to everyone who
helped implementing these changes!
The PyFrameObject structure is now opaque in Python 3.11. New getter functions
of the Python 3.11 C API:
* PyFrame_GetBuiltins
STINNER Victor added the comment:
New changeset 14a9b4895b61bcd46ed968c43c5eec27670a0aac by Victor Stinner in
branch 'main':
bpo-40421: test_capi uses assertEqual(), not assertEquals() (GH-32361)
https://github.com/python/cpython/commit/14a9b4895b61bcd46ed968c43c5eec
Change by STINNER Victor :
--
pull_requests: +30410
pull_request: https://github.com/python/cpython/pull/32361
___
Python tracker
<https://bugs.python.org/issue40
STINNER Victor added the comment:
The change was rejected by the Steering Council:
https://mail.python.org/archives/list/python-...@python.org/message/GFOMU7LP63JUVFMWNJNZJLUMZDRPTUYJ/
--
resolution: -> rejected
stage: patch review -> resolved
status: open -&g
STINNER Victor added the comment:
New changeset 2b4f2f5fa4d1123c19bf0643cfa5a4fe8df4175c by Victor Stinner in
branch 'main':
Revert "bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API
(GH-32052)" (GH-32343)
https://github.com/p
STINNER Victor added the comment:
I removed two comments: none of the mentioned URL contains a "Disallow: ?" rule
and the comments didn't add any value to this issue. It looks like regular spam
(SEO).
--
___
Python
Change by STINNER Victor :
--
Removed message: https://bugs.python.org/msg416847
___
Python tracker
<https://bugs.python.org/issue36207>
___
___
Python-bug
Change by STINNER Victor :
--
Removed message: https://bugs.python.org/msg416767
___
Python tracker
<https://bugs.python.org/issue36207>
___
___
Python-bug
STINNER Victor added the comment:
I wrote GH-32357 to check in debug mode that tp_dealloc functions leave the
current exception unchanged. You can use attached unicode_dealloc_bug.patch to
inject a bug to test my PR. Example ("make" is enough to trigger the bug):
---
Fatal Py
Change by STINNER Victor :
--
pull_requests: +30407
pull_request: https://github.com/python/cpython/pull/32357
___
Python tracker
<https://bugs.python.org/issue45
STINNER Victor added the comment:
I created bpo-47236 "Document types.CodeType.replace() changes about
co_exceptiontable".
--
___
Python tracker
<https://bugs.python.o
STINNER Victor added the comment:
Ok sure, I created bpo-47236 "Document types.CodeType.replace() changes about
co_exceptiontable".
--
___
Python tracker
<https://bugs.python.o
New submission from STINNER Victor :
It would be nice to document the bpo-40222 changes in What's New in Python 3.11
and in the CodeType documentation:
* https://docs.python.org/dev/library/types.html#types.CodeType
* https://docs.python.org/dev/whatsnew/3.11.html
Use
STINNER Victor added the comment:
>>> def f():
... foo()
... try:
... bar()
... except:
... pass
...
>>> def g():
... try:
... foo()
... bar()
... except:
... pass
...
>>> dis.dis(f)
1 0 RESU
STINNER Victor added the comment:
Thanks Hugo for the your contribution. I close the issue.
> Searching the top 5,000 PyPI sdists, there's very little (if any "real") use
> of LegacyInterpolation. Details: https://bugs.python.org/issue45173#msg409685
You can offer t
Change by STINNER Victor :
--
nosy: -vstinner
___
Python tracker
<https://bugs.python.org/issue47231>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by STINNER Victor :
--
pull_requests: +30397
pull_request: https://github.com/python/cpython/pull/32343
___
Python tracker
<https://bugs.python.org/issue46
Change by STINNER Victor :
--
title: Deprecate getdefaultlocale(), getlocale() and normalize() functions ->
Deprecate getlocale() and normalize() functions
___
Python tracker
<https://bugs.python.org/issu
Change by STINNER Victor :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
STINNER Victor added the comment:
bpo-37387 was closed as a duplicate of this issue.
--
___
Python tracker
<https://bugs.python.org/issue47089>
___
___
Pytho
STINNER Victor added the comment:
I close this issue as a duplicate of bpo-47089.
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Avoid sporadic failure of test_compileall on Windows
___
Py
STINNER Victor added the comment:
The re.template() function and the re.TEMPLATE functions are not documented and
not tested.
The re.Scanner class is not documented but has a test_scanner() test in test_re.
--
___
Python tracker
<ht
STINNER Victor added the comment:
See also bpo-40259: "re.Scanner groups".
--
___
Python tracker
<https://bugs.python.org/issue47152>
___
___
Python-b
STINNER Victor added the comment:
Old python-dev discussions on re.Scanner from 2000 to 2004:
* "[Python-Dev] A standard lexer?" (July 2000)
https://mail.python.org/archives/list/python-...@python.org/message/MQ4OMCVIVRJWNGHYGI3OUVZQPN5NNNAU/
thread:
https://mail.python.or
STINNER Victor added the comment:
Lumír Balhar:
> Do you think it's a good idea to start a PR with a copy of the implementation
> from attrs for Python 3.11? We can then add tests for the new function and
> also some for dataclasses where this new function is needed and try
STINNER Victor added the comment:
It's funny to still see mentions of "experimental stuff" in Python 3.11 (2022),
whereas these "experimental stuff" are there for 20 years.
*Maybe* it's time to consider that re.template() and re.Scanner are no longer
experimen
STINNER Victor added the comment:
Is the "import _locale" still used in re/__init__.py? It cannot see any
reference to it in the code and test_re still if it's removed.
The last reference to the _locale module has been removed in 2017 by the commit
898ff03e1e7925ecde3da6632
STINNER Victor added the comment:
$ ls Lib/re/
_compiler.py _constants.py __init__.py _parser.py
Thanks, that's a nice enhancement!
Serhiy: Would you mind to explicitly document the 3 deprecated modules in
What's New in Python 3.11?
https://docs.python.org/dev/whatsnew
STINNER Victor added the comment:
Thanks for this enhancement. I close the issue.
Do you know if it does fix the old bpo-37387 issue?
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracke
STINNER Victor added the comment:
New changeset 306a93b4819db611041da735ca3b34117a3bc961 by Jeremy Kloth in
branch '3.9':
[3.9] bpo-47089: Avoid test_compileall failures on Windows (GH-32037).
(GH-32240)
https://github.com/python/cpython/commit/306a93b4819db611041da735ca3b34
STINNER Victor added the comment:
Guido (msg416498)
> Surely the bigger issue is that the contents of new_code itself must be
> totally different? Also there are other tables that need to be adjusted if
> you really do change co_code, e.g. the debugging tables.
Do you consider that
STINNER Victor added the comment:
New changeset 76b8a075b8a79b08468fd0ed06a489a5c815bc11 by Jeremy Kloth in
branch 'main':
bpo-47089: Avoid test_compileall failures on Windows (GH-32037)
https://github.com/python/cpython/commit/76b8a075b8a79b08468fd0ed06a489
STINNER Victor added the comment:
python-dev thread:
https://mail.python.org/archives/list/python-...@python.org/thread/KWSPCLXDHBAP2U4LBSMLQEOC7LREDMPB/
Mark wrote:
"You can pass the exception table the same way you pass all the other
arguments. The exception table depends on the code
STINNER Victor added the comment:
> How would you compute the exception table from the bytecode? There are no
> clues in the bytecode about where the try and except blocks are.
Disassemble the bytecode to rebuild basic blocks and detect which ones are
except blocks. I don't k
STINNER Victor added the comment:
See bpo-47185: code.replace(co_code=new_code) no longer catch exceptions on
Python 3.11.
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.org/issue40
New submission from STINNER Victor :
Since bpo-40222 "Zero cost exception handling", code object created by from
bytecode with code.replace(co_code=new_code) no longer catch exceptions on
Python 3.11, unless an exception table is set explicitly.
Example:
---
def f():
try:
STINNER Victor added the comment:
New changeset f877b40e3f7e0d97878884d80fbec879a85ab7e8 by Victor Stinner in
branch 'main':
bpo-46850: Move _PyInterpreterState_SetEvalFrameFunc() to internal C API
(GH-32054)
https://github.com/python/cpython/commit/f877b40e3f7e0d97878884d80fbec8
STINNER Victor added the comment:
New changeset b9a5522dd952125a99ff554f01f311cae25f5a91 by Victor Stinner in
branch 'main':
bpo-46850: Move _PyEval_EvalFrameDefault() to internal C API (GH-32052)
https://github.com/python/cpython/commit/b9a5522dd952125a99ff554f01f311
STINNER Victor added the comment:
sre_constants, sre_compile and sre_parse are not tested and are not documented.
I don't consider them as public API currently.
If someone has good reason to use them, IMO we must clearly define which exact
API is needed, properly document and test it
STINNER Victor added the comment:
Oh, it seems like this issue is a duplicate of bpo-31912 created in 2017.
--
___
Python tracker
<https://bugs.python.org/issue47
STINNER Victor added the comment:
Objects/obmalloc.c currently relies on the SIZEOF_VOID_P macro:
---
#if SIZEOF_VOID_P > 4
#define ALIGNMENT 16 /* must be 2^N */
#define ALIGNMENT_SHIFT 4
#else
#define ALIGNMENT 8 /* must be
STINNER Victor added the comment:
On my x86-64 Fedora 35, gcc says 32 bytes for sizeof(max_align_t). By the way,
g++ also says 32 bytes for sizeof(std::max_align_t).
GCC 11.2.1 defines max_align_t as:
---
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
Change by STINNER Victor :
--
pull_requests: +30286
pull_request: https://github.com/python/cpython/pull/32210
___
Python tracker
<https://bugs.python.org/issue47
STINNER Victor added the comment:
New changeset 7fc39a21cb85163a456eab91b52e5fe85e7f7e3e by Victor Stinner in
branch 'main':
bpo-47164: Add _PyCFunctionObject_CAST() macr (GH-32190)
https://github.com/python/cpython/commit/7fc39a21cb85163a456eab91b52e5f
STINNER Victor added the comment:
New changeset f0bc69485677ae8973685866ada0982976d3878f by Victor Stinner in
branch 'main':
bpo-47164: Add _PyCFunction_CAST() macro (GH-32192)
https://github.com/python/cpython/commit/f0bc69485677ae8973685866ada098
STINNER Victor added the comment:
New changeset c14d7e4b816134b8e93ece4066a86d229631ce96 by Victor Stinner in
branch 'main':
bpo-47164: Add _PyASCIIObject_CAST() macro (GH-32191)
https://github.com/python/cpython/commit/c14d7e4b816134b8e93ece4066a86d
STINNER Victor added the comment:
After reading Mark's comments, I reworked my GH-32190 PR to only use the CAST
macros in other macros, not in the C code. The CAST macros are not used in such
code pattern:
else if (PyCFunction_Check(func))
-return ((PyCFunctionObject*
STINNER Victor added the comment:
> If the invariant bits are moved out, then it clearly indicates when code can
> safely assume that every interpreter will be seeing the same value.
What is the benefit of that? Do you have an e
STINNER Victor added the comment:
> I've had to debug a segfault before only because the inline function
> implicitly cast its arguments, and it was accessing a non-existent member. If
> it were a macro it would access the struct member directly, and the compiler
> would
STINNER Victor added the comment:
GH-32192 "Add _PyCFunction_CAST() macro" is special. It's used to define
functions in PyTypeObject.tp_methods or PyModuleDef.m_methods.
Casting a function pointer can cause issues with Control Flow Integrity (CFI)
implemented in LLVM. The _th
STINNER Victor added the comment:
Hum, there are two things and maybe we are not talking about the same thing.
* (A) Modifying macros defined in the Python C API (Include/ header files)
doing cast on their arguments to use CAST macros
* (B) Modify C code doing casts to use CAST macros
I
STINNER Victor added the comment:
> By the way, the current Python C API is not fully compatible with C++. (...)
I created bpo-47165 "[C API] Test that the Python C API is compatible with C++".
--
___
Python tracker
<https:/
STINNER Victor added the comment:
Follow-up issue: bpo-47165 "[C API] Test that the Python C API is compatible
with C++".
--
___
Python tracker
<https://bugs.python.o
New submission from STINNER Victor :
There are more and more popular projects using the Python C API. The first big
player is pybind11:
"Seamless operability between C++11 and Python"
https://pybind11.readthedocs.io/
Recently, I proposed a PR to add Python 3.11 support to the
STINNER Victor added the comment:
> I think that adding macros makes readability worse.
See the attached PRs, I can remove multiple layers of parenthesis in macros by
using CAST macros.
> ```
> PyObject *func = ...;
> int flags = PyCFunction_GET_FLAGS(func);
> ```
>
>
Change by STINNER Victor :
--
pull_requests: +30270
pull_request: https://github.com/python/cpython/pull/32192
___
Python tracker
<https://bugs.python.org/issue47
Change by STINNER Victor :
--
pull_requests: +30269
pull_request: https://github.com/python/cpython/pull/32191
___
Python tracker
<https://bugs.python.org/issue47
Change by STINNER Victor :
--
keywords: +patch
pull_requests: +30268
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/32190
___
Python tracker
<https://bugs.python.org/issu
New submission from STINNER Victor :
Last years, I started to add "CAST" macros like:
#define _PyObject_CAST(op) ((PyObject*)(op))
#define _PyType_CAST(op) (assert(PyType_Check(op)), (PyTypeObject*)(op))
Example of usage:
#define PyObject_TypeCheck(ob, type) PyObject_TypeCheck(_PyO
STINNER Victor added the comment:
> Any possibility that you can test the attached PR as pid 1?
Python should be built as a static binary and can be used as the init process
on the kernel command line, no? I'm not sure that "static binary" is a
requirement, since I
STINNER Victor added the comment:
The C++20 "module" keyword is "contextual keyword". It's only a keyword if the
first line if a file contains "module".
* https://en.cppreference.com/w/cpp/language/modules#Module_declarations
* https://en.cppreference.com
STINNER Victor added the comment:
I wrote the draft PR GH-32175 to test https://bugs.python.org/issue39355 and
GH-31282. Problem: I don't get any compiler warning or error about the "module"
C++20 keyword. I tested GCC 11.2.1 and clang 13.0
Change by STINNER Victor :
--
pull_requests: +30252
pull_request: https://github.com/python/cpython/pull/32175
___
Python tracker
<https://bugs.python.org/issue39
STINNER Victor added the comment:
STINNER Victor:
> What is the error message? How can the error be reproduced?
Keith (aCuria):
> Compile with a compiler supporting the C++20 core feature (Modules)
> https://en.cppreference.com/w/cpp/compiler_support
I built a C++ extension wh
STINNER Victor added the comment:
When I wrote a PR to use the C header file pythoncapi_compat.h in the datatable
C++ project, I got multiple C++ compiler warnings in static inline functions
and in some macros:
https://github.com/h2oai/datatable/pull/3231#issuecomment-1032864790
* Usage of
STINNER Victor added the comment:
If I build a C++ extension with -std=c++20, I get a compiler error on
PyModuleDef_HEAD_INIT:
Modules/_testcppext.cpp:419:5: error: either all initializer clauses should be
designated or none of them should be
419 | .m_name = "_testc
STINNER Victor added the comment:
Jelle Zijlstra:
> I believe the attrs code wouldn't work if a method is decorated with a
> decorator that wraps the original function, such as @functools.cache.
What do you mean by "wouldn't work"? Do you mean that the semantics of
STINNER Victor added the comment:
The stdlib types module looks like a better place for such new function, rather
than the functools module.
The types module documentation starts with: "This module defines utility
functions to assist in dynamic creation of new types.&q
STINNER Victor added the comment:
See also bpo-47143 "Add functools.copy_class() which updates closures".
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.o
STINNER Victor added the comment:
CreateSwappedType() is an helper function used by the _ctypes.PyCSimpleType
type. Python script reproducing this ctypes bug:
---
class PyCSimpleType(type):
def __new__(cls, name, bases, dct):
print(f"PyCSimpleType: create {name}
STINNER Victor added the comment:
Note: Implementing a metaclass in Python is hard, it's easy to mess up with
closures: see bpo-29270 "ctypes: fail to create a _ctypes._SimpleCData subclass
using a closure like calling super() without arguments". type.__new__() is
called tw
STINNER Victor added the comment:
> The same problem exists at the function level: see bpo-39805: "Copying
> functions doesn't actually copy them".
See also bpo-14369 "make function __closure__ writable".
--
___
Change by STINNER Victor :
--
title: make __closure__ writable -> make function __closure__ writable
___
Python tracker
<https://bugs.python.org/issu
STINNER Victor added the comment:
bpo-32176 "Zero argument super is broken in 3.6 for methods with a hacked
__class__ cell" added test_code.test_closure_injection() and fixed the
CO_NOFREE flag in the code object constructor (type
STINNER Victor added the comment:
> If I understand correctly, a cell content can be modified since Python 3.7:
> since commit 64505a1f6c0af4574e17e823b27ffe24eca44df5 of bpo-30486
Moreover, it's possible to create a cell object since Python
STINNER Victor added the comment:
See also the types.new_class() function:
https://docs.python.org/dev/library/types.html#types.new_class
Oh, I didn't know this function!
--
___
Python tracker
<https://bugs.python.org/is
STINNER Victor added the comment:
See also bpo-47143 "Add functools.copy_class() which updates closures".
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.o
STINNER Victor added the comment:
> * old fixed attrs issue: https://github.com/python-attrs/attrs/issues/102
> * attrs issue with Python 3.11:
> https://github.com/python-attrs/attrs/issues/907
> * dataclasses issues with slots=True: https://bugs.python.org/issue46404
Similar
STINNER Victor added the comment:
The same problem exists at the function level: see bpo-39805: "Copying
functions doesn't actually copy them".
For example, copy.deepcopy(func) returns func unchanged if it's a function.
Example:
---
import copy
def make_closure():
STINNER Victor added the comment:
In the Python C API, PEP 384 added PyType_FromSpec(). There is also
PyStructSequence_NewType(). PEP 3121 proposed PyType_Copy() but it was never
implemented: see bpo-3760. But in C, closures are implemented using a module
state, or previously using a global
STINNER Victor added the comment:
If I understand correctly, a cell content can be modified since Python 3.7:
since commit 64505a1f6c0af4574e17e823b27ffe24eca44df5 of bpo-30486:
bpo-30486: Allow setting cell value (#1840)
Antoine Pitrou created bpo-30486 for cloudpickle:
"There ar
STINNER Victor added the comment:
More recent copy.copy() change: commit 5c1c3b4f197c57952760be37d77d73669284a607
of bpo-11480:
Issue #11480: Fixed copy.copy to work with classes with custom metaclasses.
+try:
+issc = issubclass(cls, type)
+except TypeError: # cls is not
STINNER Victor added the comment:
pickle.dump(x) checks if x is a type since commit
f048a8f6d79173cc1da1bf12c60ae06fea36762c (March 2002) of bpo-494904:
Pickler.save(): Fix for SF bug #494904: Cannot pickle a class with a
metaclass, reported by Dan Parisien.
+if
STINNER Victor added the comment:
The pickle module doesn't copy a type but gets it from its module. The Python
implementation is pickle._Pickler.save_type() which calls
pickle._Pickler.save_global().
The cloudpickle module doesn't copy types neither: same behavior than pickle
STINNER Victor added the comment:
It seems like the copy module doesn't support copying a class.
copy.deepcopy(cls) doesn't copy a class but returns its argument, the class
unchanged.
--
___
Python tracker
<https://bugs.python.o
STINNER Victor added the comment:
See also bpo-45520: "Frozen dataclass deep copy doesn't work with __slots__"
which is related but a different issue.
--
___
Python tracker
<https://bugs.pyt
1 - 100 of 1229 matches
Mail list logo