Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue20490

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Show clear error message on circular import
Type:enhancementStage:resolved
Components:Interpreter CoreVersions:Python 3.9, Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: Anthony Sottile, Arfrever, brett.cannon, cool-RR, pablogsal, r.david.murray, steve.dower, yselivanov
Priority:normalKeywords:patch

Created on2014-02-02 19:04 bycool-RR, last changed2022-04-11 14:57 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 15308mergedAnthony Sottile,2019-08-15 19:49
PR 15791mergedsteve.dower,2019-09-09 15:21
Messages (6)
msg210006 -(view)Author: Ram Rachum (cool-RR)*Date: 2014-02-02 19:04
If there's a circular import in my program, I don't want to see an error message, "Cannot import name 'foo'" and then say in my mind, "ah, I'm an experienced Python developer, I know that when Python says that it often means that there's a circular import problem." I want the error message to **say there's a circular import problem**, so (a) I won't have to remember this piece of trivia and (b) less experienced developers won't have to bang their heads on their desks trying to figure out why the import isn't working. Bonus points if the error message actually shows which module is trying to import a module that imports itself, so we'll know where to fix.
msg210153 -(view)Author: Brett Cannon (brett.cannon)*(Python committer)Date: 2014-02-03 18:32
It's not as simple as it sounds because failures from "from ... import ..." are triggered in the eval loop and not in import and without thinking it through I don't know if you could use the fine-grained import locks to inspect if something is in the middle of being imported or not that way.
msg351496 -(view)Author: Steve Dower (steve.dower)*(Python committer)Date: 2019-09-09 15:17
New changeset65366bc8bdc4716ebc361e622590b45a6e5aef07 by Steve Dower (Anthony Sottile) in branch 'master':bpo-20490: Improve circular import error message (GH-15308)https://github.com/python/cpython/commit/65366bc8bdc4716ebc361e622590b45a6e5aef07
msg351505 -(view)Author: Steve Dower (steve.dower)*(Python committer)Date: 2019-09-09 15:48
Thanks for the patch, Anthony!
msg351529 -(view)Author: Steve Dower (steve.dower)*(Python committer)Date: 2019-09-09 16:45
New changeset2d5594fac21a81a06f82c3605318dfa96e72398f by Steve Dower in branch '3.8':bpo-20490: Improve circular import error message (GH-15308)https://github.com/python/cpython/commit/2d5594fac21a81a06f82c3605318dfa96e72398f
msg351642 -(view)Author: Pablo Galindo Salgado (pablogsal)*(Python committer)Date: 2019-09-10 13:06
This PR introduced a reference leak tracked in:https://bugs.python.org/issue38090
History
DateUserActionArgs
2022-04-11 14:57:58adminsetgithub: 64689
2019-09-10 13:06:52pablogsalsetnosy: +pablogsal
messages: +msg351642
2019-09-09 16:45:20steve.dowersetmessages: +msg351529
2019-09-09 15:48:07steve.dowersetstatus: open -> closed
resolution: fixed
messages: +msg351505

stage: patch review -> resolved
2019-09-09 15:21:00steve.dowersetpull_requests: +pull_request15444
2019-09-09 15:17:54steve.dowersetnosy: +steve.dower
messages: +msg351496
2019-08-15 20:02:08Anthony Sottilesetnosy: +Anthony Sottile

versions: + Python 3.8, Python 3.9, - Python 3.5
2019-08-15 19:49:46Anthony Sottilesetkeywords: +patch
stage: patch review
pull_requests: +pull_request15028
2014-02-03 19:33:00Arfreversetnosy: +Arfrever
2014-02-03 18:32:19brett.cannonsetmessages: +msg210153
2014-02-02 19:34:13r.david.murraysetnosy: +r.david.murray
2014-02-02 19:20:15yselivanovsetnosy: +brett.cannon
2014-02-02 19:20:07yselivanovsetnosy: +yselivanov
2014-02-02 19:04:48cool-RRcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp