-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Closed
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Description
Bug report
Bug description:
There's a segmentation fault in Python 3.14.1 and 3.13.10 which doesn't happen in the previous point releases.
I'm sorry about the messy reproducer, the issue was noticed in a much larger program and this is what I ended up with after removing all the cruft.
seg_fault_issue_import.py:
import asyncio
import atexit
class OtherClass:
__slots__ = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i'
def __init__(self):
pass
def register_async_client_cleanup():
def cleanup_wrapper():
loop = asyncio.new_event_loop()
loop.close()
atexit.register(cleanup_wrapper)
register_async_client_cleanup()seg_fault_debug.py:
from enum import StrEnum
from seg_fault_issue_import import OtherClass
class MyClass:
def __init__(self):
self.attr = OtherClass()
class MyEnum(StrEnum):
ATTR = "attr"
mydata = MyClass()
setattr(mydata, MyEnum.ATTR, None)Running seg_fault_debug.py causes a segmentation fault with Python 3.13.10 and 3.14.1:
$ python3 seg_fault_debug.py
Segmentation fault (core dumped)
Original reproducer
seg_fault_issue_import.py:
import asyncio
import atexit
from dataclasses import dataclass
@dataclass(slots=True)
class CPU:
"""CPU."""
count: int | None = None
frequency: float | None = None
load_average: float | None = None
per_cpu: list[float] | None = None
power: float | None = None
stats: float | None = None
temperature: float | None = None
times: float | None = None
times_percent: float | None = None
def register_async_client_cleanup():
def cleanup_wrapper():
loop = asyncio.new_event_loop()
loop.close()
atexit.register(cleanup_wrapper)
register_async_client_cleanup()seg_fault_debug.py:
from dataclasses import dataclass, field
from enum import StrEnum
from seg_fault_issue_import import CPU
@dataclass
class MyDataclass:
attr: None = field(default_factory=CPU)
class MyEnum(StrEnum):
ATTR = "attr"
mydata = MyDataclass()
setattr(mydata, MyEnum.ATTR, None)CPython versions tested on:
3.14
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)release-blockertype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
Projects
Status
Done