[issue1559549] ImportError needs attributes for module and file name

2012-04-12 Thread Brett Cannon
Brett Cannon added the comment: Patch for the attributes is in (no use by import.c)! I'm going to do a separate commit for use by importlib and then fix pydoc in my bootstrap branch. -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed

[issue1559549] ImportError needs attributes for module and file name

2012-04-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6825fd9b00ed by Brett Cannon in branch 'default': Issue #1559549: Add 'name' and 'path' attributes to ImportError. http://hg.python.org/cpython/rev/6825fd9b00ed -- nosy: +python-dev ___ Python tracker <

[issue1559549] ImportError needs attributes for module and file name

2012-04-12 Thread Brett Cannon
Changes by Brett Cannon : -- assignee: brian.curtin -> brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue1559549] ImportError needs attributes for module and file name

2012-04-10 Thread Brett Cannon
Brett Cannon added the comment: This is now officially blocking my importlib bootstrap work (issue #2377), so I have assigned this to myself to get done and I hope to get this committed within a week *without* updating Python/import.c and the requisite tests or pydoc (which I will make part o

[issue1559549] ImportError needs attributes for module and file name

2012-02-10 Thread R. David Murray
R. David Murray added the comment: However you do it, I'm very much in favor of having the full name available. I either wrote or fixed (I can't remember which) that stack walk in pydoc, and you are right, it is very very ugly. This would also be a big benefit for unittest, which currently

[issue1559549] ImportError needs attributes for module and file name

2012-02-10 Thread Brett Cannon
Brett Cannon added the comment: So I just tried to pass fullname in import.c and it didn't work (of course). Looks like even when I try to use fullname in find_module_path_list() and load_next() it is still leaving out the package name. Ugh. That means either refactoring import.c to get the f

[issue1559549] ImportError needs attributes for module and file name

2012-02-10 Thread Brett Cannon
Brett Cannon added the comment: Attached is Brian's patch with the macro fix and forward declarations. -- Added file: http://bugs.python.org/file24476/importerror.diff ___ Python tracker

[issue1559549] ImportError needs attributes for module and file name

2012-02-10 Thread Brett Cannon
Brett Cannon added the comment: Oh, and there are no forward declarations for the new functions added to errors.c -- ___ Python tracker ___ __

[issue1559549] ImportError needs attributes for module and file name

2012-02-10 Thread Brett Cannon
Brett Cannon added the comment: And to answer David's joke, I carpool from Toronto to Waterloo four days a week so I have an hour each direction to work on stuff. -- ___ Python tracker _

[issue1559549] ImportError needs attributes for module and file name

2012-02-10 Thread Brett Cannon
Brett Cannon added the comment: The patch looks fine for its current semantics except for the fact that the macro doesn't work under clang; ##macro_var is supposed to be used only when concatenating parts of a string to create a complete identifier, not concatenating two identifiers next to e

[issue1559549] ImportError needs attributes for module and file name

2012-02-09 Thread R. David Murray
R. David Murray added the comment: On the drive home...are you borrowing one of Google's self driving cars? :) -- ___ Python tracker ___ __

[issue1559549] ImportError needs attributes for module and file name

2012-02-09 Thread Brett Cannon
Brett Cannon added the comment: Thanks, Brian! I'll do a review tonight on the drive home (and maybe even write the docs up). -- ___ Python tracker ___ __

[issue1559549] ImportError needs attributes for module and file name

2012-02-09 Thread Brian Curtin
Brian Curtin added the comment: Here's an updated patch which creates two convenience functions, PyErr_SetFromImportErrorWithName and PyErr_SetFromImportErrorWithNameAndPath. I figure the two common cases are that you'll want to set just a name or you'll want a name and a path. *WithName is

[issue1559549] ImportError needs attributes for module and file name

2012-02-09 Thread Brett Cannon
Brett Cannon added the comment: On Thu, Feb 9, 2012 at 00:03, Brian Curtin wrote: > > Brian Curtin added the comment: > > Yep, I just need to actually make use of the feature. I'll generate a new > patch shortly. > If you can generate it before 17:30 EST today I can review it or at least hel

[issue1559549] ImportError needs attributes for module and file name

2012-02-08 Thread Brian Curtin
Brian Curtin added the comment: Yep, I just need to actually make use of the feature. I'll generate a new patch shortly. -- ___ Python tracker ___ ___

[issue1559549] ImportError needs attributes for module and file name

2012-02-08 Thread Brett Cannon
Brett Cannon added the comment: Brian, what is left for updating your patch? I'm going to need this to fix test_pydoc to not fail in my importlib bootstrap work so I can (finally) help with this. Is it just actually using the new features of the exception? -- assignee: brett.cannon ->

[issue1559549] ImportError needs attributes for module and file name

2011-12-16 Thread Brian Curtin
Brian Curtin added the comment: I think I'm going to stick with name unless anyone is super opposed. If we can eventually import something else (sausages?), then setting module_name with a sausage name will seem weird. I'll work up a more complete patch. The private helper is a good idea. --

[issue1559549] ImportError needs attributes for module and file name

2011-12-16 Thread Antoine Pitrou
Antoine Pitrou added the comment: "fullname" is technically wrong: >>> import logging.bar Traceback (most recent call last): File "", line 1, in ImportError: No module named 'bar' "module_name" sounds fine and explicit enough to me. Also, as Eric points out, there are many places where an

[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Brian Curtin
Brian Curtin added the comment: If I add back in the import.c change, would this then be alright? Eric - fullname seems fine, I'll update that. -- ___ Python tracker ___

[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Eric Snow
Eric Snow added the comment: I'm guessing that more than just Python/import.c should be updated, and more than one spot in import.c. -- ___ Python tracker ___ ___

[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Nick Coghlan
Nick Coghlan added the comment: The keyword-only idea is a backwards compatibility hack we discussed at the PyCon US sprints because ImportError currently accepts an arbitrary number of arguments: >>> raise ImportError(1, 2, 3) Traceback (most recent call last): File "", line 1, in ImportE

[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: The patch doesn't appear to have the necessary mechanics to pass the new arguments from the import machinery when an ImportError is raised, is this deliberate? Also, I'm not sure why the new arguments are keyword-only. -- nosy: +pitrou stage: test ne

[issue1559549] ImportError needs attributes for module and file name

2011-12-15 Thread Eric Snow
Eric Snow added the comment: Just following up on this ticket. Anyone have any objections to Brian's patch? Also, would 'fullname' be more appropriate than 'name', to be more in sync with that identifier in importlib? -- ___ Python tracker

[issue1559549] ImportError needs attributes for module and file name

2011-10-25 Thread Brian Curtin
Brian Curtin added the comment: Here's an updated patch, plus support for a second attribute that I need for #10854. I previously wrote a patch that does this same thing for that issue, but this one handles things a lot more nicely :) I renamed "module_name" to just be "name" since I was addi

[issue1559549] ImportError needs attributes for module and file name

2011-08-16 Thread Brett Cannon
Brett Cannon added the comment: I have a use for this in my bootstrapping for importlib, so I am assigning this to myself in order to make sure that at least ImportError grows the needed keyboard argument and attribute. I will probably not bother with tweaking import.c, though. -- as

[issue1559549] ImportError needs attributes for module and file name

2011-07-13 Thread Brett Cannon
Brett Cannon added the comment: No, we don't need attribute_name as that is getting too specific. Your example is simply importing validmodule.name_with_typo which happens to possibly be an attribute on the module instead of another module or subpackage. -- __

[issue1559549] ImportError needs attributes for module and file name

2011-07-13 Thread Eric Snow
Changes by Eric Snow : -- nosy: +ericsnow ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue1559549] ImportError needs attributes for module and file name

2011-07-13 Thread Éric Araujo
Éric Araujo added the comment: How about this case: from validmodule import name_with_typo Do we need one keyword argument module_name and one attribute_name? -- nosy: +eric.araujo ___ Python tracker ___

[issue1559549] ImportError needs attributes for module and file name

2011-03-18 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: Ok, here is a patch created using mq. I have a problem, however. I managed to solve following situation: try: raise ImportError('failed import' module_name='somemodule') except ImportError as e: print(e.module_name) that would print somemodule. H

[issue1559549] ImportError needs attributes for module and file name

2011-03-18 Thread Filip Gruszczyński
Changes by Filip Gruszczyński : Removed file: http://bugs.python.org/file21031/1559549_2.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue1559549] ImportError needs attributes for module and file name

2011-03-18 Thread Filip Gruszczyński
Changes by Filip Gruszczyński : Removed file: http://bugs.python.org/file21020/1559549_1.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue1559549] ImportError needs attributes for module and file name

2011-03-16 Thread R. David Murray
R. David Murray added the comment: +1 for providing a way to autogenerate the message. -- ___ Python tracker ___ ___ Python-bugs-li

[issue1559549] ImportError needs attributes for module and file name

2011-03-16 Thread Brett Cannon
Brett Cannon added the comment: At the PyCon 2011 sprint we discussed this issue and Nick, myself, and some other people agreed that using a keyword-only argument for passing in the module name is probably a better solution. While it won't be backwards-compatible (BaseException does not accep

[issue1559549] ImportError needs attributes for module and file name

2011-03-15 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: I didn't know about this mq extension. I will do a proper patch with a test after friday. -- ___ Python tracker ___

[issue1559549] ImportError needs attributes for module and file name

2011-03-15 Thread Nick Coghlan
Changes by Nick Coghlan : -- nosy: +ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue1559549] ImportError needs attributes for module and file name

2011-03-14 Thread Andreas Stührk
Andreas Stührk added the comment: > I am sorry again for those mistakes, it's all completely new to me. No worries! >I have fixed those issues and created new patch. Using hg export, that now >spans over two commits. Is it the way those patches should be provided, or >should I gather all cha

[issue1559549] ImportError needs attributes for module and file name

2011-03-07 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: I am sorry again for those mistakes, it's all completely new to me. I have fixed those issues and created new patch. Using hg export, that now spans over two commits. Is it the way those patches should be provided, or should I gather all changes into a on

[issue1559549] ImportError needs attributes for module and file name

2011-03-07 Thread STINNER Victor
STINNER Victor added the comment: The module name is a UTF-8 encoded string yes. It should be documented in PyModuleDef structure. I already documented the encoding in PyModule_New(). -- ___ Python tracker

[issue1559549] ImportError needs attributes for module and file name

2011-03-06 Thread Andreas Stührk
Andreas Stührk added the comment: There are some issues with the patch: - The check for size of `args` in `ImportError_init()` is wrong: You can't create an `ImportError` with 3 arguments now ("TypeError: ImportError expected 2 arguments, got 3") - `ImportError_clear()` doesn't clear ``self->

[issue1559549] ImportError needs attributes for module and file name

2011-03-06 Thread Filip Gruszczyński
Filip Gruszczyński added the comment: This is a draft of a patch. I have only used this new ImportError api in once place, so it would work with following code: >>> try: ... import nosuchmodule ... except ImportError as e: ... print(e.module) ... nosuchmodule I have literally no experien

[issue1559549] ImportError needs attributes for module and file name

2011-03-02 Thread Filip Gruszczyński
Changes by Filip Gruszczyński : -- nosy: +gruszczy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mai

[issue1559549] ImportError needs attributes for module and file name

2011-03-01 Thread Ram Rachum
Changes by Ram Rachum : -- nosy: +cool-RR ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue1559549] ImportError needs attributes for module and file name

2011-01-07 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue1559549] ImportError needs attributes for module and file name

2011-01-07 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > I think we should investigate deeper why this enhancement > request didn't get into Python 3. There is nothing to investigate here. This is a request for a marginal improvement and OP did not follow up even though a core developer responded on the ne

[issue1559549] ImportError needs attributes for module and file name

2011-01-07 Thread R. David Murray
R. David Murray added the comment: There's no need for any deeper investigation. The answer is "nobody wrote the patch". If someone writes a good patch, it will go in. -- nosy: +r.david.murray ___ Python tracker

[issue1559549] ImportError needs attributes for module and file name

2011-01-07 Thread Brian Curtin
Changes by Brian Curtin : -- versions: +Python 3.3 -Python 3.2 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue1559549] ImportError needs attributes for module and file name

2011-01-07 Thread anatoly techtonik
anatoly techtonik added the comment: I think we should investigate deeper why this enhancement request didn't get into Python 3. Another user story is: "from xxx import yyy", if yyy not found, the args message is ('cannot import name yyy',) Python4? label:api -- nosy: +techtonik _

[issue1559549] ImportError needs attributes for module and file name

2010-08-08 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- versions: +Python 3.2 -Python 2.7, Python 3.1 ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue1559549] ImportError needs attributes for module and file name

2009-03-29 Thread Daniel Diniz
Changes by Daniel Diniz : -- nosy: +brett.cannon stage: -> test needed versions: +Python 2.7, Python 3.1 -Python 2.6 ___ Python tracker ___ ___

[issue1559549] ImportError needs attributes for module and file name

2008-01-06 Thread Christian Heimes
Changes by Christian Heimes: -- versions: +Python 2.6 _ Tracker <[EMAIL PROTECTED]> _ ___ Python-bugs-list mailing list Unsubscribe: