Portable code: __import__ demands different string types between 2 and 3
Ben Finney
ben+python at benfinney.id.au
Mon Dec 15 21:53:21 EST 2014
Ethan Furman <ethan at stoneleaf.us> writes:
> On 12/15/2014 05:36 PM, Ben Finney wrote:
> > I'm increasingly of the opinion this is a subtle bug in ‘__import__’
> > that should be fixed instead of worked around.
And other people agree: <URL:https://bugs.python.org/issue21720>.
> Of course. But you'll still need to work around it for previous
> versions, unless you can say you only support 2.7.10+ (maybe 2.7.9+ if
> it gets fixed quick enough).
If I can eventually drop the kludge by dropping support for Python <2.7
at some future point (instead of waiting until I can drop Python <3),
that would still be an improvement.
> Functions that should accept str but barf on unicode have a tendency
> to get fixed.
I hope you're right. The bug report currently focusses on improving the
error message only.
--
\ “They who can give up essential liberty to obtain a little |
`\ temporary safety, deserve neither liberty nor safety.” |
_o__) —Benjamin Franklin, 1775-02-17 |
Ben Finney
More information about the Python-list
mailing list