Skip to content
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

crash in "./python.exe -We -m test -v test_datetime -m test_folds" #103944

Closed
iritkatriel opened this issue Apr 27, 2023 · 3 comments
Closed

crash in "./python.exe -We -m test -v test_datetime -m test_folds" #103944

iritkatriel opened this issue Apr 27, 2023 · 3 comments
Labels
3.12 bugs and security fixes tests Tests in the Lib/test dir type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@iritkatriel
Copy link
Member

iritkatriel commented Apr 27, 2023

Running on a Mac:

% ./python.exe -We -m test -v test_datetime -m test_folds
Raised RLIMIT_NOFILE: 256 -> 1024
== CPython 3.12.0a7+ (heads/main:44b5c21f41, Apr 27 2023, 20:09:36) [Clang 14.0.3 (clang-1403.0.22.14.1)]
== macOS-13.3.1-x86_64-i386-64bit little-endian
== Python build: debug
== cwd: /Users/iritkatriel/src/cpython-1/build/test_python_30946æ
== CPU count: 12
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 5.01 Run tests sequentially
0:00:00 load avg: 5.01 [1/1] test_datetime
test_folds (test.datetimetester.IranTest_Pure.test_folds) ... ERROR
test_folds (test.datetimetester.ZoneInfoTest_Pure.test_folds) ... ERROR
test_folds (test.datetimetester.IranTest_Fast.test_folds) ... Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set
Python runtime state: initialized
DeprecationWarning: datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.now(datetime.UTC).

The above exception was the direct cause of the following exception:

SystemError: <built-in method utcfromtimestamp of type object at 0x10d2559d8> returned a result with an exception set

Current thread 0x00007ff85940a340 (most recent call first):
  File "/Users/iritkatriel/src/cpython-1/Lib/test/datetimetester.py", line 6102 in transitions
  File "/Users/iritkatriel/src/cpython-1/Lib/test/datetimetester.py", line 6124 in folds
  File "/Users/iritkatriel/src/cpython-1/Lib/test/datetimetester.py", line 6158 in test_folds
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 589 in _callTestMethod
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 634 in run
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/case.py", line 690 in __call__
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 122 in run
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 122 in run
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/suite.py", line 84 in __call__
  File "/Users/iritkatriel/src/cpython-1/Lib/unittest/runner.py", line 240 in run
  File "/Users/iritkatriel/src/cpython-1/Lib/test/support/__init__.py", line 1106 in _run_suite
  File "/Users/iritkatriel/src/cpython-1/Lib/test/support/__init__.py", line 1232 in run_unittest
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 281 in _test_module
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 317 in _runtest_inner2
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 360 in _runtest_inner
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 235 in _runtest
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/runtest.py", line 265 in runtest
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 483 in run_tests_sequential
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 601 in run_tests
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 779 in _main
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 738 in main
  File "/Users/iritkatriel/src/cpython-1/Lib/test/libregrtest/main.py", line 802 in main
  File "/Users/iritkatriel/src/cpython-1/Lib/test/__main__.py", line 2 in <module>
  File "/Users/iritkatriel/src/cpython-1/Lib/runpy.py", line 88 in _run_code
  File "/Users/iritkatriel/src/cpython-1/Lib/runpy.py", line 198 in _run_module_as_main

Extension modules: _testcapi (total: 1)
zsh: abort      ./python.exe -We -m test -v test_datetime -m test_folds

Linked PRs

@iritkatriel iritkatriel added tests Tests in the Lib/test dir type-crash A hard crash of the interpreter, possibly with a core dump labels Apr 27, 2023
@sobolevn
Copy link
Member

Looks like it is related to #103858 and #103857

As it said in the error it sets an exception (warning) and returns a value, here: https://github.com/python/cpython/pull/103858/files#diff-3ee250e3806e884518fd872e9148baf532de6ec54c1cdb4e7679fbb2869d9c47R5147-R5154

CC @pganssle

@pganssle
Copy link
Member

@iritkatriel I think #103949 solves this?

Though I guess with -We on, the test suite is still failing, but it's not a crash anymore.

@iritkatriel
Copy link
Member Author

Ideally the test would expect and suppress the warning.

pganssle added a commit that referenced this issue May 3, 2023
* Remove last use of `utcfromtimestamp`

This was a weirdly valid use of `utcfromtimestamp` in the sense that the "timestamps" in TZif files are not epoch times, but actually something more properly thought of as "number of seconds since 1970 in the local time zone", so even though we didn't want UTC time, `utcfromtimestamp` was still a good way to get the thing we wanted. Since we're deprecating `utcfromtimestamp`, it's just as valid to use `timedelta` arithmetic here.

We may be able to avoid the question entirely by switching these tests over to using `ZoneInfo` in the future.

* Fix a few missing DeprecationWarnings in tests

In one test, we simply turn off DeprecationWarning rather than asserting about it, because whether the error condition happens before or after the warning seems to differ between the Python and C versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes tests Tests in the Lib/test dir type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

3 participants