- Python Home
- About
- News
- Documentation
- Downloads
- Community
- Foundation
- Developer's Guide
- Issue Tracker
- Issues
- Summaries
- User
- Administration
- Help
Issue40058
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2020-03-25 01:54 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 19213 | closed | shihai1991, 2020-03-29 08:47 | |
| Messages (10) | |||
|---|---|---|---|
| msg364970 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2020-03-25 01:54 | |
vstinner@apu$ ./python -m test -v test_datetime test_datetime -m test_divide_and_round == CPython 3.9.0a5+ (heads/pr/19122:0ac3031a80, Mar 25 2020, 02:25:19) [GCC 9.2.1 20190827 (Red Hat 9.2.1-1)] == Linux-5.5.9-200.fc31.x86_64-x86_64-with-glibc2.30 little-endian == cwd: /home/vstinner/python/master/build/test_python_233006 == CPU count: 8 == encodings: locale=UTF-8, FS=utf-8 0:00:00 load avg: 0.82 Run tests sequentially 0:00:00 load avg: 0.82 [1/2] test_datetime test_divide_and_round (test.datetimetester.TestModule_Pure) ... ok test_divide_and_round (test.datetimetester.TestModule_Fast) ... skipped 'Only run for Pure Python implementation' ---------------------------------------------------------------------- Ran 2 tests in 0.002s OK (skipped=1) 0:00:00 load avg: 0.82 [2/2] test_datetime test_divide_and_round (test.datetimetester.TestModule_Pure) ... ERROR test_divide_and_round (test.datetimetester.TestModule_Fast) ... skipped 'Only run for Pure Python implementation' ====================================================================== ERROR: test_divide_and_round (test.datetimetester.TestModule_Pure) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vstinner/python/master/Lib/test/datetimetester.py", line 87, in test_divide_and_round dar = datetime_module._divide_and_round AttributeError: module 'datetime' has no attribute '_divide_and_round' ---------------------------------------------------------------------- Ran 2 tests in 0.006s FAILED (errors=1, skipped=1) test test_datetime failed test_datetime failed == Tests result: FAILURE == 1 test OK. 1 test failed: test_datetime Total duration: 448 ms Tests result: FAILURE |
|||
| msg364993 - (view) | Author: Hai Shi (shihai1991) * ![]() |
Date: 2020-03-25 15:52 | |
`_divide_and_round()` would be deleted in https://github.com/python/cpython/blob/master/Lib/datetime.py#L2516. if it's removed L2516 of datetime.py, `test_name_cleanup()` would be failed.Looks like it's a planed behavior~ |
|||
| msg365012 - (view) | Author: Hai Shi (shihai1991) * ![]() |
Date: 2020-03-25 18:54 | |
add a pdb point in L11 of test_datetime.py 8 try: 9 pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strptime'], 10 blocked=['_datetime']) 11 import pdb;pdb.set_trace() 12 -> fast_tests = import_fresh_module(TESTS, fresh=['datetime', 13 '_datetime', '_strptime']) and run `./python -m test test_datetime test_datetime`: the first iteration: (Pdb) pure_tests.datetime_module._divide_and_round <function _divide_and_round at 0x7f694df8e7e0> the second iteration(`_datetime` not blocked?): (Pdb) pure_tests.datetime_module._divide_and_round *** AttributeError: module 'datetime' has no attribute '_divide_and_round' |
|||
| msg365018 - (view) | Author: Paul Ganssle (p-ganssle) * ![]() |
Date: 2020-03-25 19:46 | |
This isn't exactly "working as intended", but I believe it's a known problem with either `import_fresh_module` or `datetime`, as you can see from these comments: https://github.com/python/cpython/blob/302e5a8f79514fd84bafbc44b7c97ec636302322/Lib/test/test_datetime.py#L14-L23 Based on the git blame, those TODO comments are from Georg Brandl, so I'm adding him to the nosy list in case he has some insight. |
|||
| msg365020 - (view) | Author: Georg Brandl (georg.brandl) * ![]() |
Date: 2020-03-25 19:59 | |
Sorry, it seems that was far too long ago for me to remember anything :) |
|||
| msg365248 - (view) | Author: Hai Shi (shihai1991) * ![]() |
Date: 2020-03-29 08:58 | |
> I believe it's a known problem with either `import_fresh_module` or `datetime` after removed the cleanup operation of `sys.modules` in PR19213, the testcases is successed in my local vm(I am not sure there have any other potential risks). |
|||
| msg368273 - (view) | Author: Eric Snow (eric.snow) * ![]() |
Date: 2020-05-06 16:03 | |
FYI, with the following additions in Lib/test/test_datetime.py... before = set(sys.modules) try: pure_tests = import_fresh_module(TESTS, fresh=['datetime', '_strptime'], blocked=['_datetime']) _pure = set(sys.modules) fast_tests = import_fresh_module(TESTS, fresh=['datetime', '_datetime', '_strptime']) _fast = set(sys.modules) print(f'added (pure): {sorted(_pure-before)}') print(f'added (fast): {sorted(_fast-before)}') print('---') finally: ... I get the following output running "./python -m test test_datetime test_datetime": 0:00:00 load avg: 0.52 Run tests sequentially 0:00:00 load avg: 0.52 [1/2] test_datetime added (pure): ['_decimal', '_strptime', '_testcapi', 'decimal', 'numbers', 'test.datetimetester'] added (fast): ['_decimal', '_strptime', '_testcapi', 'decimal', 'numbers', 'test.datetimetester'] --- 0:00:05 load avg: 0.52 [2/2] test_datetime added (pure): ['_datetime', '_strptime', 'datetime'] added (fast): ['_datetime', '_strptime', 'datetime'] --- [snipped] That definitely tells a story. :) Unfortunately, for now I don't have any more time to investigate. Sorry. |
|||
| msg372340 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2020-06-25 10:41 | |
My PR of bpo-40799 fix this issue. |
|||
| msg372414 - (view) | Author: Hai Shi (shihai1991) * ![]() |
Date: 2020-06-26 08:18 | |
> My PR of bpo-40799 fix this issue. Thanks victor for your work, I closed my PR ;) |
|||
| msg402994 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2021-10-01 07:09 | |
Fixed in issue40173. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:28 | admin | set | github: 84239 |
| 2021-10-01 07:09:47 | serhiy.storchaka | set | status: open -> closed nosy: + serhiy.storchaka messages: + msg402994 resolution: fixed stage: patch review -> resolved |
| 2021-09-30 13:18:30 | serhiy.storchaka | link | issue45229 dependencies |
| 2020-06-26 08:18:52 | shihai1991 | set | messages: + msg372414 |
| 2020-06-25 10:41:02 | vstinner | set | messages: + msg372340 |
| 2020-05-06 16:03:27 | eric.snow | set | nosy:
+ eric.snow messages: + msg368273 |
| 2020-03-29 08:58:40 | shihai1991 | set | messages: + msg365248 |
| 2020-03-29 08:47:39 | shihai1991 | set | keywords:
+ patch stage: patch review pull_requests: + pull_request18576 |
| 2020-03-25 19:59:50 | georg.brandl | set | messages: + msg365020 |
| 2020-03-25 19:46:14 | p-ganssle | set | nosy:
+ georg.brandl messages: + msg365018 |
| 2020-03-25 18:54:40 | shihai1991 | set | messages: + msg365012 |
| 2020-03-25 15:52:39 | shihai1991 | set | nosy:
+ shihai1991 messages: + msg364993 |
| 2020-03-25 15:44:41 | xtreak | set | nosy:
+ belopolsky, p-ganssle |
| 2020-03-25 15:42:13 | corona10 | set | nosy:
+ corona10 |
| 2020-03-25 01:54:40 | vstinner | create | |



