10000 gh-132413: Fix crash in _datetime when used at shutdown by neonene · Pull Request #132599 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-132413: Fix crash in _datetime when used at shutdown #132599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a2d90ae
Update datetimetester.py
neonene Apr 16, 2025
37d317f
Make interp-dict have a strong ref to the module
neonene Apr 16, 2025
44d09c9
Fix exc leak
neonene Apr 16, 2025
19326d4
📜🤖 Added by blurb_it.
blurb-it[bot] Apr 16, 2025
c74251d
Merge branch 'main' into fix-132413
neonene Apr 16, 2025
f805ec7
Add assertion in test
neonene Apr 17, 2025
1539cc6
More assertion
neonene Apr 17, 2025
e6aa018
Allow only module's exec() to create interp-dict
neonene Apr 17, 2025
5141a76
Safer ref cycle between mod and interp-dict
neonene Apr 17, 2025
76cc153
Respect interp-dict held in module state
neonene Apr 17, 2025
e5bb7c8
Update _datetimemodule.c
neonene Apr 20, 2025
2645282
Merge branch 'main' into fix-132413
neonene Apr 20, 2025
87aa7a2
Update datetimetester.py
neonene Apr 20, 2025
b425bc8
Reword
neonene Apr 21, 2025
19de232
typo
neonene Apr 21, 2025
f7b78d9
Reword
neonene Apr 22, 2025
05811bb
Cleanup
neonene Apr 22, 2025
1416c6f
Merge branch 'main' into fix-132413
neonene Apr 22, 2025
351ac36
assert(!_Py_IsInterpreterFinalizing())
neonene Apr 24, 2025
0e4a263
Add tests
neonene Apr 25, 2025
fa0cc40
Update tests
neonene Apr 26, 2025
0377764
Take account of interp restart
neonene Apr 26, 2025
9af13a6
Add subinterp tests
neonene Apr 27, 2025
124d650
Fix tests for free-threaded builds
neonene Apr 27, 2025
c490586
Nit
neonene Apr 27, 2025
29c45a3
Merge branch 'main' into fix-132413
neonene Apr 27, 2025
db47683
Make tests generic
neonene Apr 27, 2025
ddd1635
Fix warnings
neonene Apr 27, 2025
746bf85
Update tests
neonene Apr 30, 2025
1cdaf5a
Merge branch 'main' into fix-132413
neonene Apr 30, 2025
a8f76fa
Revert to original (main)
neonene May 7, 2025
c7fc55e
Convert IsoCalendarDate to static type (3.12)
neonene May 7, 2025
b3d8a8e
Merge branch 'main' into fix-132413
neonene May 7, 2025
539cfed
Fix warning
neonene May 7, 2025
f2373f4
Merge branch 'main' into fix-132413
neonene May 8, 2025
d9f8544
Fix refleaks
neonene May 8, 2025
07ca91f
Ditto
neonene May 8, 2025
13b065f
Move up a function
neonene May 9, 2025
0052451
Smaller patch for tests
neonene May 13, 2025
fb29db1
Merge branch 'main' into fix-132413
neonene May 13, 2025
d2e2a11
Add a non-issue test case (closure)
neonene May 18, 2025
2da198e
minimize test
neonene Jun 23, 2025
2392247
Merge branch 'main' into fix-132413
neonene Jun 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make tests generic
  • Loading branch information
neonene committed Apr 27, 2025
commit db47683afae91061a22b543158543162cb961c0a
139 changes: 59 additions & 80 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -7155,49 +7155,75 @@ def test_datetime_from_timestamp(self):

self.assertEqual(dt_orig, dt_rt)

def test_type_check_in_subinterp(self):
def assert_python_ok_in_subinterp(self, script,
setup='_testcapi.test_datetime_capi()',
mainsetup='_testcapi.test_datetime_capi()',
config='isolated'):
# iOS requires the use of the custom framework loader,
# not the ExtensionFileLoader.
if sys.platform == "ios":
extension_loader = "AppleFrameworkLoader"
else:
extension_loader = "ExtensionFileLoader"

script = textwrap.dedent(f"""
maincode = textwrap.dedent(f'''
import textwrap
from test import support

subcode = textwrap.dedent("""
if {_interpreters is None}:
import _testcapi
else:
import importlib.machinery
import importlib.util
fullname = '_testcapi_datetime'
origin = importlib.util.find_spec('_testcapi').origin
loader = importlib.machinery.{extension_loader}(fullname, origin)
spec = importlib.util.spec_from_loader(fullname, loader)
_testcapi = importlib.util.module_from_spec(spec)
spec.loader.exec_module(_testcapi)

$SETUP$
$SCRIPT$
""")

import _testcapi
$MAINSETUP$

if {_interpreters is None}:
import _testcapi as module
module.test_datetime_capi()
ret = support.run_in_subinterp(subcode)
else:
import importlib.machinery
import importlib.util
fullname = '_testcapi_datetime'
origin = importlib.util.find_spec('_testcapi').origin
loader = importlib.machinery.{extension_loader}(fullname, origin)
spec = importlib.util.spec_from_loader(fullname, loader)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
module.test_datetime_capi()
import _interpreters
config = _interpreters.new_config('{config}').__dict__
ret = support.run_in_subinterp_with_config(subcode, **config)

assert ret == 0

''').replace('$MAINSETUP$', mainsetup)
maincode = maincode.replace('$SETUP$', textwrap.indent(setup, '\x20'*4))
maincode = maincode.replace('$SCRIPT$', textwrap.indent(script, '\x20'*4))

res = script_helper.assert_python_ok('-c', maincode)
return res

def test_type_check_in_subinterp(self):
script = textwrap.dedent(f"""
def run(type_checker, obj):
if not type_checker(obj, True):
raise TypeError(f'{{type(obj)}} is not C API type')

import _datetime
run(module.datetime_check_date, _datetime.date.today())
run(module.datetime_check_datetime, _datetime.datetime.now())
run(module.datetime_check_time, _datetime.time(12, 30))
run(module.datetime_check_delta, _datetime.timedelta(1))
run(module.datetime_check_tzinfo, _datetime.tzinfo())
run(_testcapi.datetime_check_date, _datetime.date.today())
run(_testcapi.datetime_check_datetime, _datetime.datetime.now())
run(_testcapi.datetime_check_time, _datetime.time(12, 30))
run(_testcapi.datetime_check_delta, _datetime.timedelta(1))
run(_testcapi.datetime_check_tzinfo, _datetime.tzinfo())
""")
if _interpreters is None:
ret = support.run_in_subinterp(script)
self.assertEqual(ret, 0)
else:
for name in ('isolated', 'legacy'):
with self.subTest(name):
config = _interpreters.new_config(name).__dict__
ret = support.run_in_subinterp_with_config(script, **config)
self.assertEqual(ret, 0)
self.assert_python_ok_in_subinterp(script, mainsetup='')
if _interpreters is not None:
with self.subTest('legacy'):
self.assert_python_ok_in_subinterp(script, mainsetup='',
config='legacy')


class ExtensionModuleTests(unittest.TestCase):
Expand Down Expand Up @@ -7284,6 +7310,7 @@ def gen():
try:
yield
finally:
# Exceptions are ignored here
assert not sys.modules
td = _datetime.timedelta(days=1)
assert td.days == 1
Expand Down Expand Up @@ -7315,55 +7342,9 @@ def gen():
res = script_helper.assert_python_ok('-c', script)
self.assertFalse(res.err)

def run_script_132413(self, script):
# iOS requires the use of the custom framework loader,
# not the ExtensionFileLoader.
if sys.platform == "ios":
extension_loader = "AppleFrameworkLoader"
else:
extension_loader = "ExtensionFileLoader"

main_interp_script = textwrap.dedent(f'''
import textwrap
from test import support

sub_script = textwrap.dedent("""
if {_interpreters is None}:
import _testcapi as module
else:
import importlib.machinery
import importlib.util
fullname = '_testcapi_datetime'
origin = importlib.util.find_spec('_testcapi').origin
loader = importlib.machinery.{extension_loader}(fullname, origin)
spec = importlib.util.spec_from_loader(fullname, loader)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)

# Skip calling test_datetime_capi()
$REPLACE_ME$
""")

import _testcapi
_testcapi.test_datetime_capi()

if {_interpreters is None}:
ret = support.run_in_subinterp(sub_script)
else:
import _interpreters
config = _interpreters.new_config('isolated').__dict__
ret = support.run_in_subinterp_with_config(sub_script, **config)

assert ret == 0

''').replace('$REPLACE_ME$', textwrap.indent(script, '\x20'*4))

res = script_helper.assert_python_ok('-c', main_interp_script)
return res

def test_static_type_at_shutdown3(self):
script = textwrap.dedent("""
timedelta = module.get_delta_type()
timedelta = _testcapi.get_capi_types()['timedelta']

def gen():
try:
Expand All @@ -7374,19 +7355,18 @@ def gen():
it = gen()
next(it)
""")
res = self.run_script_132413(script)
res = CapiTest.assert_python_ok_in_subinterp(self, script, setup='')
self.assertIn(b'ImportError: sys.meta_path is None', res.err)

def test_static_type_before_shutdown(self):
script = textwrap.dedent(f"""
import sys
assert '_datetime' not in sys.modules
timedelta = module.get_delta_type()
timedelta = _testcapi.get_capi_types()['timedelta']
timedelta(days=1)
assert '_datetime' in sys.modules
""")
res = self.run_script_132413(script)
self.assertFalse(res.err)
CapiTest.assert_python_ok_in_subinterp(self, script, setup='')

def test_remain_only_one_module(self):
script = textwrap.dedent("""
Expand All @@ -7403,8 +7383,7 @@ def test_remain_only_one_module(self):
gc.collect()
assert len(ws) == 1
""")
res = script_helper.assert_python_ok('-c', script)
self.assertFalse(res.err)
script_helper.assert_python_ok('-c', script)

@unittest.skipIf(not support.Py_DEBUG, "Debug builds only")
def test_no_leak(self):
Expand Down
31 changes: 28 additions & 3 deletions Modules/_testcapi/datetime.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,34 @@
}

static PyObject *
get_delta_type(PyObject *self, PyObject *args)
get_capi_types(PyObject *self, PyObject *args)
{
return PyDateTimeAPI ? Py_NewRef(PyDateTimeAPI->DeltaType) : Py_None;
if (PyDateTimeAPI == NULL) {
Py_RETURN_NONE;
}
PyObject *dict = PyDict_New();
if (dict == NULL) {
return NULL;
}
if (PyDict_SetItemString(dict, "date", PyDateTimeAPI->DateType) < 0) {

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 466 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]
goto error;
}
if (PyDict_SetItemString(dict, "time", PyDateTimeAPI->TimeType) < 0) {

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 469 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]
goto error;
}
if (PyDict_SetItemString(dict, "datetime", PyDateTimeAPI->DateTimeType) < 0) {

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 472 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]
goto error;
}
if (PyDict_SetItemString(dict, "timedelta", PyDateTimeAPI->DeltaType) < 0) {

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 475 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]
goto error;
}
if (PyDict_SetItemString(dict, "tzinfo", PyDateTimeAPI->TZInfoType) < 0) {

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Cross build Linux

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Address sanitizer (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [D:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'function': incompatible types - from 'PyTypeObject *' to 'PyObject *' [C:\a\cpython\cpython\PCbuild\_testcapi.vcxproj]

Check warning on line 478 in Modules/_testcapi/datetime.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

passing argument 3 of ‘PyDict_SetItemString’ from incompatible pointer type [-Wincompatible-pointer-types]
goto error;
}
return dict;
error:
Py_DECREF(dict);
return NULL;
}

static PyMethodDef test_methods[] = {
Expand All @@ -475,11 +500,11 @@
{"get_datetime_fromdateandtimeandfold", get_datetime_fromdateandtimeandfold, METH_VARARGS},
{"get_datetime_fromtimestamp", get_datetime_fromtimestamp, METH_VARARGS},
{"get_delta_fromdsu", get_delta_fromdsu, METH_VARARGS},
{"get_delta_type", get_delta_type, METH_NOARGS},
{"get_time_fromtime", get_time_fromtime, METH_VARARGS},
{"get_time_fromtimeandfold", get_time_fromtimeandfold, METH_VARARGS},
{"get_timezone_utc_capi", get_timezone_utc_capi, METH_VARARGS},
{"get_timezones_offset_zero", get_timezones_offset_zero, METH_NOARGS},
{"get_capi_types", get_capi_types, METH_NOARGS},
{"make_timezones_capi", make_timezones_capi, METH_NOARGS},
{"test_datetime_capi", test_datetime_capi, METH_NOARGS},
{NULL},
Expand Down
Loading
0