Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ZoneInfo comparison fails on free-threaded build #125243

Closed
Assignees
colesbury
@ngoldbaum

Description

@ngoldbaum

Bug report

Bug description:

(originally noticed by@davidhewitt in#116738 (comment))

Very infrequently, PyO3 tests for timezone conversions will fail with errors like:

---- conversions::chrono_tz::tests::test_into_pyobject stdout ----thread 'conversions::chrono_tz::tests::test_into_pyobject' panicked at src/conversions/chrono_tz.rs:120:17:zoneinfo.ZoneInfo(key='UTC') != zoneinfo.ZoneInfo(key='UTC')

Unfortunately, I don't have an easier way to trigger this besides "run the PyO3 tests over and over until you see a failure", since I think triggering it requires many threads simultaneously using the C API which happens automatically with cargo for the PyO3 tests.

The test code is here:

https://github.com/PyO3/pyo3/blob/eacebb8db101d05ae4ccf0396e314b098455ecd3/src/conversions/chrono_tz.rs#L116-L134

I believe that rust is more or less doing the equivalent of this C code:

#include <Python.h>int main(){  if (Py_IsInitialized() == 0) {    Py_InitializeEx(0);    PyObject *mod = PyImport_ImportModule("zoneinfo");    if (mod == NULL) {      PyErr_PrintEx(0);      return -1;    }    PyObject *zoneinfo = PyObject_GetAttrString(mod, "ZoneInfo");    if (zoneinfo == NULL) {      PyErr_PrintEx(0);      return -1;    }    PyObject *arg = PyUnicode_FromString("Europe/Paris");    PyObject *obj1 = PyObject_CallOneArg(zoneinfo, arg);    PyObject *obj2 = PyObject_CallOneArg(zoneinfo, arg);    PyObject *result = PyObject_RichCompare(obj1, obj2, Py_EQ);    PyObject_Print(result, stderr, Py_PRINT_RAW);  }  return 0;}

This doesn't fail, which makes me suspect triggering it requires touching the C API in other threads.

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp