[zope2-tracker] [Bug 659968] Re: guarded_import does not support 5-args form

Vincent Pelletier 659968 at bugs.launchpad.net
Wed Oct 13 11:14:46 EDT 2010


** Description changed:

  Environment:
  - python 2.6.5
  - Zope 2.12.9
  
  Symptom:
-   TypeError: guarded_import() takes at most 4 arguments (5 given)
+   TypeError: guarded_import() takes at most 4 arguments (5 given)
  
- I triggered this problem indirectly, when calling xrags with a float argument.
+ I triggered this problem indirectly, when calling xrange with a float argument.
  This triggers this error, because xrange tries internally (disclaimer: I didn't check exactly what does the import) to import __doc__ from _warnings module using the 5-arguments form, and it uses ZopeGuards' version to do so, which fails with above error.
  
  This bug report is just about guarded_import parameter count, but for completeness I must also say that, after adding a dummy fifth parameter to guarded_import, calling "xrange(0.1)" failed with
-   Unauthorized: You are not allowed to access '__doc__' in this context
+   Unauthorized: You are not allowed to access '__doc__' in this context
  
  For the ones who are about to question the sanity of calling xrange with a float value:
  - given error makes diagnostic non-straightforward (this is the most important point to me as I didn't intend to give it a float value)
  - it does work in "pure" python (this is secondary to me, I won't use this - but I don't see a reason to prevent this from working)
  
  Regards,
  Vincent Pelletier

-- 
guarded_import does not support 5-args form
https://bugs.launchpad.net/bugs/659968
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.


More information about the zope2-tracker mailing list